tags:

views:

34

answers:

1

Is size of _POSIX_PATH_MAX is same for all unix flovors(linux,solaris)..

+4  A: 

No, it's not even necessarily the same for given instances of the exact same version of the kernel. In most kernel's its a configurable parameter. It will often require a kernel recompile or relink to change, but it can change without having a whole new kernel.

On some (I think most nowadays) systems that macro doesn't translate into an integer literal, it translates to a system call that returns an integer. So if the kernel allows the system to be reconfigured at runtime it will return the current value for the parameter.

I would simply assume that it can't change during the lifetime of your program. If you assume it can change at any time you end up with race conditions where the value changes in between the time you read it and the time you use it. If you just explicitly state that your program assumes it never changes during the lifetime of the program, then system admins who run it will have to adopt the practice they should be adopting anyway and only change the kernel parameter at startup.

There are three POSIX specified calls that will interest you here:

I would recommend hunting down other sources as well to get a good feel for which variables are widely supported and which aren't.

Omnifarious
Which is why there is a parameter to use...
dmckee
And it would be different on 64 bit *nix yes?
tommieb75
@tommieb75: It's not likely that particular system parameter changes much between 32 and 64 bit systems.
Omnifarious
@Omnifarious: ok...what about 64 bit filesystems on 64bit *nix? Just a thought...should add that into your answer - what you think?
tommieb75
@tommieb75: For 64 bit filesystems, the path length will not change. What might change for 64 bit systems in general that's filesystem related is the maximum inode number the maximum process ID and other similar parameters. But the maximum path length won't. It's implementation has little to do with the number of bits in the architecture.
Omnifarious
@Omnifarious: ahhh ok...cool! :D
tommieb75