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 */ |
---|
36 | static 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 | |
---|
47 | int _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 | } |
---|