1 /* Copyright (c) 2002 Jeff Johnston <jjohnstn@redhat.com> */ 2 #ifndef __SYS_LOCK_H__ 3 #define __SYS_LOCK_H__ 4 5 /* dummy lock routines for single-threaded aps */ 6 7 #include <sys/cdefs.h> 8 9 #if !defined(_RETARGETABLE_LOCKING) 10 11 typedef int _LOCK_T; 12 typedef int _LOCK_RECURSIVE_T; 13 14 #define __LOCK_INIT(lock) 15 #define __LOCK_INIT_RECURSIVE(lock) 16 #define __lock_init(lock) ((void) 0) 17 #define __lock_init_recursive(lock) ((void) 0) 18 #define __lock_close(lock) ((void) 0) 19 #define __lock_close_recursive(lock) ((void) 0) 20 #define __lock_acquire(lock) ((void) 0) 21 #define __lock_acquire_recursive(lock) ((void) 0) 22 #define __lock_release(lock) ((void) 0) 23 #define __lock_release_recursive(lock) ((void) 0) 24 25 #else 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif 30 31 struct __lock; 32 typedef struct __lock * _LOCK_T; 33 #define _LOCK_RECURSIVE_T _LOCK_T 34 35 #define __LOCK_INIT(lock) extern struct __lock __lock_ ## lock; 36 #define __LOCK_INIT_RECURSIVE(lock) __LOCK_INIT(lock) 37 38 extern void __retarget_lock_init(_LOCK_T *lock); 39 #define __lock_init(lock) __retarget_lock_init(&lock) 40 extern void __retarget_lock_init_recursive(_LOCK_T *lock); 41 #define __lock_init_recursive(lock) __retarget_lock_init_recursive(&lock) 42 extern void __retarget_lock_close(_LOCK_T lock); 43 #define __lock_close(lock) __retarget_lock_close(lock) 44 extern void __retarget_lock_close_recursive(_LOCK_T lock); 45 #define __lock_close_recursive(lock) __retarget_lock_close_recursive(lock) 46 extern void __retarget_lock_acquire(_LOCK_T lock); 47 #define __lock_acquire(lock) __retarget_lock_acquire(lock) 48 extern void __retarget_lock_acquire_recursive(_LOCK_T lock); 49 #define __lock_acquire_recursive(lock) __retarget_lock_acquire_recursive(lock) 50 extern void __retarget_lock_release(_LOCK_T lock); 51 #define __lock_release(lock) __retarget_lock_release(lock) 52 extern void __retarget_lock_release_recursive(_LOCK_T lock); 53 #define __lock_release_recursive(lock) __retarget_lock_release_recursive(lock) 54 55 #ifdef __cplusplus 56 } 57 #endif 58 59 #endif /* !defined(_RETARGETABLE_LOCKING) */ 60 61 #define __LIBC_LOCK() __lock_acquire_recursive(&__lock___libc_recursive_mutex) 62 #define __LIBC_UNLOCK() __lock_release_recursive(&__lock___libc_recursive_mutex) 63 __LOCK_INIT_RECURSIVE(__libc_recursive_mutex) 64 65 #endif /* __SYS_LOCK_H__ */ 66