source: rtems/cpukit/rtems/src/msgqtranslatereturncode.c @ ebe61382

4.104.114.95
Last change on this file since ebe61382 was 860c34e, checked in by Glenn Humphrey <glenn.humphrey@…>, on 11/30/07 at 20:34:13

2007-11-30 Glenn Humphrey <glenn.humphrey@…>

  • posix/include/rtems/posix/mutex.h, posix/include/rtems/posix/semaphore.h, posix/src/cancel.c, posix/src/conddestroy.c, posix/src/condsignalsupp.c, posix/src/condwaitsupp.c, posix/src/keydelete.c, posix/src/keygetspecific.c, posix/src/keysetspecific.c, posix/src/mqueueclose.c, posix/src/mqueuegetattr.c, posix/src/mqueuenotify.c, posix/src/mqueuerecvsupp.c, posix/src/mqueuesendsupp.c, posix/src/mqueuesetattr.c, posix/src/mqueuetranslatereturncode.c, posix/src/mutexdestroy.c, posix/src/mutexgetprioceiling.c, posix/src/mutexinit.c, posix/src/mutexlocksupp.c, posix/src/mutexsetprioceiling.c, posix/src/mutexunlock.c, posix/src/pbarrierdestroy.c, posix/src/pbarriertranslatereturncode.c, posix/src/pbarrierwait.c, posix/src/prwlockdestroy.c, posix/src/prwlockrdlock.c, posix/src/prwlocktimedrdlock.c, posix/src/prwlocktimedwrlock.c, posix/src/prwlocktranslatereturncode.c, posix/src/prwlocktryrdlock.c, posix/src/prwlocktrywrlock.c, posix/src/prwlockunlock.c, posix/src/prwlockwrlock.c, posix/src/pspindestroy.c, posix/src/pspinlock.c, posix/src/pspinlocktranslatereturncode.c, posix/src/pspintrylock.c, posix/src/pspinunlock.c, posix/src/pthreaddetach.c, posix/src/pthreadequal.c, posix/src/pthreadgetschedparam.c, posix/src/pthreadjoin.c, posix/src/pthreadkill.c, posix/src/pthreadsetschedparam.c, posix/src/ptimer1.c, posix/src/semaphorewaitsupp.c, posix/src/semclose.c, posix/src/semdestroy.c, posix/src/semgetvalue.c, posix/src/sempost.c, posix/src/types.c, rtems/src/msgqtranslatereturncode.c, rtems/src/semobtain.c, rtems/src/timerfireafter.c, score/include/rtems/system.h, score/include/rtems/score/corebarrier.h, score/include/rtems/score/coremsg.h, score/include/rtems/score/coremutex.h, score/include/rtems/score/coresem.h: Restructed to move the OBJECTS_LOCAL case to the top of the switch statement and eliminate the fall-through return of POSIX_BOTTOM_REACHED. These changes produced simplier assembly code and allowed for complete test coverage. Also applied some consistency to the functions that translate the core status codes to POSIX status codes.
  • posix/src/mutextranslatereturncode.c, posix/src/semaphoretranslatereturncode.c: New files.
  • posix/src/mutexfromcorestatus.c: Removed.
  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*
2 *  Message Queue Manager
3 *
4 *
5 *  COPYRIGHT (c) 1989-2007.
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.rtems.com/license/LICENSE.
11 *
12 *  $Id$
13 */
14
15#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <rtems/system.h>
20#include <rtems/score/sysstate.h>
21#include <rtems/score/chain.h>
22#include <rtems/score/isr.h>
23#include <rtems/score/coremsg.h>
24#include <rtems/score/object.h>
25#include <rtems/score/states.h>
26#include <rtems/score/thread.h>
27#include <rtems/score/wkspace.h>
28#if defined(RTEMS_MULTIPROCESSING)
29#include <rtems/score/mpci.h>
30#endif
31#include <rtems/rtems/status.h>
32#include <rtems/rtems/attr.h>
33#include <rtems/rtems/message.h>
34#include <rtems/rtems/options.h>
35#include <rtems/rtems/support.h>
36
37/*PAGE
38 *
39 *  _Message_queue_Translate_core_message_queue_return_code
40 *
41 *  Input parameters:
42 *    the_message_queue_status - message_queue status code to translate
43 *
44 *  Output parameters:
45 *    rtems status code - translated RTEMS status code
46 *
47 */
48
49rtems_status_code _Message_queue_Translate_core_return_code_[] = {
50  RTEMS_SUCCESSFUL,         /* CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL */
51  RTEMS_INVALID_SIZE,       /* CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE */
52  RTEMS_TOO_MANY,           /* CORE_MESSAGE_QUEUE_STATUS_TOO_MANY */
53  RTEMS_UNSATISFIED,        /* CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED */
54  RTEMS_UNSATISFIED,        /* CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT */
55  RTEMS_OBJECT_WAS_DELETED, /* CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED */
56  RTEMS_TIMEOUT             /* CORE_MESSAGE_QUEUE_STATUS_TIMEOUT */
57};
58
59rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
60  uint32_t   status
61)
62{
63  /*
64   *  Check for proxy blocking first since it is out of range
65   *  from the external status codes.
66   */
67  #if defined(RTEMS_MULTIPROCESSING)
68    if ( status == THREAD_STATUS_PROXY_BLOCKING )
69      return RTEMS_PROXY_BLOCKING;
70  #endif
71
72  /*
73   *  Internal consistency check for bad status from SuperCore
74   */
75  #if defined(RTEMS_DEBUG)
76    if ( status > CORE_MESSAGE_QUEUE_STATUS_TIMEOUT )
77      return RTEMS_INTERNAL_ERROR;
78  #endif
79
80  return _Message_queue_Translate_core_return_code_[status];
81}
Note: See TracBrowser for help on using the repository browser.