fpathconf(3)
๐ fpathconf(3) โ the glow-up ๐
okay bestie, gather round, because we're talking about fpathconf and pathconf from the Library Functions Manual, and honestly? it's giving "the system is telling you its limits" energy. ๐ฆ
โจ NAME โจ
fpathconf, pathconf โ get configuration values for files. no cap, that's literally it. ๐
๐ LIBRARY ๐
Standard C library (libc, -lc). the classic. the blueprint. ๐ซถ
๐ SYNOPSIS ๐
#include <unistd.h>
long fpathconf(int fd, int name);
long pathconf(const char *path, int name);
look at her. two tiny little functions. iconic. โจ
๐ธ DESCRIPTION ๐ธ
so fpathconf() gets a value for the configuration option name for the open file descriptor fd. ๐
and pathconf() gets a value for configuration option name for the filename path. twin behaviour, different entry point, we love a duo. ๐
here's the important bit: the corresponding macros defined in <unistd.h> are minimum values. like, the bare minimum, the lowest bar. if an app wants to actually take advantage of values that may change, it can call fpathconf() or pathconf(), and those calls may yield more liberal results. so don't be shy, ask the live system, she might be feeling generous. ๐
setting name equal to one of these constants below returns the following configuration options:
_PC_LINK_MAXโ the maximum number of links to the file. iffdorpathrefer to a directory, then the value applies to the whole directory. the corresponding macro is_POSIX_LINK_MAX._PC_MAX_CANONโ the maximum length of a formatted input line, wherefdorpathmust refer to a terminal. the corresponding macro is_POSIX_MAX_CANON._PC_MAX_INPUTโ the maximum length of an input line, wherefdorpathmust refer to a terminal. the corresponding macro is_POSIX_MAX_INPUT._PC_NAME_MAXโ the maximum length of a filename in the directorypathorfdthat the process is allowed to create. the corresponding macro is_POSIX_NAME_MAX._PC_PATH_MAXโ the maximum length of a relative pathname whenpathorfdis the current working directory. the corresponding macro is_POSIX_PATH_MAX._PC_PIPE_BUFโ the maximum number of bytes that can be written atomically to a pipe of FIFO. forfpathconf(),fdshould refer to a pipe or FIFO. forfpathconf(),pathshould refer to a FIFO or a directory; in the latter case, the returned value corresponds to FIFOs created in that directory. the corresponding macro is_POSIX_PIPE_BUF.
yeah, the page really does say fpathconf() both times there, i'm just the messenger bestie, i don't make the rules ๐
_PC_CHOWN_RESTRICTEDโ this returns a positive value if the use ofchown(2)andfchown(2)for changing a file's user ID is restricted to a process with appropriate privileges, and changing a file's group ID to a value other than the process's effective group ID or one of its supplementary group IDs is restricted to a process with appropriate privileges. according to POSIX.1, this variable shall always be defined with a value other than -1. the corresponding macro is_POSIX_CHOWN_RESTRICTED.
if fd or path refers to a directory, then the return value applies to all files in that directory.
_PC_NO_TRUNCโ this returns nonzero if accessing filenames longer than_POSIX_NAME_MAXgenerates an error. the corresponding macro is_POSIX_NO_TRUNC._PC_VDISABLEโ this returns nonzero if special character processing can be disabled, wherefdorpathmust refer to a terminal.
๐ RETURN VALUE ๐
the return value of these functions is one of the following, and bestie you NEED to know which one you're getting:
- on error,
-1is returned anderrnois set to indicate the error (for example,EINVAL, indicating thatnameis invalid). ๐ - if
namecorresponds to a maximum or minimum limit, and that limit is indeterminate,-1is returned anderrnois not changed. (to distinguish an indeterminate limit from an error, seterrnoto zero before the call, and then check whethererrnois nonzero when-1is returned.) this is the trap, this is the sneaky one, do the little ritual, it's worth it. ๐ฏ๏ธ - if
namecorresponds to an option, a positive value is returned if the option is supported, and-1is returned if the option is not supported. - otherwise, the current value of the option or limit is returned. this value will not be more restrictive than the corresponding value that was described to the application in
<unistd.h>or<limits.h>when the application was compiled.
๐ฅ ERRORS ๐ฅ
EACCES(pathconf()) โ search permission is denied for one of the directories in the path prefix ofpath.EBADF(fpathconf()) โfdis not a valid file descriptor.EINVALโnameis invalid.EINVALโ the implementation does not support an association ofnamewith the specified file.ELOOP(pathconf()) โ too many symbolic links were encountered while resolvingpath.ENAMETOOLONG(pathconf()) โpathis too long.ENOENT(pathconf()) โ a component ofpathdoes not exist, orpathis an empty string.ENOTDIR(pathconf()) โ a component used as a directory inpathis not in fact a directory.
๐ ATTRIBUTES ๐
for an explanation of the terms used in this section, see attributes(7). here's the tea:
- Interface:
fpathconf(),pathconf()โ Attribute: Thread safety โ Value: MT-Safe โญ
๐ STANDARDS ๐
POSIX.1-2008. she's certified. periodt.
๐ฆ HISTORY ๐ฆ
POSIX.1-2001. a legacy queen, lowkey.
๐ NOTES ๐
files with name lengths longer than the value returned for name equal to _PC_NAME_MAX may exist in the given directory. so like, the limit said one thing and the directory said another, and the directory won. ๐ญ
some returned values may be huge; they are not suitable for allocating memory. do NOT try to malloc that number bestie i am begging you ๐๐
๐ SEE ALSO ๐
getconf(1), open(2), statfs(2), confstr(3), sysconf(3)
go read them, they're all part of the same friend group. ๐ซถ
and that's the whole page!! โจ this came to you from Linux man-pages 6.20, dated 2026-02-08 โ so if you're reading this on some future date, blame the timestamp, not me. slay, go check your limits responsibly, mwah ๐๐
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ the page's license: Linux-man-pages-copyleft
- Copyright 1993, Thomas Koenig <ig25@rz.uni-karlsruhe.de>
- Copyright 2017, Michael Kerrisk <mtk.manpages@gmail.com>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms