I\'m presently writing a filesystem. The statvfs (and even the statfs
) structs contain a field specifying the maximum length of a name in that path. As PATH_M
PATH_MAX
mostly behaves as a property of the file system function call interface, so I don't think it makes much sense to have it vary across directories.
For example, renaming or moving a directory with large directory trees in it may make the longest absolute pathname longer and it would be complicated and inefficient to limit that.
Instead, PATH_MAX
serves to allow the kernel to copy passed pathnames to temporary unpaged memory, which can then be processed without needing to allow for a page fault at each access. Allocating huge amounts of such memory may block most other things the kernel is doing or even cause kernel panics.