]>
Commit | Line | Data |
---|---|---|
6d7e8eda | 1 | /* Copyright (C) 2004-2023 Free Software Foundation, Inc. |
1b82c6c7 | 2 | This file is part of the GNU C Library. |
1b82c6c7 UD |
3 | |
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. | |
8 | ||
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. | |
13 | ||
14 | You should have received a copy of the GNU Lesser General Public | |
59ba27a6 | 15 | License along with the GNU C Library; if not, see |
5a82c748 | 16 | <https://www.gnu.org/licenses/>. */ |
1b82c6c7 UD |
17 | |
18 | #ifndef _MQUEUE_H | |
19 | #define _MQUEUE_H 1 | |
20 | ||
21 | #include <features.h> | |
22 | #include <sys/types.h> | |
23 | #include <fcntl.h> | |
a992f506 | 24 | #include <bits/types/sigevent_t.h> |
05b68e14 | 25 | #include <bits/types/struct_timespec.h> |
1b82c6c7 UD |
26 | /* Get the definition of mqd_t and struct mq_attr. */ |
27 | #include <bits/mqueue.h> | |
28 | ||
29 | __BEGIN_DECLS | |
30 | ||
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. */ | |
a784e502 | 38 | extern mqd_t mq_open (const char *__name, int __oflag, ...) |
177f96e8 | 39 | __THROW __nonnull ((1)); |
1b82c6c7 UD |
40 | |
41 | /* Removes the association between message queue descriptor MQDES and its | |
42 | message queue. */ | |
43 | extern int mq_close (mqd_t __mqdes) __THROW; | |
44 | ||
45 | /* Query status and attributes of message queue MQDES. */ | |
177f96e8 UD |
46 | extern int mq_getattr (mqd_t __mqdes, struct mq_attr *__mqstat) |
47 | __THROW __nonnull ((2)); | |
1b82c6c7 UD |
48 | |
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, | |
a784e502 | 52 | const struct mq_attr *__restrict __mqstat, |
177f96e8 UD |
53 | struct mq_attr *__restrict __omqstat) |
54 | __THROW __nonnull ((2)); | |
1b82c6c7 UD |
55 | |
56 | /* Remove message queue named NAME. */ | |
a784e502 | 57 | extern int mq_unlink (const char *__name) __THROW __nonnull ((1)); |
1b82c6c7 | 58 | |
a877d33e UD |
59 | /* Register notification issued upon message arrival to an empty |
60 | message queue MQDES. */ | |
a784e502 | 61 | extern int mq_notify (mqd_t __mqdes, const struct sigevent *__notification) |
1b82c6c7 UD |
62 | __THROW; |
63 | ||
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, | |
177f96e8 | 67 | unsigned int *__msg_prio) __nonnull ((2)); |
1b82c6c7 UD |
68 | |
69 | /* Add message pointed by MSG_PTR to message queue MQDES. */ | |
a784e502 | 70 | extern int mq_send (mqd_t __mqdes, const char *__msg_ptr, size_t __msg_len, |
177f96e8 | 71 | unsigned int __msg_prio) __nonnull ((2)); |
1b82c6c7 UD |
72 | |
73 | #ifdef __USE_XOPEN2K | |
47f24c21 | 74 | # ifndef __USE_TIME_BITS64 |
1b82c6c7 UD |
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, | |
a784e502 | 80 | const struct timespec *__restrict __abs_timeout) |
754980e4 | 81 | __nonnull ((2, 5)); |
1b82c6c7 UD |
82 | |
83 | /* Add message pointed by MSG_PTR to message queue MQDES, stop blocking | |
84 | on full message queue if ABS_TIMEOUT expires. */ | |
a784e502 | 85 | extern int mq_timedsend (mqd_t __mqdes, const char *__msg_ptr, |
1b82c6c7 | 86 | size_t __msg_len, unsigned int __msg_prio, |
a784e502 | 87 | const struct timespec *__abs_timeout) |
754980e4 | 88 | __nonnull ((2, 5)); |
47f24c21 AZ |
89 | # else |
90 | # ifdef __REDIRECT | |
91 | extern int __REDIRECT (mq_timedreceive, (mqd_t __mqdes, | |
92 | char *__restrict __msg_ptr, | |
93 | size_t __msg_len, | |
94 | unsigned int *__restrict __msg_prio, | |
95 | const struct timespec *__restrict __abs_timeout), | |
96 | __mq_timedreceive_time64) | |
97 | __nonnull ((2, 5)); | |
98 | ||
99 | extern int __REDIRECT (mq_timedsend, (mqd_t __mqdes, | |
100 | const char *__msg_ptr, size_t __msg_len, | |
101 | unsigned int __msg_prio, | |
102 | const struct timespec *__abs_timeout), | |
103 | __mq_timedsend_time64) | |
104 | __nonnull ((2, 5)); | |
105 | # else | |
106 | # define mq_timedreceive __mq_timedreceive_time64 | |
107 | # define mq_timedsend __mq_timedsend_time64 | |
108 | # endif | |
109 | # endif | |
1b82c6c7 UD |
110 | #endif |
111 | ||
3a50811c | 112 | /* Define some inlines helping to catch common problems. */ |
5ac3ea17 | 113 | #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \ |
3a50811c UD |
114 | && defined __va_arg_pack_len |
115 | # include <bits/mqueue2.h> | |
116 | #endif | |
117 | ||
a877d33e | 118 | __END_DECLS |
1b82c6c7 UD |
119 | |
120 | #endif /* mqueue.h */ |