File: sys.h

package info (click to toggle)
ircd 2.10.02-1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 2,228 kB
  • ctags: 2,087
  • sloc: ansic: 29,122; makefile: 664; sh: 307; perl: 18
file content (290 lines) | stat: -rw-r--r-- 6,324 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
/*
 * IRC - Internet Relay Chat, include/sys.h
 * Copyright (C) 1990 University of Oulu, Computing Center
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 1, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef __sys_include__
#define __sys_include__

#include "../config/config.h"
#include "../config/setup.h"

#ifdef __sun__
#ifdef __svr4__
#define SOL2
#else
#define SUNOS4
#endif
#endif

#if WORDS_BIGENDIAN
# define BIT_ZERO_ON_LEFT
#else
# define BIT_ZERO_ON_RIGHT
#endif

#ifdef _SEQUENT_		/* Dynix 1.4 or 2.0 Generic Define.. */
#undef BSD
#define SYSV			/* Also #define SYSV */
#endif

#ifdef __hpux
#define HPUX
#endif

#ifdef sgi
#define SGI
#endif

#if defined(mips)
#undef SYSV
#undef BSD
#define BSD 1			/* mips only works in bsd43 environment */
#endif

#ifdef	BSD_RELIABLE_SIGNALS
#if defined(SYSV_UNRELIABLE_SIGNALS) || defined(POSIX_SIGNALS)
#error You stuffed up config.h signals #defines use only one.
#endif
#define HAVE_RELIABLE_SIGNALS
#endif

#ifdef	SYSV_UNRELIABLE_SIGNALS
#ifdef	POSIX_SIGNALS
#error You stuffed up config.h signals #defines use only one.
#endif
#undef	HAVE_RELIABLE_SIGNALS
#endif

#ifdef	POSIX_SIGNALS
#define HAVE_RELIABLE_SIGNALS
#endif

/*
 * safety margin so we can always have one spare fd, for motd/authd or
 * whatever else.  -24 allows "safety" margin of 10 listen ports, 8 servers
 * and space reserved for logfiles, DNS sockets and identd sockets etc.
 */
#define MAXCLIENTS	(MAXCONNECTIONS-24)

#ifdef HAVECURSES
#define DOCURSES
#else
#undef DOCURSES
#endif

#ifdef HAVETERMCAP
#define DOTERMCAP
#else
#undef DOTERMCAP
#endif

#ifndef UNIXPORT
#undef	UNIXPORTPATH
#endif

#if defined(CLIENT_FLOOD)
#if (CLIENT_FLOOD > 8000) || (CLIENT_FLOOD < 512)
#error CLIENT_FLOOD needs redefining.
#endif
#else
#error CLIENT_FLOOD undefined
#endif

#ifndef CONFIG_SETUGID
#undef IRC_UID
#undef IRC_GID
#endif

#define Reg1 register
#define Reg2 register
#define Reg3 register
#define Reg4 register
#define Reg5 register
#define Reg6 register
#define Reg7 register
#define Reg8 register
#define Reg9 register
#define Reg10 register

#include <stdio.h>
#include <sys/types.h>
#include <sys/param.h>

#if HAVE_ERRNO_H
# include <errno.h>
#else
# if HAVE_NET_ERRNO_H
#  include <net/errno.h>
# endif
#endif

#if !defined(__FreeBSD__) && !defined(__NetBSD__) && \
    !defined(__bsdi__) && !defined(__alpha) && !defined(__GLIBC__)
extern char *sys_errlist[];
#endif

/* See AC_HEADER_STDC in 'info autoconf' */
#if STDC_HEADERS
# include <string.h>
#else
# if HAVE_STRING_H
#  include <string.h>
# endif
# ifndef HAVE_STRCHR
#  define strchr index
#  define strrchr rindex
# endif
char *strchr (), *strrchr (), *strtok ();
# if HAVE_MEMORY_H		/* See AC_MEMORY_H in 'info autoconf' */
#  include <memory.h>
# endif
# ifndef HAVE_MEMCPY
#  define memcpy(d, s, n) bcopy ((s), (d), (n))
#  define memset(a, b, c) bzero(a, c)		/* We ONLY use memset(x, 0, y)*/
# else
/* #  define bzero(a, c) memset((a), 0, (c))*/	/* Some use it in FD_ZERO */
# endif
# ifndef HAVE_MEMMOVE
#  define memmove(d, s, n) bcopy ((s), (d), (n))
# endif
#endif

#if defined(_AIX) || (defined(__STRICT_ANSI__) && __GLIBC__ >= 2)
#include <sys/select.h>
#endif

/* See AC_HEADER_TIME in 'info autoconf' */
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
#  include <sys/time.h>
# else
#  include <time.h>
# endif
#endif

#ifdef SOL2
#define OPT_TYPE char		/* opt type for get/setsockopt */
#else
#define OPT_TYPE void
#endif

#ifdef SUNOS4
#define LIMIT_FMT "%d"
#else
#ifdef __bsdi__
#define LIMIT_FMT "%qd"
#else
#define LIMIT_FMT "%ld"
#endif
#endif

/* Different name on NetBSD and FreeBSD --Skip */
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__bsdi__)
#define dn_skipname  __dn_skipname
#endif

#ifdef _SEQUENT_
#define NO_U_TYPES
typedef unsigned short n_short; /* short as received from the net */
typedef unsigned long n_long;	/* long as received from the net */
typedef unsigned long n_time;	/* ms since 00:00 GMT, byte rev */
#define _NETINET_IN_SYSTM_INCLUDED
#endif

#ifdef	NO_U_TYPES
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned long u_long;
typedef unsigned int u_int;
#endif

#ifndef MAX
#define MAX(a, b)	((a) > (b) ? (a) : (b))
#endif
#ifndef MIN
#define MIN(a, b)	((a) < (b) ? (a) : (b))
#endif

#ifndef FALSE
#define FALSE (0)
#endif
#ifndef TRUE
#define TRUE  (!FALSE)
#endif

#ifdef SGI
#include <stddef.h>
#endif
#ifndef offsetof
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif

#if defined(DEBUGMODE) && !defined(DEBUGMALLOC)
#define DEBUGMALLOC
#endif

#ifdef STDC_HEADERS
#include <stdlib.h>
#else /* !STDC_HEADERS */
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#else
#ifdef HAVE_SYS_MALLOC_H
#include <sys/malloc.h>
#endif /* HAVE_SYS_MALLOC_H */
#endif /* HAVE_MALLOC_H */
#endif /* !STDC_HEADERS */
#include "runmalloc.h"

#define MyCoreDump *((int *)NULL)=0

/* This isn't really POSIX :(, but we really need it -- can this be replaced ?*/
#if defined(__STRICT_ANSI__) && !defined(_AIX)
extern int gettimeofday(struct timeval *tv, struct timezone *tz);
#endif

/*
 * The following part is donated by Carlo Wood from his package 'libr':
 * (C) Copyright 1996 by Carlo Wood. All rights reserved.
 */

/* GNU CC improvements: We can only use this if we have a gcc/g++ compiler */
#ifdef __GNUC__

#if (__GNUC__ < 2) || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
#define NO_ATTRIBUTE
#endif

#else /* !__GNUC__ */

/* No attributes if we don't have gcc-2.7 or higher */
#define NO_ATTRIBUTE

#endif /* !__GNUC__ */

#ifdef NO_ATTRIBUTE
#define __attribute__(x)
#endif

#define RCSTAG_CC(string) \
    static char rcs_ident[] __attribute__ ((unused)) = string;

#endif /* __sys_include__ */