[Previous]
[Contents]
[Next]

pathconf()

return the value of a configurable limit

Synopsis:

#include <unistd.h>
long pathconf( const char *path, int name );

Description:

The pathconf() function returns a value of a configurable limit indicated by name, which is associated with the filename given in path.

Configurable limits are defined in <unistd.h>, and contain at least the following values:

_PC_LINK_MAX
Maximum value of a files link count.
_PC_MAX_CANON
Maximum number of bytes in a terminals canonical input buffer (edit buffer).
_PC_MAX_INPUT
Maximum number of bytes in a terminals raw input buffer.
_PC_NAME_MAX
Maximum number of bytes in a file name (not including the terminating null).
_PC_PATH_MAX
Maximum number of bytes in a pathname (not including the terminating null).
_PC_PIPE_BUF
Maximum number of bytes that can be written atomically when writing to a pipe.
_PC_CHOWN_RESTRICTED
If defined (not -1), indicates that the use of the chown() function is restricted to a process with appropriate privileges, and to changing the group ID of a file to the effective group ID of the process or to one of its supplementary group IDs.
_PC_NO_TRUNC
If defined (not -1), indicates that the use of pathname components longer than the value given by _PC_NAME_MAX will generate an error.
_PC_VDISABLE
If defined (not -1), this is the character value which can be used to individually disable special control characters in the termios control structure.

Returns:

The requested configurable limit. If an error occurs, pathconf() returns -1, and errno is set.

Errors:

EINVAL
name is invalid, or the indicated limit is not supported.
EACCES
Search permission is denied for a component of path.
ENAMETOOLONG
path, or a component of path, is too long.
ENOENT
The file does not exist.
ENOTDIR
A component of the path prefix is not a directory.

Examples:

#include <stdio.h>
#include <unistd.h>

void main()
  {
    long value;

    value = pathconf( "/dev/con1", _PC_MAX_INPUT );
    printf( "Input buffer size is %ld bytes\n",
        value );
  }

Classification:

POSIX 1003.1

Safety:
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

errno, fpathconf()


[Previous]
[Contents]
[Next]