msgsnd.2 (55915) | msgsnd.2 (57686) |
---|---|
1.\" $NetBSD: msgsnd.2,v 1.1 1995/10/16 23:49:24 jtc Exp $ 2.\" 3.\" Copyright (c) 1995 Frank van der Linden 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: --- 15 unchanged lines hidden (view full) --- 24.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31.\" | 1.\" $NetBSD: msgsnd.2,v 1.1 1995/10/16 23:49:24 jtc Exp $ 2.\" 3.\" Copyright (c) 1995 Frank van der Linden 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: --- 15 unchanged lines hidden (view full) --- 24.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31.\" |
32.\" $FreeBSD: head/lib/libc/gen/msgsnd.3 55915 2000-01-13 14:27:44Z asmodai $ | 32.\" $FreeBSD: head/lib/libc/gen/msgsnd.3 57686 2000-03-02 09:14:21Z sheldonh $ |
33.\" 34.Dd November 24, 1997 35.Dt MSGSND 3 36.Os FreeBSD 37.Sh NAME 38.Nm msgsnd 39.Nd send a message to a message queue 40.Sh SYNOPSIS 41.Fd #include <sys/types.h> 42.Fd #include <sys/ipc.h> 43.Fd #include <sys/msg.h> 44.Ft int 45.Fn msgsnd "int msqid" "void *msgp" "size_t msgsz" "int msgflg" 46.Sh DESCRIPTION 47The 48.Fn msgsnd 49function sends a message to the message queue specified in 50.Fa msqid . 51.Fa msgp | 33.\" 34.Dd November 24, 1997 35.Dt MSGSND 3 36.Os FreeBSD 37.Sh NAME 38.Nm msgsnd 39.Nd send a message to a message queue 40.Sh SYNOPSIS 41.Fd #include <sys/types.h> 42.Fd #include <sys/ipc.h> 43.Fd #include <sys/msg.h> 44.Ft int 45.Fn msgsnd "int msqid" "void *msgp" "size_t msgsz" "int msgflg" 46.Sh DESCRIPTION 47The 48.Fn msgsnd 49function sends a message to the message queue specified in 50.Fa msqid . 51.Fa msgp |
52points to a structure containing the message. This structure should | 52points to a structure containing the message. 53This structure should |
53consist of the following members: 54.Bd -literal 55 long mtype; /* message type */ 56 char mtext[1]; /* body of message */ 57.Ed 58.Pp 59.Va mtype 60is an integer greater than 0 that can be used for selecting messages (see --- 12 unchanged lines hidden (view full) --- 73the system limit, 74.Fa msgflg 75determines the action of 76.Fn msgsnd . 77If 78.Fa msgflg 79has 80.Dv IPC_NOWAIT | 54consist of the following members: 55.Bd -literal 56 long mtype; /* message type */ 57 char mtext[1]; /* body of message */ 58.Ed 59.Pp 60.Va mtype 61is an integer greater than 0 that can be used for selecting messages (see --- 12 unchanged lines hidden (view full) --- 74the system limit, 75.Fa msgflg 76determines the action of 77.Fn msgsnd . 78If 79.Fa msgflg 80has 81.Dv IPC_NOWAIT |
81mask set in it, the call will return immediately. If | 82mask set in it, the call will return immediately. 83If |
82.Fa msgflg 83does not have 84.Dv IPC_NOWAIT 85set in it, the call will block until: 86.Bl -bullet 87.It 88The condition which caused the call to block does no longer exist. 89The message will be sent. 90.It 91The message queue is removed, in which case -1 will be returned, and 92.Va errno 93is set to 94.Er EINVAL . 95.It | 84.Fa msgflg 85does not have 86.Dv IPC_NOWAIT 87set in it, the call will block until: 88.Bl -bullet 89.It 90The condition which caused the call to block does no longer exist. 91The message will be sent. 92.It 93The message queue is removed, in which case -1 will be returned, and 94.Va errno 95is set to 96.Er EINVAL . 97.It |
96The caller catches a signal. The call returns with | 98The caller catches a signal. 99The call returns with |
97.Va errno 98set to 99.Er EINTR . 100.El 101.Pp 102After a successful call, the data structure associated with the message 103queue is updated in the following way: 104.Bl -bullet --- 6 unchanged lines hidden (view full) --- 111.It 112.Va msg_lspid 113is set to the pid of the calling process. 114.It 115.Va msg_stime 116is set to the current time. 117.El 118.Sh RETURN VALUES | 100.Va errno 101set to 102.Er EINTR . 103.El 104.Pp 105After a successful call, the data structure associated with the message 106queue is updated in the following way: 107.Bl -bullet --- 6 unchanged lines hidden (view full) --- 114.It 115.Va msg_lspid 116is set to the pid of the calling process. 117.It 118.Va msg_stime 119is set to the current time. 120.El 121.Sh RETURN VALUES |
119Upon successful completion, 0 is returned. Otherwise, -1 is returned and | 122Upon successful completion, 0 is returned. 123Otherwise, -1 is returned and |
120.Va errno 121is set to indicate the error. 122.Sh ERRORS 123.Fn msgsnd 124will fail if: 125.Bl -tag -width Er 126.It Bq Er EINVAL 127.Fa msqid --- 37 unchanged lines hidden --- | 124.Va errno 125is set to indicate the error. 126.Sh ERRORS 127.Fn msgsnd 128will fail if: 129.Bl -tag -width Er 130.It Bq Er EINVAL 131.Fa msqid --- 37 unchanged lines hidden --- |