1ISFDTYPE(3)                Linux Programmer's Manual               ISFDTYPE(3)
2
3
4

NAME

6       isfdtype - test file type of a file descriptor
7

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

29       The isfdtype() function returns 1 if the file descriptor fd is of  type
30       fdtype and 0 if it is not.  On failure, -1 is returned and errno is set
31       to indicate the error.
32

ERRORS

34       The isfdtype() function can fail with any of the  same  errors  as  fs‐
35       tat(2).
36

CONFORMING TO

38       The  isfdtype()  function is not specified in any standard, but did ap‐
39       pear 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

NOTES

45       Portable applications should use fstat(2) instead.
46

SEE ALSO

48       fstat(2)
49

COLOPHON

51       This  page  is  part of release 5.12 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                             2021-03-22                       ISFDTYPE(3)
Impressum