OpenBSD Handbook Manuals
Search

isfdtype(3)

Canonical URL: /isfdtype.3/

ISFDTYPE(3) Library Functions Manual ISFDTYPE(3)

isfdtypedetermine whether a file descriptor is of a specific type

#include <sys/stat.h>

int
isfdtype(int fd, int fdtype);

The () function checks whether or not the file descriptor fd is of type fdtype.

A list of possible file types may be found in stat(2) and the <sys/stat.h> include file.

The isfdtype() function returns 1 if fd is of type fdtype and 0 if it is not. If isfdtype() fails, a value of -1 is returned and the global variable errno is set to indicate the error.

The following error codes may be set in errno:

[]
fd is not a valid open file descriptor.
[]
An I/O error occurred while reading from or writing to the file system.

stat(2)

The isfdtype() function first appeared in OpenBSD 3.3.

OpenBSD 7.9 January 25, 2019 ISFDTYPE(3)

Need conceptual guidance? Continue in the OpenBSD Handbook.