]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libc/gen/msgget.3
This commit was generated by cvs2svn to compensate for changes in r43829,
[FreeBSD/FreeBSD.git] / lib / libc / gen / msgget.3
1 .\"     $NetBSD: msgget.2,v 1.1 1995/10/16 23:49:19 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:
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice, this list of conditions and the following disclaimer in the
13 .\"    documentation and/or other materials provided with the distribution.
14 .\" 3. All advertising materials mentioning features or use of this software
15 .\"    must display the following acknowledgement:
16 .\"      This product includes software developed for the NetBSD Project
17 .\"      by Frank van der Linden
18 .\" 4. The name of the author may not be used to endorse or promote products
19 .\"    derived from this software without specific prior written permission
20 .\"
21 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
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 .Dd August 17, 1995
33 .Dt MSGGET 3
34 .Os FreeBSD
35 .Sh NAME
36 .Nm msgget
37 .Nd get message queue
38 .Sh SYNOPSIS
39 .Fd #include <sys/types.h>
40 .Fd #include <sys/ipc.h>
41 .Fd #include <sys/msg.h>
42 .Ft int
43 .Fn msgget "key_t key" "int msgflg"
44 .Sh DESCRIPTION
45 .Fn msgget
46 returns the message queue identifier associated with
47 .Fa key .
48 A message queue identifier is a unique integer greater than zero.
49 .Pp
50 A message queue is created if either
51 .Fa key
52 is equal to
53 .Dv IPC_PRIVATE ,
54 or
55 .Fa key
56 does not have a message queue identifier associated with it, and the
57 .Dv IPC_CREAT
58 bit is set in
59 .Fa msgflg.
60 .Pp
61 If a new message queue is created, the data structure associated with it (the
62 .Va msqid_ds
63 structure, see
64 .Xr msgctl 3 )
65 is initialized as follows:
66 .Bl -bullet
67 .It 
68 .Va msg_perm.cuid
69 and
70 .Va msg_perm.uid
71 are set to the effective uid of the calling process.
72 .It
73 .Va msg_perm.gid
74 and
75 .Va msg_perm.cgid
76 are set to the effective gid of the calling process.
77 .It
78 .Va msg_perm.mode
79 is set to the lower 9 bits of
80 .Fa msgflg .
81 .It
82 .Va msg_cbytes ,
83 .Va msg_qnum ,
84 .Va msg_lspid ,
85 .Va msg_lrpid ,
86 .Va msg_rtime ,
87 and 
88 .Va msg_stime
89 are set to 0.
90 .It
91 .Va msg_qbytes
92 is set to the system wide maximum value for the number of bytes in a queue
93 .Pf ( Dv MSGMNB ) .
94 .It
95 .Va msg_ctime
96 is set to the current time.
97 .El
98 .Sh RETURN VALUES
99 Upon successful completion a positive message queue identifier is returned.
100 Otherwise, -1 is returned and the global variable
101 .Va errno
102 is set to indicate the error.
103 .Sh ERRORS
104 .Bl -tag -width Er
105 .It Bq Er EACESS
106 A message queue is already associated with
107 .Fa key
108 and the caller has no permission to access it.
109 .It Bq Er EEXIST
110 Both
111 .Dv IPC_CREAT
112 and
113 .Dv IPC_EXCL
114 are set in
115 .Fa msgflg ,
116 and a message queue is already associated with
117 .Fa key .
118 .It Bq Er ENOSPC
119 A new message queue could not be created because the system limit for
120 the number of message queues has been reached.
121 .It Bq Er ENOENT
122 .Dv IPC_CREAT
123 was not set in
124 .Fa msgflg
125 and no message queue associated with
126 .Fa key
127 was found.
128 .El
129 .Sh SEE ALSO
130 .Xr msgctl 3 ,
131 .Xr msgrcv 3 ,
132 .Xr msgsnd 3
133 .Sh HISTORY
134 Message queues appeared in the first release of AT&T Unix System V.