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