]>
Commit | Line | Data |
---|---|---|
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 | ||
18 | If LIMIT is given, it is the new value of the specified resource. | |
19 | Otherwise, the current value of the specified resource is printed. | |
20 | @@ -202,6 +203,9 @@ | |
21 | #if defined (HAVE_RESOURCE) | |
22 | { 'v', RLIMIT_VIRTMEM, RLIMIT_VMBLKSZ, "virtual memory (kbytes)" }, | |
23 | #endif | |
24 | +#ifdef RLIMIT_LOCKS | |
25 | + { 'L', RLIMIT_LOCKS, 1, "max file locks" }, | |
26 | +#endif /* RLIMIT_LOCKS */ | |
27 | { -1, -1, -1, (char *)NULL } | |
28 | }; | |
29 | #define NCMDS (sizeof(limits) / sizeof(limits[0])) | |
30 | @@ -344,6 +348,7 @@ | |
31 | int mode, multiple; | |
32 | { | |
33 | int opt, limind, setting; | |
34 | + int dont_locks = 0; | |
35 | long block_factor; | |
36 | RLIMTYPE current_limit, real_limit, limit; | |
37 | ||
38 | @@ -354,8 +359,15 @@ | |
39 | opt = get_limit (limind, mode, ¤t_limit); | |
40 | if (opt < 0) | |
41 | { | |
42 | - builtin_error ("cannot get limit: %s", strerror (errno)); | |
43 | - return (EXECUTION_FAILURE); | |
44 | + if ( ( errno == 22 ) && | |
45 | + ( limits[limind].parameter == RLIMIT_LOCKS ) | |
46 | + ) { | |
47 | + current_limit=RLIM_INFINITY; | |
48 | + dont_locks = 1; | |
49 | + } else { | |
50 | + builtin_error ("cannot get limit: %s", strerror (errno)); | |
51 | + return (EXECUTION_FAILURE); | |
52 | + } | |
53 | } | |
54 | ||
55 | if (setting == 0) /* print the value of the specified limit */ | |
56 | @@ -363,6 +375,12 @@ | |
57 | printone (limind, current_limit, multiple); | |
58 | return (EXECUTION_SUCCESS); | |
59 | } | |
60 | + | |
61 | + if (dont_locks) | |
62 | + { | |
63 | + builtin_error ("cannot set it on the current kernel"); | |
64 | + return (EXECUTION_FAILURE); | |
65 | + } | |
66 | ||
67 | /* Setting the limit. */ | |
68 | if (STREQ (cmdarg, "unlimited")) | |
69 | @@ -617,8 +635,15 @@ | |
70 | { | |
71 | if (get_limit (i, mode, &value) < 0) | |
72 | { | |
73 | - fprintf (stderr, DESCFMT, limits[i].description); | |
74 | - builtin_error ("cannot get limit: %s", strerror (errno)); | |
75 | + if ( ( errno == 22 ) && | |
76 | + ( limits[i].parameter == RLIMIT_LOCKS ) | |
77 | + ) { | |
78 | + value=RLIM_INFINITY; | |
79 | + printone (i, value, 1); | |
80 | + } else { | |
81 | + fprintf (stderr, DESCFMT, limits[i].description); | |
82 | + builtin_error ("cannot get limit: %s", strerror (errno)); | |
83 | + } | |
84 | } | |
85 | else | |
86 | printone (i, value, 1); |