mirror of
https://github.com/nginx/nginx.git
synced 2024-12-17 23:27:49 +08:00
2402502c2f
*) Feature: the ngx_http_map_module. *) Feature: the "types_hash_max_size" and "types_hash_bucket_size" directives. *) Feature: the "ssi_value_length" directive. *) Feature: the "worker_rlimit_core" directive. *) Workaround: the connection number in logs was always 1 if nginx was built by the icc 8.1 or 9.0 compilers with optimization for Pentium 4. *) Bugfix: the "config timefmt" SSI command set incorrect time format. *) Bugfix: nginx did not close connection to IMAP/POP3 backend for the SSL connections; the bug had appeared in 0.3.13. Thanks to Rob Mueller. *) Bugfix: segmentation fault may occurred in at SSL shutdown; the bug had appeared in 0.3.13.
87 lines
1.5 KiB
C
87 lines
1.5 KiB
C
|
|
/*
|
|
* Copyright (C) Igor Sysoev
|
|
*/
|
|
|
|
|
|
#include <ngx_config.h>
|
|
#include <ngx_core.h>
|
|
|
|
|
|
int ngx_pagesize;
|
|
ngx_uint_t ngx_cacheline_size;
|
|
|
|
|
|
void *
|
|
ngx_alloc(size_t size, ngx_log_t *log)
|
|
{
|
|
void *p;
|
|
|
|
p = malloc(size);
|
|
if (p == NULL) {
|
|
ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
|
|
"malloc() %uz bytes failed", size);
|
|
}
|
|
|
|
ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0, "malloc: %p:%uz", p, size);
|
|
|
|
return p;
|
|
}
|
|
|
|
|
|
void *
|
|
ngx_calloc(size_t size, ngx_log_t *log)
|
|
{
|
|
void *p;
|
|
|
|
p = ngx_alloc(size, log);
|
|
|
|
if (p) {
|
|
ngx_memzero(p, size);
|
|
}
|
|
|
|
return p;
|
|
}
|
|
|
|
|
|
#if (NGX_HAVE_POSIX_MEMALIGN)
|
|
|
|
void *
|
|
ngx_memalign(size_t alignment, size_t size, ngx_log_t *log)
|
|
{
|
|
void *p;
|
|
|
|
if (posix_memalign(&p, alignment, size) == -1) {
|
|
ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
|
|
"posix_memalign() %uz bytes aligned to %uz failed",
|
|
size, alignment);
|
|
}
|
|
|
|
ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0,
|
|
"posix_memalign: %p:%uz", p, size);
|
|
|
|
return p;
|
|
}
|
|
|
|
#elif (NGX_HAVE_MEMALIGN)
|
|
|
|
void *
|
|
ngx_memalign(size_t alignment, size_t size, ngx_log_t *log)
|
|
{
|
|
void *p;
|
|
|
|
p = memalign(alignment, size);
|
|
if (p == NULL) {
|
|
ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
|
|
"memalign() %uz bytes aligned to %uz failed",
|
|
size, alignment);
|
|
}
|
|
|
|
ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0,
|
|
"memalign: %p:%uz", p, size);
|
|
|
|
return p;
|
|
}
|
|
|
|
#endif
|