ISFDTYPE(3) BSD Programmer's Manual ISFDTYPE(3)NAMEisfdtype - test if a file descriptor is of a specified type
SYNOPSIS
#include <sys/stat.h>
int
isfdtype(int fd, int fdtype);
DESCRIPTION
The isfdtype() call determines whether the file descriptor fd refers to a
file or object of the type identified by fdtype. The following values of
fdtype are supported:
S_IFSOCK Returns true if the descriptor refers to a socket or fifo.
S_IFIFO Returns true if the descriptor refers to a fifo or socket.
S_IFCHR Returns true if the descriptor refers to a character special
device.
S_IFDIR Returns true if the descriptor refers to a directory.
S_IFBLK Returns true if the descriptor refers to a block special de-
vice.
S_IFREG Returns true if the descriptor refers to a regular file.
S_IFTTY Returns true if the descriptor refers to a character special
device for a terminal (see tty(4)).
DIAGNOSTICS
The function returns 0 if the descriptor is not of the specified type,
and a 1 if the descriptor is of that type. It returns -1 if an error is
detected.
ERRORS
The call succeeds unless:
[EBADF] fd is not a valid descriptor.
SEE ALSOstat(2), isatty(3), tty(4)STANDARDS
The isatty() function conforms to draft 6.6 of IEEE Std 1003.1g when
fdtype is S_IFSOCK. The other types are provided as extensions.
October 31, 1997 1