mirror of https://github.com/mkerrisk/man-pages
signalfd.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
6db9f2db52
commit
cc560d7743
|
@ -22,7 +22,7 @@
|
|||
signalfd \- create a file descriptor for accepting signals
|
||||
.SH SYNOPSIS
|
||||
.B #include <sys/signalfd.h>
|
||||
.sp
|
||||
.PP
|
||||
.BI "int signalfd(int " fd ", const sigset_t *" mask ", int " flags );
|
||||
.SH DESCRIPTION
|
||||
.BR signalfd ()
|
||||
|
@ -35,7 +35,7 @@ and has the advantage that the file descriptor may be monitored by
|
|||
.BR poll (2),
|
||||
and
|
||||
.BR epoll (7).
|
||||
|
||||
.PP
|
||||
The
|
||||
.I mask
|
||||
argument specifies the set of signals that the caller
|
||||
|
@ -55,7 +55,7 @@ or
|
|||
signals via a signalfd file descriptor;
|
||||
these signals are silently ignored if specified in
|
||||
.IR mask .
|
||||
|
||||
.PP
|
||||
If the
|
||||
.I fd
|
||||
argument is \-1,
|
||||
|
@ -69,7 +69,7 @@ is not \-1,
|
|||
then it must specify a valid existing signalfd file descriptor, and
|
||||
.I mask
|
||||
is used to replace the signal set associated with that file descriptor.
|
||||
|
||||
.PP
|
||||
Starting with Linux 2.6.27, the following values may be bitwise ORed in
|
||||
.IR flags
|
||||
to change the behavior of
|
||||
|
@ -96,7 +96,7 @@ for reasons why this may be useful.
|
|||
In Linux up to version 2.6.26, the
|
||||
.I flags
|
||||
argument is unused, and must be specified as zero.
|
||||
|
||||
.PP
|
||||
.BR signalfd ()
|
||||
returns a file descriptor that supports the following operations:
|
||||
.TP
|
||||
|
@ -168,9 +168,9 @@ The format of the
|
|||
structure(s) returned by
|
||||
.BR read (2)s
|
||||
from a signalfd file descriptor is as follows:
|
||||
.PP
|
||||
.in +4n
|
||||
.nf
|
||||
|
||||
.EX
|
||||
struct signalfd_siginfo {
|
||||
uint32_t ssi_signo; /* Signal number */
|
||||
int32_t ssi_errno; /* Error number (unused) */
|
||||
|
@ -198,7 +198,7 @@ struct signalfd_siginfo {
|
|||
additional fields in the future) */
|
||||
};
|
||||
|
||||
.fi
|
||||
.EE
|
||||
.in
|
||||
Each of the fields in this structure
|
||||
is analogous to the similarly named field in the
|
||||
|
@ -334,7 +334,7 @@ If a signal appears in the
|
|||
.I mask
|
||||
of more than one of the file descriptors, then occurrences
|
||||
of that signal can be read (once) from any one of the file descriptors.
|
||||
|
||||
.PP
|
||||
Attempts to include
|
||||
.B SIGKILL
|
||||
and
|
||||
|
@ -342,7 +342,7 @@ and
|
|||
in
|
||||
.I mask
|
||||
are silently ignored.
|
||||
|
||||
.PP
|
||||
The signal mask employed by a signalfd file descriptor can be viewed
|
||||
via the entry for the corresponding file descriptor in the process's
|
||||
.IR /proc/[pid]/fdinfo
|
||||
|
@ -360,7 +360,7 @@ or the
|
|||
.BR SIGFPE
|
||||
signal that results from an arithmetic error.
|
||||
Such signals can be caught only via signal handler.
|
||||
|
||||
.PP
|
||||
As described above,
|
||||
in normal usage one blocks the signals that will be accepted via
|
||||
.BR signalfd ().
|
||||
|
@ -391,7 +391,7 @@ The glibc
|
|||
.BR signalfd ()
|
||||
wrapper function does not include this argument,
|
||||
since it provides the required value for the underlying system call.
|
||||
|
||||
.PP
|
||||
There are two underlying Linux system calls:
|
||||
.BR signalfd ()
|
||||
and the more recent
|
||||
|
@ -425,9 +425,9 @@ The program terminates after accepting a
|
|||
.B SIGQUIT
|
||||
signal.
|
||||
The following shell session demonstrates the use of the program:
|
||||
.PP
|
||||
.in +4n
|
||||
.nf
|
||||
|
||||
.EX
|
||||
.RB "$" " ./signalfd_demo"
|
||||
.BR "^C" " # Control\-C generates SIGINT"
|
||||
Got SIGINT
|
||||
|
@ -436,11 +436,11 @@ Got SIGINT
|
|||
\fB^\\\fP # Control\-\\ generates SIGQUIT
|
||||
Got SIGQUIT
|
||||
$
|
||||
.fi
|
||||
.EE
|
||||
.in
|
||||
.SS Program source
|
||||
\&
|
||||
.nf
|
||||
.EX
|
||||
#include <sys/signalfd.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
@ -487,7 +487,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
}
|
||||
.fi
|
||||
.EE
|
||||
.SH SEE ALSO
|
||||
.BR eventfd (2),
|
||||
.BR poll (2),
|
||||
|
|
Loading…
Reference in New Issue