(VERSION): Bump for 2.10 release.
[glibc/history.git] / rt / mqueue.h
bloba4c3e1b2faaf281ac5c982ee8821761668e138bd
1 /* Copyright (C) 2004, 2005, 2007 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, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA. */
19 #ifndef _MQUEUE_H
20 #define _MQUEUE_H 1
22 #include <features.h>
23 #include <sys/types.h>
24 #include <fcntl.h>
25 #define __need_sigevent_t
26 #include <bits/siginfo.h>
27 #define __need_timespec
28 #include <time.h>
29 /* Get the definition of mqd_t and struct mq_attr. */
30 #include <bits/mqueue.h>
32 __BEGIN_DECLS
34 /* Establish connection between a process and a message queue NAME and
35 return message queue descriptor or (mqd_t) -1 on error. OFLAG determines
36 the type of access used. If O_CREAT is on OFLAG, the third argument is
37 taken as a `mode_t', the mode of the created message queue, and the fourth
38 argument is taken as `struct mq_attr *', pointer to message queue
39 attributes. If the fourth argument is NULL, default attributes are
40 used. */
41 extern mqd_t mq_open (__const char *__name, int __oflag, ...)
42 __THROW __nonnull ((1));
44 /* Removes the association between message queue descriptor MQDES and its
45 message queue. */
46 extern int mq_close (mqd_t __mqdes) __THROW;
48 /* Query status and attributes of message queue MQDES. */
49 extern int mq_getattr (mqd_t __mqdes, struct mq_attr *__mqstat)
50 __THROW __nonnull ((2));
52 /* Set attributes associated with message queue MQDES and if OMQSTAT is
53 not NULL also query its old attributes. */
54 extern int mq_setattr (mqd_t __mqdes,
55 __const struct mq_attr *__restrict __mqstat,
56 struct mq_attr *__restrict __omqstat)
57 __THROW __nonnull ((2));
59 /* Remove message queue named NAME. */
60 extern int mq_unlink (__const char *__name) __THROW __nonnull ((1));
62 /* Register notification issued upon message arrival to an empty
63 message queue MQDES. */
64 extern int mq_notify (mqd_t __mqdes, __const struct sigevent *__notification)
65 __THROW;
67 /* Receive the oldest from highest priority messages in message queue
68 MQDES. */
69 extern ssize_t mq_receive (mqd_t __mqdes, char *__msg_ptr, size_t __msg_len,
70 unsigned int *__msg_prio) __nonnull ((2));
72 /* Add message pointed by MSG_PTR to message queue MQDES. */
73 extern int mq_send (mqd_t __mqdes, __const char *__msg_ptr, size_t __msg_len,
74 unsigned int __msg_prio) __nonnull ((2));
76 #ifdef __USE_XOPEN2K
77 /* Receive the oldest from highest priority messages in message queue
78 MQDES, stop waiting if ABS_TIMEOUT expires. */
79 extern ssize_t mq_timedreceive (mqd_t __mqdes, char *__restrict __msg_ptr,
80 size_t __msg_len,
81 unsigned int *__restrict __msg_prio,
82 __const struct timespec *__restrict __abs_timeout)
83 __nonnull ((2, 5));
85 /* Add message pointed by MSG_PTR to message queue MQDES, stop blocking
86 on full message queue if ABS_TIMEOUT expires. */
87 extern int mq_timedsend (mqd_t __mqdes, __const char *__msg_ptr,
88 size_t __msg_len, unsigned int __msg_prio,
89 __const struct timespec *__abs_timeout)
90 __nonnull ((2, 5));
91 #endif
93 /* Define some inlines helping to catch common problems. */
94 #if __USE_FORTIFY_LEVEL > 0 && defined __extern_always_inline \
95 && defined __va_arg_pack_len
96 # include <bits/mqueue2.h>
97 #endif
99 __END_DECLS
101 #endif /* mqueue.h */