zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <Peter.Stephenson@csr.com>
To: Thomas Klausner <tk@giga.or.at>, <zsh-workers@zsh.org>
Subject: Re: pkgsrc patches for zsh [was Re: tgoto issue in zsh-5.0.0]
Date: Fri, 17 Aug 2012 10:38:03 +0100	[thread overview]
Message-ID: <20120817103803.73f82242@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <20120817081109.GU2428@danbala.tuwien.ac.at>

On Fri, 17 Aug 2012 10:11:09 +0200
Thomas Klausner <tk@giga.or.at> 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@csr.com>            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


  reply	other threads:[~2012-08-17  9:39 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-16 12:04 tgoto issue in zsh-5.0.0 Thomas Klausner
2012-08-16 13:07 ` Peter Stephenson
2012-08-16 13:20   ` Thomas Klausner
2012-08-16 13:25     ` Peter Stephenson
2012-08-16 14:25       ` pkgsrc patches for zsh [was Re: tgoto issue in zsh-5.0.0] Thomas Klausner
2012-08-16 19:18         ` Peter Stephenson
2012-08-17  8:11           ` Thomas Klausner
2012-08-17  9:38             ` Peter Stephenson [this message]
2012-08-17 10:50               ` Thomas Klausner
2012-08-17 11:35                 ` Peter Stephenson
2012-08-17 12:16                   ` Thomas Klausner
2012-08-17 13:27                     ` Peter Stephenson
2014-06-24 14:37                     ` ulimit -a: -r vs -N [was Re: pkgsrc patches for zsh] Thomas Klausner
2014-06-24 15:07                       ` Peter Stephenson
2014-06-24 16:11                         ` Thomas Klausner
2014-06-24 16:26                           ` Peter Stephenson
2014-06-24 17:09                             ` Thomas Klausner
2014-06-25  8:26                               ` Peter Stephenson
2014-06-25  8:36                                 ` Thomas Klausner
2014-06-25 10:33                                   ` Peter Stephenson
2014-06-25 11:00                                     ` Thomas Klausner
2014-06-25 11:11                                       ` Peter Stephenson
2014-06-25 12:18                                         ` Thomas Klausner
2014-06-26  8:31                                         ` Daniel Shahaf
2014-06-26  9:49                                           ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120817103803.73f82242@pwslap01u.europe.root.pri \
    --to=peter.stephenson@csr.com \
    --cc=tk@giga.or.at \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).