If you are writing applications for several UNIX platforms, it is wisest if your application can determine the size of certain platform-specific values. One frequently needed piece of information is the maximum length of a pathname. This is needed so that pathname buffers can be safely allocated.
The pathconf(2) and fpathconf(2) functions can answer your query about the size of a pathname buffer required. The function synopsis is as follows:
#include <unistd.h> long pathconf(const char *path, int name); long fpathconf(int fd, int name);
A number of configured values can be returned to the program with these functions. The tests that can be performed are summarized in Table 6.2.
When the ...