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

4.115
Last change on this file since be1b8a7 was 972a5c5f, checked in by Sebastian Huber <sebastian.huber@…>, on 07/18/13 at 13:12:05

posix: Create message queue implementation header

Move implementation specific parts of mqueue.h and mqueue.inl into new
header file mqueueimpl.h. The mqueue.h contains now only the
application visible API.

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