SIGBLOCK(3) BSD Library Functions Manual SIGBLOCK(3)NAME
sigblock -- block signals
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <signal.h>
int
sigblock(int mask);
int
sigmask(signum);
DESCRIPTION
This interface is made obsolete by: sigprocmask(2).
sigblock() adds the signals specified in mask to the set of signals currently being blocked from delivery. Signals are blocked if the corre-
sponding bit in mask is a 1; the macro sigmask() is provided to construct the mask for a given signum.
It is not possible to block SIGKILL or SIGSTOP; this restriction is silently imposed by the system.
RETURN VALUES
The previous set of masked signals is returned.
EXAMPLES
The following example using sigblock():
int omask;
omask = sigblock(sigmask(SIGINT) | sigmask(SIGHUP));
Becomes:
sigset_t set, oset;
sigemptyset(&set);
sigaddset(&set, SIGINT);
sigaddset(&set, SIGHUP);
sigprocmask(SIG_BLOCK, &set, &oset);
Another use of sigblock() is to get the current set of masked signals without changing what is actually blocked. Instead of:
int set;
set = sigblock(0);
Use the following:
sigset_t set;
sigprocmask(SIG_BLOCK, NULL, &set);
SEE ALSO kill(2), sigaction(2), sigprocmask(2), sigsetmask(3), sigsetops(3)HISTORY
The sigblock() function call appeared in 4.2BSD and has been deprecated.
BSD August 10, 2002 BSD
Check Out this Related Man Page
SIGBLOCK(2) Linux Programmer's Manual SIGBLOCK(2)NAME
sigblock, siggetmask, sigsetmask, sigmask - manipulate the signal mask
SYNOPSIS
#include <signal.h>
int sigblock(int mask);
int siggetmask(void);
int sigsetmask(int mask);
int sigmask(int signum);
DESCRIPTION
This interface is made obsolete by sigprocmask(2).
The sigblock system call adds the signals specified in mask to the set of signals currently being blocked from delivery.
The sigsetmask system call replaces the set of blocked signals totally with a new set specified in mask. Signals are blocked if the corre-
sponding bit in mask is a 1.
The current set of blocked signals can be obtained using siggetmask.
The sigmask macro is provided to construct the mask for a given signum.
RETURN VALUE
siggetmask returns the current set of masked signals.
sigsetmask and sigblock return the previous set of masked signals.
NOTES
Prototypes for these functions are only available if _BSD_SOURCE is defined before the inclusion of any system header file.
It is not possible to block SIGKILL or SIGSTOP - this restriction is silently imposed by the system.
CONFORMING TO
4.4BSD. These function calls appeared in BSD 4.3 and are deprecated. Use the POSIX signal facilities for new programs.
SEE ALSO kill(2), sigprocmask(2), signal(7)Linux 1.3 1995-08-31 SIGBLOCK(2)
We know that a process can block certain signals by call sigprocmask(), but sometimes we may want to block signals from certain processes for safety concerning.
For example, a system may have a process management daemon, and it will response to certain signals from certain processes managed by... (4 Replies)
hi,
in my application, i have set up to capture SIGINT and execute a handler.the problem is whenever i hit C-c, multiple SIGINT are sent to the application.I have blocked the SIGINT right after catching the first one but it is unsuccessful.Here is what i do :
jmp_buf main_loop;
int... (1 Reply)
Too generic to post elsewhere, too advanced for the newbie forums. There are some applications within the unix/linux milieu that understand signals such as SIGHUP, etc as instructions to perform administrative tasks (clearing information out of this, disconnect users, etc.) I was just wondering if... (2 Replies)
Hi:
I have some old code need to be compiled - which include a system call, the function name is: sigblock like:
.....
int holdnum = sigblock(sigmask(SIGCHLD));
....
but the compiler told me the sigblock cannot be found even I include signal.h. Looks like it is depricated - but I need to... (1 Reply)