1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #include "_stdio.h"
- #include <stdio_ext.h>
- int __fsetlocking(FILE *stream, int locking_mode)
- {
- #ifdef __UCLIBC_HAS_THREADS__
- int current = 1 + (stream->__user_locking & 1);
-
- assert((FSETLOCKING_QUERY == 0) && (FSETLOCKING_INTERNAL == 1)
- && (FSETLOCKING_BYCALLER == 2));
- __STDIO_STREAM_VALIDATE(stream);
- assert(((unsigned int) locking_mode) <= 2);
- if (locking_mode != FSETLOCKING_QUERY) {
- stream->__user_locking = ((locking_mode == FSETLOCKING_BYCALLER)
- ? 1
- : _stdio_user_locking);
- __STDIO_STREAM_VALIDATE(stream);
- }
- return current;
- #else
- __STDIO_STREAM_VALIDATE(stream);
- assert(((unsigned int) locking_mode) <= 2);
- return FSETLOCKING_INTERNAL;
- #endif
- }
- libc_hidden_def(__fsetlocking)
|