Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: unknown limits message



"Andrei A. Voropaev" wrote:
> Hi!
> 
> Sorry if this message duplicates some other already, but searching in
> archives didn't produce it. When compiling zsh-4.2.1 on my system I got
> the warning about unknown limits. I'm using very new kernel, so
> maybe it is worth mentioning :) Here's the rlimits.h

Thanks, this is indeed new.  The patch below is actually against 4.2.3;
4.2.2 will be the same but 4.2.1 may be different, although probably not
very much.

I've updated my /usr/include/asm/resources.h (I'm on Linux 2.6.10 as
supplied as an update for Fedora Core 3) and tested this.

I also added bash-compatible option letters for ulimit.

I reordered the switch for ulimit output to be more logical, but it
doesn't affect the actual output which is in limit order, not order of
the switches.  This is reasonable rational even if it's not immediately
clear to the user that there is a rationale, I think.

I note bash allows you to seee the pipe size, which isn't actually a
limit.  You can't modify it, either.

Index: configure.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.ac,v
retrieving revision 1.22
diff -u -r1.22 configure.ac
--- configure.ac	14 Jan 2005 13:04:49 -0000	1.22
+++ configure.ac	19 Jan 2005 12:07:23 -0000
@@ -1392,6 +1392,8 @@
 zsh_LIMIT_PRESENT(RLIMIT_SBSIZE)
 zsh_LIMIT_PRESENT(RLIMIT_TCACHE)
 zsh_LIMIT_PRESENT(RLIMIT_VMEM)
+zsh_LIMIT_PRESENT(RLIMIT_SIGPENDING)
+zsh_LIMIT_PRESENT(RLIMIT_MSGQUEUE)
 
 AH_TEMPLATE([RLIMIT_VMEM_IS_RSS],
 [Define to 1 if RLIMIT_VMEM and RLIMIT_RSS both exist and are equal.])
Index: Doc/Zsh/builtins.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/builtins.yo,v
retrieving revision 1.73
diff -u -r1.73 builtins.yo
--- Doc/Zsh/builtins.yo	7 Dec 2004 16:55:02 -0000	1.73
+++ Doc/Zsh/builtins.yo	19 Jan 2005 12:07:24 -0000
@@ -679,7 +679,9 @@
 sitem(tt(maxpthreads))(Maximum number of threads per process.)
 sitem(tt(memorylocked))(Maximum amount of memory locked in RAM.)
 sitem(tt(memoryuse))(Maximum resident set size.)
+sitem(tt(msgqueue))(Maximum number of bytes in POSIX message queues.)
 sitem(tt(resident))(Maximum resident set size.)
+sitem(tt(sigpending))(Maximum number of pending signals.)
 sitem(tt(sockbufsize))(Maximum size of all socket buffers.)
 sitem(tt(stacksize))(Maximum stack size for each process.)
 sitem(tt(vmemorysize))(Maximum amount of virtual memory.)
@@ -1441,7 +1443,7 @@
 findex(ulimit)
 cindex(resource limits)
 cindex(limits, resource)
