The POSIX.1 standard specifies a number of parameters that describe the limitations of the file system. It's possible for the system to have a fixed, uniform limit for a parameter, but this isn't the usual case. On most systems, it's possible for different file systems (and, for some parameters, even different files) to have different maximum limits. For example, this is very likely if you use NFS to mount some of the file systems from other machines.
Each of the following macros is defined in limits.h only if the system has a fixed, uniform limit for the parameter in question. If the system allows different file systems or files to have different limits, then the macro is undefined; use pathconf or fpathconf to find out the limit that applies to a particular file. the section called “Using pathconf”.
Each parameter also has another macro, with a name starting with _POSIX, which gives the lowest value that the limit is allowed to have on any POSIX system. the section called “Minimum Values for File System Limits”.
int function>LINK_MAX/function> The uniform system limit (if any) for the number of names for a given file. the section called “Hard Links”.
int function>MAX_CANON/function> The uniform system limit (if any) for the amount of text in a line of input when input editing is enabled. the section called “Two Styles of Input: Canonical or Not”.
int function>MAX_INPUT/function> The uniform system limit (if any) for the total number of characters typed ahead as input. the section called “I/O Queues”.
int function>NAME_MAX/function> The uniform system limit (if any) for the length of a file name component.
int function>PATH_MAX/function> The uniform system limit (if any) for the length of an entire file name (that is, the argument given to system calls such as open).
int function>PIPE_BUF/function> The uniform system limit (if any) for the number of bytes that can be written atomically to a pipe. If multiple processes are writing to the same pipe simultaneously, output from different processes might be interleaved in chunks of this size. Chapter 16.
These are alternative macro names for some of the same information.
int function>MAXNAMLEN/function> This is the BSD name for NAME_MAX. It is defined in dirent.h.
int function>FILENAME_MAX/function> The value of this macro is an integer constant expression that represents the maximum length of a file name string. It is defined in stdio.h.
Unlike PATH_MAX, this macro is defined even if there is no actual limit imposed. In such a case, its value is typically a very large number. This is always the case on the GNU system.
Usage Note: Don't use FILENAME_MAX as the size of an array in which to store a file name! You can't possibly make an array that big! Use dynamic allocation (the section called “Allocating Storage For Program Data”) instead.