I am currently reading Michael Kerrisk "The Linux programming interface". In chapter dedicated to system limits it is written:
SUSv3 requires that the value returned by sysconf() for a particular limit be constant for the lifetime of the calling process.
Does that mean that if I get current system limits and use them somehow in the current process, It is a rule of good taste to get them again in a child process after fork?
In principle, yes. If you want a dynamic value that reflects the actual limit set on a particular process, it's best to call sysconf() once per process.
However, some configuration values will certainly not change. For example, PAGESIZE won't be changing between calls to fork(). Invoking sysconf() again may not be necessary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With