OSDN Git Service

- adds several config-options to allow for turning off certain features
[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 #warning FIXME: hard dependency on ADVANCED REALTIME feature
10
11 librt_hidden_proto(mq_timedsend)
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,
16                         msg_prio, 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, const struct timespec *abs_timeout)
25 {
26 #ifdef __NR_mq_timedsend
27         return __syscall_mq_timedsend(mqdes, msg_ptr, msg_len, msg_prio,
28                                       abs_timeout);
29 #else
30         errno = ENOSYS;
31         return -1;
32 #endif
33 }
34
35 librt_hidden_def(mq_timedsend)
36
37 /* Add a message to queue */
38 int mq_send(mqd_t mqdes, const char *msg_ptr, size_t msg_len,
39             unsigned int msg_prio)
40 {
41         return mq_timedsend(mqdes, msg_ptr, msg_len, msg_prio, NULL);
42 }