23
23
.\" Formatted or processed versions of this manual, if unaccompanied by
24
24
.\" the source, must acknowledge the copyright and authors of this work.
26
.TH MQ_NOTIFY 3 2010-08-29 "Linux" "Linux Programmer's Manual"
26
.TH MQ_NOTIFY 3 2010-09-19 "Linux" "Linux Programmer's Manual"
28
28
mq_notify \- register for notification when a message is available
46
46
argument is a pointer to a
48
structure that is defined something like the following:
52
union sigval { /* Data passed with notification */
53
int sival_int; /* Integer value */
54
void *sival_ptr; /* Pointer value */
58
int sigev_notify; /* Notification method */
59
int sigev_signo; /* Notification signal */
60
union sigval sigev_value; /* Data passed with
62
void (*sigev_notify_function) (union sigval);
63
/* Function for thread
65
void *sigev_notify_attributes;
66
/* Thread function attributes */
49
For the definition and general details of this structure, see
91
72
Notify the process by sending the signal specified in
93
If the signal is caught with a signal handler that
94
was registered using the
97
flag, then the following fields are set in the
99
structure that is passed as the second argument of the handler:
104
is set to the signal number;
106
is set to the value specified in
107
.IR notification\->sigev_value ;
81
structure will be set to
108
84
.\" I don't know of other implementations that set
109
85
.\" si_pid and si_uid -- MTK
111
is set to the PID of the process that sent the message; and
87
will be set to the PID of the process that sent the message, and
113
is set to the real user ID of the sending process.
114
The same information is available if the signal is accepted using
89
will be set to the real user ID of the sending process.
118
Deliver notification by invoking
119
.I notification\->sigev_notify_function
120
as the start function of a new thread.
121
The function is invoked with
122
.I notification\->sigev_value
123
as its sole argument.
125
.I notification\->sigev_notify_attributes
126
is not NULL, then it should point to a
128
structure that defines attributes for the thread (see
129
.BR pthread_attr_init (3)).
92
Upon message delivery, invoke
93
.I sigev_notify_function
94
as if it were the start function of a new thread.
131
99
Only one process can be registered to receive notification
132
100
from a message queue.