Debian Codegraph @

upstream/debian-trixie/man3/isfdtype.3

raw
1 .\" Copyright (C) 2014 Michael Kerrisk <[email protected]>
2 .\"
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
4 .\"
5 .TH isfdtype 3 2024-05-02 "Linux man-pages 6.9.1"
6 .SH NAME
7 isfdtype \- test file type of a file descriptor
8 .SH LIBRARY
9 Standard C library
10 .RI ( libc ", " \-lc )
11 .SH SYNOPSIS
12 .nf
13 .B #include <sys/stat.h>
14 .B #include <sys/socket.h>
15 .P
16 .BI "int isfdtype(int " fd ", int " fdtype );
17 .fi
18 .P
19 .RS -4
20 Feature Test Macro Requirements for glibc (see
21 .BR feature_test_macros (7)):
22 .RE
23 .P
24 .BR isfdtype ():
25 .nf
26 Since glibc 2.20:
27 _DEFAULT_SOURCE
28 Before glibc 2.20:
29 _BSD_SOURCE || _SVID_SOURCE
30 .fi
31 .SH DESCRIPTION
32 The
33 .BR isfdtype ()
34 function tests whether the file descriptor
35 .I fd
36 refers to a file of type
37 .IR fdtype .
38 The
39 .I fdtype
40 argument specifies one of the
41 .B S_IF*
42 constants defined in
43 .I <sys/stat.h>
44 and documented in
45 .BR stat (2)
46 (e.g.,
47 .BR S_IFREG ).
48 .SH RETURN VALUE
49 The
50 .BR isfdtype ()
51 function returns 1 if the file descriptor
52 .I fd
53 is of type
54 .I fdtype
55 and 0 if it is not.
56 On failure, \-1 is returned and
57 .I errno
58 is set to indicate the error.
59 .SH ERRORS
60 The
61 .BR isfdtype ()
62 function can fail with any of the same errors as
63 .BR fstat (2).
64 .SH VERSIONS
65 Portable applications should use
66 .BR fstat (2)
67 instead.
68 .SH STANDARDS
69 None.
70 .SH HISTORY
71 It appeared in the draft POSIX.1g standard.
72 It is present on OpenBSD and Tru64 UNIX
73 (where the required header file in both cases is just
74 .IR <sys/stat.h> ,
75 as shown in the POSIX.1g draft).
76 .SH SEE ALSO
77 .BR fstat (2)