2002-05-08 08:12:49 +08:00
|
|
|
#ifndef _NEWLIB_STDIO_H
|
|
|
|
#define _NEWLIB_STDIO_H
|
|
|
|
|
2004-06-12 04:37:10 +08:00
|
|
|
#include <sys/lock.h>
|
|
|
|
#include <sys/reent.h>
|
|
|
|
|
2002-05-08 08:12:49 +08:00
|
|
|
/* Internal locking macros, used to protect stdio functions. In the
|
2004-09-17 05:30:51 +08:00
|
|
|
general case, expand to nothing. Use __SSTR flag in FILE _flags to
|
|
|
|
detect if FILE is private to sprintf/sscanf class of functions; if
|
|
|
|
set then do nothing as lock is not initialised. */
|
2002-05-08 08:12:49 +08:00
|
|
|
#if !defined(_flockfile)
|
2004-06-12 04:37:10 +08:00
|
|
|
#ifndef __SINGLE_THREAD__
|
2004-09-17 05:30:51 +08:00
|
|
|
# define _flockfile(fp) (((fp)->_flags & __SSTR) ? 0 : __lock_acquire_recursive((fp)->_lock))
|
2004-06-12 04:37:10 +08:00
|
|
|
#else
|
2017-12-04 10:56:37 +08:00
|
|
|
# define _flockfile(fp) ((void) 0)
|
2002-05-08 08:12:49 +08:00
|
|
|
#endif
|
2004-06-12 04:37:10 +08:00
|
|
|
#endif
|
2002-05-08 08:12:49 +08:00
|
|
|
|
|
|
|
#if !defined(_funlockfile)
|
2004-06-12 04:37:10 +08:00
|
|
|
#ifndef __SINGLE_THREAD__
|
2004-09-17 05:30:51 +08:00
|
|
|
# define _funlockfile(fp) (((fp)->_flags & __SSTR) ? 0 : __lock_release_recursive((fp)->_lock))
|
2004-06-12 04:37:10 +08:00
|
|
|
#else
|
2017-12-04 10:56:37 +08:00
|
|
|
# define _funlockfile(fp) ((void) 0)
|
2002-05-08 08:12:49 +08:00
|
|
|
#endif
|
2004-06-12 04:37:10 +08:00
|
|
|
#endif
|
2002-05-08 08:12:49 +08:00
|
|
|
|
|
|
|
#endif /* _NEWLIB_STDIO_H */
|