about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2012-08-17 11:12:34 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2012-08-17 11:12:34 +0000
commit9fdcd824d8df307081723ec5f0ae04c838b2b7b8 (patch)
tree0808f7bc974fb6bdf01bbbf47ea18e808e4ef8dd
parent3aae0ef8fecd69c983e6452a6b4f9c641cac9ab1 (diff)
downloadzsh-9fdcd824d8df307081723ec5f0ae04c838b2b7b8.tar.gz
zsh-9fdcd824d8df307081723ec5f0ae04c838b2b7b8.tar.xz
zsh-9fdcd824d8df307081723ec5f0ae04c838b2b7b8.zip
30627: support RLIMIT_NTHR as on NetBSD
-rw-r--r--ChangeLog21
-rw-r--r--Doc/Zsh/builtins.yo8
-rw-r--r--Src/Builtins/rlimits.awk1
-rw-r--r--Src/Builtins/rlimits.c11
-rw-r--r--configure.ac1
5 files changed, 24 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 825b6bb58..97c1efe27 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,19 +1,8 @@
-2012-08-17  Frank Terbeck  <ft@bewatermyfriend.org>
+2012-08-17  Peter Stephenson  <pws@csr.com>
 
-	* Stepan Koltsov: Doc/Zsh/contrib.yo,
-	Functions/VCS_Info/Backends/VCS_INFO_get_data_git,
-	Functions/VCS_Info/Backends/VCS_INFO_get_data_hg,
-	Functions/VCS_Info/VCS_INFO_quilt: vcs_info: %a to output number
-	of all patches in (no)?patch-format styles
-
-2012-08-16  Peter Stephenson  <p.w.stephenson@ntlworld.com>
-
-	* Hiramatsu Yoshifumi: 30621 patch-ac (from NetBSD pkgsrc)
-	backported to configure.ac: compilation on interix, also
-	change linker flags for NetBSD.
-
-	* Hiramatsu Yoshifumi: 30621 patch-ab (from NetBSD pkgsrc):
-	Src/zsh.h: compilation on __INTERIX
+	* 30627: configure.ac, Doc/Zsh/builtins.yo,
+	Src/Builtins/rlimits.awk, Src/Builtins/rlimits.c:
+	support RLIMIT_NTHR as on NetBSD.
 
 2012-08-16  Peter Stephenson  <pws@csr.com>
 
@@ -78,5 +67,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5699 $
+* $Revision: 1.5700 $
 *****************************************************
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index 5c133a856..f0af72085 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -1738,7 +1738,7 @@ enditem()
 findex(ulimit)
 cindex(resource limits)
 cindex(limits, resource)
-item(tt(ulimit) [ [ tt(-SHacdfilmnpqstvx) | tt(-N) var(resource) [ var(limit) ] ... ])(
+item(tt(ulimit) [ [ tt(-SHacdfilmnpqrstvx) | 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 one of the values `tt(unlimited)', which removes the limit on the
@@ -1759,6 +1759,9 @@ When looping over multiple resources, the shell will abort immediately if
 it detects a badly formed argument.  However, if it fails to set a limit
 for some other reason it will continue trying to set the remaining limits.
 
+Not all the following resources are supported on all systems.  Running
+tt(ulimit -a) will show which are supported.
+
 startsitem()
 sitem(tt(-a))(Lists all of the current resource limits.)
 sitem(tt(-c))(512-byte blocks on the size of core dumps.)
@@ -1771,7 +1774,8 @@ 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(-r))(The number of simultaneous threads available to the user.)
+sitem(tt(-u))(The number of 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.)
diff --git a/Src/Builtins/rlimits.awk b/Src/Builtins/rlimits.awk
index 418206a66..bf914814d 100644
--- a/Src/Builtins/rlimits.awk
+++ b/Src/Builtins/rlimits.awk
@@ -42,6 +42,7 @@ BEGIN {limidx = 0}
 	    if (limnam == "MEMLOCK") { msg[limnum] = "Mmemorylocked" }
 	    if (limnam == "NOFILE")  { msg[limnum] = "Ndescriptors" }
 	    if (limnam == "NPROC")   { msg[limnum] = "Nmaxproc" }
+	    if (limnam == "NTHR")    { msg[limnum] = "Nmaxthr" }
 	    if (limnam == "OFILE")   { msg[limnum] = "Ndescriptors" }
 	    if (limnam == "PTHREAD") { msg[limnum] = "Nmaxpthreads" }
 	    if (limnam == "RSS")     { msg[limnum] = "Mresident" }
diff --git a/Src/Builtins/rlimits.c b/Src/Builtins/rlimits.c
index 670516169..45d5b2dea 100644
--- a/Src/Builtins/rlimits.c
+++ b/Src/Builtins/rlimits.c
@@ -314,6 +314,12 @@ printulimit(char *nam, int lim, int hard, int head)
 	    printf("-u: processes                  ");
 	break;
 # endif /* HAVE_RLIMIT_NPROC */
+# ifdef HAVE_RLIMIT_NTHR
+    case RLIMIT_NTHR:
+	if (head)
+	    printf("-r: threads                    ");
+	break;
+#endif /* HAVE_RLIMIT_NTHR */
 # if defined(HAVE_RLIMIT_VMEM) && (!defined(HAVE_RLIMIT_RSS) || !defined(RLIMIT_VMEM_IS_RSS))
     case RLIMIT_VMEM:
 	if (head)
@@ -791,6 +797,11 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
 		    res = RLIMIT_NOFILE;
 		    break;
 # endif /* HAVE_RLIMIT_NOFILE */
+# ifdef HAVE_RLIMIT_NTHR
+		case 'r':
+		    res = RLIMIT_NTHR;
+		    break;
+# endif /* HAVE_RLIMIT_NTHR */
 # ifdef HAVE_RLIMIT_NPROC
 		case 'u':
 		    res = RLIMIT_NPROC;
diff --git a/configure.ac b/configure.ac
index 04b2ce21a..986ef3a33 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1799,6 +1799,7 @@ zsh_LIMIT_PRESENT(RLIMIT_AS)
 zsh_LIMIT_PRESENT(RLIMIT_LOCKS)
 zsh_LIMIT_PRESENT(RLIMIT_MEMLOCK)
 zsh_LIMIT_PRESENT(RLIMIT_NPROC)
+zsh_LIMIT_PRESENT(RLIMIT_NTHR)
 zsh_LIMIT_PRESENT(RLIMIT_NOFILE)
 zsh_LIMIT_PRESENT(RLIMIT_PTHREAD)
 zsh_LIMIT_PRESENT(RLIMIT_RSS)