1 #ifndef _NEWLIB_STDIO_H
2 #define _NEWLIB_STDIO_H
3 
4 #include <sys/lock.h>
5 
6 /* Internal locking macros, used to protect stdio functions.  In the
7    general case, expand to nothing. Use __SSTR flag in FILE _flags to
8    detect if FILE is private to sprintf/sscanf class of functions; if
9    set then do nothing as lock is not initialised. */
10 #if !defined(_flockfile)
11 #ifndef __SINGLE_THREAD__
12 #  define _flockfile(fp) (((fp)->_flags & __SSTR) ? 0 : __lock_acquire_recursive((fp)->_lock))
13 #else
14 #  define _flockfile(fp)	((void) 0)
15 #endif
16 #endif
17 
18 #if !defined(_funlockfile)
19 #ifndef __SINGLE_THREAD__
20 #  define _funlockfile(fp) (((fp)->_flags & __SSTR) ? 0 : __lock_release_recursive((fp)->_lock))
21 #else
22 #  define _funlockfile(fp)	((void) 0)
23 #endif
24 #endif
25 
26 #endif /* _NEWLIB_STDIO_H */
27