Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: pkgsrc patches for zsh [was Re: tgoto issue in zsh-5.0.0]
On Fri, 17 Aug 2012 10:11:09 +0200
Thomas Klausner <tk@xxxxxxxxxx> wrote:
> One more issue: Recently NetBSD added support for per-user thread (not
> process) limits. zsh doesn't seem to support this.
It should be as simple as this, though I can't test it directly.
Index: configure.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.ac,v
retrieving revision 1.139
diff -p -u -r1.139 configure.ac
--- configure.ac 21 Jun 2012 08:45:02 -0000 1.139
+++ configure.ac 17 Aug 2012 09:36:54 -0000
@@ -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)
Index: Doc/Zsh/builtins.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/builtins.yo,v
retrieving revision 1.139
diff -p -u -r1.139 builtins.yo
--- Doc/Zsh/builtins.yo 16 Aug 2012 14:00:11 -0000 1.139
+++ Doc/Zsh/builtins.yo 17 Aug 2012 09:36:54 -0000
@@ -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, th
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.)
Index: Src/Builtins/rlimits.awk
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Builtins/rlimits.awk,v
retrieving revision 1.9
diff -p -u -r1.9 rlimits.awk
--- Src/Builtins/rlimits.awk 19 Jun 2011 00:10:34 -0000 1.9
+++ Src/Builtins/rlimits.awk 17 Aug 2012 09:36:54 -0000
@@ -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" }
Index: Src/Builtins/rlimits.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Builtins/rlimits.c,v
retrieving revision 1.25
diff -p -u -r1.25 rlimits.c
--- Src/Builtins/rlimits.c 31 Oct 2011 09:48:59 -0000 1.25
+++ Src/Builtins/rlimits.c 17 Aug 2012 09:36:54 -0000
@@ -314,6 +314,12 @@ printulimit(char *nam, int lim, int hard
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, UNUS
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;
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
Messages sorted by:
Reverse Date,
Date,
Thread,
Author