summaryrefslogtreecommitdiff
blob: 8fcffc8c479eabd162b10c3c2926c030c1759e4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
--- bash-3.0/builtins/ulimit.def	2004-08-27 17:29:19.662577512 +0100
+++ bash-3.0/builtins/ulimit.def	2004-08-31 12:56:27.693244884 +0100
@@ -35,14 +35,17 @@
     -c	the maximum size of core files created
     -d	the maximum size of a process's data segment
     -f	the maximum size of files created by the shell
+    -i	the maximum number of pending signals
     -l	the maximum size a process may lock into memory
     -m	the maximum resident set size
     -n	the maximum number of open file descriptors
     -p	the pipe buffer size
+    -q	the maximum number of bytes in POSIX message queues
     -s	the maximum stack size
     -t	the maximum amount of cpu time in seconds
     -u	the maximum number of user processes
     -v	the size of virtual memory 
+    -x	the maximum number of file locks
 
 If LIMIT is given, it is the new value of the specified resource;
 the special LIMIT values `soft', `hard', and `unlimited' stand for
@@ -200,6 +203,9 @@
   { 'd',	RLIMIT_DATA,  1024,	"data seg size",	"kbytes" },
 #endif
   { 'f',	RLIMIT_FILESIZE, 1024,	"file size",		"blocks" },
+#ifdef RLIMIT_SIGPENDING
+  { 'i',	RLIMIT_SIGPENDING, 1,	"pending signals",	(char *)NULL},
+#endif
 #ifdef RLIMIT_MEMLOCK
   { 'l',	RLIMIT_MEMLOCK, 1024,	"max locked memory",	"kbytes" },
 #endif
@@ -208,6 +214,9 @@
 #endif /* RLIMIT_RSS */
   { 'n',	RLIMIT_OPENFILES, 1,	"open files",		(char *)NULL},
   { 'p',	RLIMIT_PIPESIZE, 512,	"pipe size", 		"512 bytes" },
+#ifdef RLIMIT_MSGQUEUE
+  { 'q',	RLIMIT_MSGQUEUE, 1,	"POSIX message queues",	"bytes" },
+#endif
 #ifdef RLIMIT_STACK
   { 's',	RLIMIT_STACK, 1024,	"stack size",		"kbytes" },
 #endif
@@ -221,6 +230,9 @@
 #ifdef RLIMIT_SWAP
   { 'w',	RLIMIT_SWAP,	1024,	"swap size",		"kbytes" },
 #endif
+#ifdef RLIMIT_LOCKS
+  { 'x',	RLIMIT_LOCKS, 1,	"file locks",		(char *)NULL},
+#endif
   { -1, -1, -1, (char *)NULL, (char *)NULL }
 };
 #define NCMDS	(sizeof(limits) / sizeof(limits[0]))
@@ -647,11 +659,11 @@
 
   for (i = 0; limits[i].option > 0; i++)
     {
-      if (get_limit (i, &softlim, &hardlim) < 0)
+      if (get_limit (i, &softlim, &hardlim) == 0)
+	printone (i, (mode & LIMIT_SOFT) ? softlim : hardlim, 1);
+      else if (errno != EINVAL)
 	builtin_error ("%s: cannot get limit: %s", limits[i].description,
 						   strerror (errno));
-      else
-	printone (i, (mode & LIMIT_SOFT) ? softlim : hardlim, 1);
     }
 }
 
@@ -670,7 +682,7 @@
       else
         sprintf (unitstr, "(-%c) ", limits[limind].option);
 
-      printf ("%-18s %16s", limits[limind].description, unitstr);
+      printf ("%-20s %16s", limits[limind].description, unitstr);
     }
   if (curlim == RLIM_INFINITY)
     puts ("unlimited");