source: rtems/cpukit/posix/src/pspinlocktranslatereturncode.c @ 8a8f5b2

4.104.114.95
Last change on this file since 8a8f5b2 was 8a8f5b2, checked in by Glenn Humphrey <glenn.humphrey@…>, on 11/06/07 at 19:52:36

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

Miscellaneous changes made after a review against the POSIX spec.

  • posix/src/pbarrierinit.c, posix/src/prwlockinit.c: If the caller passes a NULL in the attributes parameter, default attributes are used.
  • posix/src/prwlockdestroy.c: If there is at least one thread waiting, do not allow deletion.
  • posix/src/prwlockwrlock.c: Corrected parameter passed to the core operation used to obtain a RWLock for writing.
  • posix/src/pspinlocktranslatereturncode.c, score/include/rtems/score/corespinlock.h, score/src/corespinlockrelease.c: If the current thread is not the holder of the lock, do not allow an unlock and return EPERM.
  • score/src/corerwlockobtainwrite.c: Corrected to use the operation for queueing with a timeout handler.
  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 *  Spinlock Manager -- Translate SuperCore Status
3 *
4 *  COPYRIGHT (c) 1989-2006.
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/posix/spinlock.h>
23
24/*
25 *  _POSIX_Spinlock_Translate_core_spinlock_return_code
26 *
27 *  Input parameters:
28 *    the_spinlock_status - spinlock status code to translate
29 *
30 *  Output parameters:
31 *    status code - translated POSIX status code
32 *
33 */
34
35/* XXX fix me */
36static int _POSIX_Spinlock_Return_codes[] = {
37  0,                        /* CORE_SPINLOCK_SUCCESSFUL */
38  EDEADLK,                  /* CORE_SPINLOCK_HOLDER_RELOCKING */
39  EPERM,                    /* CORE_SPINLOCK_NOT_HOLDER */
40  -1,                       /* CORE_SPINLOCK_TIMEOUT */
41  EBUSY,                    /* CORE_SPINLOCK_IS_BUSY */
42  EBUSY,                    /* CORE_SPINLOCK_UNAVAILABLE */
43  0                         /* CORE_SPINLOCK_NOT_LOCKED */
44};
45
46
47int _POSIX_Spinlock_Translate_core_spinlock_return_code(
48  CORE_spinlock_Status  the_spinlock_status
49)
50{
51  if ( the_spinlock_status <= CORE_SPINLOCK_STATUS_LAST )
52    return _POSIX_Spinlock_Return_codes[the_spinlock_status];
53  return POSIX_BOTTOM_REACHED();
54}
Note: See TracBrowser for help on using the repository browser.