O'Reilly logo

Advanced UNIX Programming by Warren W. Gay

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Obtaining Size and Configuration Information

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.

Warning

When the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required