Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!rutgers!clyde!cbatt!cbuxc!cbuxb!cbrma!karl
From: karl@cbrma.att.com (Karl Kleinpaste)
Newsgroups: comp.unix.questions
Subject: Re: ulimit considered braindamaged ?
Message-ID: <5599@cbrma.att.com>
Date: Fri, 9-Jan-87 07:25:52 EST
Article-I.D.: cbrma.5599
Posted: Fri Jan  9 07:25:52 1987
Date-Received: Tue, 13-Jan-87 01:15:08 EST
References: <790@maynard.BSW.COM> <5486@brl-smoke.ARPA>
Organization: AT&T-BL, Columbus
Lines: 51
Summary: here's a fix we use on sourceless machines

# gwyn@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