diff options
author | Richard Basch <probe@mit.edu> | 1993-09-24 17:19:36 +0000 |
---|---|---|
committer | Richard Basch <probe@mit.edu> | 1993-09-24 17:19:36 +0000 |
commit | f1720653f0647ee5aac692bbff2689a2a1098ce9 (patch) | |
tree | 60dbb21ff6312cbd372cc2bec771cb888390953c /server/uloc.c | |
parent | 77a043be93791f3ce530a7f099fd3031fec2d47e (diff) |
Added POSIX signal handling
Diffstat (limited to 'server/uloc.c')
-rw-r--r-- | server/uloc.c | 108 |
1 files changed, 101 insertions, 7 deletions
diff --git a/server/uloc.c b/server/uloc.c index ee45c72..fac34d2 100644 --- a/server/uloc.c +++ b/server/uloc.c @@ -438,12 +438,22 @@ uloc_hflush(addr) { ZLocation_t *loc; register int i = 0, new_num = 0; +#ifdef POSIX + sigset_t mask, omask; +#else int omask; +#endif if (num_locs == 0) return; /* none to flush */ - omask = sigblock(sigmask(SIGFPE)); /* don't do ascii dumps */ +#ifdef POSIX + sigemptyset(&mask); + sigaddset(&mask, SIGFPE); + sigprocmask(SIG_BLOCK, &mask, &omask); +#else + omask = sigblock(sigmask(SIGFPE)); /* don't let db dumps start */ +#endif /* slightly inefficient, assume the worst, and allocate enough space */ loc = (ZLocation_t *) xmalloc(num_locs *sizeof(ZLocation_t)); @@ -480,13 +490,21 @@ uloc_hflush(addr) xfree(loc); loc = NULLZLT; num_locs = new_num; +#ifdef POSIX + (void) sigprocmask(SIG_SETMASK, &omask, (sigset_t *)0); +#else (void) sigsetmask(omask); +#endif return; } locations = loc; num_locs = new_num; +#ifdef POSIX + (void) sigprocmask(SIG_SETMASK, &omask, (sigset_t *)0); +#else (void) sigsetmask(omask); +#endif /* all done */ return; } @@ -497,12 +515,22 @@ uloc_flush_client(sin) { ZLocation_t *loc; register int i = 0, new_num = 0; +#ifdef POSIX + sigset_t mask, omask; +#else int omask; +#endif if (num_locs == 0) return; /* none to flush */ - omask = sigblock(sigmask(SIGFPE)); /* don't do ascii dumps */ +#ifdef POSIX + sigemptyset(&mask); + sigaddset(&mask, SIGFPE); + sigprocmask(SIG_BLOCK, &mask, &omask); +#else + omask = sigblock(sigmask(SIGFPE)); /* don't let db dumps start */ +#endif /* slightly inefficient, assume the worst, and allocate enough space */ loc = (ZLocation_t *) xmalloc(num_locs *sizeof(ZLocation_t)); @@ -540,13 +568,21 @@ uloc_flush_client(sin) xfree(loc); loc = NULLZLT; num_locs = new_num; +#ifdef POSIX + (void) sigprocmask(SIG_SETMASK, &omask, (sigset_t *)0); +#else (void) sigsetmask(omask); +#endif return; } locations = loc; num_locs = new_num; +#ifdef POSIX + (void) sigprocmask(SIG_SETMASK, &omask, (sigset_t *)0); +#else (void) sigsetmask(omask); +#endif #ifdef DEBUG if (zdebug) { register int i; @@ -634,7 +670,11 @@ ulogin_add_user(notice, exposure, who) { ZLocation_t *oldlocs, newloc; register int i; +#ifdef POSIX + sigset_t mask, omask; +#else int omask; +#endif if ((oldlocs = ulogin_find(notice,1)) != NULLZLT) { #if 0 @@ -646,7 +686,13 @@ ulogin_add_user(notice, exposure, who) oldlocs = locations; - omask = sigblock(sigmask(SIGFPE)); /* don't do ascii dumps */ +#ifdef POSIX + sigemptyset(&mask); + sigaddset(&mask, SIGFPE); + sigprocmask(SIG_BLOCK, &mask, &omask); +#else + omask = sigblock(sigmask(SIGFPE)); /* don't let db dumps start */ +#endif locations = (ZLocation_t *) xmalloc((num_locs +1) * sizeof(ZLocation_t)); if (!locations) { @@ -659,7 +705,11 @@ ulogin_add_user(notice, exposure, who) if (ulogin_setup(notice, locations, exposure, who)) { xfree(locations); locations = NULLZLT; +#ifdef POSIX + (void) sigprocmask(SIG_SETMASK, &omask, (sigset_t *)0); +#else (void) sigsetmask(omask); +#endif return 1; } num_locs = 1; @@ -671,7 +721,11 @@ ulogin_add_user(notice, exposure, who) if (ulogin_setup(notice, &newloc, exposure, who)) { xfree(locations); locations = oldlocs; +#ifdef POSIX + (void) sigprocmask(SIG_SETMASK, &omask, (sigset_t *)0); +#else (void) sigsetmask(omask); +#endif return 1; } num_locs++; @@ -708,7 +762,11 @@ ulogin_add_user(notice, exposure, who) (int) locations[i].zlt_exposure); } #endif +#ifdef POSIX + (void) sigprocmask(SIG_SETMASK, &omask, (sigset_t *)0); +#else (void) sigsetmask(omask); +#endif return 0; } @@ -932,7 +990,11 @@ ulogin_remove_user(notice, auth, who, err_return) ZLocation_t *loc, *loc2; register int i = 0; exposure_type quiet; +#ifdef POSIX + sigset_t mask, omask; +#else int omask; +#endif *err_return = 0; if (!(loc2 = ulogin_find(notice, 1))) { @@ -952,7 +1014,13 @@ ulogin_remove_user(notice, auth, who, err_return) quiet = loc2->zlt_exposure; - omask = sigblock(sigmask(SIGFPE)); /* don't let disk db dumps start */ +#ifdef POSIX + sigemptyset(&mask); + sigaddset(&mask, SIGFPE); + sigprocmask(SIG_BLOCK, &mask, &omask); +#else + omask = sigblock(sigmask(SIGFPE)); /* don't let db dumps start */ +#endif if (--num_locs == 0) { /* last one */ #if 0 zdbug((LOG_DEBUG,"last loc")); @@ -960,7 +1028,11 @@ ulogin_remove_user(notice, auth, who, err_return) free_loc(locations); xfree(locations); locations = NULLZLT; +#ifdef POSIX + (void) sigprocmask(SIG_SETMASK, &omask, (sigset_t *)0); +#else (void) sigsetmask(omask); +#endif return(quiet); } @@ -991,7 +1063,11 @@ ulogin_remove_user(notice, auth, who, err_return) locations = loc; +#ifdef POSIX + (void) sigprocmask(SIG_SETMASK, &omask, (sigset_t *)0); +#else (void) sigsetmask(omask); +#endif #if defined(DEBUG) && 0 if (zdebug) { register int i; @@ -1016,7 +1092,11 @@ ulogin_flush_user(notice) { register ZLocation_t *loc, *loc2; register int i, j, num_match, num_left; +#ifdef POSIX + sigset_t mask, omask; +#else int omask; +#endif i = num_match = num_left = 0; @@ -1030,7 +1110,13 @@ ulogin_flush_user(notice) /* compute # locations left in the list, after loc2 (inclusive) */ num_left = num_locs - (loc2 - locations); - omask = sigblock(sigmask(SIGFPE)); /* don't let disk db dumps start */ +#ifdef POSIX + sigemptyset(&mask); + sigaddset(&mask, SIGFPE); + sigprocmask(SIG_BLOCK, &mask, &omask); +#else + omask = sigblock(sigmask(SIGFPE)); /* don't let db dumps start */ +#endif while (num_left && !strcasecmp(loc2[num_match].zlt_user->string, notice->z_class_inst)) { @@ -1047,7 +1133,11 @@ ulogin_flush_user(notice) xfree (locations); locations = NULLZLT; num_locs = 0; +#ifdef POSIX + (void) sigprocmask(SIG_SETMASK, &omask, (sigset_t *)0); +#else (void) sigsetmask(omask); +#endif return; } @@ -1061,7 +1151,7 @@ ulogin_flush_user(notice) /* copy old entries */ while (i < num_locs && &locations[i] < loc2) { - /* XXX should bcopy */ + /* XXX should _BCOPY */ loc[i] = locations[i]; i++; } @@ -1073,7 +1163,7 @@ ulogin_flush_user(notice) /* copy the rest */ while (i < num_locs) { - /* XXX should bcopy */ + /* XXX should _BCOPY */ loc[i - num_match] = locations[i]; i++; } @@ -1083,7 +1173,11 @@ ulogin_flush_user(notice) locations = loc; num_locs -= num_match; +#ifdef POSIX + (void) sigprocmask(SIG_SETMASK, &omask, (sigset_t *)0); +#else (void) sigsetmask(omask); +#endif #ifdef DEBUG if (zdebug) { register int i; |