diff options
author | rsc <devnull@localhost> | 2003-12-17 04:34:52 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2003-12-17 04:34:52 +0000 |
commit | 49588d5d9089589ccda28c41aae90c29d6f72787 (patch) | |
tree | 48cbc911e34b71977b7b98b4d0b94b27d4454081 /src/lib9 | |
parent | 7f11104a5737adf261d10bc1a7b85e740f2eb491 (diff) | |
download | plan9port-49588d5d9089589ccda28c41aae90c29d6f72787.tar.gz plan9port-49588d5d9089589ccda28c41aae90c29d6f72787.tar.bz2 plan9port-49588d5d9089589ccda28c41aae90c29d6f72787.zip |
Tweaks to various bits.
Until I hear otherwise, Refs aren't used enough to
merit their own assembly. They are now implemented with locks.
Diffstat (limited to 'src/lib9')
-rw-r--r-- | src/lib9/notify.c | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/src/lib9/notify.c b/src/lib9/notify.c index 160755d0..2e589de7 100644 --- a/src/lib9/notify.c +++ b/src/lib9/notify.c @@ -7,33 +7,37 @@ extern char *_p9sigstr(int, char*); -static int sigs[] = { - SIGHUP, - SIGINT, - SIGQUIT, - SIGILL, - SIGTRAP, +static struct { + int sig; + int restart; +} sigs[] = { + SIGHUP, 0, + SIGINT, 0, + SIGQUIT, 0, + SIGILL, 0, + SIGTRAP, 0, /* SIGABRT, */ #ifdef SIGEMT - SIGEMT, + SIGEMT, 0, #endif - SIGFPE, - SIGBUS, + SIGFPE, 0, + SIGBUS, 0, /* SIGSEGV, */ - SIGSYS, - SIGPIPE, - SIGALRM, - SIGTERM, - SIGTSTP, - SIGTTIN, - SIGTTOU, - SIGXCPU, - SIGXFSZ, - SIGVTALRM, - SIGUSR1, - SIGUSR2, + SIGCHLD, 1, + SIGSYS, 0, + SIGPIPE, 0, + SIGALRM, 0, + SIGTERM, 0, + SIGTSTP, 1, + SIGTTIN, 1, + SIGTTOU, 1, + SIGXCPU, 0, + SIGXFSZ, 0, + SIGVTALRM, 0, + SIGUSR1, 0, + SIGUSR2, 0, #ifdef SIGINFO - SIGINFO, + SIGINFO, 0, #endif }; @@ -72,8 +76,13 @@ notify(void (*f)(void*, char*)) notifyf = f; sa.sa_handler = notifysigf; } - for(i=0; i<nelem(sigs); i++) - sigaction(sigs[i], &sa, 0); + for(i=0; i<nelem(sigs); i++){ + if(sigs[i].restart) + sa.sa_flags |= SA_RESTART; + else + sa.sa_flags &= ~SA_RESTART; + sigaction(sigs[i].sig, &sa, 0); + } return 0; } |