mq_notify.3: Factor out generic material that was moved to new sigevent(7) page

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2010-09-21 06:59:51 +02:00
parent 0e39ed973e
commit 168e3472bc
1 changed files with 24 additions and 55 deletions

View File

@ -23,7 +23,7 @@
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
.TH MQ_NOTIFY 3 2010-08-29 "Linux" "Linux Programmer's Manual" .TH MQ_NOTIFY 3 2010-09-19 "Linux" "Linux Programmer's Manual"
.SH NAME .SH NAME
mq_notify \- register for notification when a message is available mq_notify \- register for notification when a message is available
.SH SYNOPSIS .SH SYNOPSIS
@ -45,28 +45,9 @@ The
.I notification .I notification
argument is a pointer to a argument is a pointer to a
.I sigevent .I sigevent
structure that is defined something like the following: structure.
.in +4n For the definition and general details of this structure, see
.nf .BR sigevent (7).
union sigval { /* Data passed with notification */
int sival_int; /* Integer value */
void *sival_ptr; /* Pointer value */
};
struct sigevent {
int sigev_notify; /* Notification method */
int sigev_signo; /* Notification signal */
union sigval sigev_value; /* Data passed with
notification */
void (*sigev_notify_function) (union sigval);
/* Function for thread
notification */
void *sigev_notify_attributes;
/* Thread function attributes */
};
.fi
.in
.PP .PP
If If
.I notification .I notification
@ -77,7 +58,7 @@ The
.I sigev_notify .I sigev_notify
field of the field of the
.I sigevent .I sigevent
to which structure to which
.I notification .I notification
points specifies how notification is to be performed. points specifies how notification is to be performed.
This field has one of the following values: This field has one of the following values:
@ -90,43 +71,30 @@ for notification, but when a message arrives, no notification is sent.
.B SIGEV_SIGNAL .B SIGEV_SIGNAL
Notify the process by sending the signal specified in Notify the process by sending the signal specified in
.IR sigev_signo . .IR sigev_signo .
If the signal is caught with a signal handler that See
was registered using the .BR sigevent (7)
.BR sigaction (2) for general details.
.B SA_SIGINFO The
flag, then the following fields are set in the
.I siginfo_t
structure that is passed as the second argument of the handler:
.I si_code .I si_code
is set to field of the
.BR SI_MESGQ ; .I siginfo_t
.I si_signo structure will be set to
is set to the signal number; .BR SI_MESGQ .
.I si_value In addition,
is set to the value specified in
.IR notification\->sigev_value ;
.\" I don't know of other implementations that set .\" I don't know of other implementations that set
.\" si_pid and si_uid -- MTK .\" si_pid and si_uid -- MTK
.I si_pid .I si_pid
is set to the PID of the process that sent the message; and will be set to the PID of the process that sent the message, and
.I si_uid .I si_uid
is set to the real user ID of the sending process. will be set to the real user ID of the sending process.
The same information is available if the signal is accepted using
.BR sigwaitinfo (2).
.TP .TP
.B SIGEV_THREAD .B SIGEV_THREAD
Deliver notification by invoking Upon message delivery, invoke
.I notification\->sigev_notify_function .I sigev_notify_function
as the start function of a new thread. as if it were the start function of a new thread.
The function is invoked with See
.I notification\->sigev_value .BR sigevent (7)
as its sole argument. for details.
If
.I notification\->sigev_notify_attributes
is not NULL, then it should point to a
.I pthread_attr_t
structure that defines attributes for the thread (see
.BR pthread_attr_init (3)).
.PP .PP
Only one process can be registered to receive notification Only one process can be registered to receive notification
from a message queue. from a message queue.
@ -279,4 +247,5 @@ main(int argc, char *argv[])
.BR mq_receive (3), .BR mq_receive (3),
.BR mq_send (3), .BR mq_send (3),
.BR mq_unlink (3), .BR mq_unlink (3),
.BR mq_overview (7) .BR mq_overview (7),
.BR sigevent (7)