|
|
1.1 root 1: .ds ZZ DEVELOPMENT PACKAGE
2: .TH MSGGET 3L "630 MTG"
3: .XE "msgget()"
4: .SH NAME
5: msgget \- get message queue
6: .SH SYNOPSIS
7: .B #include <message.h>
8: .sp
9: .B long msgget (key, msgflg)
10: .br
11: .B long key;
12: .br
13: .B int msgflg;
14: .SH DESCRIPTION
15: .I Msgget
16: returns the message queue identifier associated with
17: .IR key .
18: .PP
19: A message queue identifier and associated message queue and
20: data structure are created for
21: .I key
22: if one of the following is true:
23: .PP
24: .RS 6
25: .I Key
26: is equal to \fBIPC_PRIVATE\fR.
27: .PP
28: .I Key
29: does not already have a message queue identifier
30: associated with it, and
31: .RI ( msgflg
32: &
33: .BR IPC_CREAT )
34: is ``true''.
35: .PP
36: .RE
37: Upon creation, the data structure associated with the new
38: message queue identifier is initialized as follows:
39: .PP
40: .RS 6
41: .BR Msg_qnum ,
42: .BR msg_curbytes ,
43: .BR msg_list ,
44: .BR msg_lspid ,
45: .BR msg_lrpid ,
46: .BR msg_stime ,
47: and
48: .B msg_rtime
49: are set equal to 0.
50: .sp
51: .B Msg_ctime
52: is set equal to the current time
53: .RI ( realtime ).
54: .sp
55: .B Msg_qbytes
56: is set equal to
57: .BR MAX_QBYTES .
58: .sp
59: .B State
60: is set to
61: .RB ( msgflg
62: &
63: .BR NO_SAVE ).
64: .sp
65: .B Cid
66: is set to the calling process's id
67: .RI ( P ).
68: .sp
69: .B Name
70: is set to
71: .IR key .
72: .RE
73: .PP
74: If
75: .I state
76: is ``true'', the message queue will be deleted when the process
77: .I cid
78: is deleted.
79: .PP
80: .I Msgget
81: will fail if one or more of the following are true:
82: .sp
83: .RS 6
84: A message queue identifier does not exist for
85: .I key
86: and
87: .RI ( msgflg
88: &
89: .BR IPC_CREAT )
90: is ``false''.
91: .sp
92: A message queue identifier is to be created
93: but there isn't enough memory.
94: .sp
95: A message queue identifier exists for
96: .I key
97: but (
98: .RI [ msgflg
99: &
100: .BR IPC_CREAT ]
101: &&
102: .RI [ msgflg
103: &
104: .BR IPC_EXCL ]
105: ) is ``true''.
106: .PP
107: .RE
108: .PP
109: Each message queue identifier that \fImsgget\fR returns is added to
110: a list maintained for the application.
111: This list defines which message queues constitute the MSG resource when
112: using the \fIwait\fR(MSG) and \fIown\fR(MSG) functions.
113: .PP
114: .SS Return Value
115: Upon successful completion, a non-negative long, namely a
116: message queue identifier (pointer to msqid_ds structure), is returned.
117: Otherwise, a value of -1 is returned.
118: .PP
119: .SH SEE ALSO
120: msgctl(3L), msgop(3L), realtime(3R), resources(3R), structures(3R).
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.