1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-01 05:16:05 +01:00

32799: resource NTHR not well handled on NetBSD

This commit is contained in:
Peter Stephenson 2014-06-26 10:48:19 +01:00
parent 920db696cb
commit e0dccff13e
3 changed files with 28 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2014-06-26 Peter Stephenson <p.stephenson@samsung.com>
* 32799: Doc/Zsh/builtins.yo, Src/Builtins/rlimits.c: resource
NTHR is not properly handled on netBSD.
2014-06-24 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 32789: Src/lex.c Src/mem.c Src/zsh_system.h configure.ac:

View file

@ -1940,6 +1940,9 @@ sitem(tt(-m))(Kilobytes on the size of physical memory.)
sitem(tt(-n))(open file descriptors.)
sitem(tt(-p))(The number of pseudo-terminals.)
sitem(tt(-q))(Bytes in POSIX message queues.)
sitem(tt(-r))(Maximum real time priority. On some systems where this
is not available, such as NetBSD, this has the same effect as tt(-T)
for compatibility with tt(sh).)
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.)

View file

@ -32,12 +32,17 @@
#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
# define THREAD_FMT "-T: threads "
#else
# define THREAD_FMT "-T: threads per process "
#endif
enum {
@ -373,7 +378,7 @@ printulimit(char *nam, int lim, int hard, int head)
# ifdef HAVE_RLIMIT_PTHREAD
case RLIMIT_PTHREAD:
if (head)
printf("-T: threads per process ");
printf("%s", THREAD_FMT);
break;
# endif /* HAVE_RLIMIT_PTHREAD */
# ifdef HAVE_RLIMIT_NICE
@ -860,6 +865,13 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
case 'r':
res = RLIMIT_RTPRIO;
break;
# else
# ifdef HAVE_RLIMIT_NTHR
/* For compatibility with sh on NetBSD */
case 'r':
res = RLIMIT_NTHR;
break;
# endif /* HAVE_RLIMIT_NTHR */
# endif
# ifdef HAVE_RLIMIT_NPTS
case 'p':
@ -875,6 +887,11 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
case 'k':
res = RLIMIT_KQUEUES;
break;
# endif
# ifdef HAVE_RLIMIT_PTHREAD
case 'T':
res = RLIMIT_PTHREAD;
break;
# endif
default:
/* unrecognised limit */