![]() |
![]() |
![]() |
![]() |
Determine whether a file descriptor refers to a socket
#include <sys/stat.h> int isfdtype( int filedes, int fdtype );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The isfdtype() function determines whether the file descriptor filedes has the properties identified by fdtype.
![]() |
This function is based on a POSIX draft; for better portability, call
fstat()
and check the buffer that it fills in:
if ((buf.st_mode & S_IFMT) == fdtype) /* The file descriptor matches fdtype. */ else /* The file descriptor doesn't match fdtype. */ instead of calling isfdtype(). |
Safety: | |
---|---|
Cancellation point | Yes |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
fstat(), isatty(), socket(), stat()
![]() |
![]() |
![]() |
![]() |