From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29333 invoked by alias); 31 Oct 2013 20:11:19 -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: 31934 Received: (qmail 325 invoked from network); 31 Oct 2013 20:11:05 -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 autolearn=ham version=3.3.2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=BxRXzx/tnSrpS/vAMoN1LrqUxLeLZHUTIvMb6ViKMDs=; b=i85bs6s+DQCRddHaNVL7mzq/+Qdnhwb9MSZmJmDf2RcIK/6MEpuqS6ATxHMwjgsi7W TCH5J9feY4AV2gugsIRc69ciVbkCIMjfM9Y35PUZ75yVPBaMtuvp0a9sJHAmutBbD34a bhht3bk96L5NPFy6skD5PsvnSadEfLj8n9D9gQGykpPGrSb/wZJIuDXq8uayTMtsAGcU ihiPbUBDTCI5qwZI2zyIVPvVdP785pbZH7QRPIzq6yfOGZ1OFGpfbmsjxN3YGu27vBK7 BTcJ3PlqLIFkIRuWFZ3iC4SOLJHoCrMPlenTxw6MsoXoTRIkWEH0pSqdPuKdOfkXrkXg GPew== X-Gm-Message-State: ALoCoQl5nGr3bsQQAuez8v0I7Ltq6X1mXTRn/C9soUdImnPbCdettB9WPqHUX9/vpIM9ma+t/uVl X-Received: by 10.205.5.74 with SMTP id of10mr30178bkb.92.1383250259009; Thu, 31 Oct 2013 13:10:59 -0700 (PDT) X-ProxyUser-IP: 86.6.157.246 Date: Thu, 31 Oct 2013 20:10:55 +0000 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: PATCH: add more ulimit extensions from BSDs Message-ID: <20131031201055.25b982fe@pws-pc.ntlworld.com> In-Reply-To: <20131031113307.30f95260@pwslap01u.europe.root.pri> References: <20131030.86li1bwnj5@bitmessage.ch> <20131030105933.4c6336e0@pwslap01u.europe.root.pri> <131030082930.ZM8009@torch.brasslantern.com> <20131031113307.30f95260@pwslap01u.europe.root.pri> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.7; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 31 Oct 2013 11:33:07 +0000 Peter Stephenson wrote: > In the absence of other suggestions I think I'll just turn posixlocks > into -K (but note the incompatibility in the manual). Done, with some additional documentation for ulimit. diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo index 6f33c02..f33685b 100644 --- a/Doc/Zsh/builtins.yo +++ b/Doc/Zsh/builtins.yo @@ -1013,6 +1013,10 @@ sitem(tt(sigpending))(Maximum number of pending signals.) sitem(tt(sockbufsize))(Maximum size of all socket buffers.) sitem(tt(stacksize))(Maximum stack size for each process.) sitem(tt(vmemorysize))(Maximum amount of virtual memory.) +sitem(tt(posixlocks))(Maximum number of POSIX locks per user.) +sitem(tt(pseudoterminals))(Maximum number of pseudo-terminals.) +sitem(tt(swapuse))(Maximum amount of swap used.) +sitem(tt(kqueues))(Maximum number of kqueues allocated.) endsitem() Which of these resource limits are available depends on the system. @@ -1893,7 +1897,7 @@ enditem() findex(ulimit) cindex(resource limits) cindex(limits, resource) -item(tt(ulimit) [ [ tt(-SHacdfilmnpqrstvx) | tt(-N) var(resource) [ var(limit) ] ... ])( +item(tt(ulimit) [ [ tt(-SHacdfikKlmnpqrstvwx) | 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 @@ -1924,9 +1928,13 @@ sitem(tt(-c))(512-byte blocks on the size of core dumps.) sitem(tt(-d))(Kilobytes on the size of the data segment.) sitem(tt(-f))(512-byte blocks on the size of files written.) sitem(tt(-i))(The number of pending signals.) +sitem(tt(-k))(Maximum number of kqueues allocated.) +sitem(tt(-K))(Maximum number of POSIX locks per user. Note this is +tt(-k) in some other shells.) sitem(tt(-l))(Kilobytes on the size of locked-in memory.) sitem(tt(-m))(Kilobytes on the size of physical memory.) sitem(tt(-n))(open file descriptors.) +sitem(tt(-p))(Maximum number of pseudo-terminals.) sitem(tt(-q))(Bytes in POSIX message queues.) sitem(tt(-s))(Kilobytes on the size of the stack.) sitem(tt(-t))(CPU seconds to be used.) @@ -1934,6 +1942,7 @@ 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))(Kilobytes on the size of virtual memory. On some systems this refers to the limit called `address space'.) +sitem(tt(-w))(Maximum amount of swap memory.) sitem(tt(-x))(The number of locks on files.) endsitem() diff --git a/Src/Builtins/rlimits.awk b/Src/Builtins/rlimits.awk index bf91481..ccee49e 100644 --- a/Src/Builtins/rlimits.awk +++ b/Src/Builtins/rlimits.awk @@ -55,6 +55,10 @@ BEGIN {limidx = 0} if (limnam == "NICE") { msg[limnum] = "Nnice" } if (limnam == "RTPRIO") { msg[limnum] = "Nrt_priority" } if (limnam == "RTTIME") { msg[limnum] = "Urt_time" } + if (limnam == "POSIXLOCKS") { msg[limnum] = "Nposixlocks" } + if (limnam == "NPTS") { msg[limnum] = "Npseudoterminals" } + if (limnam == "SWAP") { msg[limnum] = "Mswapuse" } + if (limnam == "KQUEUES") { msg[limnum] = "Nkqueues" } } } } diff --git a/Src/Builtins/rlimits.c b/Src/Builtins/rlimits.c index eedfa96..a0f2948 100644 --- a/Src/Builtins/rlimits.c +++ b/Src/Builtins/rlimits.c @@ -386,6 +386,32 @@ printulimit(char *nam, int lim, int hard, int head) printf("-r: max rt priority "); break; # endif /* HAVE_RLIMIT_RTPRIO */ +# ifdef HAVE_RLIMIT_POSIXLOCKS + case RLIMIT_POSIXLOCKS: + if (head) + printf("-K: posixlocks "); + break; +# endif /* HAVE_RLIMIT_POSIXLOCKS */ +# ifdef HAVE_RLIMIT_NPTS + case RLIMIT_NPTS: + if (head) + printf("-p: pseudo-terminals "); + break; +# endif /* HAVE_RLIMIT_NPTS */ +# ifdef HAVE_RLIMIT_SWAP + case RLIMIT_SWAP: + if (head) + printf("-w: swap limit (kbytes) "); + if (limit != RLIM_INFINITY) + limit /= 1024; + break; +# endif /* HAVE_RLIMIT_SWAP */ +# ifdef HAVE_RLIMIT_KQUEUES + case RLIMIT_KQUEUES: + if (head) + printf("-k: kqueues "); + break; +# endif /* HAVE_RLIMIT_KQUEUES */ default: if (head) printf("-N %2d: ", lim); @@ -844,6 +870,26 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func)) res = RLIMIT_RTPRIO; break; # endif +# ifdef HAVE_RLIMIT_POSIXLOCKS + case 'K': + res = RLIMIT_POSIXLOCKS; + break; +# endif +# ifdef HAVE_RLIMIT_NPTS + case 'p': + res = RLIMIT_NPTS; + break; +# endif +# ifdef HAVE_RLIMIT_SWAP + case 'w': + res = RLIMIT_SWAP; + break; +# endif +# ifdef HAVE_RLIMIT_KQUEUES + case 'k': + res = RLIMIT_KQUEUES; + break; +# endif default: /* unrecognised limit */ zwarnnam(name, "bad option: -%c", *options); diff --git a/configure.ac b/configure.ac index c3093f2..32872be 100644 --- a/configure.ac +++ b/configure.ac @@ -1812,6 +1812,10 @@ zsh_LIMIT_PRESENT(RLIMIT_SIGPENDING) zsh_LIMIT_PRESENT(RLIMIT_MSGQUEUE) zsh_LIMIT_PRESENT(RLIMIT_NICE) zsh_LIMIT_PRESENT(RLIMIT_RTPRIO) +zsh_LIMIT_PRESENT(RLIMIT_POSIXLOCKS) +zsh_LIMIT_PRESENT(RLIMIT_NPTS) +zsh_LIMIT_PRESENT(RLIMIT_SWAP) +zsh_LIMIT_PRESENT(RLIMIT_KQUEUES) AH_TEMPLATE([RLIMIT_VMEM_IS_RSS], [Define to 1 if RLIMIT_VMEM and RLIMIT_RSS both exist and are equal.]) -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/