diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-09-10 00:06:52 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-09-10 00:06:52 +0800 |
commit | 56e7ec2edacc18f3b323a35544dc577545eb24d4 (patch) | |
tree | 6ef013967bd762a48bfe0d003da51af614327600 | |
parent | 428f0736872120d93a2820d5012908f1f0ab6944 (diff) | |
download | pttbbs-victor.solaris.tar pttbbs-victor.solaris.tar.gz pttbbs-victor.solaris.tar.bz2 pttbbs-victor.solaris.tar.lz pttbbs-victor.solaris.tar.xz pttbbs-victor.solaris.tar.zst pttbbs-victor.solaris.zip |
use Signal instead of signal, and define the correct one in osdep.hvictor.solaris
fix compile error
git-svn-id: http://opensvn.csie.org/pttbbs/branches/victor.solaris@2188 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | include/osdep.h | 15 | ||||
-rw-r--r-- | innbbsd/Makefile | 1 | ||||
-rw-r--r-- | innbbsd/bbsnnrp.c | 17 | ||||
-rw-r--r-- | innbbsd/connectsock.c | 23 | ||||
-rw-r--r-- | innbbsd/rfc931.c | 3 | ||||
-rw-r--r-- | mbbsd/brc.c | 2 | ||||
-rw-r--r-- | mbbsd/chc.c | 6 | ||||
-rw-r--r-- | mbbsd/mbbsd.c | 36 | ||||
-rw-r--r-- | mbbsd/osdep.c | 18 | ||||
-rw-r--r-- | mbbsd/term.c | 6 | ||||
-rw-r--r-- | util/diskstat.c | 4 | ||||
-rw-r--r-- | util/outmail.c | 2 | ||||
-rw-r--r-- | util/xchatd.c | 16 |
13 files changed, 92 insertions, 57 deletions
diff --git a/include/osdep.h b/include/osdep.h index c9223ba3..a7c719d1 100644 --- a/include/osdep.h +++ b/include/osdep.h @@ -4,7 +4,7 @@ /* os dependant include file, define */ #ifdef __FreeBSD__ - #if __FreeBSD__ >=5 + #if __FreeBSD__ >= 5 #include <sys/limits.h> #else #include <machine/limits.h> @@ -43,8 +43,21 @@ #define NEED_INET_PTON #endif + #if __OS_MAJOR_VERSION__ == 5 && __OS_MAJOR_VERSION__ < 6 + #define NEED_BSD_SIGNAL + #endif + #else + #warning "Unknown OSTYPE" + +#endif + + +#ifdef Solaris + #define Signal (bsd_signal) +#else + #define Signal (signal) #endif diff --git a/innbbsd/Makefile b/innbbsd/Makefile index 385eba17..9399d32d 100644 --- a/innbbsd/Makefile +++ b/innbbsd/Makefile @@ -31,6 +31,7 @@ BBS_REC = $(BBS_UTIL)/util_record.o $(BBS_UTIL)/util_cache.o \ $(BBS_UTIL)/util_var.o $(BBS_REC_EXTRA_$(OSTYPE)) BBS_REC_EXTRA_Linux = $(BBS_UTIL)/util_osdep.o +BBS_REC_EXTRA_Solaris = $(BBS_UTIL)/util_osdep.o ######################### # diff --git a/innbbsd/bbsnnrp.c b/innbbsd/bbsnnrp.c index fadafe72..544e3336 100644 --- a/innbbsd/bbsnnrp.c +++ b/innbbsd/bbsnnrp.c @@ -18,6 +18,7 @@ #include "bbslib.h" #include "daemon.h" #include "nntp.h" +#include "osdep.h" #ifndef MAX_ARTS #define MAX_ARTS 100 @@ -288,10 +289,10 @@ main(argc, argv) sprintf(BBSNNRP.rcfile, "%s/.newsrc.%s.%s", INNDHOME, server, ptr); initrcfiles(&BBSNNRP); - signal(SIGTERM, doterm); - signal(SIGKILL, doterm); - signal(SIGHUP, doterm); - signal(SIGPIPE, doterm); + Signal(SIGTERM, doterm); + Signal(SIGKILL, doterm); + Signal(SIGHUP, doterm); + Signal(SIGPIPE, doterm); readnews(server, &BBSNNRP); writerc(&BBSNNRP); @@ -310,10 +311,10 @@ main(argc, argv) exit(1); } initsockets(server, &BBSNNRP, inputtype); - signal(SIGTERM, doterm); - signal(SIGKILL, doterm); - signal(SIGHUP, doterm); - signal(SIGPIPE, doterm); + Signal(SIGTERM, doterm); + Signal(SIGKILL, doterm); + Signal(SIGHUP, doterm); + Signal(SIGPIPE, doterm); stdinreadnews(&BBSNNRP); closesockets(); diff --git a/innbbsd/connectsock.c b/innbbsd/connectsock.c index 1c401dbc..f61ff160 100644 --- a/innbbsd/connectsock.c +++ b/innbbsd/connectsock.c @@ -2,6 +2,7 @@ #include "daemon.h" #include <signal.h> #include <setjmp.h> +#include "osdep.h" static jmp_buf timebuf; @@ -112,12 +113,12 @@ initunixserver(path, protocol) return -1; } /* standalonesetup(s); */ - signal(SIGHUP, SIG_IGN); - signal(SIGUSR1, SIG_IGN); - signal(SIGCHLD, reapchild); + Signal(SIGHUP, SIG_IGN); + Signal(SIGUSR1, SIG_IGN); + Signal(SIGCHLD, reapchild); UNIX_SERVER_PATH = path; - signal(SIGINT, doremove); - signal(SIGTERM, doremove); + Signal(SIGINT, doremove); + Signal(SIGTERM, doremove); chdir("/"); if (bind(s, (struct sockaddr *) & s_un, sizeof(struct sockaddr_un)) < 0) { @@ -176,11 +177,11 @@ initinetserver(service, protocol) return -1; } standalonesetup(s); - signal(SIGHUP, SIG_IGN); - signal(SIGUSR1, SIG_IGN); - signal(SIGCHLD, reapchild); - signal(SIGINT, dokill); - signal(SIGTERM, dokill); + Signal(SIGHUP, SIG_IGN); + Signal(SIGUSR1, SIG_IGN); + Signal(SIGCHLD, reapchild); + Signal(SIGINT, dokill); + Signal(SIGTERM, dokill); chdir("/"); if (bind(s, (struct sockaddr *) & sin, sizeof(struct sockaddr_in)) < 0) { @@ -404,7 +405,7 @@ inetclient(server, service, protocol) return -1; } if (setjmp(timebuf) == 0) { - signal(SIGALRM, timeout); + Signal(SIGALRM, timeout); alarm(5); if (connect(s, (struct sockaddr *) & sin, sizeof(sin)) < 0) { alarm(0); diff --git a/innbbsd/rfc931.c b/innbbsd/rfc931.c index d8428119..187f7929 100644 --- a/innbbsd/rfc931.c +++ b/innbbsd/rfc931.c @@ -23,6 +23,7 @@ static char sccsid[] = "@(#) rfc931.c 1.4 93/03/07 22:47:52"; #include <netinet/in.h> #include <setjmp.h> #include <signal.h> +#include "osdep.h" /* #include "log_tcp.h" */ @@ -90,7 +91,7 @@ my_rfc931_name(herefd, there) } /* Set up timer so we won't get stuck. */ - signal(SIGALRM, timeout); + Signal(SIGALRM, timeout); if (setjmp(timebuf)) { close(s); /* not: fclose(fp) */ return (result); diff --git a/mbbsd/brc.c b/mbbsd/brc.c index 4233ea59..7bff2787 100644 --- a/mbbsd/brc.c +++ b/mbbsd/brc.c @@ -97,7 +97,7 @@ brc_find_record(int bid, int *num) { char *p; brcnbrd_t tnum; - ptr = brc_findrecord_in(brc_buf, brc_buf + brc_size, bid, &tnum); + p = brc_findrecord_in(brc_buf, brc_buf + brc_size, bid, &tnum); *num = tnum; if (p) return (time_t*)(p + sizeof(brcbid_t) + sizeof(brcnbrd_t)); diff --git a/mbbsd/chc.c b/mbbsd/chc.c index 54a351ba..4a37dbfe 100644 --- a/mbbsd/chc.c +++ b/mbbsd/chc.c @@ -896,7 +896,7 @@ chc_init(int s, chcusr_t *user1, chcusr_t *user2, board_t board, play_func_t pla chc_redraw(user1, user2, board); add_io(s, 0); - signal(SIGUSR1, chc_watch_request); + Signal(SIGUSR1, chc_watch_request); if (my->turn && !(chc_mode & CHC_WATCH)) chc_broadcast_recv(act_list, board); @@ -926,7 +926,7 @@ chc(int s, int mode) char mode0 = currutmp->mode; char file[80]; - signal(SIGUSR1, SIG_IGN); + Signal(SIGUSR1, SIG_IGN); chc_mode = mode; chc_bp = &board; @@ -963,7 +963,7 @@ chc(int s, int mode) } else chc_log_close(); - signal(SIGUSR1, talk_request); + Signal(SIGUSR1, talk_request); } static userinfo_t * diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 4b343466..eb6ae50f 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -1007,17 +1007,17 @@ start_client() login_start_time = time(0); currmode = 0; - signal(SIGHUP, abort_bbs); - signal(SIGTERM, abort_bbs); - signal(SIGPIPE, abort_bbs); - - signal(SIGINT, abort_bbs_debug); - signal(SIGQUIT, abort_bbs_debug); - signal(SIGILL, abort_bbs_debug); - signal(SIGABRT, abort_bbs_debug); - signal(SIGFPE, abort_bbs_debug); - signal(SIGBUS, abort_bbs_debug); - signal(SIGSEGV, abort_bbs_debug); + Signal(SIGHUP, abort_bbs); + Signal(SIGTERM, abort_bbs); + Signal(SIGPIPE, abort_bbs); + + Signal(SIGINT, abort_bbs_debug); + Signal(SIGQUIT, abort_bbs_debug); + Signal(SIGILL, abort_bbs_debug); + Signal(SIGABRT, abort_bbs_debug); + Signal(SIGFPE, abort_bbs_debug); + Signal(SIGBUS, abort_bbs_debug); + Signal(SIGSEGV, abort_bbs_debug); signal_restart(SIGUSR1, talk_request); signal_restart(SIGUSR2, write_request); @@ -1029,7 +1029,7 @@ start_client() exit(1); do_term_init(); - signal(SIGALRM, abort_bbs); + Signal(SIGALRM, abort_bbs); alarm(600); login_query(); /* Ptt 加上login time out */ @@ -1042,7 +1042,7 @@ start_client() b_closepolls(); SHM->close_vote_time = now; } - signal(SIGALRM, SIG_IGN); + Signal(SIGALRM, SIG_IGN); domenu(MMENU, "主功\能表", (currutmp->mailalert ? 'M' : 'C'), cmdlist); } @@ -1122,7 +1122,7 @@ getremotename(struct sockaddr_in * from, char *rhost, char *rname) hp = NULL; if (setjmp(byebye) == 0) { - signal(SIGALRM, timeout); + Signal(SIGALRM, timeout); alarm(3); hp = gethostbyaddr((char *)&from->sin_addr, sizeof(struct in_addr), from->sin_family); @@ -1153,7 +1153,7 @@ getremotename(struct sockaddr_in * from, char *rhost, char *rname) } /* Set up a timer so we won't get stuck while waiting for the server. */ if (setjmp(byebye) == 0) { - signal(SIGALRM, timeout); + Signal(SIGALRM, timeout); alarm(RFC931_TIMEOUT); /* @@ -1251,11 +1251,11 @@ main(int argc, char *argv[], char *envp[]) start_time = time(NULL); /* avoid SIGPIPE */ - signal(SIGPIPE, SIG_IGN); + Signal(SIGPIPE, SIG_IGN); /* avoid erroneous signal from other mbbsd */ - signal(SIGUSR1, SIG_IGN); - signal(SIGUSR2, SIG_IGN); + Signal(SIGUSR1, SIG_IGN); + Signal(SIGUSR2, SIG_IGN); attach_SHM(); if( (argc == 3 && shell_login(argc, argv, envp)) || diff --git a/mbbsd/osdep.c b/mbbsd/osdep.c index e7852177..1bca7208 100644 --- a/mbbsd/osdep.c +++ b/mbbsd/osdep.c @@ -380,6 +380,24 @@ inet_pton(int af, const char *src, void *dst) } #endif +#ifdef NEED_BSD_SIGNAL + +void (*bsd_signal(int sig, void (*func)(int)))(int) +{ + struct sigaction act, oact; + + act.sa_handler = func; + act.sa_flags = SA_RESTART; + sigemptyset(&act.sa_mask); + sigaddset(&act.sa_mask, sig); + if (sigaction(sig, &act, &oact) == -1) + return(SIG_ERR); + return(oact.sa_handler); +} + + +#endif + #ifdef Solaris diff --git a/mbbsd/term.c b/mbbsd/term.c index 555840d1..9d766fe4 100644 --- a/mbbsd/term.c +++ b/mbbsd/term.c @@ -58,7 +58,7 @@ term_resize(int sig) struct winsize newsize; screenline_t *new_picture; - signal(SIGWINCH, SIG_IGN); /* Don't bother me! */ + Signal(SIGWINCH, SIG_IGN); /* Don't bother me! */ ioctl(0, TIOCGWINSZ, &newsize); /* make sure reasonable size */ @@ -82,13 +82,13 @@ term_resize(int sig) b_lines = t_lines - 1; p_lines = t_lines - 4; - signal(SIGWINCH, term_resize); + Signal(SIGWINCH, term_resize); } int term_init() { - signal(SIGWINCH, term_resize); + Signal(SIGWINCH, term_resize); return YEA; } diff --git a/util/diskstat.c b/util/diskstat.c index 370c1a7b..1b785120 100644 --- a/util/diskstat.c +++ b/util/diskstat.c @@ -305,7 +305,7 @@ main(int argc, char **argv) } #endif - signal(SIGINT, printresult); + Signal(SIGINT, printresult); /* find out how many devices we have */ if ((num_devices = getnumdevs()) < 0) err(1, "can't get number of devices"); @@ -424,7 +424,7 @@ main(int argc, char **argv) * If the user stops the program (control-Z) and then resumes it, * print out the header again. */ - (void)signal(SIGCONT, phdr); + (void)Signal(SIGCONT, phdr); for (headercount = 1;;) { struct devinfo *tmp_dinfo; diff --git a/util/outmail.c b/util/outmail.c index 508d857b..8f01c486 100644 --- a/util/outmail.c +++ b/util/outmail.c @@ -218,7 +218,7 @@ void parseserver(char *sx, char **name, int *port) int main(int argc, char **argv, char **envp) { int ch; - signal(SIGHUP, wakeup); + Signal(SIGHUP, wakeup); initsetproctitle(argc, argv, envp); if(chdir(BBSHOME)) diff --git a/util/xchatd.c b/util/xchatd.c index bcc3d6ea..22be9620 100644 --- a/util/xchatd.c +++ b/util/xchatd.c @@ -3148,7 +3148,7 @@ start_daemon() for (fd = 1; fd < NSIG; fd++) { - signal(fd, SIG_IGN); + Signal(fd, SIG_IGN); } #endif @@ -3297,16 +3297,16 @@ main() log_init(); - signal(SIGBUS, SIG_IGN); - signal(SIGSEGV, SIG_IGN); - signal(SIGPIPE, SIG_IGN); - signal(SIGURG, SIG_IGN); + Signal(SIGBUS, SIG_IGN); + Signal(SIGSEGV, SIG_IGN); + Signal(SIGPIPE, SIG_IGN); + Signal(SIGURG, SIG_IGN); - signal(SIGCHLD, reaper); - signal(SIGTERM, abort_server); + Signal(SIGCHLD, reaper); + Signal(SIGTERM, abort_server); #ifdef SERVER_USAGE - signal(SIGPROF, server_usage); + Signal(SIGPROF, server_usage); #endif /* ----------------------------- */ |