source: rtems/cpukit/posix/src/mqueuetranslatereturncode.c @ 92f4671

4.104.115
Last change on this file since 92f4671 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: 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
24
25/*PAGE
26 *
27 *  _POSIX_Message_queue_Translate_core_message_queue_return_code
28 *
29 *  Input parameters:
30 *    the_message_queue_status - message_queue status code to translate
31 *
32 *  Output parameters:
33 *    status code - translated POSIX status code
34 *
35 */
36
37static
38 int _POSIX_Message_queue_Return_codes[CORE_MESSAGE_QUEUE_STATUS_LAST + 1] = {
39  0,                     /* CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL */
40  EMSGSIZE,              /* CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE */
41  EAGAIN,                /* CORE_MESSAGE_QUEUE_STATUS_TOO_MANY */
42  ENOMEM,                /* CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED */
43  EAGAIN,                /* CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT */
44  EBADF,                 /* CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED */
45  ETIMEDOUT,             /* CORE_MESSAGE_QUEUE_STATUS_TIMEOUT */
46  ENOSYS                 /* CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_WAIT */
47};
48
49
50int _POSIX_Message_queue_Translate_core_message_queue_return_code(
51  uint32_t   the_message_queue_status
52)
53{
54  /*
55   *  Internal consistency check for bad status from SuperCore
56   */
57  #if defined(RTEMS_DEBUG)
58    if ( the_message_queue_status > CORE_MESSAGE_QUEUE_STATUS_LAST )
59      return EINVAL;
60  #endif
61  return _POSIX_Message_queue_Return_codes[the_message_queue_status];
62}
Note: See TracBrowser for help on using the repository browser.