2 * mq_open.c - open a message queue.
8 #include <sys/syscall.h>
14 #define __NR___syscall_mq_open __NR_mq_open
15 static __inline__
_syscall4(int, __syscall_mq_open
, const char *, name
,
16 int, oflag
, __kernel_mode_t
, mode
, void *, attr
);
18 * Establish connection between a process and a message queue and
19 * return message queue descriptor or (mqd_t) -1 on error.
20 * oflag determines the type of access used. If O_CREAT is on oflag, the
21 * third argument is taken as a `mode_t', the mode of the created
22 * message queue, and the fourth argument is taken as `struct mq_attr *',
23 * pointer to message queue attributes.
24 * If the fourth argument is NULL, default attributes are used.
26 mqd_t
mq_open(const char *name
, int oflag
, ...)
39 if (oflag
& O_CREAT
) {
43 mode
= va_arg(ap
, mode_t
);
44 attr
= va_arg(ap
, struct mq_attr
*);
49 return __syscall_mq_open(name
+ 1, oflag
, mode
, attr
);