source: rtems/c/src/exec/posix/src/mqueuetranslatereturncode.c @ e38cb52

4.104.114.84.95
Last change on this file since e38cb52 was e38cb52, checked in by Jennifer Averett <Jennifer.Averett@…>, on Jan 12, 2000 at 6:47:22 PM

Debugged and yellow line tested routines.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*
2 *  POSIX Message Queue Error Translation
3 *
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.OARcorp.com/rtems/license.html.
11 *
12 *  $Id$
13 */
14
15#include <pthread.h>
16#include <limits.h>
17#include <errno.h>
18#include <fcntl.h>
19#include <mqueue.h>
20
21#include <rtems/system.h>
22#include <rtems/score/watchdog.h>
23#include <rtems/posix/seterr.h>
24#include <rtems/posix/mqueue.h>
25#include <rtems/posix/time.h>
26
27
28/*PAGE
29 *
30 *  _POSIX_Message_queue_Translate_core_message_queue_return_code
31 *
32 *  Input parameters:
33 *    the_message_queue_status - message_queue status code to translate
34 *
35 *  Output parameters:
36 *    rtems status code - translated POSIX status code
37 *
38 */
39 
40int _POSIX_Message_queue_Translate_core_message_queue_return_code(
41  unsigned32 the_message_queue_status
42)
43{
44  switch ( the_message_queue_status ) {
45    case  CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL:
46      return 0;
47
48      /*
49       *  Bad message size
50       */
51    case  CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE:
52      return EMSGSIZE;
53
54      /*
55       *  Queue is full of pending messages.
56       */
57    case  CORE_MESSAGE_QUEUE_STATUS_TOO_MANY:
58      return EAGAIN;
59
60      /*
61       *  Out of message buffers to queue pending message
62       */
63    case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED:
64      return ENOMEM;
65
66      /*
67       *  No message available on receive poll
68       */
69    case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT:
70      return EAGAIN;
71
72      /*
73       *  Queue was deleted while thread blocked on it.
74       */
75    case CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED:
76      return EBADF;
77
78      /*
79       *  POSIX Real-Time Extensions add timeouts to send and receive.
80       */
81    case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT:
82      return ETIMEDOUT;
83
84      /*
85       *  RTEMS POSIX API implementation does not support multiprocessing.
86       */
87    case THREAD_STATUS_PROXY_BLOCKING:
88      return ENOSYS;
89  }
90  _Internal_error_Occurred(
91    INTERNAL_ERROR_POSIX_API,
92    TRUE,
93    the_message_queue_status
94  );
95  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
96}
Note: See TracBrowser for help on using the repository browser.