pathname, filename
how pathnames are encoded and interpreted
- Provided by: manpages (Version: 6.17-1)
- Report a bug
how pathnames are encoded and interpreted
Some system calls allow you to pass a pathname as a parameter. When writing code that deals with pathnames, there are kernel-space requirements that you must comply with, and user-space requirements that you should comply with.
The kernel stores pathnames as C strings, that is, sequences of non-null bytes terminated by a null byte. There are a few general rules that apply to all pathnames:
Some filesystems or APIs may apply further restrictions, such as requiring shorter filenames, or restricting the allowed bytes in a filename.
For maximum interoperability, programs and users should also limit the characters that they use for their own pathnames to characters in the POSIX Portable Filename Character Set.
POSIX.1-2024 encourages implementations to disallow creation of filenames containing new-line characters. Linux doesn't follow this, and allows using new-line characters.
limits.h(0p), open(2), fpathconf(3), path_resolution(7), mount(8)