-item(tt(ulimit) [ [ tt(-SHacdflmnpstv) | tt(-N) var(resource) [ var(limit) ] ... ])(
+item(tt(ulimit) [ [ tt(-SHacdfilmnpqstvx) | tt(-N) var(resource) [ var(limit) ] ... ])(
 Set or display resource limits of the shell and the processes started by
 the shell.  The value of var(limit) can be a number in the unit specified
 below or the value `tt(unlimited)'.  By default, only soft limits are
@@ -1462,14 +1464,17 @@
 sitem(tt(-c))(512-byte blocks on the size of core dumps.)
 sitem(tt(-d))(K-bytes on the size of the data segment.)
 sitem(tt(-f))(512-byte blocks on the size of files written.)
+sitem(tt(-i))(The number of pending signals.)
 sitem(tt(-l))(K-bytes on the size of locked-in memory.)
 sitem(tt(-m))(K-bytes on the size of physical memory.)
 sitem(tt(-n))(open file descriptors.)
+sitem(tt(-q))(Bytes in POSIX message queues.)
 sitem(tt(-s))(K-bytes on the size of the stack.)
 sitem(tt(-t))(CPU seconds to be used.)
 sitem(tt(-u))(processes available to the user.)
 sitem(tt(-v))(K-bytes on the size of virtual memory.  On some systems this
 refers to the limit called `address space'.)
+sitem(tt(-x))(The number of locks on files.)
 endsitem()
 
 A resource may also be specified by integer in the form `tt(-N)
Index: Src/Builtins/rlimits.awk
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Builtins/rlimits.awk,v
retrieving revision 1.5
diff -u -r1.5 rlimits.awk
--- Src/Builtins/rlimits.awk	21 Aug 2001 20:05:33 -0000	1.5
+++ Src/Builtins/rlimits.awk	19 Jan 2005 12:07:24 -0000
@@ -45,6 +45,8 @@
 	    if (limnam == "STACK")   { msg[limnum] = "Mstacksize" }
 	    if (limnam == "TCACHE")  { msg[limnum] = "Ncachedthreads" }
 	    if (limnam == "VMEM")    { msg[limnum] = "Mvmemorysize" }
+	    if (limnam == "SIGPENDING") { msg[limnum] = "Nsigpending" }
+	    if (limnam == "MSGQUEUE") { msg[limnum] = "Nmsgqueue" }
         }
     }
 }
Index: Src/Builtins/rlimits.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Builtins/rlimits.c,v
retrieving revision 1.12
diff -u -r1.12 rlimits.c
--- Src/Builtins/rlimits.c	30 Jun 2004 11:10:46 -0000	1.12
+++ Src/Builtins/rlimits.c	19 Jan 2005 12:07:24 -0000
@@ -208,13 +208,9 @@
 	limit = (hard) ? limits[lim].rlim_max : limits[lim].rlim_cur;
     /* display the appropriate heading */
     switch (lim) {
-    case RLIMIT_CPU:
-	if (head)
-	    printf("-t: cpu time (seconds)         ");
-	break;
-    case RLIMIT_FSIZE:
+    case RLIMIT_CORE:
 	if (head)
-	    printf("-f: file size (blocks)         ");
+	    printf("-c: core file size (blocks)    ");
 	if (limit != RLIM_INFINITY)
 	    limit /= 512;
 	break;
@@ -224,18 +220,26 @@
 	if (limit != RLIM_INFINITY)
 	    limit /= 1024;
 	break;
-    case RLIMIT_STACK:
+    case RLIMIT_FSIZE:
 	if (head)
-	    printf("-s: stack size (kbytes)        ");
+	    printf("-f: file size (blocks)         ");
 	if (limit != RLIM_INFINITY)
-	    limit /= 1024;
+	    limit /= 512;
 	break;
-    case RLIMIT_CORE:
+# ifdef HAVE_RLIMIT_SIGPENDING
+    case RLIMIT_SIGPENDING:
 	if (head)
-	    printf("-c: core file size (blocks)    ");
+	    printf("-i: pending signals            ");
+	break;
+# endif
+# ifdef HAVE_RLIMIT_MEMLOCK
+    case RLIMIT_MEMLOCK:
+	if (head)
+	    printf("-l: locked-in-memory size (kb) ");
 	if (limit != RLIM_INFINITY)
-	    limit /= 512;
+	    limit /= 1024;
 	break;
+# endif /* HAVE_RLIMIT_MEMLOCK */
 /* If RLIMIT_VMEM and RLIMIT_RSS are defined and equal, avoid *
  * duplicate case statement.  Observed on QNX Neutrino 6.1.0. */
 # if defined(HAVE_RLIMIT_RSS) && !defined(RLIMIT_VMEM_IS_RSS)
@@ -246,34 +250,46 @@
 	    limit /= 1024;
 	break;
 # endif /* HAVE_RLIMIT_RSS */
-# ifdef HAVE_RLIMIT_MEMLOCK
-    case RLIMIT_MEMLOCK:
+# if defined(HAVE_RLIMIT_VMEM) && defined(HAVE_RLIMIT_RSS) && defined(RLIMIT_VMEM_IS_RSS)
+    case RLIMIT_VMEM:
 	if (head)
-	    printf("-l: locked-in-memory size (kb) ");
+	    printf("-m: memory size (kb)           ");
 	if (limit != RLIM_INFINITY)
 	    limit /= 1024;
 	break;
-# endif /* HAVE_RLIMIT_MEMLOCK */
-# ifdef HAVE_RLIMIT_NPROC
-    case RLIMIT_NPROC:
-	if (head)
-	    printf("-u: processes                  ");
-	break;
-# endif /* HAVE_RLIMIT_NPROC */
+# endif /* HAVE_RLIMIT_VMEM */
 # ifdef HAVE_RLIMIT_NOFILE
     case RLIMIT_NOFILE:
 	if (head)
 	    printf("-n: file descriptors           ");
 	break;
 # endif /* HAVE_RLIMIT_NOFILE */
-# ifdef HAVE_RLIMIT_VMEM
+# ifdef HAVE_RLIMIT_MSGQUEUE
+    case RLIMIT_MSGQUEUE:
+	if (head)
+	    printf("-q: bytes in POSIX msg queues  ");
+	break;
+# endif
+    case RLIMIT_STACK:
+	if (head)
+	    printf("-s: stack size (kbytes)        ");
+	if (limit != RLIM_INFINITY)
+	    limit /= 1024;
+	break;
+    case RLIMIT_CPU:
+	if (head)
+	    printf("-t: cpu time (seconds)         ");
+	break;
+# ifdef HAVE_RLIMIT_NPROC
+    case RLIMIT_NPROC:
+	if (head)
+	    printf("-u: processes                  ");
+	break;
+# endif /* HAVE_RLIMIT_NPROC */
+# if defined(HAVE_RLIMIT_VMEM) && (!defined(HAVE_RLIMIT_RSS) || !defined(RLIMIT_VMEM_IS_RSS))
     case RLIMIT_VMEM:
 	if (head)
-#  if defined(HAVE_RLIMIT_RSS) && defined(RLIMIT_VMEM_IS_RSS)
-	    printf("-m: memory size (kb)           ");
-#  else
 	    printf("-v: virtual memory size (kb)   ");
-#  endif
 	if (limit != RLIM_INFINITY)
 	    limit /= 1024;
 	break;
@@ -286,18 +302,12 @@
 	    limit /= 1024;
 	break;
 # endif /* HAVE_RLIMIT_AS */
-# ifdef HAVE_RLIMIT_TCACHE
-    case RLIMIT_TCACHE:
-	if (head)
-	    printf("-N %2d: cached threads          ", RLIMIT_TCACHE);
-	break;
-# endif /* HAVE_RLIMIT_TCACHE */
-# ifdef HAVE_RLIMIT_AIO_OPS
-    case RLIMIT_AIO_OPS:
+# ifdef HAVE_RLIMIT_LOCKS
+    case RLIMIT_LOCKS:
 	if (head)
-	    printf("-N %2d: AIO operations          ", RLIMIT_AIO_OPS);
+	    printf("-x: file locks                 ");
 	break;
-# endif /* HAVE_RLIMIT_AIO_OPS */
+# endif /* HAVE_RLIMIT_LOCKS */
 # ifdef HAVE_RLIMIT_AIO_MEM
     case RLIMIT_AIO_MEM:
 	if (head)
@@ -306,6 +316,18 @@
 	    limit /= 1024;
 	break;
 # endif /* HAVE_RLIMIT_AIO_MEM */
+# ifdef HAVE_RLIMIT_AIO_OPS
+    case RLIMIT_AIO_OPS:
+	if (head)
+	    printf("-N %2d: AIO operations          ", RLIMIT_AIO_OPS);
+	break;
+# endif /* HAVE_RLIMIT_AIO_OPS */
+# ifdef HAVE_RLIMIT_TCACHE
+    case RLIMIT_TCACHE:
+	if (head)
+	    printf("-N %2d: cached threads          ", RLIMIT_TCACHE);
+	break;
+# endif /* HAVE_RLIMIT_TCACHE */
 # ifdef HAVE_RLIMIT_SBSIZE
     case RLIMIT_SBSIZE:
 	if (head)
@@ -320,12 +342,6 @@
 	    printf("-N %2d: threads per process     ", RLIMIT_PTHREAD);
 	break;
 # endif /* HAVE_RLIMIT_PTHREAD */
-# ifdef HAVE_RLIMIT_LOCKS
-    case RLIMIT_LOCKS:
-	if (head)
-	    printf("-N %2d: file locks              ", RLIMIT_LOCKS);
-	break;
-# endif /* HAVE_RLIMIT_LOCKS */
     default:
 	if (head)
 	    printf("-N %2d:                         ", lim);
@@ -745,6 +761,21 @@
 #  endif
 		    break;
 # endif /* HAVE_RLIMIT_VMEM */
+# ifdef HAVE_RLIMIT_LOCKS
+		case 'x':
+		    res = RLIMIT_LOCKS;
+		    break;
+# endif
+# ifdef HAVE_RLIMIT_SIGPENDING
+		case 'i':
+		    res = RLIMIT_SIGPENDING;
+		    break;
+# endif
+# ifdef HAVE_RLIMIT_MSGQUEUES
+		case 'q':
+		    res = RLIMIT_MSGQUEUES;
+		    break;
+# endif
 		default:
 		    /* unrecognised limit */
 		    zwarnnam(name, "bad option: -%c", NULL, *options);

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************



Messages sorted by: Reverse Date, Date, Thread, Author