1 /* Copyright (c) 2016 Thomas Preud'homme <thomas.preudhomme@arm.com> */
2 /*
3 FUNCTION
4 <<__retarget_lock_init>>, <<__retarget_lock_init_recursive>>, <<__retarget_lock_close>>, <<__retarget_lock_close_recursive>>, <<__retarget_lock_acquire>>, <<__retarget_lock_acquire_recursive>>, <<__retarget_lock_try_acquire>>, <<__retarget_lock_try_acquire_recursive>>, <<__retarget_lock_release>>, <<__retarget_lock_release_recursive>>---locking routines
5 
6 INDEX
7 	__lock___sfp_recursive_mutex
8 INDEX
9 	__lock___atexit_recursive_mutex
10 INDEX
11 	__lock___at_quick_exit_mutex
12 INDEX
13 	__lock___malloc_recursive_mutex
14 INDEX
15 	__lock___env_recursive_mutex
16 INDEX
17 	__lock___tz_mutex
18 INDEX
19 	__lock___arc4random_mutex
20 
21 INDEX
22 	__retarget_lock_init
23 INDEX
24 	__retarget_lock_init_recursive
25 INDEX
26 	__retarget_lock_close
27 INDEX
28 	__retarget_lock_close_recursive
29 INDEX
30 	__retarget_lock_acquire
31 INDEX
32 	__retarget_lock_acquire_recursive
33 INDEX
34 	__retarget_lock_try_acquire
35 INDEX
36 	__retarget_lock_try_acquire_recursive
37 INDEX
38 	__retarget_lock_release
39 INDEX
40 	__retarget_lock_release_recursive
41 
42 SYNOPSIS
43 	#include <lock.h>
44 	struct __lock __lock___sfp_recursive_mutex;
45 	struct __lock __lock___atexit_recursive_mutex;
46 	struct __lock __lock___at_quick_exit_mutex;
47 	struct __lock __lock___malloc_recursive_mutex;
48 	struct __lock __lock___env_recursive_mutex;
49 	struct __lock __lock___tz_mutex;
50 	struct __lock __lock___arc4random_mutex;
51 
52 	void __retarget_lock_init (_LOCK_T * <[lock_ptr]>);
53 	void __retarget_lock_init_recursive (_LOCK_T * <[lock_ptr]>);
54 	void __retarget_lock_close (_LOCK_T <[lock]>);
55 	void __retarget_lock_close_recursive (_LOCK_T <[lock]>);
56 	void __retarget_lock_acquire (_LOCK_T <[lock]>);
57 	void __retarget_lock_acquire_recursive (_LOCK_T <[lock]>);
58 	int __retarget_lock_try_acquire (_LOCK_T <[lock]>);
59 	int __retarget_lock_try_acquire_recursive (_LOCK_T <[lock]>);
60 	void __retarget_lock_release (_LOCK_T <[lock]>);
61 	void __retarget_lock_release_recursive (_LOCK_T <[lock]>);
62 
63 DESCRIPTION
64 Newlib was configured to allow the target platform to provide the locking
65 routines and static locks at link time.  As such, a dummy default
66 implementation of these routines and static locks is provided for
67 single-threaded application to link successfully out of the box on bare-metal
68 systems.
69 
70 For multi-threaded applications the target platform is required to provide
71 an implementation for @strong{all} these routines and static locks.  If some
72 routines or static locks are missing, the link will fail with doubly defined
73 symbols.
74 
75 PORTABILITY
76 These locking routines and static lock are newlib-specific.  Supporting OS
77 subroutines are required for linking multi-threaded applications.
78 */
79 
80 /* dummy lock routines and static locks for single-threaded apps */
81 
82 #ifndef __SINGLE_THREAD__
83 
84 #include <sys/lock.h>
85 
86 struct __lock {
87   char unused;
88 };
89 
90 struct __lock __lock___libc_recursive_mutex;
91 
92 void
__retarget_lock_init(_LOCK_T * lock)93 __retarget_lock_init (_LOCK_T *lock)
94 {
95   (void) lock;
96 }
97 
98 void
__retarget_lock_init_recursive(_LOCK_T * lock)99 __retarget_lock_init_recursive(_LOCK_T *lock)
100 {
101   (void) lock;
102 }
103 
104 void
__retarget_lock_close(_LOCK_T lock)105 __retarget_lock_close(_LOCK_T lock)
106 {
107   (void) lock;
108 }
109 
110 void
__retarget_lock_close_recursive(_LOCK_T lock)111 __retarget_lock_close_recursive(_LOCK_T lock)
112 {
113   (void) lock;
114 }
115 
116 void
__retarget_lock_acquire(_LOCK_T lock)117 __retarget_lock_acquire (_LOCK_T lock)
118 {
119   (void) lock;
120 }
121 
122 void
__retarget_lock_acquire_recursive(_LOCK_T lock)123 __retarget_lock_acquire_recursive (_LOCK_T lock)
124 {
125   (void) lock;
126 }
127 
128 int
__retarget_lock_try_acquire(_LOCK_T lock)129 __retarget_lock_try_acquire(_LOCK_T lock)
130 {
131   (void) lock;
132   return 1;
133 }
134 
135 int
__retarget_lock_try_acquire_recursive(_LOCK_T lock)136 __retarget_lock_try_acquire_recursive(_LOCK_T lock)
137 {
138   (void) lock;
139   return 1;
140 }
141 
142 void
__retarget_lock_release(_LOCK_T lock)143 __retarget_lock_release (_LOCK_T lock)
144 {
145   (void) lock;
146 }
147 
148 void
__retarget_lock_release_recursive(_LOCK_T lock)149 __retarget_lock_release_recursive (_LOCK_T lock)
150 {
151   (void) lock;
152 }
153 
154 #endif /* !defined(__SINGLE_THREAD__) */
155