ulimit -- You don't need sources! (kind of long)

gregg.r.siegfried grs at cbnews.ATT.COM
Thu May 4 09:36:15 AEST 1989


In article <5627 at xyzzy.UUCP> duncan at rtp48.dg.com (W. Lee Duncan) writes:
>Simply move /bin/login to, e.g. /usr/lib/old_login (and make it non-setuid).
>Then, create a new /bin/login program (which will be setuid to root):

[ C program that raises ulimit and invokes login mostly deleted ]

>        ulimit(SOME_BIG_NUMBER);            /* set some big ulimit */
         ulimit(2,SOME_BIG_NUMBER);          /* would probably work better */

Aside from the minor correction above, this approach does work.  It does
have some minor tradeoffs, however.  The problem I've always had with this
is that all user processes (or the ones in your "database") have a higher
ulimit, while all the non-login processes retain the 1K ulimit.  If you
use the at(1) command (is "at(1) command" redundant BTW? :-), you'll have
to alias "at" to "ulimit 2048;/usr/bin/at $*" since at tries to reproduce
the environment of the user submitting the job (oohh that sounds IBMish)
exactly, and because your at job is running with the cron daemon's 1 
Meg ulimit, it will fail in its attempt to raise it to SOME_LARGE_NUMBER,
and the only work it will do is send you a mail message reading
something like "ulimit: bad number".  I was always a stickler for 
consistency and used the CDLIMIT define in sys/param.h to raise the 
thing globally.  But, I guess a lot of people don't have that luxury.

The last time I observed anyone using a front end to login to raise
the ulimit, and thus the at(1) problem, was with SVR2, but that would
make sense because starting with SVR3, ulimit became a tunable, and 
people quit thinking of silly things to do to raise it.

It was a fairly easy to fix cron to stop the unpleasant at behavior,
as I recall, but in practice most people stuck with raising the 
ulimit in /etc/rc before cron was started.  Yeah!  Raise it in
TWO places.  Now THAT's elegant. ;-)

Gregg Siegfried
Speaking for myself, of course..



More information about the Comp.bugs.sys5 mailing list