Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System limits for child processes in linux

Tags:

c

linux

unix

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?

like image 406
Seleznev Anton Avatar asked May 31 '26 07:05

Seleznev Anton


1 Answers

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.

like image 199
slezica Avatar answered Jun 02 '26 22:06

slezica



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!