1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00
This commit is contained in:
Jakub Jelinek
2007-07-12 18:26:36 +00:00
parent 7d58530341
commit 0ecb606cb6
6215 changed files with 494638 additions and 305010 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
/* Copyright (C) 1998, 2000, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -20,6 +20,7 @@
#define __need_NULL
#include <stddef.h>
#include <signal.h>
#include <string.h> /* For the real memset prototype. */
/* Set the disposition for SIG. */
@ -28,8 +29,10 @@ sigset (sig, disp)
int sig;
__sighandler_t disp;
{
struct sigaction act, oact;
struct sigaction act;
struct sigaction oact;
sigset_t set;
sigset_t oset;
#ifdef SIG_HOLD
/* Handle SIG_HOLD first. */
@ -44,10 +47,18 @@ sigset (sig, disp)
return SIG_ERR;
/* Add the signal set to the current signal mask. */
if (__sigprocmask (SIG_BLOCK, &set, NULL) < 0)
if (__sigprocmask (SIG_BLOCK, &set, &oset) < 0)
return SIG_ERR;
return SIG_HOLD;
/* If the signal was already blocked signal this to the caller. */
if (__sigismember (&oset, sig))
return SIG_HOLD;
/* We need to determine whether a specific handler is installed. */
if (__sigaction (sig, NULL, &oact) < 0)
return SIG_ERR;
return oact.sa_handler;
}
#endif /* SIG_HOLD */
@ -74,8 +85,9 @@ sigset (sig, disp)
return SIG_ERR;
/* Remove the signal set from the current signal mask. */
if (__sigprocmask (SIG_UNBLOCK, &set, NULL) < 0)
if (__sigprocmask (SIG_UNBLOCK, &set, &oset) < 0)
return SIG_ERR;
return oact.sa_handler;
/* If the signal was already blocked return SIG_HOLD. */
return __sigismember (&oset, sig) ? SIG_HOLD : oact.sa_handler;
}