Back to home page

Nginx displayed by LXR

Source navigation ]
Diff markup ]
Identifier search ]
general search ]
 
 
Version: nginx-1.15.12 ]​[ nginx-1.16.0 ]​

0001 
0002 /*
0003  * Copyright (C) Igor Sysoev
0004  * Copyright (C) Nginx, Inc.
0005  */
0006 
0007 
0008 #ifndef _NGX_ALLOC_H_INCLUDED_
0009 #define _NGX_ALLOC_H_INCLUDED_
0010 
0011 
0012 #include <ngx_config.h>
0013 #include <ngx_core.h>
0014 
0015 
0016 void *ngx_alloc(size_t size, ngx_log_t *log);
0017 void *ngx_calloc(size_t size, ngx_log_t *log);
0018 
0019 #define ngx_free          free
0020 
0021 
0022 /*
0023  * Linux has memalign() or posix_memalign()
0024  * Solaris has memalign()
0025  * FreeBSD 7.0 has posix_memalign(), besides, early version's malloc()
0026  * aligns allocations bigger than page size at the page boundary
0027  */
0028 
0029 #if (NGX_HAVE_POSIX_MEMALIGN || NGX_HAVE_MEMALIGN)
0030 
0031 void *ngx_memalign(size_t alignment, size_t size, ngx_log_t *log);
0032 
0033 #else
0034 
0035 #define ngx_memalign(alignment, size, log)  ngx_alloc(size, log)
0036 
0037 #endif
0038 
0039 
0040 extern ngx_uint_t  ngx_pagesize;
0041 extern ngx_uint_t  ngx_pagesize_shift;
0042 extern ngx_uint_t  ngx_cacheline_size;
0043 
0044 
0045 #endif /* _NGX_ALLOC_H_INCLUDED_ */