File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / usr / src / man / man2 / msgget.2i
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:24:19 2019 UTC (7 years ago) by root
Branches: bsd, MAIN
CVS tags: v12b, v121, HEAD
Power 6/32 Unix version 1.2b

.TH MSGGET 2
.SH NAME
msgget \- get message queue
.SH SYNOPSIS
.B #include <sys/types.h>
.br
.B #include <sys/ipc.h>
.br
.B #include <sys/msg.h>
.PP
.nf
.B "int msgget (key, msgflg)"
.B key_t key;
.B int msgflg;
.fi
.SH DESCRIPTION
.I Msgget
returns the message queue identifier associated with
.IR key .
.PP
A message queue identifier and associated message queue and data structure
(see
.IR intro (2))
are created for
.I key
if one of the following are true:
.IP 10
.I Key
is equal to
.SM
.BR IPC_PRIVATE .
.IP
.I Key
does not already have a message queue identifier associated with it, and
.RI ( msgflg " & "
.SM
.BR IPC_CREAT\*S )
is ``true''.
.PP
Upon creation, the data structure associated with the new message queue
identifier is initialized as follows:
.IP
.BR Msg_perm.cuid ", " msg_perm.uid ,
.BR msg_perm.cgid ", and " msg_perm.gid
are set equal to the effective user
.SM ID
and effective group
.SM ID\*S,
respectively, of the calling process.
.IP
The low-order 9 bits of
.B msg_perm.mode
are set equal to the low-order 9 bits of
.IR msgflg .
.IP
.BR Msg_qnum ", " msg_lspid ", " msg_lrpid ,
.BR msg_stime ", and " msg_rtime "
are set equal to 0.
.IP
.B Msg_ctime
is set equal to the current time.
.IP
.B Msg_qbytes
is set equal to the system limit.
.PP
.I Msgget
will fail if one or more of the following are true:
.TP 15
\s-1\%[EACCES]\s+1
A message queue identifier exists for
.IR key ,
but operation permission (see
.IR intro (2))
as specified by the low-order 9 bits of
.I msgflg
would not be granted. 
.TP
\s-1\%[ENOENT]\s+1
A message queue identifier does not exist for
.I key
and
.RI ( msgflg " &"
.SM
.BR IPC_CREAT\*S )
is ``false''.
.TP
\s-1\%[ENOSPC]\s+1
A message queue identifier is to be created but
the system-imposed limit on the maximum number of
allowed message queue identifiers system wide
would be exceeded.
.TP
\s-1\%[EEXIST]\s+1
A message queue identifier exists for
.I key
but
.RI "((" msgflg " & "
.SM
.RB IPC_CREAT\*S ") & ("
.IR msgflg " & "
.SM
.BR IPC_EXCL\*S "))"
is ``true''.
.SH "RETURN VALUE"
Upon successful completion,
a non-negative integer,
namely a message queue identifier, is returned.
Otherwise, a value of \-1 is returned and
.I errno\^
is set to indicate the error.
.SH SEE ALSO
intro(2), msgctl(2), msgop(2).
.\"	@(#)msgget.2	6.2 of 9/6/83

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.