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>
121 #if defined(BSD) && defined(__FreeBSD__) && defined(__FreeBSD_kernel__)
122 #include <semaphore.h>
126 #include <semaphore.h>
129 #if defined(__linux__) || defined(GNU)
133 #include <sys/sockio.h>
134 #include <sys/filio.h>
135 #include <sys/loadavg.h>
136 #include <semaphore.h>
142 #include <sys/ucred.h>
155 #if HAVE_SYS_RESOURCE_H
156 #include <sys/resource.h>
162 #if HAVE_SYS_ENDIAN_H
163 #include <sys/endian.h>
166 #define DIR_SEPARATOR '/'
167 #define DIR_SEPARATOR_STR "/"
168 #define PATH_SEPARATOR ':'
169 #define PATH_SEPARATOR_STR ":"
175 #ifndef FRAMEWORK_BUILD
178 * GNU gettext support macro.
180 #define _(String) dgettext (PACKAGE, String)
181 #define LIBEXTRACTOR_GETTEXT_DOMAIN "libextractor"
183 #include "libintlemu.h"
184 #define _(String) dgettext ("org.gnunet.gnunet", String)
185 #define LIBEXTRACTOR_GETTEXT_DOMAIN "org.gnunet.libextractor"
188 #include <sys/mman.h>
190 /* FreeBSD_kernel is not defined on the now discontinued kFreeBSD */
191 #if defined(BSD) && defined(__FreeBSD__) && defined(__FreeBSD_kernel__)
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);
212 #include "langinfo.h"
216 #define SIZE_MAX ((size_t) (-1))
220 #define O_LARGEFILE 0
224 * AI_NUMERICSERV not defined in windows. Then we just do without.
226 #ifndef AI_NUMERICSERV
227 #define AI_NUMERICSERV 0
231 #if defined(__sparc__)
232 #define MAKE_UNALIGNED(val) ({ __typeof__((val))__tmp; memmove (&__tmp, &(val), \
236 #define MAKE_UNALIGNED(val) val
240 * The termination signal
242 #define GNUNET_TERM_SIG SIGTERM
247 * Assumed maximum path length.
249 #define PATH_MAX 4096
252 #if HAVE_THREAD_LOCAL_GCC
253 #define GNUNET_THREAD_LOCAL __thread
255 #define GNUNET_THREAD_LOCAL
259 * clang et al do not have such an attribute
261 #if __has_attribute (__nonstring__)
262 # define __nonstring __attribute__((__nonstring__))