---
name: "pathconf"
section: "2"
platform: "linux"
package: "freebsd-manpages"
version: "6.0-5"
release: "Debian 4.0 (Etch)"
platforms: ["linux", "freebsd", "macos"]
url: "https://new.carta.tech/pathconf"
---

# pathconf(2)

get configurable pathname variables

## NAME

**pathconf**, **fpathconf** – get configurable pathname variables

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

**#include \<unistd.h\>**

*long*\

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

*long*\

**fpathconf**(*int fd*, *int name*);

## DESCRIPTION

The **pathconf**() and **fpathconf**() system calls provide a method for applications to determine the current value of a configurable system limit or option variable associated with a pathname or file descriptor.

For **pathconf**(), the *path* argument is the name of a file or directory. For **fpathconf**(), the *fd* argument is an open file descriptor. The *name* argument specifies the system variable to be queried. Symbolic constants for each name value are found in the include file \<unistd.h\>.

The available values are as follows:

- \_PC\_LINK\_MAX

  The maximum file link count.

- \_PC\_MAX\_CANON

  The maximum number of bytes in terminal canonical input line.

- \_PC\_MAX\_INPUT

  The minimum maximum number of bytes for which space is available in a terminal input queue.

- \_PC\_NAME\_MAX

  The maximum number of bytes in a file name.

- \_PC\_PATH\_MAX

  The maximum number of bytes in a pathname.

- \_PC\_PIPE\_BUF

  The maximum number of bytes which will be written atomically to a pipe.

- \_PC\_CHOWN\_RESTRICTED

  Return 1 if appropriate privilege is required for the [chown(2)](/chown/2.md) system call, otherwise 0. IEEE Std 1003.1-2001 (“POSIX.1”) requires appropriate privilege in all cases, but this behavior was optional in prior editions of the standard.

- \_PC\_NO\_TRUNC

  Return greater than zero if attempts to use pathname components longer than {NAME\_MAX} will result in an \[ENAMETOOLONG\] error; otherwise, such components will be truncated to {NAME\_MAX}. IEEE Std 1003.1-2001 (“POSIX.1”) requires the error in all cases, but this behavior was optional in prior editions of the standard, and some non-POSIX-compliant file systems do not support this behavior.

- \_PC\_VDISABLE

  Returns the terminal character disabling value.

- \_PC\_ASYNC\_IO

  Return 1 if asynchronous I/O is supported, otherwise 0.

- \_PC\_PRIO\_IO

  Returns 1 if prioritised I/O is supported for this file, otherwise 0.

- \_PC\_SYNC\_IO

  Returns 1 if synchronised I/O is supported for this file, otherwise 0.

- \_PC\_ALLOC\_SIZE\_MIN

  Minimum number of bytes of storage allocated for any portion of a file.

- \_PC\_FILESIZEBITS

  Number of bits needed to represent the maximum file size.

- \_PC\_REC\_INCR\_XFER\_SIZE

  Recommended increment for file transfer sizes between \_PC\_REC\_MIN\_XFER\_SIZE and \_PC\_REC\_MAX\_XFER\_SIZE.

- \_PC\_REC\_MAX\_XFER\_SIZE

  Maximum recommended file transfer size.

- \_PC\_REC\_MIN\_XFER\_SIZE

  Minimum recommended file transfer size.

- \_PC\_REC\_XFER\_ALIGN

  Recommended file transfer buffer alignment.

- \_PC\_SYMLINK\_MAX

  Maximum number of bytes in a symbolic link.

- \_PC\_ACL\_EXTENDED

  Returns 1 if an Access Control List (ACL) can be set on the specified file, otherwise 0.

- \_PC\_ACL\_PATH\_MAX

  Maximum number of ACL entries per file.

- \_PC\_CAP\_PRESENT

  Returns 1 if a capability state can be set on the specified file, otherwise 0.

- \_PC\_INF\_PRESENT

  Returns 1 if an information label can be set on the specified file, otherwise 0.

- \_PC\_MAC\_PRESENT

  Returns 1 if a Mandatory Access Control (MAC) label can be set on the specified file, otherwise 0.

## RETURN VALUES

If the call to **pathconf**() or **fpathconf**() is not successful, -1 is returned and *errno* is set appropriately. Otherwise, if the variable is associated with functionality that does not have a limit in the system, -1 is returned and *errno* is not modified. Otherwise, the current variable value is returned.

## ERRORS

If any of the following conditions occur, the **pathconf**() and **fpathconf**() system calls shall return -1 and set *errno* to the corresponding value.

- \[EINVAL\]

  The value of the *name* argument is invalid.

- \[EINVAL\]

  The implementation does not support an association of the variable name with the associated file.

The **pathconf**() system call will fail if:

- \[ENOTDIR\]

  A component of the path prefix is not a directory.

- \[ENAMETOOLONG\]

  A component of a pathname exceeded {NAME\_MAX} characters (but see \_PC\_NO\_TRUNC above), or an entire path name exceeded {PATH\_MAX} characters.

- \[ENOENT\]

  The named file does not exist.

- \[EACCES\]

  Search permission is denied for a component of the path prefix.

- \[ELOOP\]

  Too many symbolic links were encountered in translating the pathname.

- \[EIO\]

  An I/O error occurred while reading from or writing to the file system.

- \[EBADF\]

  The *fd* argument is not a valid open file descriptor.

- \[EIO\]

  An I/O error occurred while reading from or writing to the file system.

The **fpathconf**() system call will fail if:

## SEE ALSO

[sysctl(3)](/sysctl/3.md)

## HISTORY

The **pathconf**() and **fpathconf**() system calls first appeared in 4.4BSD.
