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
5 $FUNCTION ulimit_builtin
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:
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)
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
21 #if defined (HAVE_RESOURCE)
22 { 'v', RLIMIT_VIRTMEM, RLIMIT_VMBLKSZ, "virtual memory", "kbytes" },
25 + { 'L', RLIMIT_LOCKS, 1, "max file locks" },
26 +#endif /* RLIMIT_LOCKS */
28 { 'w', RLIMIT_SWAP, 1024, "swap size", "kbytes" },
33 int opt, limind, setting;
36 RLIMTYPE soft_limit, hard_limit, real_limit, limit;
39 opt = get_limit (limind, &soft_limit, &hard_limit);
42 - builtin_error (_("%s: cannot get limit: %s"), limits[limind].description,
44 - return (EXECUTION_FAILURE);
45 + if (( errno == 22) && (limits[limind].parameter == RLIMIT_LOCKS))
47 + if (mode & LIMIT_SOFT)
48 + soft_limit = RLIM_INFINITY;
50 + hard_limit = RLIM_INFINITY;
55 + builtin_error (_("%s: cannot get limit: %s"), limits[limind].description,
57 + return (EXECUTION_FAILURE);
61 if (setting == 0) /* print the value of the specified limit */
63 printone (limind, (mode & LIMIT_SOFT) ? soft_limit : hard_limit, multiple);
64 return (EXECUTION_SUCCESS);
69 + builtin_error (_("cannot set it on the current kernel"));
70 + return (EXECUTION_FAILURE);
74 if (STREQ (cmdarg, "hard"))
76 for (i = 0; limits[i].option > 0; i++)
78 if (get_limit (i, &softlim, &hardlim) < 0)
79 - builtin_error ("%s: cannot get limit: %s", limits[i].description,
82 + if ((errno == 22) && (limits[i].parameter == RLIMIT_LOCKS))
84 + if (mode & LIMIT_SOFT)
85 + softlim = RLIM_INFINITY;
87 + hardlim = RLIM_INFINITY;
88 + printone (i, (mode & LIMIT_SOFT) ? softlim : hardlim, 1);
90 + builtin_error ("%s: cannot get limit: %s", limits[i].description,
94 printone (i, (mode & LIMIT_SOFT) ? softlim : hardlim, 1);