1 /* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
3 * GNU Library General Public License (LGPL) version 2 or later.
5 * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
10 /* libc_hidden_proto(fileno_unlocked) */
14 int fileno_unlocked(register FILE *stream)
16 __STDIO_STREAM_VALIDATE(stream);
18 if ((!__STDIO_STREAM_IS_CUSTOM(stream)) && (stream->__filedes >= 0)) {
19 return stream->__filedes;
25 libc_hidden_def(fileno_unlocked)
27 #ifndef __UCLIBC_HAS_THREADS__
28 /* libc_hidden_proto(fileno) */
29 strong_alias(fileno_unlocked,fileno)
30 libc_hidden_def(fileno)
33 #elif defined __UCLIBC_HAS_THREADS__
35 /* libc_hidden_proto(fileno) */
36 int fileno(register FILE *stream)
39 __STDIO_AUTO_THREADLOCK_VAR;
41 __STDIO_AUTO_THREADLOCK(stream);
43 retval = fileno_unlocked(stream);
45 __STDIO_AUTO_THREADUNLOCK(stream);
49 libc_hidden_def(fileno)