]>
Commit | Line | Data |
---|---|---|
af81e9cd MK |
1 | '\" t |
2 | .\" Copyright (C) 2014 Michael Kerrisk <mtk.manpages@gmail.com> | |
3 | .\" | |
4 | .\" %%%LICENSE_START(VERBATIM) | |
5 | .\" Permission is granted to make and distribute verbatim copies of this | |
6 | .\" manual provided the copyright notice and this permission notice are | |
7 | .\" preserved on all copies. | |
8 | .\" | |
9 | .\" Permission is granted to copy and distribute modified versions of this | |
10 | .\" manual under the conditions for verbatim copying, provided that the | |
11 | .\" entire resulting derived work is distributed under the terms of a | |
12 | .\" permission notice identical to this one. | |
13 | .\" | |
14 | .\" Since the Linux kernel and libraries are constantly changing, this | |
15 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
16 | .\" responsibility for errors or omissions, or for damages resulting from | |
17 | .\" the use of the information contained herein. The author(s) may not | |
18 | .\" have taken the same level of care in the production of this manual, | |
19 | .\" which is licensed free of charge, as they might when working | |
20 | .\" professionally. | |
21 | .\" | |
22 | .\" Formatted or processed versions of this manual, if unaccompanied by | |
23 | .\" the source, must acknowledge the copyright and authors of this work. | |
24 | .\" %%%LICENSE_END | |
25 | .\" | |
26 | .TH ISFDTYPE 3 2014-03-13 "Linux" "Linux Programmer's Manual" | |
27 | .SH NAME | |
28 | isfdtype \- test file type of a file descriptor | |
29 | .SH SYNOPSIS | |
30 | .nf | |
31 | .B #include <sys/stat.h> | |
32 | .B #include <sys/socket.h> | |
f90f031e | 33 | .PP |
95a456f5 | 34 | .BI "int isfdtype(int " fd ", int " fdtype ); |
af81e9cd | 35 | .fi |
68e4db0a | 36 | .PP |
af81e9cd MK |
37 | .in -4n |
38 | Feature Test Macro Requirements for glibc (see | |
39 | .BR feature_test_macros (7)): | |
40 | .in | |
68e4db0a | 41 | .PP |
af81e9cd MK |
42 | .BR isfdtype (): |
43 | .ad l | |
44 | .RS 4 | |
45 | .PD 0 | |
46 | .TP 4 | |
47 | Since glibc 2.20: | |
48 | _DEFAULT_SOURCE | |
49 | .TP 4 | |
50 | Before glibc 2.20: | |
51 | _BSD_SOURCE || _SVID_SOURCE | |
52 | .PD | |
53 | .RE | |
54 | .ad b | |
55 | .SH DESCRIPTION | |
56 | The | |
57 | .BR isfdtype () | |
58 | function tests whether the file descriptor | |
59 | .I fd | |
60 | refers to a file of type | |
61 | .IR fdtype . | |
62 | The | |
63 | .I fdtype | |
64 | argument specifies one of the | |
65 | .B S_IF* | |
66 | constants defined in | |
67 | .I <sys/stat.h> | |
68 | and documented in | |
69 | .BR stat (2) | |
70 | (e.g., | |
71 | .BR S_IFREG ). | |
72 | .SH RETURN VALUE | |
73 | The | |
74 | .BR isfdtype () | |
75 | function returns 1 if the file descriptor | |
76 | .I fd | |
77 | is of type | |
78 | .IR fdtype | |
79 | and 0 if it is not. | |
80 | On error, -1 is returned and | |
81 | .I errno | |
82 | is set to indicate the cause. | |
83 | .SH ERRORS | |
84 | The | |
85 | .BR isfdtype () | |
86 | function can fail with any of the same errors as | |
87 | .BR fstat (3). | |
88 | .SH CONFORMING TO | |
89 | The | |
90 | .BR isfdtype () | |
91 | function is not specified in any standard, | |
92 | but did appear in the draft POSIX.1g standard. | |
93 | It is present on OpenBSD and Tru64 UNIX | |
94 | (where the required header file in both cases is just | |
95 | .IR <sys/stat.h> , | |
96 | as shown in the POSIX.1g draft), | |
97 | and possibly other systems. | |
98 | .SH NOTES | |
99 | Portable applications should use | |
100 | .BR fstat (3) | |
101 | instead. | |
102 | .SH SEE ALSO | |
103 | .BR fstat (3) |