On Tue, Nov 18, 2008 at 08:54:47AM +1100, Peter Miller wrote:
> Ho Folks,
> 
> yet another puzzle for you.
> 
> fork(2) can fail and report EAGAIN if
> a. run out of a resource other than memory
> b. too many processes on the system
> c. too many processes per uid
> d. too many child processes per process
> 
> for each of the above, on linux, how the heck do you 
> 1. obtain current usage
> 2. obtain limit
> 
> afaics getrusage(2) is no help
> 
> (d)(2) can be done by getrlimit(RLIMIT_NPROC) or sysconf(_SC_CHILD_MAX)
> except that both man pages are pretty vague as to whether they are (c)
> or (d).
> 
> It would be great if libexplain could distinguish between the 4 cases.
> 
> suggestions?

Peter,

I remember some argy bargy on the linux kernel mailing list
between the author of glibc (Ulrich Drepper) and Linus about various 
getconf/sysconf
stuff.  Ulrich wanted to get these figures to satisfy some POSIXism.

Linus was adamant that he was not going to have such fixed numbers in the
kernel; that these in principal could certainly change dynamically.
Per process, per hour, per user or whatever.

So, even in the event  you are able to get some figures for these, they
may be made up in glibc for the sake of POSIX conformance (POSIX_ME_HARDER?)
and may not bear much relation to real in-kernel limits.

I'm afraid I can't find a link to the thread, and this was quite some time
ago (5 years?) so the situation may have changed.
Also I might be slightly misrepresenting the actual thread, since this
is all from memory.

Regards,
Matt

_______________________________________________
coders mailing list
coders@slug.org.au
http://lists.slug.org.au/listinfo/coders

Reply via email to