2 This file is part of GNUnet.
3 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2012 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 SPDX-License-Identifier: AGPL3.0-or-later
23 * @author Christian Grothoff
26 * Plaform specific includes and defines.
28 * This file should never be included by installed
29 * header files (those starting with "gnunet_").
34 #ifndef HAVE_USED_CONFIG_H
35 #define HAVE_USED_CONFIG_H
37 #include "gnunet_config.h"
42 #define GNUNET_SIGCHLD SIGCHLD
44 #ifdef HAVE_SYS_TYPES_H
45 #include <sys/types.h>
49 * These may be expensive, but good for debugging...
51 #define ALLOW_EXTRA_CHECKS GNUNET_YES
54 * For strptime (glibc2 needs this).
57 #define _XOPEN_SOURCE 499
64 /* configuration options */
66 #define VERBOSE_STATS 0
69 #include <sys/socket.h>
72 #include <netinet/in.h>
74 #if HAVE_NETINET_IN_SYSTM_H
75 #include <netinet/in_systm.h>
78 #include <netinet/ip.h> /* superset of previous */
80 #include <arpa/inet.h>
81 #include <netinet/tcp.h>
83 #include <sys/ioctl.h>
97 #include <malloc.h> /* for mallinfo on GNU */
99 #include <unistd.h> /* KLB_FIX */
100 #include <sys/stat.h>
101 #include <sys/types.h>
102 #include <dirent.h> /* KLB_FIX */
106 #include <sys/param.h>
108 #if TIME_WITH_SYS_TIME
109 #include <sys/time.h>
113 #include <sys/time.h>
123 #include <semaphore.h>
127 #include <semaphore.h>
130 #if defined(LINUX) || defined(GNU)
134 #include <sys/sockio.h>
135 #include <sys/filio.h>
136 #include <sys/loadavg.h>
137 #include <semaphore.h>
143 #include <sys/ucred.h>
156 #if HAVE_SYS_RESOURCE_H
157 #include <sys/resource.h>
163 #if HAVE_SYS_ENDIAN_H
164 #include <sys/endian.h>
167 #define DIR_SEPARATOR '/'
168 #define DIR_SEPARATOR_STR "/"
169 #define PATH_SEPARATOR ':'
170 #define PATH_SEPARATOR_STR ":"
176 #ifndef FRAMEWORK_BUILD
179 * GNU gettext support macro.
181 #define _(String) dgettext (PACKAGE, String)
182 #define LIBEXTRACTOR_GETTEXT_DOMAIN "libextractor"
184 #include "libintlemu.h"
185 #define _(String) dgettext ("org.gnunet.gnunet", String)
186 #define LIBEXTRACTOR_GETTEXT_DOMAIN "org.gnunet.libextractor"
189 #include <sys/mman.h>
192 #define __BYTE_ORDER BYTE_ORDER
193 #define __BIG_ENDIAN BIG_ENDIAN
197 #define __BYTE_ORDER BYTE_ORDER
198 #define __BIG_ENDIAN BIG_ENDIAN
199 /* not available on darwin, override configure */
207 atoll (const char *nptr);
211 #include "langinfo.h"
215 #define SIZE_MAX ((size_t) (-1))
219 #define O_LARGEFILE 0
223 * AI_NUMERICSERV not defined in windows. Then we just do without.
225 #ifndef AI_NUMERICSERV
226 #define AI_NUMERICSERV 0
230 #if defined(__sparc__)
231 #define MAKE_UNALIGNED(val) ({ __typeof__((val)) __tmp; memmove (&__tmp, &(val), \
235 #define MAKE_UNALIGNED(val) val
242 * The termination signal
244 #define GNUNET_TERM_SIG SIGTERM
249 * Assumed maximum path length.
251 #define PATH_MAX 4096
254 #if HAVE_THREAD_LOCAL_GCC
255 #define GNUNET_THREAD_LOCAL __thread
257 #define GNUNET_THREAD_LOCAL
261 * clang et al do not have such an attribute
263 #if __has_attribute (__nonstring__)
264 # define __nonstring __attribute__((__nonstring__))