]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man7/sigevent.7
namespaces.7: ffix
[thirdparty/man-pages.git] / man7 / sigevent.7
CommitLineData
bcc5e407
PB
1.\" Copyright (C) 2006, 2010 Michael Kerrisk <mtk.manpages@gmail.com>
2.\" Copyright (C) 2009 Petr Baudis <pasky@suse.cz>
3.\"
93015253 4.\" %%%LICENSE_START(VERBATIM)
bcc5e407
PB
5.\" Permission is granted to make and distribute verbatim copies of this
6.\" manual provided the copyright notice and this permission notice are
7.\" preserved on all copies.
8.\"
9.\" Permission is granted to copy and distribute modified versions of this
10.\" manual under the conditions for verbatim copying, provided that the
11.\" entire resulting derived work is distributed under the terms of a
12.\" permission notice identical to this one.
13.\"
14.\" Since the Linux kernel and libraries are constantly changing, this
15.\" manual page may be incorrect or out-of-date. The author(s) assume no
16.\" responsibility for errors or omissions, or for damages resulting from
17.\" the use of the information contained herein. The author(s) may not
18.\" have taken the same level of care in the production of this manual,
19.\" which is licensed free of charge, as they might when working
20.\" professionally.
21.\"
22.\" Formatted or processed versions of this manual, if unaccompanied by
23.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 24.\" %%%LICENSE_END
bcc5e407 25.\"
460495ca 26.TH SIGEVENT 7 2015-08-08 "GNU" "Linux Programmer's Manual"
bcc5e407 27.SH NAME
5b64c2d1 28sigevent \- structure for notification from asynchronous routines
bcc5e407
PB
29.SH SYNOPSIS
30.nf
31
32union sigval { /* Data passed with notification */
33 int sival_int; /* Integer value */
34 void *sival_ptr; /* Pointer value */
35};
36
37struct sigevent {
38 int sigev_notify; /* Notification method */
39 int sigev_signo; /* Notification signal */
40 union sigval sigev_value; /* Data passed with
41 notification */
42 void (*sigev_notify_function) (union sigval);
43 /* Function used for thread
44 notification (SIGEV_THREAD) */
45 void *sigev_notify_attributes;
46 /* Attributes for notification thread
47 (SIGEV_THREAD) */
48 pid_t sigev_notify_thread_id;
49 /* ID of thread to signal (SIGEV_THREAD_ID) */
50};
51.fi
52.SH DESCRIPTION
53.PP
54The
55.I sigevent
56structure is used by various APIs
57to describe the way a process is to be notified about an event
58(e.g., completion of an asynchronous request, expiration of a timer,
59or the arrival of a message).
60.PP
61The definition shown in the SYNOPSIS is approximate:
62some of the fields in the
63.I sigevent
64structure may be defined as part of a union.
33a0ccb2 65Programs should employ only those fields relevant
bcc5e407
PB
66to the value specified in
67.IR sigev_notify .
68.PP
69The
70.I sigev_notify
71field specifies how notification is to be performed.
72This field can have one of the following values:
73.TP 8
74.BR SIGEV_NONE
75A "null" notification: don't do anything when the event occurs.
76.TP
77.BR SIGEV_SIGNAL
78Notify the process by sending the signal specified in
79.IR sigev_signo .
80.IP
81If the signal is caught with a signal handler that was registered using the
82.BR sigaction (2)
83.B SA_SIGINFO
84flag, then the following fields are set in the
85.I siginfo_t
86structure that is passed as the second argument of the handler:
87.RS 8
88.TP 10
89.I si_code
90This field is set to a value that depends on the API
91delivering the notification.
92.TP
93.I si_signo
f6b326eb 94This field is set to the signal number (i.e., the same value as in
bcc5e407
PB
95.IR sigev_signo ).
96.TP
97.I si_value
98This field is set to the value specified in
99.IR sigev_value .
100.RE
101.IP
102Depending on the API, other fields may also be set in the
103.I siginfo_t
104structure.
105.IP
106The same information is also available if the signal is accepted using
107.BR sigwaitinfo (2).
108.TP
109.BR SIGEV_THREAD
110Notify the process by invoking
111.I sigev_notify_function
112"as if" it were the start function of a new thread.
113(Among the implementation possibilities here are that
114each timer notification could result in the creation of a new thread,
115or that a single thread is created to receive all notifications.)
116The function is invoked with
117.I sigev_value
118as its sole argument.
119If
120.I sigev_notify_attributes
121is not NULL, it should point to a
122.I pthread_attr_t
123structure that defines attributes for the new thread (see
124.BR pthread_attr_init (3)).
125.TP
126.BR SIGEV_THREAD_ID " (Linux-specific)"
127.\" | SIGEV_SIGNAL vs not?
128Currently used only by POSIX timers; see
129.BR timer_create (2).
47297adb 130.SH SEE ALSO
bcc5e407
PB
131.BR timer_create (2),
132.BR aio_fsync (3),
a9ba82d5
MK
133.BR aio_read (3),
134.BR aio_write (3),
0f848cbc 135.BR getaddrinfo_a (3),
3e5c319e 136.BR lio_listio (3),
bcc5e407 137.BR mq_notify (3),
9889b88b 138.BR aio (7),
bcc5e407 139.BR pthreads (7)