From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16561 invoked by alias); 31 Oct 2013 23:44:54 -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: 31936 Received: (qmail 23611 invoked from network); 31 Oct 2013 23:44:38 -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=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FROM_LOCAL_NOVOWEL autolearn=ham version=3.3.2 dkim-signature: v=1; a=rsa-sha256; d=bitmessage.ch; s=mail; c=relaxed/relaxed; q=dns/txt; h=From:Subject:Date:Message-ID:To:MIME-Version:Content-Type; bh=rSKgckqNG3bF+kfI4Ff2EUqxp+cgcJh6iwWoF6JO6+o=; b=OBMo1faXKexBmhN8U2fHdiJCLsYaMt5nPwRYIGIK9DvFpftqncqxuscI0Qh/D+UI5l1Rgk3h6rUM3zOST3Dl5ne7CBJdRWumoWXX+VJltqftfAVYPxld5mv+7BzhGQ/o0zqMC5dX8v476ucIYDv4Oj+9BfT6MJYHjePfYWrII7I= From: Stefan Neudorf To: zsh-workers@zsh.org Subject: PATCH: assign threads ulimit -T flag like in bash Date: Fri, 01 Nov 2013 00:41:41 +0100 Message-ID: <20131101.86y559c8ju@bitmessage.ch> MIME-Version: 1.0 Content-Type: text/plain Currently limiting threads in zsh is done via either -N X maxpthreads or -r maxthr. However, ulimit -r occupied by two limits: RLIMIT_RTPRIO and RLIMIT_NTHR. And to make matter worse bash uses -T option letter. This change renames -r maxthr to -T maxpthread given that maxthr csh-style limit wasn't documented in the zsh manpage. But maxpthread is still different name from maxthread in login.conf or threads which tcsh is going to use (my fault). -r rt_priority as previously is left undocumented. --- Doc/Zsh/builtins.yo | 4 ++-- Src/Builtins/rlimits.awk | 2 +- Src/Builtins/rlimits.c | 17 +++++------------ 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo index 7927232..4864e21 100644 --- a/Doc/Zsh/builtins.yo +++ b/Doc/Zsh/builtins.yo @@ -1897,7 +1897,7 @@ enditem() findex(ulimit) cindex(resource limits) cindex(limits, resource) -item(tt(ulimit) [ [ tt(-SHacdfiklmnpqrstvwx) | tt(-N) var(resource) [ var(limit) ] ... ])( +item(tt(ulimit) [ [ tt(-SHacdfiklmnpqsTtvwx) | 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 @@ -1935,8 +1935,8 @@ sitem(tt(-n))(open file descriptors.) sitem(tt(-p))(The 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))(The number of simultaneous threads available to the user.) sitem(tt(-t))(CPU seconds to be used.) -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'.) diff --git a/Src/Builtins/rlimits.awk b/Src/Builtins/rlimits.awk index b5a25fd..fe2d0e9 100644 --- a/Src/Builtins/rlimits.awk +++ b/Src/Builtins/rlimits.awk @@ -42,7 +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 == "NTHR") { msg[limnum] = "Nmaxpthreads" } if (limnam == "OFILE") { msg[limnum] = "Ndescriptors" } if (limnam == "PTHREAD") { msg[limnum] = "Nmaxpthreads" } if (limnam == "RSS") { msg[limnum] = "Mresident" } diff --git a/Src/Builtins/rlimits.c b/Src/Builtins/rlimits.c index e48a1d3..fd4c94a 100644 --- a/Src/Builtins/rlimits.c +++ b/Src/Builtins/rlimits.c @@ -36,6 +36,10 @@ # define RLIMIT_LOCKS RLIMIT_POSIXLOCKS #endif +#ifdef RLIMIT_NTHR +# define RLIMIT_PTHREAD RLIMIT_NTHR +#endif + enum { ZLIMTYPE_MEMORY, ZLIMTYPE_NUMBER, @@ -318,12 +322,6 @@ printulimit(char *nam, int lim, int hard, int head) 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) @@ -375,7 +373,7 @@ printulimit(char *nam, int lim, int hard, int head) # ifdef HAVE_RLIMIT_PTHREAD case RLIMIT_PTHREAD: if (head) - printf("-N %2d: threads per process ", RLIMIT_PTHREAD); + printf("-T: threads per process "); break; # endif /* HAVE_RLIMIT_PTHREAD */ # ifdef HAVE_RLIMIT_NICE @@ -824,11 +822,6 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func)) 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;