fpathconf

Retrieves file implementation characteristics.

Format

#include  <unistd.h>

long int fpathconf  (int filedes, int name);

Arguments

filedes
An open file descriptor.
name
The configuration attribute to query. If this attribute is not applicable to the file specified by the filesdes argument, fpathconf returns an error.

Description

This function allows an application to retrieve the characteristics of operations supported by the file system underlying the file named by the filesdes argument. Read, write, or execute permission of the named file is not required, but you must be able to search all directories in the path leading to the file.

Symbolic values for the name argument are defined in the <unistd.h> header file as follows:
_PC_LINK_MAX   The maximum number of links to the file. If the filedes argument refers to a directory, the value returned applies to the directory itself. 
_PC_MAX_CANON   The maximum number of bytes in a canonical input line. This is applicable only to terminal devices. 
_PC_MAX_INPUT   The number of types allowed in an input queue. This is applicable only to terminal devices. 
_PC_NAME_MAX   Maximum number of bytes in a filename (not including a terminating null). The byte range value is between 13 and 255. This is applicable only to a directory file. The value returned applies to filenames within the directory. 
_PC_PATH_MAX   Maximum number of bytes in a pathname (not including a terminating null). The byte value is never larger than 65,535. This is applicable only to a directory file. The value returned is the maximum length of a relative pathname when the specified directory is the working directory. 
_PC_PIPE_BUF   Maximum number of bytes guaranteed to be written atomically. This is applicable only to a FIFO. The value returned applies to the referenced object. If the path argument refers to a directory, the value returned applies to any FIFO that exists or can be created within the directory. 
_PC_CHOWN_RESTRICTED   The value returned applies to any files (other than directories) that exist or can be created within the directory. This is applicable only to a directory file. 
_ PC_NO_TRUNC   Returns 1 if supplying a component name longer than allowed by NAME_MAX causes an error. Returns 0 (zero) if long component names are truncated. This is applicable only to a directory file. 
_PC_VDISABLE   This is always 0 (zero); no disabling character is defined. This is applicable only to a terminal device. 

Return Values
The resultant value for the configuration attribute specified in the name argument. 
-1  Indicates an error; errno is set to one of the following values:

  • EINVAL - The name argument specifies an unknown or inapplicable characteristic.

  • EBADF - the filedes argument is not a valid file descriptor.
 


Previous Page | Next Page | Table of Contents | Index