.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
-.TH MQ_OPEN 3 2015-07-23 "Linux" "Linux Programmer's Manual"
+.TH MQ_OPEN 3 2017-09-15 "Linux" "Linux Programmer's Manual"
.SH NAME
mq_open \- open a message queue
.SH SYNOPSIS
.BR "#include <fcntl.h>" " /* For O_* constants */"
.BR "#include <sys/stat.h>" " /* For mode constants */"
.B #include <mqueue.h>
-.sp
+.PP
.BI "mqd_t mq_open(const char *" name ", int " oflag );
.BI "mqd_t mq_open(const char *" name ", int " oflag ", mode_t " mode ,
.BI " struct mq_attr *" attr );
.fi
-.sp
+.PP
Link with \fI\-lrt\fP.
.SH DESCRIPTION
.BR mq_open ()
.IR name ,
see
.BR mq_overview (7).
-
+.PP
The
.I oflag
argument specifies flags that control the operation of the call.
(Symbolic definitions for the permissions bits can be obtained by including
.IR <sys/stat.h> .)
The permissions settings are masked against the process umask.
-
-The
+.PP
+The fields of the
+.IR "struct mq_attr"
+pointed to
.I attr
-argument specifies attributes for the queue.
-See
-.BR mq_getattr (3)
-for details.
+specify the maximum number of messages and
+the maximum size of messages that the queue will allow.
+This structure is defined as follows:
+.PP
+.PP
+.in +4n
+.EX
+struct mq_attr {
+ long mq_flags; /* Flags (ignored for mq_open()) */
+ long mq_maxmsg; /* Max. # of messages on queue */
+ long mq_msgsize; /* Max. message size (bytes) */
+ long mq_curmsgs; /* # of messages currently in queue
+ (ignored for mq_open()) */
+};
+.EE
+.in
+.PP
+Only the
+.I mq_maxmsg
+and
+.I mq_msgsize
+fields are employed when calling
+.BR mq_open ();
+the values in the remaining fields are ignored.
+.PP
If
.I attr
is NULL, then the queue is created with implementation-defined
for details of these limits.)
.TP
.B EMFILE
-The process already has the maximum number of files and
-message queues open.
+The per-process limit on the number of open file
+and message queue descriptors has been reached
+(see the description of
+.BR RLIMIT_NOFILE
+in
+.BR getrlimit (2)).
.TP
.B ENAMETOOLONG
.I name
was too long.
.TP
.B ENFILE
-The system limit on the total number of open files and message queues
-has been reached.
+The system-wide limit on the total number of open files
+and message queues has been reached.
.TP
.B ENOENT
The