From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29759 invoked by alias); 25 Jun 2014 08:37:21 -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: 32796 Received: (qmail 23826 invoked from network); 25 Jun 2014 08:37: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=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f5-b7f626d000004b39-95-53aa87d4486c Date: Wed, 25 Jun 2014 09:26:59 +0100 From: Peter Stephenson To: Thomas Klausner , zsh-workers@zsh.org Subject: Re: ulimit -a: -r vs -N [was Re: pkgsrc patches for zsh] Message-id: <20140625092659.3e084cc7@pwslap01u.europe.root.pri> In-reply-to: <20140624170908.GK13765@danbala.tuwien.ac.at> References: <20120817081109.GU2428@danbala.tuwien.ac.at> <20120817103803.73f82242@pwslap01u.europe.root.pri> <20120817105019.GB2428@danbala.tuwien.ac.at> <20120817123535.62ab00a1@pwslap01u.europe.root.pri> <20120817121605.GD2428@danbala.tuwien.ac.at> <20140624143711.GG13765@danbala.tuwien.ac.at> <20140624160708.6bef4d2c@pwslap01u.europe.root.pri> <20140624161102.GJ13765@danbala.tuwien.ac.at> <20140624172642.61b422e0@pwslap01u.europe.root.pri> <20140624170908.GK13765@danbala.tuwien.ac.at> Organization: Samsung Cambridge Solution Centre 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-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOLMWRmVeSWpSXmKPExsVy+t/xa7pX2lcFG2zZKWAx7/ViVouDzQ+Z HJg8erf/YPdYdfADUwBTFJdNSmpOZllqkb5dAlfG/GkNLAWPxCt+99o2MH4X6mLk5JAQMJG4 evACI4QtJnHh3nq2LkYuDiGBpYwSd5c9h3L6mSSeLbjFAlLFIqAq0bVvBzuIzSZgKDF102yw bhEBC4kZB78zg9jCAo4SE9bPBKvhFbCXeNx8F8zmFLCSmDBvIhPE0G0sEptm7Qdr5hfQl7j6 9xMTxBn2EjOvnGGEaBaU+DH5HthiZgEtic3bmlghbHmJzWveMk9gFJiFpGwWkrJZSMoWMDKv YhRNLU0uKE5KzzXSK07MLS7NS9dLzs/dxAgJzK87GJceszrEKMDBqMTDG8CzKliINbGsuDL3 EKMEB7OSCO8lL6AQb0piZVVqUX58UWlOavEhRiYOTqkGxsNSoVflLnxUKN1xT/FCBafHnr5v oibLS8VVPr4y3PT0IttSEweuoqg8tp5QwVjjuzqNLDJntlkaOBno/fZzsa/obFn2qn3Hfdeu zLuP7h260+kTOetQa4u2pXMwj5bdFG6VXW4fs6RV+BoyVBns7zG9ej2d38Xh0ItCSfVXWz+y x6cf5p2txFKckWioxVxUnAgAL5TG1SoCAAA= On Tue, 24 Jun 2014 19:09:08 +0200 Thomas Klausner wrote: > On Tue, Jun 24, 2014 at 05:26:42PM +0100, Peter Stephenson wrote: > > On Tue, 24 Jun 2014 18:11:02 +0200 > > Thomas Klausner wrote: > > > thread (-r threads ) 160 > > > > > If I raise the threads limit here to 161, the value for "-N 11" in zsh > > > is also 161, so it's the same limit. > > > > I'm presuming you don't have RTPRIO (so there's no clash)? What's the > > name (enum or #defined) of the limit referred to as "threads", i.e. with > > the value 11? Should be in something like /usr/include/sys/resource.h > > or something included from there. > > > > gcc -E /usr/include/sys/resource.h | grep RLIMIT > > > > might be enough to answer both questions. > > The gcc statement, for some reason, doesn't work, but: > > ./sys/resource.h:#define RLIMIT_NTHR 11 /* number of threads */ > > # grep -r RTPRIO /usr/include > # That's supposed to be covered by -T for RLIMIT_PTHREAD, but the way NetBSD sets up its limits this doesn't work, and there appears to be a case missing in the handler. It was moved by zsh-workers/31936 (http://www.zsh.org/mla/workers/2013/msg00970.html) to avoid the clash with other meanings of -r, which seems reasonable given the possible confusions, although we could provide backward compatibility where RTPRIO doesn't exist. diff --git a/Src/Builtins/rlimits.c b/Src/Builtins/rlimits.c index 0bcafda..a9eb328 100644 --- a/Src/Builtins/rlimits.c +++ b/Src/Builtins/rlimits.c @@ -32,12 +32,14 @@ #if defined(HAVE_GETRLIMIT) && defined(RLIM_INFINITY) -#ifdef RLIMIT_POSIXLOCKS +#if defined(HAVE_RLIMIT_POSIXLOCKS) && !defined(HAVE_RLIMIT_LOCKS) # define RLIMIT_LOCKS RLIMIT_POSIXLOCKS +# define HAVE_RLIMIT_LOCKS 1 #endif -#ifdef RLIMIT_NTHR +#if defined(HAVE_RLIMIT_NTHR) && !defined(HAVE_RLIMIT_PTHREAD) # define RLIMIT_PTHREAD RLIMIT_NTHR +# define HAVE_RLIMIT_PTHREAD 1 #endif enum { @@ -876,6 +878,11 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func)) res = RLIMIT_KQUEUES; break; # endif +# ifdef HAVE_RLIMIT_PTHREAD + case 'T': + res = RLIMIT_PTHREAD; + break; +# endif default: /* unrecognised limit */ zwarnnam(name, "bad option: -%c", *options); diff --git a/configure.ac b/configure.ac index a2a6b9e..7c04c3a 100644 --- a/configure.ac +++ b/configure.ac @@ -1836,6 +1836,7 @@ zsh_LIMIT_PRESENT(RLIMIT_POSIXLOCKS) zsh_LIMIT_PRESENT(RLIMIT_NPTS) zsh_LIMIT_PRESENT(RLIMIT_SWAP) zsh_LIMIT_PRESENT(RLIMIT_KQUEUES) +zsh_LIMIT_PRESENT(RLIMIT_NTHR) AH_TEMPLATE([RLIMIT_VMEM_IS_RSS], [Define to 1 if RLIMIT_VMEM and RLIMIT_RSS both exist and are equal.]) -- Peter Stephenson Principal Software Engineer Tel: +44 (0)1223 434724 Samsung Cambridge Solution Centre St John's House, St John's Innovation Park, Cowley Road, Cambridge, CB4 0DS, UK