annotate etc/ulimit.hack @ 42:8b8b7f3559a2 r19-15b104

Import from CVS: tag r19-15b104
author cvs
date Mon, 13 Aug 2007 08:54:51 +0200
parents 376386a54a3c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 #!/bin/sh
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 #
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 # ulimit.hack: Create an intermediate program for use in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 # between kernel initialization and init startup.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 # This is needed on a 3b system if the standard CDLIMIT is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 # so small that the dumped Emacs file cannot be written.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 # This program causes everyone to get a bigger CDLIMIT value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 # so that the dumped Emacs can be written out.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 #
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 # Users of V.3.1 and later should not use this; see etc/MACHINES
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 # and reconfig your kernel's CDLIMIT parameter instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 #
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 # Caveat: Heaven help you if you screw this up. This puts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 # a new program in as /etc/init, which then execs the real init.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 #
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 cat > ulimit.init.c << \EOF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 main(argc, argv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 int argc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 char *argv[];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ulimit(2, 262144L); /* "2" is the "set" command. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 /* 262,144 allows for 128Mb files to be written. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 /* If that value isn't suitable, roll your own. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 execv("/etc/real.init", argv);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 EOF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 #
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 # Compile it and put it in place of the usual init program.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 #
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 cc ulimit.init.c -o ulimit.init
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 mv /etc/init /etc/real.init
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 mv ulimit.init /etc/ulimit.init
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ln /etc/ulimit.init /etc/init
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 mv ulimit.init.c /etc/ulimit.init.c # to keep src for this hack nearby.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 chmod 0754 /etc/init
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 exit 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 #
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 # Upon system reboot, all processes will inherit the new large ulimit.