From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25155 invoked by alias); 17 Aug 2012 09:39:10 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30627 Received: (qmail 12117 invoked from network); 17 Aug 2012 09:39:06 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Fri, 17 Aug 2012 10:38:03 +0100 From: Peter Stephenson To: Thomas Klausner , Subject: Re: pkgsrc patches for zsh [was Re: tgoto issue in zsh-5.0.0] Message-ID: <20120817103803.73f82242@pwslap01u.europe.root.pri> In-Reply-To: <20120817081109.GU2428@danbala.tuwien.ac.at> References: <20120816120421.GE2428@danbala.tuwien.ac.at> <20120816140734.20a7def9@pwslap01u.europe.root.pri> <20120816132053.GJ2428@danbala.tuwien.ac.at> <20120816142517.188972cd@pwslap01u.europe.root.pri> <20120816142504.GO2428@danbala.tuwien.ac.at> <20120816201848.4b442246@pws-pc.ntlworld.com> <20120817081109.GU2428@danbala.tuwien.ac.at> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.101.10.18] X-Scanned-By: MailControl 8316.0 (www.mailcontrol.com) on 10.68.1.150 On Fri, 17 Aug 2012 10:11:09 +0200 Thomas Klausner 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 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