source: rtems/cpukit/posix/src/mqueuetranslatereturncode.c @ e511f6d0

4.115
Last change on this file since e511f6d0 was e511f6d0, checked in by Ralf Corsepius <ralf.corsepius@…>, on 12/05/11 at 05:15:38

2011-12-05 Ralf Corsépius <ralf.corsepius@…>

  • posix/src/mqueuetranslatereturncode.c: Include <rtems/posix/mqueue.h> (Missing prototypes).
  • posix/src/mutextranslatereturncode.c: Include <rtems/posix/mutex.h> (Missing prototypes).
  • posix/src/semaphoretranslatereturncode.c: Include <rtems/posix/semaphore.h> (Missing prototypes).
  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 *  POSIX Message Queue Error Translation
3 *
4 *  COPYRIGHT (c) 1989-2007.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <pthread.h>
19#include <errno.h>
20
21#include <rtems/system.h>
22#include <rtems/score/coremsg.h>
23#include <rtems/posix/mqueue.h>
24
25/*
26 *  _POSIX_Message_queue_Translate_core_message_queue_return_code
27 *
28 *  Input parameters:
29 *    the_message_queue_status - message_queue status code to translate
30 *
31 *  Output parameters:
32 *    status code - translated POSIX status code
33 *
34 */
35
36static
37 int _POSIX_Message_queue_Return_codes[CORE_MESSAGE_QUEUE_STATUS_LAST + 1] = {
38  0,                     /* CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL */
39  EMSGSIZE,              /* CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE */
40  EAGAIN,                /* CORE_MESSAGE_QUEUE_STATUS_TOO_MANY */
41  ENOMEM,                /* CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED */
42  EAGAIN,                /* CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT */
43  EBADF,                 /* CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED */
44  ETIMEDOUT,             /* CORE_MESSAGE_QUEUE_STATUS_TIMEOUT */
45  ENOSYS                 /* CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_WAIT */
46};
47
48
49int _POSIX_Message_queue_Translate_core_message_queue_return_code(
50  uint32_t   the_message_queue_status
51)
52{
53  /*
54   *  Internal consistency check for bad status from SuperCore
55   */
56  #if defined(RTEMS_DEBUG)
57    if ( the_message_queue_status > CORE_MESSAGE_QUEUE_STATUS_LAST )
58      return EINVAL;
59  #endif
60  return _POSIX_Message_queue_Return_codes[the_message_queue_status];
61}
Note: See TracBrowser for help on using the repository browser.