isfdtype()

QNX SDP8.0C Library ReferenceAPIDeveloper

Test the file type of a file descriptor

Synopsis:

#include <sys/stat.h>

int isfdtype( int filedes, 
              int fdtype );

Arguments:

filedes
The file descriptor that you want to test.
fdtype
The file type that you want to test for. The valid values and the type of file that they test for are:
  • S_IFIFO — socket
  • S_IFCHR — character special
  • S_IFDIR — directory
  • S_IFNAM — special named file
  • S_IFBLK — block special
  • S_IFREG — regular
  • S_IFLNK — symbolic link
  • S_IFSOCK — socket

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The isfdtype() function determines whether the file descriptor filedes refers to a file of the type fdtype.

Note:
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. */

Returns:

1
The filedes file descriptor matches fdtype.
0
The filedes file descriptor doesn't match fdtype.
-1
An error occurred (errno is set).

Errors:

Any value from the errors section in fstat().

Classification:

QNX OS

Safety:
Cancellation pointYes
Signal handlerYes
ThreadYes
Page updated: