source: rtems/cpukit/posix/src/mqueuetimedsend.c @ a0e6c73

4.115
Last change on this file since a0e6c73 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*
2 *  NOTE:  The structure of the routines is identical to that of POSIX
3 *         Message_queues to leave the option of having unnamed message
4 *         queues at a future date.  They are currently not part of the
5 *         POSIX standard but unnamed message_queues are.  This is also
6 *         the reason for the apparently unnecessary tracking of
7 *         the process_shared attribute.  [In addition to the fact that
8 *         it would be trivial to add pshared to the mq_attr structure
9 *         and have process private message queues.]
10 *
11 *         This code ignores the O_RDONLY/O_WRONLY/O_RDWR flag at open
12 *         time.
13 */
14
15/*
16 *  COPYRIGHT (c) 1989-2008.
17 *  On-Line Applications Research Corporation (OAR).
18 *
19 *  The license and distribution terms for this file may be
20 *  found in the file LICENSE in this distribution or at
21 *  http://www.rtems.com/license/LICENSE.
22 */
23
24#if HAVE_CONFIG_H
25#include "config.h"
26#endif
27
28#include <stdarg.h>
29
30#include <pthread.h>
31#include <limits.h>
32#include <errno.h>
33#include <fcntl.h>
34#include <mqueue.h>
35
36#include <rtems/system.h>
37#include <rtems/score/watchdog.h>
38#include <rtems/seterr.h>
39#include <rtems/posix/mqueue.h>
40#include <rtems/posix/time.h>
41
42/*
43 *  15.2.4 Send a Message to a Message Queue, P1003.1b-1993, p. 277
44 *
45 *  NOTE: P1003.4b/D8, p. 45 adds mq_timedsend().
46 */
47
48int mq_timedsend(
49  mqd_t                  mqdes,
50  const char            *msg_ptr,
51  size_t                 msg_len,
52  unsigned int           msg_prio,
53  const struct timespec *abstime
54)
55{
56  Watchdog_Interval                            ticks;
57  bool                                         do_wait = true;
58  POSIX_Absolute_timeout_conversion_results_t  status;
59
60  /*
61   *  POSIX requires that blocking calls with timeouts that take
62   *  an absolute timeout must ignore issues with the absolute
63   *  time provided if the operation would otherwise succeed.
64   *  So we check the abstime provided, and hold on to whether it
65   *  is valid or not.  If it isn't correct and in the future,
66   *  then we do a polling operation and convert the UNSATISFIED
67   *  status into the appropriate error.
68   *
69   *  If the status is POSIX_ABSOLUTE_TIMEOUT_INVALID,
70   *  POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST, or POSIX_ABSOLUTE_TIMEOUT_IS_NOW,
71   *  then we should not wait.
72   */
73  status = _POSIX_Absolute_timeout_to_ticks( abstime, &ticks );
74  if ( status != POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE )
75    do_wait = false;
76
77  return _POSIX_Message_queue_Send_support(
78    mqdes,
79    msg_ptr,
80    msg_len,
81    msg_prio,
82    do_wait,
83    ticks
84  );
85}
Note: See TracBrowser for help on using the repository browser.