|
|
1.1 root 1: .TH MSGGET 2
2: .SH NAME
3: msgget \- get message queue
4: .SH SYNOPSIS
5: .B #include <sys/types.h>
6: .br
7: .B #include <sys/ipc.h>
8: .br
9: .B #include <sys/msg.h>
10: .PP
11: .nf
12: .B "int msgget (key, msgflg)"
13: .B key_t key;
14: .B int msgflg;
15: .fi
16: .SH DESCRIPTION
17: .I Msgget
18: returns the message queue identifier associated with
19: .IR key .
20: .PP
21: A message queue identifier and associated message queue and data structure
22: (see
23: .IR intro (2))
24: are created for
25: .I key
26: if one of the following are true:
27: .IP 10
28: .I Key
29: is equal to
30: .SM
31: .BR IPC_PRIVATE .
32: .IP
33: .I Key
34: does not already have a message queue identifier associated with it, and
35: .RI ( msgflg " & "
36: .SM
37: .BR IPC_CREAT\*S )
38: is ``true''.
39: .PP
40: Upon creation, the data structure associated with the new message queue
41: identifier is initialized as follows:
42: .IP
43: .BR Msg_perm.cuid ", " msg_perm.uid ,
44: .BR msg_perm.cgid ", and " msg_perm.gid
45: are set equal to the effective user
46: .SM ID
47: and effective group
48: .SM ID\*S,
49: respectively, of the calling process.
50: .IP
51: The low-order 9 bits of
52: .B msg_perm.mode
53: are set equal to the low-order 9 bits of
54: .IR msgflg .
55: .IP
56: .BR Msg_qnum ", " msg_lspid ", " msg_lrpid ,
57: .BR msg_stime ", and " msg_rtime "
58: are set equal to 0.
59: .IP
60: .B Msg_ctime
61: is set equal to the current time.
62: .IP
63: .B Msg_qbytes
64: is set equal to the system limit.
65: .PP
66: .I Msgget
67: will fail if one or more of the following are true:
68: .TP 15
69: \s-1\%[EACCES]\s+1
70: A message queue identifier exists for
71: .IR key ,
72: but operation permission (see
73: .IR intro (2))
74: as specified by the low-order 9 bits of
75: .I msgflg
76: would not be granted.
77: .TP
78: \s-1\%[ENOENT]\s+1
79: A message queue identifier does not exist for
80: .I key
81: and
82: .RI ( msgflg " &"
83: .SM
84: .BR IPC_CREAT\*S )
85: is ``false''.
86: .TP
87: \s-1\%[ENOSPC]\s+1
88: A message queue identifier is to be created but
89: the system-imposed limit on the maximum number of
90: allowed message queue identifiers system wide
91: would be exceeded.
92: .TP
93: \s-1\%[EEXIST]\s+1
94: A message queue identifier exists for
95: .I key
96: but
97: .RI "((" msgflg " & "
98: .SM
99: .RB IPC_CREAT\*S ") & ("
100: .IR msgflg " & "
101: .SM
102: .BR IPC_EXCL\*S "))"
103: is ``true''.
104: .SH "RETURN VALUE"
105: Upon successful completion,
106: a non-negative integer,
107: namely a message queue identifier, is returned.
108: Otherwise, a value of \-1 is returned and
109: .I errno\^
110: is set to indicate the error.
111: .SH SEE ALSO
112: intro(2), msgctl(2), msgop(2).
113: .\" @(#)msgget.2 6.2 of 9/6/83
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.