ulimit considered braindamaged ?

Karl Kleinpaste karl at cbrma.att.com
Fri Jan 9 22:25:52 AEST 1987


# gwyn at brl.arpa writes:
# >The correct solution is to change the kernel's initial ulimit
# >setting to be "infinite"; it is easy enough to lower it when
# >so desired (e.g. in /etc/profile).  If you can't patch the
# >kernel, then modify init(1M) to raise the ulimit, which it can
# >do since it runs as super-user.  Failing that, you could try
#
# Modifying init is not possible for sites running sourceless 3Bs.
#
# >running a "pre-login shell" that is set-UID 0, which would
# >simply raise the ulimit, change the UID, and exec a real shell.
#
# Inserting a program as a pre-login shell will take care of normal
# mortals who login in the routine manner.  It won't do anything for
# things like cron-initiated stuff (including, significantly, large cron
# logs).  We use the following script on a small army of our machines
# around here.  I offer it without any guarantees whatever, but with the
# evidence that we have BIG ulimits on our machines.
#
# Caveat: Heaven help you if you screw up the installation of this
# hack.  It installs a pre-init program in init's place.
# 
# This article is a shar script.  You can "w|sh" from an rn prompt to
# save the script "ulimit.hack" below.
#
cat > ulimit.hack << \ENDOFFILE
# Create an intermediate program for use in between
# kernel initialization and init startup.
cat > ulimit.init.c << \EOF
main(argc, argv)
int argc;
char *argv[];
{

	ulimit(2, 32768L);      /* "2" sets ulimit.  32768 = 16Mb. */
	/* roll your own size if that's not big enough. */
	execv("/etc/real.init", argv);
}
EOF
# Compile it and put it in place of the usual init program.
cc ulimit.init.c -o ulimit.init
mv /etc/init /etc/real.init
mv ulimit.init /etc/init
chmod 0754 /etc/init	    # same as old init
# Done.  The next time the machine is booted, the
# ulimit will be suitably enlarged.
exit 0
ENDOFFILE
exit 0
-- 
Karl



More information about the Comp.unix.questions mailing list