]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/librt/mq_send.c
update
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / librt / mq_send.c
1 /*
2  * mq_send.c - functions for sending to message queue.
3  */
4
5 #include <sys/syscall.h>
6
7 #ifdef __NR_mq_timedsend
8
9 #include <stddef.h>
10 #include <mqueue.h>
11
12 #ifdef __UCLIBC_HAS_THREADS_NATIVE__
13 # ifndef __UCLIBC_HAS_ADVANCED_REALTIME__
14 extern int mq_timedsend(mqd_t mqdes, const char *msg_ptr, size_t msg_len,
15                         unsigned int msg_prio, const struct timespec *abs_timeout);
16 # endif
17 librt_hidden_proto(mq_timedsend)
18 #else
19
20 # define __NR___syscall_mq_timedsend __NR_mq_timedsend
21 static _syscall5(int, __syscall_mq_timedsend, int, mqdes,
22                  const char *, msg_ptr, size_t, msg_len, unsigned int,
23                  msg_prio, const void *, abs_timeout)
24
25 # ifdef __UCLIBC_HAS_ADVANCED_REALTIME__
26 /*
27  * Add a message to queue. If O_NONBLOCK is set and queue is full, wait
28  * for sufficient room in the queue until abs_timeout expires.
29  */
30 int mq_timedsend(mqd_t mqdes, const char *msg_ptr, size_t msg_len,
31                  unsigned int msg_prio, const struct timespec *abs_timeout)
32 {
33         return __syscall_mq_timedsend(mqdes, msg_ptr, msg_len, msg_prio,
34                                       abs_timeout);
35 }
36 # endif
37 #endif
38
39 /* Add a message to queue */
40 int mq_send(mqd_t mqdes, const char *msg_ptr, size_t msg_len,
41             unsigned int msg_prio)
42 {
43 #ifdef __UCLIBC_HAS_THREADS_NATIVE__
44         return mq_timedsend(mqdes, msg_ptr, msg_len, msg_prio, NULL);
45 #else
46         return __syscall_mq_timedsend(mqdes, msg_ptr, msg_len, msg_prio, NULL);
47 #endif
48 }
49
50 #endif