]> granicus.if.org Git - php/commitdiff
Use zend_accel_error_noreturn in more places
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 19 Oct 2020 14:59:00 +0000 (16:59 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 19 Oct 2020 14:59:00 +0000 (16:59 +0200)
Missed the place in accelerator_blacklist that was the actual
motivation here...

ext/opcache/zend_accelerator_blacklist.c
ext/opcache/zend_accelerator_hash.c
ext/opcache/zend_shared_alloc.c

index 9ae897b521146e5d828bf7e061203373e4fea52b..45ad0b26850070200e4542e3bff680c0f2640d47 100644 (file)
@@ -60,7 +60,7 @@ void zend_accel_blacklist_init(zend_blacklist *blacklist)
 
        blacklist->entries = (zend_blacklist_entry *) calloc(sizeof(zend_blacklist_entry), blacklist->size);
        if (!blacklist->entries) {
-               zend_accel_error(ACCEL_LOG_FATAL, "Blacklist initialization: no memory\n");
+               zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Blacklist initialization: no memory\n");
                return;
        }
        blacklist->regexp_list = NULL;
@@ -68,7 +68,7 @@ void zend_accel_blacklist_init(zend_blacklist *blacklist)
 
 static void blacklist_report_regexp_error(const char *pcre_error, int pcre_error_offset)
 {
-       zend_accel_error(ACCEL_LOG_ERROR, "Blacklist compilation failed (offset: %d), %s\n", pcre_error_offset, pcre_error);
+       zend_accel_error_noreturn(ACCEL_LOG_ERROR, "Blacklist compilation failed (offset: %d), %s\n", pcre_error_offset, pcre_error);
 }
 
 static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist)
@@ -163,7 +163,7 @@ static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist)
                if (*c || i == blacklist->pos - 1) {
                        if (*c) {
                                if (!backtrack) {
-                                       zend_accel_error(ACCEL_LOG_ERROR, "Too long blacklist entry\n");
+                                       zend_accel_error_noreturn(ACCEL_LOG_ERROR, "Too long blacklist entry\n");
                                }
                                p = backtrack;
                        } else {
@@ -173,7 +173,7 @@ static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist)
 
                        it = (zend_regexp_list*)malloc(sizeof(zend_regexp_list));
                        if (!it) {
-                               zend_accel_error(ACCEL_LOG_ERROR, "malloc() failed\n");
+                               zend_accel_error_noreturn(ACCEL_LOG_ERROR, "malloc() failed\n");
                                return;
                        }
                        it->next = NULL;
@@ -302,7 +302,7 @@ static void zend_accel_blacklist_loadone(zend_blacklist *blacklist, char *filena
                blacklist->entries[blacklist->pos].path_length = path_length;
                blacklist->entries[blacklist->pos].path = (char *)malloc(path_length + 1);
                if (!blacklist->entries[blacklist->pos].path) {
-                       zend_accel_error(ACCEL_LOG_ERROR, "malloc() failed\n");
+                       zend_accel_error_noreturn(ACCEL_LOG_ERROR, "malloc() failed\n");
                        fclose(fp);
                        return;
                }
index 7cd9ef1ef45bec06232973839d9689abf6906bbf..b0293ae8f2ff24af400d05574ef5c82812b83ad2 100644 (file)
@@ -54,14 +54,14 @@ void zend_accel_hash_init(zend_accel_hash *accel_hash, uint32_t hash_size)
        /* set up hash pointers table */
        accel_hash->hash_table = zend_shared_alloc(sizeof(zend_accel_hash_entry *)*accel_hash->max_num_entries);
        if (!accel_hash->hash_table) {
-               zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!");
+               zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Insufficient shared memory!");
                return;
        }
 
        /* set up hash values table */
        accel_hash->hash_entries = zend_shared_alloc(sizeof(zend_accel_hash_entry)*accel_hash->max_num_entries);
        if (!accel_hash->hash_entries) {
-               zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!");
+               zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Insufficient shared memory!");
                return;
        }
        memset(accel_hash->hash_table, 0, sizeof(zend_accel_hash_entry *)*accel_hash->max_num_entries);
index d32a70b7e8356579ed25dd65510ceb029bfbee6c..f4cb4f55af6fa88ff388e76a29a4f5a4d3863eed 100644 (file)
@@ -86,7 +86,7 @@ void zend_shared_alloc_create_lock(char *lockfile_path)
        fchmod(lock_file, 0666);
 
        if (lock_file == -1) {
-               zend_accel_error(ACCEL_LOG_FATAL, "Unable to create lock file: %s (%d)", strerror(errno), errno);
+               zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Unable to create lock file: %s (%d)", strerror(errno), errno);
        }
        val = fcntl(lock_file, F_GETFD, 0);
        val |= FD_CLOEXEC;
@@ -98,7 +98,7 @@ void zend_shared_alloc_create_lock(char *lockfile_path)
 
 static void no_memory_bailout(size_t allocate_size, char *error)
 {
-       zend_accel_error(ACCEL_LOG_FATAL, "Unable to allocate shared memory segment of %zu bytes: %s: %s (%d)", allocate_size, error?error:"unknown", strerror(errno), errno );
+       zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Unable to allocate shared memory segment of %zu bytes: %s: %s (%d)", allocate_size, error?error:"unknown", strerror(errno), errno );
 }
 
 static void copy_shared_segments(void *to, void *from, int count, int size)
@@ -231,14 +231,14 @@ int zend_shared_alloc_startup(size_t requested_size, size_t reserved_size)
 
        p_tmp_shared_globals = (zend_smm_shared_globals *) zend_shared_alloc(sizeof(zend_smm_shared_globals));
        if (!p_tmp_shared_globals) {
-               zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!");
+               zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Insufficient shared memory!");
                return ALLOC_FAILURE;
        }
        memset(p_tmp_shared_globals, 0, sizeof(zend_smm_shared_globals));
 
        tmp_shared_segments = zend_shared_alloc(shared_segments_array_size + ZSMMG(shared_segments_count) * sizeof(void *));
        if (!tmp_shared_segments) {
-               zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!");
+               zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Insufficient shared memory!");
                return ALLOC_FAILURE;
        }
 
@@ -252,7 +252,7 @@ int zend_shared_alloc_startup(size_t requested_size, size_t reserved_size)
 
        ZSMMG(shared_memory_state).positions = (int *)zend_shared_alloc(sizeof(int) * ZSMMG(shared_segments_count));
        if (!ZSMMG(shared_memory_state).positions) {
-               zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!");
+               zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Insufficient shared memory!");
                return ALLOC_FAILURE;
        }
 
@@ -263,7 +263,7 @@ int zend_shared_alloc_startup(size_t requested_size, size_t reserved_size)
                        ZSMMG(reserved) = (char*)ZSMMG(shared_segments)[i]->p + ZSMMG(shared_segments)[i]->end;
                        ZSMMG(reserved_size) = reserved_size;
                } else {
-                       zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!");
+                       zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Insufficient shared memory!");
                        return ALLOC_FAILURE;
                }
        }
