OSDN Git Service

test/math/*: unbreak
[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
13 #ifndef __UCLIBC_HAS_THREADS_NATIVE__
14 #ifdef __NR_mq_timedsend
15 #define __NR___syscall_mq_timedsend __NR_mq_timedsend
16 static __inline__ _syscall5(int, __syscall_mq_timedsend, int, mqdes,
17                         const char *, msg_ptr, size_t, msg_len, unsigned int,
18                         msg_prio, const void *, abs_timeout);
19 #endif
20
21 /*
22  * Add a message to queue. If O_NONBLOCK is set and queue is full, wait
23  * for sufficient room in the queue until abs_timeout expires.
24  */
25 int mq_timedsend(mqd_t mqdes, const char *msg_ptr, size_t msg_len,
26                  unsigned int msg_prio, const struct timespec *abs_timeout)
27 {
28 #ifdef __NR_mq_timedsend
29         return __syscall_mq_timedsend(mqdes, msg_ptr, msg_len, msg_prio,
30                                       abs_timeout);
31 #else
32         errno = ENOSYS;
33         return -1;
34 #endif
35 }
36
37 librt_hidden_def(mq_timedsend)
38 #endif
39
40 /* Add a message to queue */
41 int mq_send(mqd_t mqdes, const char *msg_ptr, size_t msg_len,
42             unsigned int msg_prio)
43 {
44         return mq_timedsend(mqdes, msg_ptr, msg_len, msg_prio, NULL);
45 }