1isfdtype(3) Library Functions Manual isfdtype(3)
2
3
4
6 isfdtype - test file type of a file descriptor
7
9 Standard C library (libc, -lc)
10
12 #include <sys/stat.h>
13 #include <sys/socket.h>
14
15 int isfdtype(int fd, int fdtype);
16
17 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
18
19 isfdtype():
20 Since glibc 2.20:
21 _DEFAULT_SOURCE
22 Before glibc 2.20:
23 _BSD_SOURCE || _SVID_SOURCE
24
26 The isfdtype() function tests whether the file descriptor fd refers to
27 a file of type fdtype. The fdtype argument specifies one of the S_IF*
28 constants defined in <sys/stat.h> and documented in stat(2) (e.g.,
29 S_IFREG).
30
32 The isfdtype() function returns 1 if the file descriptor fd is of type
33 fdtype and 0 if it is not. On failure, -1 is returned and errno is set
34 to indicate the error.
35
37 The isfdtype() function can fail with any of the same errors as fs‐
38 tat(2).
39
41 Portable applications should use fstat(2) instead.
42
44 None.
45
47 It appeared in the draft POSIX.1g standard. It is present on OpenBSD
48 and Tru64 UNIX (where the required header file in both cases is just
49 <sys/stat.h>, as shown in the POSIX.1g draft).
50
52 fstat(2)
53
54
55
56Linux man-pages 6.04 2023-03-30 isfdtype(3)