2 .\" Copyright (c) 1990, 1991 The Regents of the University of California.
3 .\" and Copyright (C) 2021 Michael Kerrisk <mtk.manpages@gmail.com>
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to Berkeley by
7 .\" Chris Torek and the American National Standards Committee X3,
8 .\" on Information Processing Systems.
10 .\" SPDX-License-Identifier: BSD-4-Clause-UC
12 .\" Converted for Linux, Mon Nov 29 14:24:40 1993, faith@cs.unc.edu
13 .\" Added remark on EBADF for fileno, aeb, 2001-03-22
15 .TH fileno 3 (date) "Linux man-pages (unreleased)"
17 fileno \- obtain file descriptor of a stdio stream
20 .RI ( libc ", " \-lc )
25 .BI "int fileno(FILE *" stream );
29 Feature Test Macro Requirements for glibc (see
30 .BR feature_test_macros (7)):
42 and returns the integer file descriptor used to implement this stream.
43 The file descriptor is still owned by
45 and will be closed when
48 Duplicate the file descriptor with
50 before passing it to code that might close it.
52 For the nonlocking counterpart, see
53 .BR unlocked_stdio (3).
57 returns the file descriptor associated with
59 On failure, \-1 is returned and
61 is set to indicate the error.
66 is not associated with a file.
68 For an explanation of the terms used in this section, see
74 Interface Attribute Value
79 T} Thread safety MT-Safe
89 .BR unlocked_stdio (3)