2 * Copyright (C) 2005 Philippe Gerum <rpm@xenomai.org>.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 #ifndef _XENO_POSIX_MQUEUE_H
20 #define _XENO_POSIX_MQUEUE_H
22 #if defined(__KERNEL__) || defined(__XENO_SIM__)
24 #include <nucleus/xenomai.h>
27 #include <linux/types.h>
28 #include <linux/signal.h>
29 #include <linux/fcntl.h>
30 #endif /* !__KERNEL__ */
33 #include <posix_overrides.h>
34 #endif /* __XENO_SIM__ */
36 #else /* !(__KERNEL__ || __XENO_SIM__) */
38 #include <xeno_config.h>
41 #endif /* !(__KERNEL__ || __XENO_SIM__) */
43 #if defined(__KERNEL__) || defined(__XENO_SIM__) || !defined(CONFIG_XENO_HAVE_MQUEUE_H)
46 #define MQ_PRIO_MAX 32768
50 typedef unsigned long mqd_t
;
51 #endif /* !__KERNEL__ */
64 int mq_getattr(mqd_t qd
,
65 struct mq_attr
*attr
);
67 int mq_setattr(mqd_t qd
,
68 const struct mq_attr
*__restrict__ attr
,
69 struct mq_attr
*__restrict__ oattr
);
76 int mq_close(mqd_t qd
);
78 ssize_t
mq_receive(mqd_t q
,
83 ssize_t
mq_timedreceive(mqd_t q
,
84 char *__restrict__ buffer
,
86 unsigned *__restrict__ prio
,
87 const struct timespec
*__restrict__ timeout
);
89 int mq_timedsend(mqd_t q
,
93 const struct timespec
*timeout
);
95 int mq_notify(mqd_t mqdes
, const struct sigevent
*notification
);
97 mqd_t
mq_open(const char *name
,
101 int mq_unlink(const char *name
);
107 #else /* !(__KERNEL__ || __XENO_SIM__ || !CONFIG_XENO_HAVE_MQUEUE_H) */
109 #pragma GCC system_header
111 #include_next <mqueue.h>
117 mqd_t
__real_mq_open(const char *name
,
121 int __real_mq_close(mqd_t qd
);
123 int __real_mq_unlink(const char *name
);
125 int __real_mq_getattr(mqd_t qd
,
126 struct mq_attr
*attr
);
128 int __real_mq_setattr(mqd_t qd
,
129 const struct mq_attr
*__restrict__ attr
,
130 struct mq_attr
*__restrict__ oattr
);
132 int __real_mq_send(mqd_t qd
,
137 int __real_mq_timedsend(mqd_t q
,
141 const struct timespec
*timeout
);
143 ssize_t
__real_mq_receive(mqd_t q
,
148 ssize_t
__real_mq_timedreceive(mqd_t q
,
149 char *__restrict__ buffer
,
151 unsigned *__restrict__ prio
,
152 const struct timespec
*__restrict__ timeout
);
154 int __real_mq_notify(mqd_t mqdes
, const struct sigevent
*notification
);
160 #endif /* !(__KERNEL__ || __XENO_SIM__ || !CONFIG_XENO_HAVE_MQUEUE_H) */
162 #endif /* _XENO_POSIX_MQUEUE_H */