From: Remco Rijnders Date: Sat, 7 Mar 2026 17:17:36 +0000 (-0500) Subject: CLEANUP: Remove obsolete OS/arch code, assume modern POSIX, fix linker errors X-Git-Url: http://git.serene-ircd.net/?a=commitdiff_plain;h=789a72358da9c168e2476a2b9a3bc17eeec2a016;p=serene-ircd.git CLEANUP: Remove obsolete OS/arch code, assume modern POSIX, fix linker errors Remove support for dead platforms (Apollo, ISC202, OSF/1, PCS/MUNIX, Windows NT/95, DEC Alpha) and obsolete compatibility shims (K&R prototypes, VOIDSIG, OPT_TYPE, valloc, sys_errlist, custom strtok/strerror/inet_netof). Assume POSIX throughout: signals via sigaction, non-blocking via O_NONBLOCK, standard headers (errno.h, unistd.h, stdlib.h, string.h, stdarg.h), getrusage for resource stats, lrand48 for random numbers. Fix pre-existing multiple-definition linker errors by changing bare global declarations in headers (h.h, common.h) to extern and placing the actual definitions in ircd.c. Co-Authored-By: Claude Opus 4.6 --- diff --git a/include/class.h b/include/class.h index 3adf622..5f6565f 100644 --- a/include/class.h +++ b/include/class.h @@ -20,14 +20,6 @@ #ifndef __class_include__ #define __class_include__ -#ifndef PROTO -#if __STDC__ -# define PROTO(x) x -#else -# define PROTO(x) () -#endif -#endif - typedef struct Class { int class; int conFreq; diff --git a/include/common.h b/include/common.h index c29c2ac..21d2ad6 100644 --- a/include/common.h +++ b/include/common.h @@ -23,21 +23,7 @@ #include #include "sys.h" -#ifdef HAVE_PARAM_H -#include -#endif - -#ifndef PROTO -#if __STDC__ -# define PROTO(x) x -#else -# define PROTO(x) () -#endif -#endif - -#ifndef NULL -#define NULL 0 -#endif +#define PROTO(x) x #ifdef TRUE #undef TRUE @@ -57,29 +43,11 @@ extern int match PROTO((char *, char *)); extern int mycmp (char *, char *); -#ifdef NEED_STRTOK -extern char *strtok PROTO((char *, char *)); -#endif #ifndef HAVE_STRTOKEN extern char *strtoken PROTO((char **, char *, char *)); #endif -#ifndef HAVE_INET_ADDR -extern unsigned long inet_addr PROTO((char *)); -#endif - -#if !defined(HAVE_INET_NTOA) || !defined(HAVE_INET_NETOF) -#include -#endif - -#ifndef HAVE_INET_NTOA -extern char *inet_ntoa PROTO((struct in_addr)); -#endif - -#ifndef HAVE_INET_NETOF -extern int inet_netof PROTO((struct in_addr)); -#endif -int global_count, max_global_count; +extern int global_count, max_global_count; extern char *myctime PROTO((time_t)); extern char *strtoken PROTO((char **, char *, char *)); @@ -166,6 +134,6 @@ extern int lu_noninv, lu_inv, lu_serv, lu_oper, lu_clu, lu_mlu, lu_cglobalu, lu_mglobalu; -time_t now; +extern time_t now; #endif /* __common_include__ */ diff --git a/include/config.h b/include/config.h index 2bd1f29..c185042 100644 --- a/include/config.h +++ b/include/config.h @@ -95,16 +95,6 @@ #define MALLOC_FLAGS_EXTRA "" -/* Many older Operating Systems are running with insecure TCP stacks. - * This allows IP spoofing attacks, which are very difficult for - * operators to track down and ban." - * - * If you have such an old OS you can enable it here but keep in mind that - * this will be the least of your security problems. - * - * Enable this option for any windows version older than 2000 - */ - #undef NOSPOOF @@ -154,24 +144,6 @@ #undef COMMENT_IS_FILE -/* Do these work? I dunno... */ - -/* #undef PCS *//* PCS Cadmus MUNIX, use with BSD flag! */ - -/* - * NOTE: On some systems, valloc() causes many problems. - */ -#undef VALLOC /* Define this if you have valloc(3) */ - -/* - * read/write are restarted after signals defining this 1, gets - * siginterrupt call compiled, which attempts to remove this - * behaviour (apollo sr10.1/bsd4.3 needs this) - */ -#ifdef APOLLO -#define RESTARTING_SYSTEMCALLS -#endif - /* #undef DEBUGMODE *//* define DEBUGMODE to enable debugging mode.*/ //#define DEBUGMODE @@ -507,12 +479,8 @@ * 1 server = 1 connection, 1 user = 1 connection. * This should be at *least* 3: 1 listen port, 1 dns port + 1 client * - * Note: this figure will be too high for most systems. If you get an + * Note: this figure will be too high for most systems. If you get an * fd-related error on compile, change this to 256. - * - * Windows users: This should be a fairly high number. Some operations - * will slow down because of this, but it is _required_ because of the way - * windows NT(and possibly 95) allocate fd handles. A good number is 16384. */ #ifndef MAXCONNECTIONS #define MAXCONNECTIONS 1024 diff --git a/include/dbuf.h b/include/dbuf.h index 17acf8a..0aedc8c 100644 --- a/include/dbuf.h +++ b/include/dbuf.h @@ -20,14 +20,6 @@ #ifndef __dbuf_include__ #define __dbuf_include__ -#ifndef PROTO -#ifdef __STDC__ -# define PROTO(x) x -#else -# define PROTO(x) () -#endif /* __STDC__ */ -#endif /* ! PROTO */ - /* ** dbuf is a collection of functions which can be used to ** maintain a dynamic buffering of a byte stream. diff --git a/include/h.h b/include/h.h index 58d76d9..6c942ec 100644 --- a/include/h.h +++ b/include/h.h @@ -111,8 +111,8 @@ extern int initconf PROTO((int)); extern void add_temp_conf(); extern void inittoken PROTO(()); extern int do_channel_synch(char *); -int synchmode; -int SVSNOOP; +extern int synchmode; +extern int SVSNOOP; extern void calc_mask(aClient *) ; char *return_host(aClient *, aClient *) ; char *return_oper_host(aClient *, aClient *) ; @@ -323,6 +323,6 @@ extern void send_list(aClient *, int); extern void serv_info(aClient *, char *); extern int str2array(char **, char *, char *); extern void CheckBandwidth(void); -int max_connection_count, max_client_count; -long max_sendqs,max_recvqs; +extern int max_connection_count, max_client_count; +extern long max_sendqs,max_recvqs; extern int find_services(void); diff --git a/include/res.h b/include/res.h index 3d384fa..85a5aa0 100644 --- a/include/res.h +++ b/include/res.h @@ -30,11 +30,7 @@ typedef struct reslist { int id; int sent; /* number of requests sent */ int srch; -#ifdef __alpha - u_int ttl; /* time to live */ -#else - u_long ttl; /* time to live */ -#endif + unsigned int ttl; /* time to live */ char type; char retries; /* retry counter */ char sends; /* number of sends (>1 means resent) */ diff --git a/include/sock.h b/include/sock.h index dc0dbbf..ad277e3 100644 --- a/include/sock.h +++ b/include/sock.h @@ -18,27 +18,4 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* - * Revision 1.1.1.1 1997/08/22 17:23:01 donwulff - * Original import from the "deadlined" version. - * - * Revision 1.1.1.1 1996/11/18 07:53:41 explorer - * ircd 4.3.3 -- about time - * - * Revision 1.1.1.1.4.1 1996/09/16 02:45:38 donwulff - * *** empty log message *** - * - * Revision 6.1 1991/07/04 21:04:35 gruner - * Revision 2.6.1 [released] - * - * Revision 6.0 1991/07/04 18:05:04 gruner - * frozen beta revision 2.6.1 - * - */ - -#ifndef FD_ZERO -#define FD_ZERO(set) (((set)->fds_bits[0]) = 0) -#define FD_SET(s1, set) (((set)->fds_bits[0]) |= 1 << (s1)) -#define FD_ISSET(s1, set) (((set)->fds_bits[0]) & (1 << (s1))) -#define FD_SETSIZE 30 -#endif +#include diff --git a/include/sys.h b/include/sys.h index 3fc2ff4..6d9133f 100644 --- a/include/sys.h +++ b/include/sys.h @@ -17,76 +17,21 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifdef ISC202 -#include -#else -#include -#endif +#include #include "setup.h" #include #include #include - -#ifdef HAVE_UNISTD_H #include -#endif -#ifdef HAVE_STDLIB_H #include -#endif - -#ifdef HAVE_STRINGS_H #include -#endif - -#ifdef HAVE_STRING_H -# include -#endif - - -#ifndef HAVE_STRCASECMP -#define strcasecmp mycmp -#endif -#ifndef HAVE_INDEX -#define index strchr -#define rindex strrchr -#endif - -#ifndef HAVE_BZERO -#define bzero(a,b) memset(a,0,b) -#define bcopy(a,b,c) memcpy(b,a,c) -#define bcmp memcmp -#endif - -#ifdef HAVE_GETRUSAGE_2 -# define GETRUSAGE_2 -#else -# ifdef HAVE_TIMES_2 -# define TIMES_2 -# endif /* HAVE_TIMES_2 */ -#endif /* GETRUSAGE_2 */ - -#ifdef HAVE_POSIX_NBLOCK -# define NBLOCK_POSIX -#else /* HAVE_POSIX_NBLOCK */ -# ifdef HAVE_BSD_NBLOCK -# define NBLOCK_BSD -# else -# define NBLOCK_SYSV -# endif /* HAVE_BSD_NBLOCK */ -#endif /* HAVE_POSIX_NBLOCK */ - -#ifdef HAVE_POSIX_SIGNALS -# define POSIX_SIGNALS -#else -# ifdef HAVE_BSD_SIGNALS -# define BSD_RELIABLE_SIGNALS -# else -# define SYSV_UNRELIABLE_SIGNALS -# endif /* HAVE_BSD_SIGNALS */ -#endif /* HAVE_POSIX_SIGNALS */ - +#include #include +#include + +#define NBLOCK_POSIX +#define POSIX_SIGNALS #if !defined(DEBUGMODE) # define MyFree(x) if ((x) != NULL) free(x) @@ -94,23 +39,7 @@ #define free(x) MyFree(x) #endif -#define VOIDSIG void /* whether signal() returns int of void */ - -#define OPT_TYPE void /* opt type for get/setsockopt */ - -#ifdef __osf__ -# define OSF -/* OSF defines BSD to be its version of BSD */ -# undef BSD -# include -# ifndef BSD -# define BSD -# endif -#endif - -#define dn_skipname __dn_skipname - -extern VOIDSIG dummy(); +extern void dummy(); #ifndef u_char typedef unsigned char u_char; @@ -119,9 +48,6 @@ typedef unsigned long u_long; typedef unsigned int u_int; #endif -#ifdef USE_VARARGS -#include -#endif #define MOTD MPATH #define LUSERS LUPATH #define OMOTD OMPATH @@ -150,7 +76,7 @@ extern void debug(); */ #define MAXCLIENTS (MAXCONNECTIONS-4) - + #if defined(CLIENT_FLOOD) # if (CLIENT_FLOOD > 8000) # define CLIENT_FLOOD 8000 diff --git a/include/whowas.h b/include/whowas.h index d0dbb7a..7c3059f 100644 --- a/include/whowas.h +++ b/include/whowas.h @@ -38,14 +38,6 @@ #ifndef __whowas_include__ #define __whowas_include__ -#ifndef PROTO -#if __STDC__ -# define PROTO(x) x -#else -# define PROTO(x) () -#endif /* __STDC__ */ -#endif /* ! PROTO */ - /* ** WHOWAS structure moved here from whowas.c */ diff --git a/src/bsd.c b/src/bsd.c index 1991648..c6ee069 100644 --- a/src/bsd.c +++ b/src/bsd.c @@ -28,24 +28,13 @@ #include #include -extern int errno; /* ...seems that errno.h doesn't define this everywhere */ -#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__linux__) && !defined(__Darwin__) -extern char *sys_errlist[]; -#endif +extern int errno; #ifdef DEBUGMODE int writecalls = 0, writeb[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; #endif -VOIDSIG dummy () +void dummy () { -#ifndef HAVE_RELIABLE_SIGNALS - (void) signal (SIGALRM, dummy); - (void) signal (SIGPIPE, dummy); -#ifdef SIGWINCH - (void) signal (SIGWINCH, dummy); -#endif -#else -#ifdef POSIX_SIGNALS struct sigaction act; act.sa_handler = dummy; @@ -61,8 +50,6 @@ VOIDSIG dummy () #ifdef SIGWINCH (void) sigaction (SIGWINCH, &act, (struct sigaction *) NULL); #endif -#endif -#endif } @@ -115,7 +102,6 @@ int deliver_it (cptr, str, len) ** all is Ok, if the 'write' just returns '0' instead of an ** error and errno=EWOULDBLOCK. ** - ** ...now, would this work on VMS too? --msa */ if (retval < 0 && (errno == EWOULDBLOCK || errno == EAGAIN || errno == ENOBUFS)) { diff --git a/src/dbuf.c b/src/dbuf.c index cc6ee8b..12cf515 100644 --- a/src/dbuf.c +++ b/src/dbuf.c @@ -29,10 +29,6 @@ #include "sys.h" #include "h.h" -#if !defined(VALLOC) && !defined(valloc) -#define valloc malloc -#endif - int dbufalloc = 0, dbufblocks = 0; static dbufbuf *freelist = NULL; @@ -50,12 +46,7 @@ static dbufbuf *freelist = NULL; */ static dbufbuf *dbuf_alloc () { -#if defined(VALLOC) && !defined(DEBUGMODE) - dbufbuf *dbptr, *db2ptr; - int num; -#else dbufbuf *dbptr; -#endif dbufalloc++; if ((dbptr = freelist)) { @@ -66,32 +57,8 @@ static dbufbuf *dbuf_alloc () dbufalloc--; return NULL; } -#if defined(VALLOC) && !defined(DEBUGMODE) -#if defined(_SC_PAGESIZE) - num = sysconf (_SC_PAGESIZE) / sizeof (dbufbuf); -#else - num = getpagesize () / sizeof (dbufbuf); -#endif - if (num < 0) - num = 1; - - dbufblocks += num; - - dbptr = (dbufbuf *) valloc (num * sizeof (dbufbuf)); - if (!dbptr) - return (dbufbuf *) NULL; - - num--; - for (db2ptr = dbptr; num; num--) { - db2ptr = (dbufbuf *) ((char *) db2ptr + sizeof (dbufbuf)); - db2ptr->next = freelist; - freelist = db2ptr; - } - return dbptr; -#else dbufblocks++; return (dbufbuf *) MyMalloc (sizeof (dbufbuf)); -#endif } /* diff --git a/src/ircd.c b/src/ircd.c index 683f0dc..432b0ae 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -42,6 +42,13 @@ char *malloc_options = "h" MALLOC_FLAGS_EXTRA; uint32_t NOSPOOF_SEED01, NOSPOOF_SEED02; #endif /* NOSPOOF */ +int global_count, max_global_count; +time_t now; +int synchmode; +int SVSNOOP; +int max_connection_count, max_client_count; +long max_sendqs, max_recvqs; + int R_do_dns, R_fin_dns, R_fin_dnsc, R_fail_dns, R_do_id, R_fin_id, R_fail_id; char REPORT_DO_DNS[128], REPORT_FIN_DNS[128], REPORT_FIN_DNSC[128], @@ -52,7 +59,7 @@ aClient me; /* That's me */ aClient *client = &me; /* Pointer to beginning of Client list */ void server_reboot (char *); -void restart PROTO ((char *)); +void restart (char *); static void open_debugfile (), setup_signals (); void check_lusers (void); @@ -84,32 +91,8 @@ char clonekillhost[100]; int client_count = 0; /* I guess -SJW */ time_t NOW; -#if defined(PROFIL) -extern etext (); -VOIDSIG s_monitor () -{ - static int mon = 0; -#ifdef POSIX_SIGNALS - struct sigaction act; -#endif - - (void) moncontrol (mon); - mon = 1 - mon; -#ifdef POSIX_SIGNALS - act.sa_handler = s_rehash; - act.sa_flags = 0; - (void) sigemptyset (&act.sa_mask); - (void) sigaddset (&act.sa_mask, SIGUSR1); - (void) sigaction (SIGUSR1, &act, NULL); -#else - (void) signal (SIGUSR1, s_monitor); -#endif -} - -#endif - -VOIDSIG s_die () +void s_die () { int fd; @@ -128,21 +111,16 @@ VOIDSIG s_die () exit (-1); } -static VOIDSIG s_rehash () +static void s_rehash () { -#ifdef POSIX_SIGNALS struct sigaction act; -#endif + dorehash = 1; -#ifdef POSIX_SIGNALS act.sa_handler = s_rehash; act.sa_flags = 0; (void) sigemptyset (&act.sa_mask); (void) sigaddset (&act.sa_mask, SIGHUP); (void) sigaction (SIGHUP, &act, NULL); -#else - (void) signal (SIGHUP, s_rehash); /* sysV -argv */ -#endif } void restart (mesg) @@ -154,7 +132,7 @@ void restart (mesg) server_reboot (mesg); } -VOIDSIG s_restart () +void s_restart () { static int restarting = 0; @@ -453,11 +431,6 @@ int main (argc, argv) sbrk0 = (char *) sbrk ((size_t) 0); uid = getuid (); euid = geteuid (); -#ifdef PROFIL - (void) monstartup (0, etext); - (void) moncontrol (1); - (void) signal (SIGUSR1, s_monitor); -#endif /* PROFIL */ client_count = 0; global_count = 0; @@ -858,7 +831,6 @@ static void open_debugfile () static void setup_signals () { -#ifdef POSIX_SIGNALS struct sigaction act; act.sa_handler = SIG_IGN; @@ -869,7 +841,7 @@ static void setup_signals () #ifdef SIGWINCH (void) sigaddset (&act.sa_mask, SIGWINCH); (void) sigaction (SIGWINCH, &act, NULL); -#endif /* SIGWINCH */ +#endif (void) sigaction (SIGPIPE, &act, NULL); act.sa_handler = dummy; (void) sigaction (SIGALRM, &act, NULL); @@ -883,33 +855,6 @@ static void setup_signals () act.sa_handler = s_die; (void) sigaddset (&act.sa_mask, SIGTERM); (void) sigaction (SIGTERM, &act, NULL); - -#else /* POSIX_SIGNALS */ -#ifndef HAVE_RELIABLE_SIGNALS - (void) signal (SIGPIPE, dummy); -#ifdef SIGWINCH - (void) signal (SIGWINCH, dummy); -#endif -#else -#ifdef SIGWINCH - (void) signal (SIGWINCH, SIG_IGN); -#endif - (void) signal (SIGPIPE, SIG_IGN); -#endif - (void) signal (SIGALRM, dummy); - (void) signal (SIGHUP, s_rehash); - (void) signal (SIGTERM, s_die); - (void) signal (SIGINT, s_restart); -#endif /* POSIX_SIGNALS */ - -#ifdef RESTARTING_SYSTEMCALLS - /* - ** At least on Apollo sr10.1 it seems continuing system calls - ** after signal is the default. The following 'siginterrupt' - ** should change that default to interrupting calls. - */ - (void) siginterrupt (SIGALRM, 1); -#endif } diff --git a/src/res.c b/src/res.c index 3733607..ed46dc9 100644 --- a/src/res.c +++ b/src/res.c @@ -81,9 +81,7 @@ int init_resolver (op) { int ret = 0; -#ifdef HAVE_LRAND48 srand48 (time (NULL)); -#endif if (op & RES_INITLIST) { bzero ((char *) &reinfo, sizeof (reinfo)); first = last = NULL; @@ -411,18 +409,8 @@ static int query_name (char *name, int class, int type, ResRQ *rptr) return r; } hptr = (HEADER *) buf; -#ifdef HAVE_LRAND48 do { hptr->id = htons (ntohs (hptr->id) + k + lrand48 () & 0xffff); -#else - (void) gettimeofday (&tv, NULL); - do { - /* htons/ntohs can be assembler macros, which cannot - be nested. Thus two lines. -Vesa */ - u_short nstmp = - ntohs (hptr->id) + k + (u_short) (tv.tv_usec & 0xffff); - hptr->id = htons (nstmp); -#endif /* HAVE_LRAND48 */ k++; } while (find_id (ntohs (hptr->id))); diff --git a/src/s_bsd.c b/src/s_bsd.c index 43fd29d..85ee7f8 100644 --- a/src/s_bsd.c +++ b/src/s_bsd.c @@ -138,7 +138,7 @@ void report_error (text, cptr) #ifdef SO_ERROR if (cptr && !IsMe (cptr) && cptr->fd >= 0) if (!getsockopt - (cptr->fd, SOL_SOCKET, SO_ERROR, (OPT_TYPE *) & err, &len)) + (cptr->fd, SOL_SOCKET, SO_ERROR, (void *) & err, &len)) if (err) errtmp = err; #endif @@ -860,13 +860,13 @@ static void set_sock_opts (fd, cptr) #ifdef SO_REUSEADDR opt = 1; if (setsockopt - (fd, SOL_SOCKET, SO_REUSEADDR, (OPT_TYPE *) & opt, sizeof (opt)) < 0) + (fd, SOL_SOCKET, SO_REUSEADDR, (void *) & opt, sizeof (opt)) < 0) report_error ("setsockopt(SO_REUSEADDR) %s:%s", cptr); #endif #if defined(SO_USELOOPBACK) opt = 1; if (setsockopt - (fd, SOL_SOCKET, SO_USELOOPBACK, (OPT_TYPE *) & opt, + (fd, SOL_SOCKET, SO_USELOOPBACK, (void *) & opt, sizeof (opt)) < 0) report_error ("setsockopt(SO_USELOOPBACK) %s:%s", cptr); #endif @@ -880,14 +880,14 @@ static void set_sock_opts (fd, cptr) else opt = 4096; if (setsockopt - (fd, SOL_SOCKET, SO_RCVBUF, (OPT_TYPE *) & opt, sizeof (opt)) + (fd, SOL_SOCKET, SO_RCVBUF, (void *) & opt, sizeof (opt)) < 0) report_error ("setsockopt(SO_RCVBUF) %s:%s", cptr); #endif #ifdef SO_SNDBUF opt = 8192; if (setsockopt - (fd, SOL_SOCKET, SO_SNDBUF, (OPT_TYPE *) & opt, sizeof (opt)) + (fd, SOL_SOCKET, SO_SNDBUF, (void *) & opt, sizeof (opt)) < 0) report_error ("setsockopt(SO_SNDBUF) %s:%s", cptr); #endif @@ -896,7 +896,7 @@ static void set_sock_opts (fd, cptr) char *s = readbuf, *t = readbuf + sizeof (readbuf) / 2; opt = sizeof (readbuf) / 8; - if (getsockopt (fd, IPPROTO_IP, IP_OPTIONS, (OPT_TYPE *) t, &opt) < 0) + if (getsockopt (fd, IPPROTO_IP, IP_OPTIONS, (void *) t, &opt) < 0) report_error ("getsockopt(IP_OPTIONS) %s:%s", cptr); else if (opt > 0 && opt != sizeof (readbuf) / 8) { for (*readbuf = '\0'; opt > 0; opt--, s += 3) @@ -905,7 +905,7 @@ static void set_sock_opts (fd, cptr) sendto_ops ("Connection %s using IP opts: (%s)", get_client_name (cptr, TRUE), readbuf); } - if (setsockopt (fd, IPPROTO_IP, IP_OPTIONS, (OPT_TYPE *) NULL, 0) < 0) + if (setsockopt (fd, IPPROTO_IP, IP_OPTIONS, (void *) NULL, 0) < 0) report_error ("setsockopt(IP_OPTIONS) %s:%s", cptr); } #endif @@ -919,7 +919,7 @@ int get_sockerr (cptr) #ifdef SO_ERROR if (cptr->fd >= 0) if (!getsockopt - (cptr->fd, SOL_SOCKET, SO_ERROR, (OPT_TYPE *) & err, &len)) + (cptr->fd, SOL_SOCKET, SO_ERROR, (void *) & err, &len)) if (err) errtmp = err; #endif @@ -940,30 +940,12 @@ void set_non_blocking (fd, cptr) { int res, nonb = 0; - /* - ** NOTE: consult ALL your relevant manual pages *BEFORE* changing - ** these ioctl's. There are quite a few variations on them, - ** as can be seen by the PCS one. They are *NOT* all the same. - ** Heed this well. - Avalon. - */ -#ifdef NBLOCK_POSIX nonb |= O_NONBLOCK; -#endif -#ifdef NBLOCK_BSD - nonb |= O_NDELAY; -#endif -#ifdef NBLOCK_SYSV - /* This portion of code might also apply to NeXT. -LynX */ - res = 1; - if (ioctl (fd, FIONBIO, &res) < 0) - report_error ("ioctl(fd,FIONBIO) failed for %s:%s", cptr); -#else if ((res = fcntl (fd, F_GETFL, 0)) == -1) report_error ("fcntl(fd, F_GETFL) failed for %s:%s", cptr); else if (fcntl (fd, F_SETFL, res | nonb) == -1) report_error ("fcntl(fd, F_SETL, nonb) failed for %s:%s", cptr); -#endif return; } @@ -1681,7 +1663,7 @@ int setup_ping () return -1; } if (setsockopt (udpfd, SOL_SOCKET, SO_REUSEADDR, - (OPT_TYPE *) & on, sizeof (on)) == -1) { + (void *) & on, sizeof (on)) == -1) { #ifdef USE_SYSLOG syslog (LOG_ERR, "setsockopt udp fd %d : %m", udpfd); #endif diff --git a/src/s_debug.c b/src/s_debug.c index 072a9af..45ad583 100644 --- a/src/s_debug.c +++ b/src/s_debug.c @@ -50,9 +50,6 @@ char serveropts[] = { #ifdef NOSPOOF 'n', #endif -#ifdef VALLOC - 'V', -#endif #ifdef USE_SYSLOG 'Y', #endif @@ -69,13 +66,7 @@ char serveropts[] = { #include "hash.h" #include #include -#ifdef GETRUSAGE_2 #include -#else -#ifdef TIMES_2 -#include -#endif -#endif #include "h.h" #ifndef ssize_t @@ -115,8 +106,6 @@ void send_usage (cptr, nick) aClient *cptr; char *nick; { - -#ifdef GETRUSAGE_2 struct rusage rus; time_t secs, rup; #ifdef hz @@ -130,11 +119,8 @@ void send_usage (cptr, nick) #endif if (getrusage (RUSAGE_SELF, &rus) == -1) { -#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__linux__) && !defined(__Darwin__) - extern char *sys_errlist[]; -#endif - sendto_one (cptr, ":%s NOTICE %s :Getruseage error: %s.", - me.name, nick, sys_errlist[errno]); + sendto_one (cptr, ":%s NOTICE %s :Getrusage error: %s.", + me.name, nick, strerror (errno)); return; } secs = rus.ru_utime.tv_sec + rus.ru_stime.tv_sec; @@ -162,36 +148,6 @@ void send_usage (cptr, nick) sendto_one (cptr, ":%s %d %s :Signals %d Context Vol. %d Invol %d", me.name, RPL_STATSDEBUG, nick, rus.ru_nsignals, rus.ru_nvcsw, rus.ru_nivcsw); -#else -#ifdef TIMES_2 - struct tms tmsbuf; - time_t secs, mins; - int hzz = 1, ticpermin; - int umin, smin, usec, ssec; - - ticpermin = hzz * 60; - - umin = tmsbuf.tms_utime / ticpermin; - usec = (tmsbuf.tms_utime % ticpermin) / (float) hzz; - smin = tmsbuf.tms_stime / ticpermin; - ssec = (tmsbuf.tms_stime % ticpermin) / (float) hzz; - secs = usec + ssec; - mins = (secs / 60) + umin + smin; - secs %= hzz; - - if (times (&tmsbuf) == -1) { - sendto_one (cptr, ":%s %d %s :times(2) error: %s.", - me.name, RPL_STATSDEBUG, nick, strerror (errno)); - return; - } - secs = tmsbuf.tms_utime + tmsbuf.tms_stime; - - sendto_one (cptr, - ":%s %d %s :CPU Secs %d:%d User %d:%d System %d:%d", - me.name, RPL_STATSDEBUG, nick, mins, secs, umin, usec, - smin, ssec); -#endif -#endif sendto_one (cptr, ":%s %d %s :Reads %d Writes %d", me.name, RPL_STATSDEBUG, nick, readcalls, writecalls); sendto_one (cptr, ":%s %d %s :DBUF alloc %d blocks %d", diff --git a/src/s_ping.c b/src/s_ping.c index c32adfe..08968c9 100644 --- a/src/s_ping.c +++ b/src/s_ping.c @@ -381,9 +381,9 @@ int m_uping (cptr, sptr, parc, parv) */ opt = 2048; if (setsockopt - (fd, SOL_SOCKET, SO_SNDBUF, (OPT_TYPE *) & opt, sizeof (opt)) + (fd, SOL_SOCKET, SO_SNDBUF, (void *) & opt, sizeof (opt)) < 0 - || setsockopt (fd, SOL_SOCKET, SO_RCVBUF, (OPT_TYPE *) & opt, + || setsockopt (fd, SOL_SOCKET, SO_RCVBUF, (void *) & opt, sizeof (opt)) < 0) { int err = errno; sendto_ops ("m_uping: setsockopt SO_SNDBUF|SO_RCVBUF: %s", diff --git a/src/s_serv.c b/src/s_serv.c index 3dc9eed..15cea35 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -38,7 +38,7 @@ static void report_jinx (aClient * sptr); static char buf[BUFSIZE]; -VOIDSIG s_die (); +void s_die (); /* I guess we can move this to somewhere else ... */ /* diff --git a/src/support.c b/src/support.c index 5cd3127..3755850 100644 --- a/src/support.c +++ b/src/support.c @@ -66,48 +66,6 @@ char *strtoken (save, str, fs) } #endif /* HAVE_STRTOKEN */ -#ifdef NEED_STRTOK -/* - ** NOT encouraged to use! - */ - -char *strtok (str, fs) - char *str, *fs; -{ - static char *pos; - - return strtoken (&pos, str, fs); -} - -#endif /* NEED_STRTOK */ - -#ifdef NEED_STRERROR -/* - ** strerror - return an appropriate system error string to a given errno - ** - ** argv 11/90 - */ - -char *strerror (err_no) - int err_no; -{ - extern char *sys_errlist[]; /* Sigh... hopefully on all systems */ - extern int sys_nerr; - - static char buff[40]; - char *errp; - - errp = (err_no > sys_nerr ? (char *) NULL : sys_errlist[err_no]); - - if (errp == (char *) NULL) { - errp = buff; - (void) sprintf (errp, "Unknown Error %d", err_no); - } - return errp; -} - -#endif /* NEED_STRERROR */ - /* ** inetntoa -- changed name to remove collision possibility and ** so behaviour is guaranteed to take a pointer arg. @@ -130,27 +88,6 @@ char *inetntoa (in) return buf; } -#ifndef HAVE_INET_NETOF -/* - ** inet_netof -- return the net portion of an internet number - ** argv 11/90 - */ - -int inet_netof (in) - struct in_addr in; -{ - int addr = in.s_net; - - if (addr & 0x80 == 0) - return ((int) in.s_net); - - if (addr & 0x40 == 0) - return ((int) in.s_net * 256 + in.s_host); - - return ((int) in.s_net * 256 + in.s_host * 256 + in.s_lh); -} - -#endif /* HAVE_INET_NETOF */ #ifdef DEBUGMODE