Update.
[glibc.git] / rt / mqueue.h
blob42313b192bbb5abfd45567ba69a398870c1749a4
1 /* Copyright (C) 2004 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #ifndef _MQUEUE_H
21 #define _MQUEUE_H 1
23 #include <features.h>
24 #include <sys/types.h>
25 #include <fcntl.h>
26 #define __need_sigevent_t
27 #include <bits/siginfo.h>
28 #define __need_timespec
29 #include <time.h>
30 /* Get the definition of mqd_t and struct mq_attr. */
31 #include <bits/mqueue.h>
33 __BEGIN_DECLS
35 /* Establish connection between a process and a message queue NAME and
36 return message queue descriptor or (mqd_t) -1 on error. OFLAG determines
37 the type of access used. If O_CREAT is on OFLAG, the third argument is
38 taken as a `mode_t', the mode of the created message queue, and the fourth
39 argument is taken as `struct mq_attr *', pointer to message queue
40 attributes. If the fourth argument is NULL, default attributes are
41 used. */
42 extern mqd_t mq_open (const char *__name, int __oflag, ...) __THROW;
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) __THROW;
51 /* Set attributes associated with message queue MQDES and if OMQSTAT is
52 not NULL also query its old attributes. */
53 extern int mq_setattr (mqd_t __mqdes,
54 const struct mq_attr *__restrict __mqstat,
55 struct mq_attr *__restrict __omqstat) __THROW;
57 /* Remove message queue named NAME. */
58 extern int mq_unlink (const char *__name) __THROW;
60 /* Register notification upon message arrival to an empty message queue
61 MQDES. */
62 extern int mq_notify (mqd_t __mqdes, const struct sigevent *__notification)
63 __THROW;
65 /* Receive the oldest from highest priority messages in message queue
66 MQDES. */
67 extern ssize_t mq_receive (mqd_t __mqdes, char *__msg_ptr, size_t __msg_len,
68 unsigned int *__msg_prio);
70 /* Add message pointed by MSG_PTR to message queue MQDES. */
71 extern int mq_send (mqd_t __mqdes, const char *__msg_ptr, size_t __msg_len,
72 unsigned int __msg_prio);
74 #ifdef __USE_XOPEN2K
75 /* Receive the oldest from highest priority messages in message queue
76 MQDES, stop waiting if ABS_TIMEOUT expires. */
77 extern ssize_t mq_timedreceive (mqd_t __mqdes, char *__restrict __msg_ptr,
78 size_t __msg_len,
79 unsigned int *__restrict __msg_prio,
80 const struct timespec *__restrict __abs_timeout);
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 #endif
89 __END_DECLS
91 #endif /* mqueue.h */