1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-02 10:01:11 +02:00

30629 plus unposted formatting changes:

support socket buffer size limit properly in ulimit;
improve consistency of output and documentation and tweak formatting appropriately
This commit is contained in:
Peter Stephenson 2012-08-17 13:26:22 +00:00
parent 9fdcd824d8
commit e92a823a4b
3 changed files with 46 additions and 36 deletions

View file

@ -1,5 +1,11 @@
2012-08-17 Peter Stephenson <pws@csr.com>
* 30629 plus unposted formatting improvements:
Doc/Zsh/builtins.yo, Src/Builtins/rlimits.c: more complete
handling for socket buffer size limit (NetBSD) plus formatting
and consistency changes (kb -> kbytes everywhere in ulimit
output, K-bytes to kilobytes everywhere in documentation).
* 30627: configure.ac, Doc/Zsh/builtins.yo,
Src/Builtins/rlimits.awk, Src/Builtins/rlimits.c:
support RLIMIT_NTHR as on NetBSD.
@ -67,5 +73,5 @@
*****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL
* $Revision: 1.5700 $
* $Revision: 1.5701 $
*****************************************************

View file

@ -1764,19 +1764,20 @@ tt(ulimit -a) will show which are supported.
startsitem()
sitem(tt(-a))(Lists all of the current resource limits.)
sitem(tt(-b))(Socket buffer size in bytes LPAR()N.B. not kilobytes+RPAR())
sitem(tt(-c))(512-byte blocks on the size of core dumps.)
sitem(tt(-d))(K-bytes on the size of the data segment.)
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(-l))(K-bytes on the size of locked-in memory.)
sitem(tt(-m))(K-bytes on the size of physical memory.)
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(-q))(Bytes in POSIX message queues.)
sitem(tt(-s))(K-bytes on the size of the stack.)
sitem(tt(-s))(Kilobytes on the size of the stack.)
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))(K-bytes on the size of virtual memory. On some systems this
sitem(tt(-v))(Kilobytes 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.)
endsitem()

View file

@ -238,32 +238,32 @@ printulimit(char *nam, int lim, int hard, int head)
switch (lim) {
case RLIMIT_CORE:
if (head)
printf("-c: core file size (blocks) ");
printf("-c: core file size (blocks) ");
if (limit != RLIM_INFINITY)
limit /= 512;
break;
case RLIMIT_DATA:
if (head)
printf("-d: data seg size (kbytes) ");
printf("-d: data seg size (kbytes) ");
if (limit != RLIM_INFINITY)
limit /= 1024;
break;
case RLIMIT_FSIZE:
if (head)
printf("-f: file size (blocks) ");
printf("-f: file size (blocks) ");
if (limit != RLIM_INFINITY)
limit /= 512;
break;
# ifdef HAVE_RLIMIT_SIGPENDING
case RLIMIT_SIGPENDING:
if (head)
printf("-i: pending signals ");
printf("-i: pending signals ");
break;
# endif
# ifdef HAVE_RLIMIT_MEMLOCK
case RLIMIT_MEMLOCK:
if (head)
printf("-l: locked-in-memory size (kb) ");
printf("-l: locked-in-memory size (kbytes) ");
if (limit != RLIM_INFINITY)
limit /= 1024;
break;
@ -273,7 +273,7 @@ printulimit(char *nam, int lim, int hard, int head)
# if defined(HAVE_RLIMIT_RSS) && !defined(RLIMIT_VMEM_IS_RSS) && !defined(RLIMIT_RSS_IS_AS)
case RLIMIT_RSS:
if (head)
printf("-m: resident set size (kbytes) ");
printf("-m: resident set size (kbytes) ");
if (limit != RLIM_INFINITY)
limit /= 1024;
break;
@ -281,7 +281,7 @@ printulimit(char *nam, int lim, int hard, int head)
# if defined(HAVE_RLIMIT_VMEM) && defined(HAVE_RLIMIT_RSS) && defined(RLIMIT_VMEM_IS_RSS)
case RLIMIT_VMEM:
if (head)
printf("-m: memory size (kb) ");
printf("-m: memory size (kbytes) ");
if (limit != RLIM_INFINITY)
limit /= 1024;
break;
@ -289,41 +289,41 @@ printulimit(char *nam, int lim, int hard, int head)
# ifdef HAVE_RLIMIT_NOFILE
case RLIMIT_NOFILE:
if (head)
printf("-n: file descriptors ");
printf("-n: file descriptors ");
break;
# endif /* HAVE_RLIMIT_NOFILE */
# ifdef HAVE_RLIMIT_MSGQUEUE
case RLIMIT_MSGQUEUE:
if (head)
printf("-q: bytes in POSIX msg queues ");
printf("-q: bytes in POSIX msg queues ");
break;
# endif
case RLIMIT_STACK:
if (head)
printf("-s: stack size (kbytes) ");
printf("-s: stack size (kbytes) ");
if (limit != RLIM_INFINITY)
limit /= 1024;
break;
case RLIMIT_CPU:
if (head)
printf("-t: cpu time (seconds) ");
printf("-t: cpu time (seconds) ");
break;
# ifdef HAVE_RLIMIT_NPROC
case RLIMIT_NPROC:
if (head)
printf("-u: processes ");
printf("-u: processes ");
break;
# endif /* HAVE_RLIMIT_NPROC */
# ifdef HAVE_RLIMIT_NTHR
case RLIMIT_NTHR:
if (head)
printf("-r: threads ");
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)
printf("-v: virtual memory size (kb) ");
printf("-v: virtual memory size (kbytes) ");
if (limit != RLIM_INFINITY)
limit /= 1024;
break;
@ -331,7 +331,7 @@ printulimit(char *nam, int lim, int hard, int head)
# if defined HAVE_RLIMIT_AS && !defined(RLIMIT_VMEM_IS_AS)
case RLIMIT_AS:
if (head)
printf("-v: address space (kb) ");
printf("-v: address space (kbytes) ");
if (limit != RLIM_INFINITY)
limit /= 1024;
break;
@ -339,13 +339,13 @@ printulimit(char *nam, int lim, int hard, int head)
# ifdef HAVE_RLIMIT_LOCKS
case RLIMIT_LOCKS:
if (head)
printf("-x: file locks ");
printf("-x: file locks ");
break;
# endif /* HAVE_RLIMIT_LOCKS */
# ifdef HAVE_RLIMIT_AIO_MEM
case RLIMIT_AIO_MEM:
if (head)
printf("-N %2d: AIO locked-in-memory (kb) ", RLIMIT_AIO_MEM);
printf("-N %2d: AIO locked-in-memory (kbytes)", RLIMIT_AIO_MEM);
if (limit != RLIM_INFINITY)
limit /= 1024;
break;
@ -353,44 +353,42 @@ printulimit(char *nam, int lim, int hard, int head)
# ifdef HAVE_RLIMIT_AIO_OPS
case RLIMIT_AIO_OPS:
if (head)
printf("-N %2d: AIO operations ", RLIMIT_AIO_OPS);
printf("-N %2d: AIO operations ", RLIMIT_AIO_OPS);
break;
# endif /* HAVE_RLIMIT_AIO_OPS */
# ifdef HAVE_RLIMIT_TCACHE
case RLIMIT_TCACHE:
if (head)
printf("-N %2d: cached threads ", RLIMIT_TCACHE);
printf("-N %2d: cached threads ", RLIMIT_TCACHE);
break;
# endif /* HAVE_RLIMIT_TCACHE */
# ifdef HAVE_RLIMIT_SBSIZE
case RLIMIT_SBSIZE:
if (head)
printf("-N %2d: socket buffer size (kb) ", RLIMIT_SBSIZE);
if (limit != RLIM_INFINITY)
limit /= 1024;
printf("-b: socket buffer size (bytes) ", RLIMIT_SBSIZE);
break;
# endif /* HAVE_RLIMIT_SBSIZE */
# ifdef HAVE_RLIMIT_PTHREAD
case RLIMIT_PTHREAD:
if (head)
printf("-N %2d: threads per process ", RLIMIT_PTHREAD);
printf("-N %2d: threads per process ", RLIMIT_PTHREAD);
break;
# endif /* HAVE_RLIMIT_PTHREAD */
# ifdef HAVE_RLIMIT_NICE
case RLIMIT_NICE:
if (head)
printf("-e: max nice ");
printf("-e: max nice ");
break;
# endif /* HAVE_RLIMIT_NICE */
# ifdef HAVE_RLIMIT_RTPRIO
case RLIMIT_RTPRIO:
if (head)
printf("-r: max rt priority ");
printf("-r: max rt priority ");
break;
# endif /* HAVE_RLIMIT_RTPRIO */
default:
if (head)
printf("-N %2d: ", lim);
printf("-N %2d: ", lim);
break;
}
/* display the limit */
@ -782,16 +780,21 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
case 'c':
res = RLIMIT_CORE;
break;
# ifdef HAVE_RLIMIT_RSS
case 'm':
res = RLIMIT_RSS;
# ifdef HAVE_RLIMIT_SBSIZE
case 'b':
res = RLIMIT_SBSIZE;
break;
# endif /* HAVE_RLIMIT_RSS */
# endif /* HAVE_RLIMIT_SBSIZE */
# ifdef HAVE_RLIMIT_MEMLOCK
case 'l':
res = RLIMIT_MEMLOCK;
break;
# endif /* HAVE_RLIMIT_MEMLOCK */
# ifdef HAVE_RLIMIT_RSS
case 'm':
res = RLIMIT_RSS;
break;
# endif /* HAVE_RLIMIT_RSS */
# ifdef HAVE_RLIMIT_NOFILE
case 'n':
res = RLIMIT_NOFILE;