@@ -340,7 +340,7 @@ void *zend_shared_alloc(size_t size)
 
 #if 1
        if (!ZCG(locked)) {
-               zend_accel_error(ACCEL_LOG_ERROR, "Shared memory lock not obtained");
+               zend_accel_error_noreturn(ACCEL_LOG_ERROR, "Shared memory lock not obtained");
        }
 #endif
        if (block_size > ZSMMG(shared_free)) { /* No hope to find a big-enough block */
@@ -482,7 +482,7 @@ void zend_shared_alloc_lock(void)
                        if (errno == EINTR) {
                                continue;
                        }
-                       zend_accel_error(ACCEL_LOG_ERROR, "Cannot create lock - %s (%d)", strerror(errno), errno);
+                       zend_accel_error_noreturn(ACCEL_LOG_ERROR, "Cannot create lock - %s (%d)", strerror(errno), errno);
                }
                break;
        }
@@ -508,7 +508,7 @@ void zend_shared_alloc_unlock(void)
 
 #ifndef ZEND_WIN32
        if (fcntl(lock_file, F_SETLK, &mem_write_unlock) == -1) {
-               zend_accel_error(ACCEL_LOG_ERROR, "Cannot remove lock - %s (%d)", strerror(errno), errno);
+               zend_accel_error_noreturn(ACCEL_LOG_ERROR, "Cannot remove lock - %s (%d)", strerror(errno), errno);
        }
 #ifdef ZTS
        tsrm_mutex_unlock(zts_lock);
@@ -631,7 +631,7 @@ void zend_accel_shared_protect(int mode)
        for (i = 0; i < ZSMMG(shared_segments_count); i++) {
                DWORD oldProtect;
                if (!VirtualProtect(ZSMMG(shared_segments)[i]->p, ZSMMG(shared_segments)[i]->end, mode, &oldProtect)) {
-                       zend_accel_error(ACCEL_LOG_ERROR, "Failed to protect memory");
+                       zend_accel_error_noreturn(ACCEL_LOG_ERROR, "Failed to protect memory");
                }
        }
 #endif