Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

fpathconf()

Return the value of a configurable limit associated with a file

Synopsis:

#include <unistd.h>

long fpathconf( int filedes, 
                int name );

Arguments:

filedes
A file descriptor for the file whose limit you want to check.
name
The name of the configurable limit; see below.

Library:

libc

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

Description:

The fpathconf() function returns a value of a configurable limit indicated by name that's associated with the file indicated by filedes.

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

_PC_LINK_MAX
Maximum value of a file's link count.
_PC_MAX_CANON
Maximum number of bytes in a terminal's canonical input buffer (edit buffer).
_PC_MAX_INPUT
Maximum number of bytes in a terminal's 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 generates an error.
_PC_VDISABLE
If defined (not -1), this is the character value that can be used to individually disable special control characters in the termios control structure.

Returns:

The requested configurable limit, or -1 if an error occurred (errno is set).

Errors:

EINVAL
The name argument is invalid, or the indicated limit isn't supported for this filedes.
EBADF
The argument filedes is invalid.

Examples:

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

int main()
  {
    long value;

    value = fpathconf( 0, _PC_MAX_INPUT );
    printf( "Input buffer size is %ld bytes\n",
        value );
    return EXIT_SUCCESS;
  }

Classification:

POSIX 1003.1

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

confstr(), pathconf(), sysconf(), termios