1 #ifndef JEMALLOC_INTERNAL_DECLS_H 2 #define JEMALLOC_INTERNAL_DECLS_H 3 4 #ifndef JEMALLOC_NO_PRIVATE_NAMESPACE 5 #include "libc_private.h" 6 #include "namespace.h" 7 #endif 8 9 #include <math.h> 10 #ifdef _WIN32 11 # include <windows.h> 12 # include "msvc_compat/windows_extra.h" 13 # include "msvc_compat/strings.h" 14 # ifdef _WIN64 15 # if LG_VADDR <= 32 16 # error Generate the headers using x64 vcargs 17 # endif 18 # else 19 # if LG_VADDR > 32 20 # undef LG_VADDR 21 # define LG_VADDR 32 22 # endif 23 # endif 24 #else 25 # include <sys/param.h> 26 # include <sys/mman.h> 27 # if !defined(__pnacl__) && !defined(__native_client__) 28 # include <sys/syscall.h> 29 # if !defined(SYS_write) && defined(__NR_write) 30 # define SYS_write __NR_write 31 # endif 32 # if defined(SYS_open) && defined(__aarch64__) 33 /* Android headers may define SYS_open to __NR_open even though 34 * __NR_open may not exist on AArch64 (superseded by __NR_openat). */ 35 # undef SYS_open 36 # endif 37 # include <sys/uio.h> 38 # endif 39 # include <pthread.h> 40 # if defined(__FreeBSD__) || defined(__DragonFly__) 41 # include <pthread_np.h> 42 # include <sched.h> 43 # if defined(__FreeBSD__) 44 # define cpu_set_t cpuset_t 45 # endif 46 # endif 47 # include <signal.h> 48 # ifdef JEMALLOC_OS_UNFAIR_LOCK 49 # include <os/lock.h> 50 # endif 51 # ifdef JEMALLOC_GLIBC_MALLOC_HOOK 52 # include <sched.h> 53 # endif 54 # include <errno.h> 55 # include <sys/time.h> 56 # include <time.h> 57 # ifdef JEMALLOC_HAVE_MACH_ABSOLUTE_TIME 58 # include <mach/mach_time.h> 59 # endif 60 #endif 61 #include <sys/types.h> 62 63 #include <limits.h> 64 #ifndef SIZE_T_MAX 65 # define SIZE_T_MAX SIZE_MAX 66 #endif 67 #ifndef SSIZE_MAX 68 # define SSIZE_MAX ((ssize_t)(SIZE_T_MAX >> 1)) 69 #endif 70 #include <stdarg.h> 71 #include <stdbool.h> 72 #include <stdio.h> 73 #include <stdlib.h> 74 #include <stdint.h> 75 #include <stddef.h> 76 #ifndef offsetof 77 # define offsetof(type, member) ((size_t)&(((type *)NULL)->member)) 78 #endif 79 #include <string.h> 80 #include <strings.h> 81 #include <ctype.h> 82 #ifdef _MSC_VER 83 # include <io.h> 84 typedef intptr_t ssize_t; 85 # define PATH_MAX 1024 86 # define STDERR_FILENO 2 87 # define __func__ __FUNCTION__ 88 # ifdef JEMALLOC_HAS_RESTRICT 89 # define restrict __restrict 90 # endif 91 /* Disable warnings about deprecated system functions. */ 92 # pragma warning(disable: 4996) 93 #if _MSC_VER < 1800 94 static int 95 isblank(int c) { 96 return (c == '\t' || c == ' '); 97 } 98 #endif 99 #else 100 # include <unistd.h> 101 #endif 102 #include <fcntl.h> 103 104 /* 105 * The Win32 midl compiler has #define small char; we don't use midl, but 106 * "small" is a nice identifier to have available when talking about size 107 * classes. 108 */ 109 #ifdef small 110 # undef small 111 #endif 112 113 #endif /* JEMALLOC_INTERNAL_H */ 114