source: rtems/cpukit/posix/src/pspinlocktranslatereturncode.c @ c499856

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief POSIX Spinlock Translate Core Spinlock Return Code
5 *  @ingroup POSIX_SPINLOCK
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2007.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <pthread.h>
22#include <errno.h>
23
24#include <rtems/system.h>
25#include <rtems/score/corespinlock.h>
26#include <rtems/posix/spinlockimpl.h>
27
28static int _POSIX_Spinlock_Return_codes[CORE_SPINLOCK_STATUS_LAST + 1] = {
29  0,                        /* CORE_SPINLOCK_SUCCESSFUL */
30  EDEADLK,                  /* CORE_SPINLOCK_HOLDER_RELOCKING */
31  EPERM,                    /* CORE_SPINLOCK_NOT_HOLDER */
32  -1,                       /* CORE_SPINLOCK_TIMEOUT */
33  EBUSY,                    /* CORE_SPINLOCK_IS_BUSY */
34  EBUSY,                    /* CORE_SPINLOCK_UNAVAILABLE */
35  0                         /* CORE_SPINLOCK_NOT_LOCKED */
36};
37
38
39int _POSIX_Spinlock_Translate_core_spinlock_return_code(
40  CORE_spinlock_Status  the_spinlock_status
41)
42{
43  /*
44   *  Internal consistency check for bad status from SuperCore
45   */
46  #if defined(RTEMS_DEBUG)
47    if ( the_spinlock_status > CORE_SPINLOCK_STATUS_LAST )
48      return EINVAL;
49  #endif
50  return _POSIX_Spinlock_Return_codes[the_spinlock_status];
51}
Note: See TracBrowser for help on using the repository browser.