src/os/unix/ngx_alloc.h - nginx-1.7.10

Macros defined

Source code


  1. /*
  2. * Copyright (C) Igor Sysoev
  3. * Copyright (C) Nginx, Inc.
  4. */


  5. #ifndef _NGX_ALLOC_H_INCLUDED_
  6. #define _NGX_ALLOC_H_INCLUDED_


  7. #include <ngx_config.h>
  8. #include <ngx_core.h>


  9. void *ngx_alloc(size_t size, ngx_log_t *log);
  10. void *ngx_calloc(size_t size, ngx_log_t *log);

  11. #define ngx_free          free


  12. /*
  13. * Linux has memalign() or posix_memalign()
  14. * Solaris has memalign()
  15. * FreeBSD 7.0 has posix_memalign(), besides, early version's malloc()
  16. * aligns allocations bigger than page size at the page boundary
  17. */

  18. #if (NGX_HAVE_POSIX_MEMALIGN || NGX_HAVE_MEMALIGN)

  19. void *ngx_memalign(size_t alignment, size_t size, ngx_log_t *log);

  20. #else

  21. #define ngx_memalign(alignment, size, log)  ngx_alloc(size, log)

  22. #endif


  23. extern ngx_uint_t  ngx_pagesize;
  24. extern ngx_uint_t  ngx_pagesize_shift;
  25. extern ngx_uint_t  ngx_cacheline_size;


  26. #endif /* _NGX_ALLOC_H_INCLUDED_ */