2 * IRC - Internet Relay Chat, include/sys.h
3 * Copyright (C) 1990 University of Oulu, Computing Center
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 1, or (at your option)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __sys_include__
21 #define __sys_include__
23 #include "../config/config.h"
24 #include "../config/setup.h"
39 # define BIT_ZERO_ON_LEFT
41 # define BIT_ZERO_ON_RIGHT
44 #ifdef _SEQUENT_ /* Dynix 1.4 or 2.0 Generic Define.. */
46 #define SYSV /* Also #define SYSV */
60 #define BSD 1 /* mips only works in bsd43 environment */
63 #ifdef BSD_RELIABLE_SIGNALS
64 #if defined(SYSV_UNRELIABLE_SIGNALS) || defined(POSIX_SIGNALS)
65 #error You stuffed up config.h signals #defines use only one.
67 #define HAVE_RELIABLE_SIGNALS
70 #ifdef SYSV_UNRELIABLE_SIGNALS
72 #error You stuffed up config.h signals #defines use only one.
74 #undef HAVE_RELIABLE_SIGNALS
78 #define HAVE_RELIABLE_SIGNALS
82 * safety margin so we can always have one spare fd, for motd/authd or
83 * whatever else. -24 allows "safety" margin of 10 listen ports, 8 servers
84 * and space reserved for logfiles, DNS sockets and identd sockets etc.
86 #define MAXCLIENTS (MAXCONNECTIONS-24)
104 #if defined(CLIENT_FLOOD)
105 #if (CLIENT_FLOOD > 8000) || (CLIENT_FLOOD < 512)
106 #error CLIENT_FLOOD needs redefining.
109 #error CLIENT_FLOOD undefined
112 #ifndef CONFIG_SETUGID
117 #define Reg1 register
118 #define Reg2 register
119 #define Reg3 register
120 #define Reg4 register
121 #define Reg5 register
122 #define Reg6 register
123 #define Reg7 register
124 #define Reg8 register
125 #define Reg9 register
126 #define Reg10 register
128 /* Define FD_SETSIZE to what we want before including sys/types.h on BSD */
129 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
130 #if ((!defined(USE_POLL)) && (!defined(FD_SETSIZE)))
131 #define FD_SETSIZE ((MAXCONNECTIONS)+4)
136 #include <sys/types.h>
137 #include <sys/param.h>
149 # if HAVE_NET_ERRNO_H
150 # include <net/errno.h>
154 #if !defined(__FreeBSD__) && !defined(__NetBSD__) && \
155 !defined(__bsdi__) && !defined(__alpha) && !defined(__GLIBC__)
156 extern char *sys_errlist[];
159 /* See AC_HEADER_STDC in 'info autoconf' */
167 # define strchr index
168 # define strrchr rindex
170 char *strchr(), *strrchr(), *strtok();
171 # if HAVE_MEMORY_H /* See AC_MEMORY_H in 'info autoconf' */
175 # define memcpy(d, s, n) bcopy ((s), (d), (n))
176 # define memset(a, b, c) bzero(a, c) /* We ONLY use memset(x, 0, y) */
178 # if NEED_BZERO /* This is not used yet - needs to be added to `configure' */
179 # define bzero(a, c) memset((a), 0, (c)) /* Some use it in FD_ZERO */
182 # ifndef HAVE_MEMMOVE
183 # define memmove(d, s, n) bcopy ((s), (d), (n))
187 #if defined(_AIX) || (defined(__STRICT_ANSI__) && __GLIBC__ >= 2)
188 #include <sys/select.h>
191 /* See AC_HEADER_TIME in 'info autoconf' */
192 #if TIME_WITH_SYS_TIME
193 # include <sys/time.h>
197 # include <sys/time.h>
204 #define OPT_TYPE char /* opt type for get/setsockopt */
206 #define OPT_TYPE void
210 #define LIMIT_FMT "%d"
212 #if (defined(__bsdi__) || defined(__NetBSD__))
213 #define LIMIT_FMT "%qd"
215 #define LIMIT_FMT "%ld"
219 /* Different name on NetBSD and FreeBSD --Skip */
220 #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__bsdi__)
221 #define dn_skipname __dn_skipname
224 #if defined(DEBUGMODE) && !defined(DEBUGMALLOC)
231 #else /* !STDC_HEADERS */
235 #ifdef HAVE_SYS_MALLOC_H
236 #include <sys/malloc.h>
237 #endif /* HAVE_SYS_MALLOC_H */
238 #endif /* HAVE_MALLOC_H */
239 #endif /* !STDC_HEADERS */
242 #define MAX(a, b) ((a) > (b) ? (a) : (b))
245 #define MIN(a, b) ((a) < (b) ? (a) : (b))
252 #define TRUE (!FALSE)
256 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
259 #include "runmalloc.h"
261 #define MyCoreDump *((int *)NULL)=0
263 /* This isn't really POSIX :(, but we really need it -- can this be replaced ? */
264 #if defined(__STRICT_ANSI__) && !defined(_AIX)
265 extern int gettimeofday(struct timeval *tv, struct timezone *tz);
269 * The following part is donated by Carlo Wood from his package 'libr':
270 * (C) Copyright 1996 by Carlo Wood. All rights reserved.
273 /* GNU CC improvements: We can only use this if we have a gcc/g++ compiler */
276 #if (__GNUC__ < 2) || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
280 #else /* !__GNUC__ */
282 /* No attributes if we don't have gcc-2.7 or higher */
285 #endif /* !__GNUC__ */
288 #define HANDLER_ARG(x) x
291 #define HANDLER_ARG(x)
293 #define __attribute__(x)
294 #define UNUSED(x) unused_##x
296 #define UNUSED(x) x __attribute__ ((unused))
301 #define RCSTAG_CC(string) static char unused_rcs_ident[] = string
303 #define RCSTAG_CC(string) static char rcs_ident[] __attribute__ ((unused)) = string
306 #ifdef HAVE_SYS_CDEFS_H
307 #include <sys/cdefs.h>
308 #else /* !HAVE_SYS_MALLOC_H */
312 #define __BEGIN_DECLS extern "C" {
313 #define __END_DECLS }
315 #define __BEGIN_DECLS
318 #endif /* !HAVE_SYS_CDEFS_H */
320 #endif /* __sys_include__ */