OSDN Git Service

Add MS7619SE
[uclinux-h8/uClinux-dist.git] / uClibc / librt / mq_receive.c
1 /*
2  * mq_receive.c - functions for receiving from message queue.
3  */
4
5 #include <sys/syscall.h>
6
7 #ifdef __NR_mq_timedreceive
8
9 #include <stddef.h>
10 #include <mqueue.h>
11
12 #ifdef __UCLIBC_HAS_THREADS_NATIVE__
13 librt_hidden_proto(mq_timedreceive)
14 #else
15
16 # define __NR___syscall_mq_timedreceive __NR_mq_timedreceive
17 static _syscall5(int, __syscall_mq_timedreceive, int, mqdes,
18                  char *, msg_ptr, size_t, msg_len, unsigned int *,
19                  msg_prio, const void *, abs_timeout);
20
21 # ifdef __UCLIBC_HAS_ADVANCED_REALTIME__
22 /*
23  * Receive the oldest from highest priority messages.
24  * Stop waiting if abs_timeout expires.
25  */
26 ssize_t mq_timedreceive(mqd_t mqdes, char *msg_ptr, size_t msg_len,
27                         unsigned int *msg_prio,
28                         const struct timespec *abs_timeout)
29 {
30         return __syscall_mq_timedreceive(mqdes, msg_ptr, msg_len, msg_prio,
31                                          abs_timeout);
32 }
33 # endif
34
35 #endif
36
37 /* Receive the oldest from highest priority messages */
38 ssize_t mq_receive(mqd_t mqdes, char *msg_ptr, size_t msg_len,
39                    unsigned int *msg_prio)
40 {
41 #ifdef __UCLIBC_HAS_THREADS_NATIVE__
42         return mq_timedreceive(mqdes, msg_ptr, msg_len, msg_prio, NULL);
43 #else
44         return __syscall_mq_timedreceive(mqdes, msg_ptr, msg_len, msg_prio, NULL);
45 #endif
46 }
47
48 #endif