OSDN Git Service

fix ARM types that are known to have MMU's to select ARCH_HAS_MMU
[uclinux-h8/uClibc.git] / librt / mq_send.c
1 /*
2  * mq_send.c - functions for sending to 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_timedsend)
11
12 #ifdef __NR_mq_timedsend
13 #define __NR___syscall_mq_timedsend __NR_mq_timedsend
14 static inline _syscall5(int, __syscall_mq_timedsend, int, mqdes,
15         const char *, msg_ptr, size_t, msg_len, unsigned int, msg_prio,
16         const void *, abs_timeout);
17 #endif
18
19 /*
20  * Add a message to queue. If O_NONBLOCK is set and queue is full, wait
21  * for sufficient room in the queue until abs_timeout expires.
22  */
23 int mq_timedsend(mqd_t mqdes, const char *msg_ptr, size_t msg_len,
24                 unsigned int msg_prio,
25                 const struct timespec *abs_timeout)
26 {
27 #ifdef __NR_mq_timedsend
28         return __syscall_mq_timedsend(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_timedsend)
35
36 /* Add a message to queue */
37 int mq_send(mqd_t mqdes, const char *msg_ptr, size_t msg_len,
38                 unsigned int msg_prio)
39 {
40         return mq_timedsend(mqdes, msg_ptr, msg_len, msg_prio, NULL);
41 }