Return the value of a configurable limit


#include <unistd.h>

long pathconf( const char* path, 
               int name );


The name of the file whose limit you want to get.
The name of the configurable limit; see below.



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


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 <confname.h>, and include at least the following values:

Defined if asynchronous I/O is supported for the file.
If defined (not -1), indicates that the use of the chown() function is restricted to a process with root 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.
Defined (not -1) if the filesystem permits the unlinking of a directory.
Maximum value of a file's link count.
Maximum number of bytes in a terminal's canonical input buffer (edit buffer).
Maximum number of bytes in a terminal's raw input buffer.
Maximum number of bytes in a file name (not including the terminating null).
If defined (not -1), indicates that the use of pathname components longer than the value given by _PC_NAME_MAX will generate an error.
Maximum number of bytes in a pathname (not including the terminating null).
Maximum number of bytes that can be written atomically when writing to a pipe.
Defined (not -1) if prioritized I/O is supported for the file.
Defined (not -1) if synchronous I/O is supported for the file.
If defined (not -1), this is the character value which can be used to individually disable special control characters in the termios control structure.


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


Search permission is denied for a component of path.
The name argument is invalid, or the indicated limit isn't supported.
Too many levels of symbolic links or prefixes.
The path argument, or a component of path, is too long.
The file doesn't exist.
The pathconf() function isn't implemented for the filesystem specified in path.
A component of the path prefix isn't a directory.


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

int main( void )
    long value;

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


POSIX 1003.1

Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

chown(), confstr(), errno, fpathconf(), sysconf(), termios

getconf in the Utilities Reference

Understanding System Limits chapter of the Neutrino User's Guide