1ISFDTYPE(3) Linux Programmer's Manual ISFDTYPE(3)
2
3
4
6 isfdtype - test file type of a file descriptor
7
9 #include <sys/stat.h>
10 #include <sys/socket.h>
11
12 int isfdtype(int fd, int fdtype);
13
14 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
15
16 isfdtype():
17 Since glibc 2.20:
18 _DEFAULT_SOURCE
19 Before glibc 2.20:
20 _BSD_SOURCE || _SVID_SOURCE
21
23 The isfdtype() function tests whether the file descriptor fd refers to
24 a file of type fdtype. The fdtype argument specifies one of the S_IF*
25 constants defined in <sys/stat.h> and documented in stat(2) (e.g.,
26 S_IFREG).
27
29 The isfdtype() function returns 1 if the file descriptor fd is of type
30 fdtype and 0 if it is not. On error, -1 is returned and errno is set
31 to indicate the cause.
32
34 The isfdtype() function can fail with any of the same errors as
35 fstat(3).
36
38 The isfdtype() function is not specified in any standard, but did
39 appear in the draft POSIX.1g standard. It is present on OpenBSD and
40 Tru64 UNIX (where the required header file in both cases is just
41 <sys/stat.h>, as shown in the POSIX.1g draft), and possibly other sys‐
42 tems.
43
45 Portable applications should use fstat(3) instead.
46
48 fstat(3)
49
51 This page is part of release 5.04 of the Linux man-pages project. A
52 description of the project, information about reporting bugs, and the
53 latest version of this page, can be found at
54 https://www.kernel.org/doc/man-pages/.
55
56
57
58Linux 2014-03-13 ISFDTYPE(3)