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