Fix {INLINE,INTERNAL}_SYSCALL macros for x32
[glibc.git] / rt / mqueue.h
blobc79aa53b94c043ab6935033acbc3ea066bbe7624
1 /* Copyright (C) 2004-2017 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
18 #ifndef _MQUEUE_H
19 #define _MQUEUE_H 1
21 #include <features.h>
22 #include <sys/types.h>
23 #include <fcntl.h>
24 #include <bits/types/sigevent_t.h>
25 #include <bits/types/struct_timespec.h>
26 /* Get the definition of mqd_t and struct mq_attr. */
27 #include <bits/mqueue.h>
29 __BEGIN_DECLS
31 /* Establish connection between a process and a message queue NAME and
32 return message queue descriptor or (mqd_t) -1 on error. OFLAG determines
33 the type of access used. If O_CREAT is on OFLAG, the third argument is
34 taken as a `mode_t', the mode of the created message queue, and the fourth
35 argument is taken as `struct mq_attr *', pointer to message queue
36 attributes. If the fourth argument is NULL, default attributes are
37 used. */
38 extern mqd_t mq_open (const char *__name, int __oflag, ...)
39 __THROW __nonnull ((1));
41 /* Removes the association between message queue descriptor MQDES and its
42 message queue. */
43 extern int mq_close (mqd_t __mqdes) __THROW;
45 /* Query status and attributes of message queue MQDES. */
46 extern int mq_getattr (mqd_t __mqdes, struct mq_attr *__mqstat)
47 __THROW __nonnull ((2));
49 /* Set attributes associated with message queue MQDES and if OMQSTAT is
50 not NULL also query its old attributes. */
51 extern int mq_setattr (mqd_t __mqdes,
52 const struct mq_attr *__restrict __mqstat,
53 struct mq_attr *__restrict __omqstat)
54 __THROW __nonnull ((2));
56 /* Remove message queue named NAME. */
57 extern int mq_unlink (const char *__name) __THROW __nonnull ((1));
59 /* Register notification issued upon message arrival to an empty
60 message queue MQDES. */
61 extern int mq_notify (mqd_t __mqdes, const struct sigevent *__notification)
62 __THROW;
64 /* Receive the oldest from highest priority messages in message queue
65 MQDES. */
66 extern ssize_t mq_receive (mqd_t __mqdes, char *__msg_ptr, size_t __msg_len,
67 unsigned int *__msg_prio) __nonnull ((2));
69 /* Add message pointed by MSG_PTR to message queue MQDES. */
70 extern int mq_send (mqd_t __mqdes, const char *__msg_ptr, size_t __msg_len,
71 unsigned int __msg_prio) __nonnull ((2));
73 #ifdef __USE_XOPEN2K
74 /* Receive the oldest from highest priority messages in message queue
75 MQDES, stop waiting if ABS_TIMEOUT expires. */
76 extern ssize_t mq_timedreceive (mqd_t __mqdes, char *__restrict __msg_ptr,
77 size_t __msg_len,
78 unsigned int *__restrict __msg_prio,
79 const struct timespec *__restrict __abs_timeout)
80 __nonnull ((2, 5));
82 /* Add message pointed by MSG_PTR to message queue MQDES, stop blocking
83 on full message queue if ABS_TIMEOUT expires. */
84 extern int mq_timedsend (mqd_t __mqdes, const char *__msg_ptr,
85 size_t __msg_len, unsigned int __msg_prio,
86 const struct timespec *__abs_timeout)
87 __nonnull ((2, 5));
88 #endif
90 /* Define some inlines helping to catch common problems. */
91 #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \
92 && defined __va_arg_pack_len
93 # include <bits/mqueue2.h>
94 #endif
96 __END_DECLS
98 #endif /* mqueue.h */