source: rtems/cpukit/include/mqueue.h @ 89ac281

Last change on this file since 89ac281 was 89ac281, checked in by Joel Sherrill <joel@…>, on Mar 8, 2018 at 12:40:20 AM

cpukit/include/mqueue.h: Delete unneeded includes

  • Property mode set to 100644
File size: 4.6 KB
RevLine 
[6c2675d]1/**
[3cf4031]2 * @file
[21242c2]3 *
[3cf4031]4 * @brief POSIX Message Queues
5 *
[21242c2]6 * This file contains the definitions related to POSIX Message Queues.
[e43f4758]7 *
8 * The structure of the routines is identical to that of POSIX
9 * Message_queues to leave the option of having unnamed message
10 * queues at a future date.  They are currently not part of the
11 * POSIX standard but unnamed message_queues are.  This is also
12 * the reason for the apparently unnecessary tracking of
13 * the process_shared attribute.  [In addition to the fact that
14 * it would be trivial to add pshared to the mq_attr structure
15 * and have process private message queues.]
16 *
17 * This code ignores the O_RDONLY/O_WRONLY/O_RDWR flag at open
18 * time.
[6c2675d]19 */
20
21/*
[21242c2]22 *  COPYRIGHT (c) 1989-2011.
[feaa007]23 *  On-Line Applications Research Corporation (OAR).
24 *
25 *  The license and distribution terms for this file may be
26 *  found in the file LICENSE in this distribution or at
[c499856]27 *  http://www.rtems.org/license/LICENSE.
[5e9b32b]28 */
29
[5ec2f12d]30#ifndef _MQUEUE_H
31#define _MQUEUE_H
[5e9b32b]32
[c7aa9d6]33
[0ff3df03]34#include <unistd.h>
[5e9b32b]35
36#if defined(_POSIX_MESSAGE_PASSING)
37
38#include <sys/types.h>
39
[a0e6c73]40/**
[cf301c9]41 * @defgroup POSIX_MQUEUE POSIX Message Queues
[a0e6c73]42 *
[a15eaaf]43 * @ingroup POSIXAPI
[cf301c9]44 *
[a0e6c73]45 */
[b697bc6]46/**@{**/
[a0e6c73]47
[b69e6cd]48#ifdef __cplusplus
49extern "C" {
50#endif
51
[5e9b32b]52/*
53 *  15.1.1 Data Structures, P1003.1b-1993, p. 271
54 */
55
[6a0898b]56/**
[cf301c9]57 * Message queue id type.
[3507c6df]58 *
[cf301c9]59 * NOTE: Use uint32_t since all POSIX Ids are 32-bit currently.
[6a0898b]60 */
[3507c6df]61typedef uint32_t  mqd_t;
[5e9b32b]62
[6a0898b]63/**
[cf301c9]64 * This is the message queue attributes structure.
[6a0898b]65 */
[5e9b32b]66struct mq_attr {
[6a0898b]67  /** This is the message queue flags */
68  long  mq_flags;
69  /** This is the maximum number of messages */
70  long  mq_maxmsg;
71  /** This is the maximum message size */
72  long  mq_msgsize;
73  /** This is the mumber of messages currently queued */
74  long  mq_curmsgs;
[5e9b32b]75};
76
[6a0898b]77/**
[cf301c9]78 * 15.2.2 Open a Message Queue, P1003.1b-1993, p. 272
[5e9b32b]79 */
80mqd_t mq_open(
81  const char *name,
82  int         oflag,
83  ...
84);
85
[6a0898b]86/**
[cf301c9]87 * 15.2.2 Close a Message Queue, P1003.1b-1993, p. 275
[5e9b32b]88 */
89int mq_close(
90  mqd_t  mqdes
91);
92
[6a0898b]93/**
[cf301c9]94 * @brief Remove a message queue.
[a0e6c73]95 *
[cf301c9]96 * 15.2.2 Remove a Message Queue, P1003.1b-1993, p. 276
[a0e6c73]97 *
[cf301c9]98 * NOTE:  The structure of the routines is identical to that of POSIX
99 *        Message_queues to leave the option of having unnamed message
100 *        queues at a future date.  They are currently not part of the
101 *        POSIX standard but unnamed message_queues are.  This is also
102 *        the reason for the apparently unnecessary tracking of
103 *        the process_shared attribute.  [In addition to the fact that
104 *        it would be trivial to add pshared to the mq_attr structure
105 *        and have process private message queues.]
[a0e6c73]106 *
[cf301c9]107 *        This code ignores the O_RDONLY/O_WRONLY/O_RDWR flag at open
108 *        time.
[5e9b32b]109 */
110int mq_unlink(
111  const char *name
112);
113
[6a0898b]114/**
[cf301c9]115 * 15.2.4 Send a Message to a Message Queue, P1003.1b-1993, p. 277
[5e9b32b]116 *
[cf301c9]117 * NOTE; P1003.4b/D8, p. 45 adds mq_timedsend().
[5e9b32b]118 */
119int mq_send(
120  mqd_t         mqdes,
121  const char   *msg_ptr,
122  size_t        msg_len,
[874297f3]123  unsigned int  msg_prio
[5e9b32b]124);
125
126#if defined(_POSIX_TIMEOUTS)
127
128#include <time.h>
129
[e43f4758]130/**
[cf301c9]131 * @brief Send a message to a message queue.
[e43f4758]132 *
[cf301c9]133 * @see mq_send()
[e43f4758]134 */
[5e9b32b]135int mq_timedsend(
136  mqd_t                  mqdes,
137  const char            *msg_ptr,
138  size_t                 msg_len,
139  unsigned int           msg_prio,
[6a0898b]140  const struct timespec *abstime
[5e9b32b]141);
142
143#endif /* _POSIX_TIMEOUTS */
144
[e43f4758]145/**
[cf301c9]146 * @brief Receive a message from a message queue.
[e43f4758]147 *
[cf301c9]148 * 15.2.5 Receive a Message From a Message Queue, P1003.1b-1993, p. 279
[5e9b32b]149 *
[cf301c9]150 * NOTE: P1003.4b/D8, p. 45 adds mq_timedreceive().
[5e9b32b]151 */
152ssize_t mq_receive(
153  mqd_t         mqdes,
154  char         *msg_ptr,
155  size_t        msg_len,
156  unsigned int *msg_prio
157);
158
159#if defined(_POSIX_TIMEOUTS)
160
[fffda815]161ssize_t mq_timedreceive(
[5e9b32b]162  mqd_t                  mqdes,
[f74a492c]163  char                  *__restrict msg_ptr,
[5e9b32b]164  size_t                 msg_len,
[f74a492c]165  unsigned int          *__restrict msg_prio,
166  const struct timespec *__restrict abstime
[5e9b32b]167);
168
169#endif /* _POSIX_TIMEOUTS */
170
171#if defined(_POSIX_REALTIME_SIGNALS)
172
[d86308b]173/**
[cf301c9]174 * @brief Notify process that a message is available on a queue.
[d86308b]175 *
176 * 15.2.6 Notify Process that a Message is Available on a Queue,
177 *        P1003.1b-1993, p. 280
[5e9b32b]178 */
179int mq_notify(
180  mqd_t                  mqdes,
181  const struct sigevent *notification
182);
183
184#endif /* _POSIX_REALTIME_SIGNALS */
185
[d86308b]186/**
[cf301c9]187 * @brief Set message queue attributes.
[d86308b]188 *
189 * 15.2.7 Set Message Queue Attributes, P1003.1b-1993, p. 281
[5e9b32b]190 */
191int mq_setattr(
192  mqd_t                 mqdes,
[f74a492c]193  const struct mq_attr *__restrict mqstat,
194  struct mq_attr       *__restrict omqstat
[5e9b32b]195);
196
197/*
198 *  15.2.8 Get Message Queue Attributes, P1003.1b-1993, p. 283
199 */
200
201int mq_getattr(
202  mqd_t           mqdes,
203  struct mq_attr *mqstat
204);
205
[cf301c9]206/** @} */
207
[c7aa9d6]208#ifdef __cplusplus
209}
210#endif
211
[b69e6cd]212#endif /* _POSIX_MESSAGE_PASSING */
[cf301c9]213
[5e9b32b]214#endif
215/* end of include file */
Note: See TracBrowser for help on using the repository browser.