From 790a4fee2b498a80b43605d64f4c81f01501b727 Mon Sep 17 00:00:00 2001 From: Stefan Neudorf Date: Wed, 30 Oct 2013 02:33:18 +0100 Subject: 31930 / 31934: New limits from BSD. Avoid clash of uses for ulimit -k. --- Src/Builtins/rlimits.awk | 4 ++++ Src/Builtins/rlimits.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) (limited to 'Src/Builtins') diff --git a/Src/Builtins/rlimits.awk b/Src/Builtins/rlimits.awk index bf914814d..ccee49e87 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 eedfa969c..a0f294876 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); @@ -843,6 +869,26 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func)) case 'r': 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 */ -- cgit v1.2.3 From 93dec3a96a38141c6176eb07d51c59f0ab15d151 Mon Sep 17 00:00:00 2001 From: Stefan Neudorf Date: Fri, 1 Nov 2013 00:09:04 +0100 Subject: 31935: further updates to limits for BSD --- ChangeLog | 6 ++++++ Doc/Zsh/builtins.yo | 18 ++++++++---------- Src/Builtins/rlimits.awk | 2 +- Src/Builtins/rlimits.c | 17 +++++------------ 4 files changed, 20 insertions(+), 23 deletions(-) (limited to 'Src/Builtins') diff --git a/ChangeLog b/ChangeLog index 198147ed4..85eaf3d98 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-11-03 Peter Stephenson + + * Stefan Neudorf: 31935: Doc/Zsh/builtins.yo, + Src/Builtins/rlimits.awk, Src/Builtins/rlimits.c: further + limit updates for 31930, 39134. + 2013-10-31 Peter Stephenson * Stefan Neudorf: 31930 / 31934: Doc/Zsh/builtins.yo, diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo index f33685b66..b9b504de8 100644 --- a/Doc/Zsh/builtins.yo +++ b/Doc/Zsh/builtins.yo @@ -1003,20 +1003,20 @@ sitem(tt(cputime))(Maximum CPU seconds per process.) sitem(tt(datasize))(Maximum data size (including stack) for each process.) sitem(tt(descriptors))(Maximum value for a file descriptor.) sitem(tt(filesize))(Largest single file allowed.) +sitem(tt(kqueues))(Maximum number of kqueues allocated.) sitem(tt(maxproc))(Maximum number of processes.) sitem(tt(maxpthreads))(Maximum number of threads per process.) sitem(tt(memorylocked))(Maximum amount of memory locked in RAM.) sitem(tt(memoryuse))(Maximum resident set size.) sitem(tt(msgqueue))(Maximum number of bytes in POSIX message queues.) +sitem(tt(posixlocks))(Maximum number of POSIX locks per user.) +sitem(tt(pseudoterminals))(Maximum number of pseudo-terminals.) sitem(tt(resident))(Maximum resident set size.) 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(swapsize))(Maximum amount of swap used.) 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. @@ -1897,7 +1897,7 @@ enditem() findex(ulimit) cindex(resource limits) cindex(limits, resource) -item(tt(ulimit) [ [ tt(-SHacdfikKlmnpqrstvwx) | tt(-N) var(resource) [ var(limit) ] ... ])( +item(tt(ulimit) [ [ tt(-SHacdfiklmnpqrstvwx) | 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 @@ -1928,13 +1928,11 @@ 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(-k))(The number of kqueues allocated.) 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(-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))(CPU seconds to be used.) @@ -1942,7 +1940,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(-w))(Kilobytes on the size of swapped out memory.) sitem(tt(-x))(The number of locks on files.) endsitem() diff --git a/Src/Builtins/rlimits.awk b/Src/Builtins/rlimits.awk index ccee49e87..b5a25fd83 100644 --- a/Src/Builtins/rlimits.awk +++ b/Src/Builtins/rlimits.awk @@ -57,7 +57,7 @@ BEGIN {limidx = 0} 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 == "SWAP") { msg[limnum] = "Mswapsize" } if (limnam == "KQUEUES") { msg[limnum] = "Nkqueues" } } } diff --git a/Src/Builtins/rlimits.c b/Src/Builtins/rlimits.c index a0f294876..e48a1d3e3 100644 --- a/Src/Builtins/rlimits.c +++ b/Src/Builtins/rlimits.c @@ -32,6 +32,10 @@ #if defined(HAVE_GETRLIMIT) && defined(RLIM_INFINITY) +#ifdef RLIMIT_POSIXLOCKS +# define RLIMIT_LOCKS RLIMIT_POSIXLOCKS +#endif + enum { ZLIMTYPE_MEMORY, ZLIMTYPE_NUMBER, @@ -386,12 +390,6 @@ 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) @@ -401,7 +399,7 @@ printulimit(char *nam, int lim, int hard, int head) # ifdef HAVE_RLIMIT_SWAP case RLIMIT_SWAP: if (head) - printf("-w: swap limit (kbytes) "); + printf("-w: swap size (kbytes) "); if (limit != RLIM_INFINITY) limit /= 1024; break; @@ -870,11 +868,6 @@ 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; -- cgit v1.2.3 From 73746daf7f1e79fa970ab979e645915295157426 Mon Sep 17 00:00:00 2001 From: Stefan Neudorf Date: Fri, 1 Nov 2013 00:41:41 +0100 Subject: 31936: Rationalise limits for threads --- ChangeLog | 4 ++++ Doc/Zsh/builtins.yo | 4 ++-- Src/Builtins/rlimits.awk | 2 +- Src/Builtins/rlimits.c | 17 +++++------------ 4 files changed, 12 insertions(+), 15 deletions(-) (limited to 'Src/Builtins') diff --git a/ChangeLog b/ChangeLog index 85eaf3d98..06abd2415 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2013-11-03 Peter Stephenson + * Stefan Neudorf: 31936: Doc/Zsh/builtins.yo, + Src/Builtins/rlimits.awk, Src/Builtins/rlimits.c: rationalise + thread limits + * Stefan Neudorf: 31935: Doc/Zsh/builtins.yo, Src/Builtins/rlimits.awk, Src/Builtins/rlimits.c: further limit updates for 31930, 39134. diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo index b9b504de8..b23ce3083 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 b5a25fd83..fe2d0e931 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 e48a1d3e3..fd4c94aaa 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; -- cgit v1.2.3