2 This file is part of GNUnet.
3 (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2012 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 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 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file include/platform.h
23 * @brief plaform specific includes and defines
25 * @author Christian Grothoff
26 * This file should never be included by installed
27 * header files (those starting with "gnunet_").
32 #ifndef HAVE_USED_CONFIG_H
33 #define HAVE_USED_CONFIG_H
35 #include "gnunet_config.h"
40 #define BREAKPOINT asm("int $3;");
41 #define GNUNET_SIGCHLD 17
44 #define GNUNET_SIGCHLD SIGCHLD
47 #ifdef HAVE_SYS_TYPES_H
48 #include <sys/types.h>
52 * These may be expensive, but good for debugging...
54 #define ALLOW_EXTRA_CHECKS GNUNET_YES
57 * For strptime (glibc2 needs this).
60 #define _XOPEN_SOURCE 499
67 /* configuration options */
69 #define VERBOSE_STATS 0
72 #include <sys/reent.h>
77 #define FD_SETSIZE 1024
84 #include <sys/socket.h>
87 #include <netinet/in.h>
89 #if HAVE_NETINET_IN_SYSTM_H
90 #include <netinet/in_systm.h>
93 #include <netinet/ip.h> /* superset of previous */
95 #include <arpa/inet.h>
96 #include <netinet/tcp.h>
98 #include <sys/ioctl.h>
115 #include <malloc.h> /* for alloca(), on other OSes it's in stdlib.h */
118 #include <malloc.h> /* for mallinfo on GNU */
121 #include <unistd.h> /* KLB_FIX */
123 #include <sys/stat.h>
124 #include <sys/types.h>
126 #include <dirent.h> /* KLB_FIX */
131 #include <sys/param.h>
133 #if TIME_WITH_SYS_TIME
134 #include <sys/time.h>
138 #include <sys/time.h>
148 #include <semaphore.h>
152 #include <semaphore.h>
155 #if defined(LINUX) || defined(GNU)
159 #include <sys/sockio.h>
160 #include <sys/filio.h>
161 #include <sys/loadavg.h>
162 #include <semaphore.h>
168 #include <sys/ucred.h>
172 #include <cygwin/if.h>
185 #if HAVE_SYS_RESOURCE_H
186 #include <sys/resource.h>
192 #if HAVE_SYS_ENDIAN_H
193 #include <sys/endian.h>
199 #ifndef FRAMEWORK_BUILD
202 * GNU gettext support macro.
204 #define _(String) dgettext("gnunet",String)
205 #define LIBEXTRACTOR_GETTEXT_DOMAIN "libextractor"
207 #include "libintlemu.h"
208 #define _(String) dgettext("org.gnunet.gnunet",String)
209 #define LIBEXTRACTOR_GETTEXT_DOMAIN "org.gnunet.libextractor"
213 #define SIOCGIFCONF _IOW('s', 100, struct ifconf) /* get if list */
214 #define SIOCGIFFLAGS _IOW('s', 101, struct ifreq) /* Get if flags */
215 #define SIOCGIFADDR _IOW('s', 102, struct ifreq) /* Get if addr */
219 #include <sys/mman.h>
223 #define __BYTE_ORDER BYTE_ORDER
224 #define __BIG_ENDIAN BIG_ENDIAN
228 #define __BYTE_ORDER BYTE_ORDER
229 #define __BIG_ENDIAN BIG_ENDIAN
230 /* not available on darwin, override configure */
238 atoll (const char *nptr);
242 #include "langinfo.h"
246 #define SIZE_MAX ((size_t)(-1))
250 #define O_LARGEFILE 0
254 * AI_NUMERICSERV not defined in windows. Then we just do without.
256 #ifndef AI_NUMERICSERV
257 #define AI_NUMERICSERV 0
261 #if defined(__sparc__)
262 #define MAKE_UNALIGNED(val) ({ __typeof__((val)) __tmp; memmove(&__tmp, &(val), sizeof((val))); __tmp; })
264 #define MAKE_UNALIGNED(val) val
268 #define FDTYPE HANDLE
269 #define SOCKTYPE SOCKET
276 * The termination signal
278 #define GNUNET_TERM_SIG SIGTERM