source: rtems/cpukit/posix/src/pspinlocktranslatereturncode.c @ 3f72dda6

4.11
Last change on this file since 3f72dda6 was 3f72dda6, checked in by Sebastian Huber <sebastian.huber@…>, on May 25, 2016 at 6:37:28 AM

posix: Fix pthread_spin_unlock() error status

Update #2719.

  • Property mode set to 100644
File size: 1.3 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};
36
37
38int _POSIX_Spinlock_Translate_core_spinlock_return_code(
39  CORE_spinlock_Status  the_spinlock_status
40)
41{
42  /*
43   *  Internal consistency check for bad status from SuperCore
44   */
45  #if defined(RTEMS_DEBUG)
46    if ( the_spinlock_status > CORE_SPINLOCK_STATUS_LAST )
47      return EINVAL;
48  #endif
49  return _POSIX_Spinlock_Return_codes[the_spinlock_status];
50}
Note: See TracBrowser for help on using the repository browser.