How to determine system value for _POSIX_PATH_MAX How to determine system value for _POSIX_PATH_MAX unix unix

How to determine system value for _POSIX_PATH_MAX


The tool to use, according to POSIX, is named getconf(1):

  $ getconf _POSIX_PATH_MAX  256


One more way to get it's value.

#include "stdio.h"#include "unistd.h"#include "limits.h"int main(){    printf ("Value :: %d \n", _POSIX_PATH_MAX);    return 0;}


#define one of the following

#define _POSIX_SOURCE#define _POSIX_C_SOURCE 1 /* or any value larger then 1 */#define _XOPEN_SOURCE

before #includeing <limits.h>and the compiler will see _POSIX_PATH_MAX.

You also can specify this on the command line via the compiler option -D:

gcc -c main.c -D_POSIX_C_SOURCE=1

for example.