]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - lib/libc/sys/mq_notify.2
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / lib / libc / sys / mq_notify.2
1 .\" Copyright (c) 2005 David Xu <davidxu@FreeBSD.org>
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice(s), this list of conditions and the following disclaimer as
9 .\"    the first lines of this file unmodified other than the possible
10 .\"    addition of one or more copyright notices.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice(s), this list of conditions and the following disclaimer in
13 .\"    the documentation and/or other materials provided with the
14 .\"    distribution.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
17 .\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
20 .\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 .\"
28 .\" Portions of this text are reprinted and reproduced in electronic form
29 .\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
30 .\" Portable Operating System Interface (POSIX), The Open Group Base
31 .\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
32 .\" Electrical and Electronics Engineers, Inc and The Open Group.  In the
33 .\" event of any discrepancy between this version and the original IEEE and
34 .\" The Open Group Standard, the original IEEE and The Open Group Standard is
35 .\" the referee document.  The original Standard can be obtained online at
36 .\"     http://www.opengroup.org/unix/online.html.
37 .\"
38 .\" $FreeBSD$
39 .\"
40 .Dd November 29, 2005
41 .Dt MQ_NOTIFY 2
42 .Os
43 .Sh NAME
44 .Nm mq_notify
45 .Nd "notify process that a message is available (REALTIME)"
46 .Sh LIBRARY
47 .Lb librt
48 .Sh SYNOPSIS
49 .In mqueue.h
50 .Ft int
51 .Fn mq_notify "mqd_t mqdes" "const struct sigevent *notification"
52 .Sh DESCRIPTION
53 If the argument notification is not
54 .Dv NULL ,
55 this system call will register the calling process to be notified of message
56 arrival at an empty message queue associated with the specified message
57 queue descriptor,
58 .Fa mqdes .
59 The notification specified by the
60 .Fa notification
61 argument will be sent to
62 the process when the message queue transitions from empty to non-empty.
63 At any time, only one process may be registered for notification by a
64 message queue.
65 If the calling process or any other process has already
66 registered for notification of message arrival at the specified message
67 queue, subsequent attempts to register for that message queue will fail.
68 .Pp
69 The
70 .Fa notification
71 argument points to a
72 .Vt sigevent
73 structure that defines how the calling process will be notified.
74 If
75 .Fa notification->sigev_notify
76 is
77 .Dv SIGEV_NONE ,
78 then no signal will be posted, but the error status and the return status
79 for the operation will be set appropriately.
80 If
81 .Fa notification->sigev_notify
82 is
83 .Dv SIGEV_SIGNAL ,
84 then the signal specified in
85 .Fa notification->sigev_signo
86 will be sent to the process.
87 The signal will be queued to the process and the value specified in
88 .Fa notification->sigev_value
89 will be the
90 .Va si_value
91 component of the generated signal.
92 .Pp
93 If
94 .Fa notification
95 is
96 .Dv NULL
97 and the process is currently registered for notification by the specified
98 message queue, the existing registration will be removed.
99 .Pp
100 When the notification is sent to the registered process, its registration
101 is removed.
102 The message queue then is available for registration.
103 .Pp
104 If a process has registered for notification of message arrival at a
105 message queue and some thread is blocked in
106 .Fn mq_receive
107 waiting to receive a message when a message arrives at the queue, the
108 arriving message will satisfy the appropriate
109 .Fn mq_receive .
110 The resulting behavior is as if the message queue remains empty, and no
111 notification will be sent.
112 .Sh RETURN VALUES
113 .Rv -std
114 .Sh ERRORS
115 The
116 .Fn mq_notify
117 system call
118 will fail if:
119 .Bl -tag -width Er
120 .It Bq Er EBADF
121 The
122 .Fa mqdes
123 argument is not a valid message queue descriptor.
124 .It Bq Er EBUSY
125 Process is already registered for notification by the message queue.
126 .El
127 .Sh SEE ALSO
128 .Xr mq_open 2 ,
129 .Xr mq_send 2 ,
130 .Xr mq_timedsend 2 ,
131 .Xr siginfo 3
132 .Sh STANDARDS
133 The
134 .Fn mq_notify
135 system call conforms to
136 .St -p1003.1-2004 .
137 .Sh HISTORY
138 Support for
139 .Tn POSIX
140 message queues first appeared in
141 .Fx 7.0 .
142 .Sh COPYRIGHT
143 Portions of this text are reprinted and reproduced in electronic form
144 from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
145 Portable Operating System Interface (POSIX), The Open Group Base
146 Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
147 Electrical and Electronics Engineers, Inc and The Open Group.  In the
148 event of any discrepancy between this version and the original IEEE and
149 The Open Group Standard, the original IEEE and The Open Group Standard is
150 the referee document.  The original Standard can be obtained online at
151 http://www.opengroup.org/unix/online.html.