]> git.pld-linux.org Git - packages/bash.git/blame - bash-rlimit_locks.patch
- backspace broken under screen too (reported by glen)
[packages/bash.git] / bash-rlimit_locks.patch
CommitLineData
99317301 1--- bash-2.04.old/builtins/ulimit.def Mon Jan 24 13:47:38 2000
2+++ bash-2.04/builtins/ulimit.def Mon Apr 16 17:39:19 2001
3@@ -24,7 +24,7 @@
4 $BUILTIN ulimit
5 $FUNCTION ulimit_builtin
6 $DEPENDS_ON !_MINIX
7-$SHORT_DOC ulimit [-SHacdflmnpstuv] [limit]
8+$SHORT_DOC ulimit [-SHacdflmnpstuvL] [limit]
9 Ulimit provides control over the resources available to processes
10 started by the shell, on systems that allow such control. If an
11 option is given, it is interpreted as follows:
12@@ -43,6 +43,7 @@
13 -t the maximum amount of cpu time in seconds
14 -u the maximum number of user processes
15 -v the size of virtual memory
16+ -L the maximum number of file locks (Kernel >= 2.4)
17
2fce1949 18 If LIMIT is given, it is the new value of the specified resource;
19 the special LIMIT values `soft', `hard', and `unlimited' stand for
20@@ -216,6 +216,9 @@
99317301 21 #if defined (HAVE_RESOURCE)
2fce1949 22 { 'v', RLIMIT_VIRTMEM, RLIMIT_VMBLKSZ, "virtual memory", "kbytes" },
99317301 23 #endif
24+#ifdef RLIMIT_LOCKS
25+ { 'L', RLIMIT_LOCKS, 1, "max file locks" },
26+#endif /* RLIMIT_LOCKS */
2fce1949 27 #ifdef RLIMIT_SWAP
28 { 'w', RLIMIT_SWAP, 1024, "swap size", "kbytes" },
29 #endif
99317301 30@@ -344,6 +348,7 @@
31 int mode, multiple;
32 {
33 int opt, limind, setting;
34+ int dont_locks = 0;
2fce1949 35 int block_factor;
36 RLIMTYPE soft_limit, hard_limit, real_limit, limit;
99317301 37
2fce1949 38@@ -354,9 +359,20 @@
39 opt = get_limit (limind, &soft_limit, &hard_limit);
99317301 40 if (opt < 0)
41 {
71ad8a74 42- builtin_error (_("%s: cannot get limit: %s"), limits[limind].description,
69ed6004 43- strerror (errno));
99317301 44- return (EXECUTION_FAILURE);
2fce1949 45+ if (( errno == 22) && (limits[limind].parameter == RLIMIT_LOCKS))
46+ {
47+ if (mode & LIMIT_SOFT)
48+ soft_limit = RLIM_INFINITY;
49+ else
50+ hard_limit = RLIM_INFINITY;
51+ dont_locks = 1;
52+ }
53+ else
54+ {
71ad8a74 55+ builtin_error (_("%s: cannot get limit: %s"), limits[limind].description,
2fce1949 56+ strerror (errno));
57+ return (EXECUTION_FAILURE);
58+ }
99317301 59 }
60
61 if (setting == 0) /* print the value of the specified limit */
62@@ -363,6 +375,12 @@
2fce1949 63 printone (limind, (mode & LIMIT_SOFT) ? soft_limit : hard_limit, multiple);
99317301 64 return (EXECUTION_SUCCESS);
65 }
66+
67+ if (dont_locks)
68+ {
71ad8a74 69+ builtin_error (_("cannot set it on the current kernel"));
99317301 70+ return (EXECUTION_FAILURE);
71+ }
72
2fce1949 73 /* Setting the limit.
74 if (STREQ (cmdarg, "hard"))
69ed6004 75@@ -617,8 +635,18 @@
2fce1949 76 for (i = 0; limits[i].option > 0; i++)
99317301 77 {
2fce1949 78 if (get_limit (i, &softlim, &hardlim) < 0)
69ed6004
JB
79- builtin_error ("%s: cannot get limit: %s", limits[i].description,
80- strerror (errno));
2fce1949 81+ {
82+ if ((errno == 22) && (limits[i].parameter == RLIMIT_LOCKS))
83+ {
84+ if (mode & LIMIT_SOFT)
85+ softlim = RLIM_INFINITY;
86+ else
87+ hardlim = RLIM_INFINITY;
88+ printone (i, (mode & LIMIT_SOFT) ? softlim : hardlim, 1);
89+ } else
69ed6004
JB
90+ builtin_error ("%s: cannot get limit: %s", limits[i].description,
91+ strerror (errno));
2fce1949 92+ }
99317301 93 else
2fce1949 94 printone (i, (mode & LIMIT_SOFT) ? softlim : hardlim, 1);
95
This page took 0.11018 seconds and 4 git commands to generate.