OSDN Git Service

Enable _GNU_SOURCE build wide, trying to get consistent interfaces, else IMA is a...
[uclinux-h8/uClibc.git] / librt / mq_receive.c
1 /*
2  * mq_receive.c - functions for receiving from message queue.
3  */
4
5 #include <errno.h>
6 #include <stddef.h>
7 #include <sys/syscall.h>
8 #include <mqueue.h>
9
10 librt_hidden_proto(mq_timedreceive)
11
12 #ifdef __NR_mq_timedreceive
13 #define __NR___syscall_mq_timedreceive __NR_mq_timedreceive
14 static inline _syscall5(int, __syscall_mq_timedreceive, int, mqdes,
15         char *, msg_ptr, size_t, msg_len, unsigned int *, msg_prio,
16         const void *, abs_timeout);
17 #endif
18
19 /*
20  * Receive the oldest from highest priority messages.
21  * Stop waiting if abs_timeout expires.
22  */
23 ssize_t mq_timedreceive(mqd_t mqdes, char *msg_ptr, size_t msg_len,
24                         unsigned int *msg_prio,
25                         const struct timespec *abs_timeout)
26 {
27 #ifdef __NR_mq_timedreceive
28         return __syscall_mq_timedreceive(mqdes, msg_ptr, msg_len, msg_prio, abs_timeout);
29 #else
30         errno = ENOSYS;
31         return -1;
32 #endif
33 }
34 librt_hidden_def(mq_timedreceive)
35
36 /* Receive the oldest from highest priority messages */
37 ssize_t mq_receive(mqd_t mqdes, char *msg_ptr, size_t msg_len,
38                         unsigned int *msg_prio)
39 {
40         return mq_timedreceive(mqdes, msg_ptr, msg_len, msg_prio, NULL);
41 }