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.
13 int fileno_unlocked(register FILE *stream
)
15 __STDIO_STREAM_VALIDATE(stream
);
17 if ((!__STDIO_STREAM_IS_CUSTOM(stream
)) && (stream
->__filedes
>= 0)) {
18 return stream
->__filedes
;
24 libc_hidden_def(fileno_unlocked
)
26 #ifndef __UCLIBC_HAS_THREADS__
27 strong_alias(fileno_unlocked
,fileno
)
28 libc_hidden_def(fileno
)
31 #elif defined __UCLIBC_HAS_THREADS__
33 int fileno(register FILE *stream
)
36 __STDIO_AUTO_THREADLOCK_VAR
;
38 __STDIO_AUTO_THREADLOCK(stream
);
40 retval
= fileno_unlocked(stream
);
42 __STDIO_AUTO_THREADUNLOCK(stream
);
46 libc_hidden_def(fileno
)