From: Peter Stephenson <p.stephenson@samsung.com>
To: Thomas Klausner <tk@giga.or.at>, zsh-workers@zsh.org
Subject: Re: ulimit -a: -r vs -N [was Re: pkgsrc patches for zsh]
Date: Wed, 25 Jun 2014 12:11:55 +0100 [thread overview]
Message-ID: <20140625121155.70228dab@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <20140625110010.GQ13765@danbala.tuwien.ac.at>
On Wed, 25 Jun 2014 13:00:11 +0200
Thomas Klausner <tk@giga.or.at> wrote:
> On Wed, Jun 25, 2014 at 11:33:35AM +0100, Peter Stephenson wrote:
> > I've added compatibility with sh when NTHR is present and RTPRIO isn't
> > --- which should be just about specific enough that the additional
> > compatibility more than offsets any confusion.
>
> Thanks, but this version doesn't compile since:
> rlimits.c: In function 'printulimit':
> rlimits.c:398:5: error: duplicate case value
> case RLIMIT_NTHR:
> ^
> rlimits.c:379:5: error: previously used here
> case RLIMIT_PTHREAD:
> ^
> *** Error code 1
Right, we'll just have to output for -T only, not -r. As -r's for
compatibility with sh and the zsh documentation mentions -T that's
probably not a problem.
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index 9905ab5..dd090d6 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -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.)
diff --git a/Src/Builtins/rlimits.c b/Src/Builtins/rlimits.c
index 0bcafda..1ab8710 100644
--- a/Src/Builtins/rlimits.c
+++ b/Src/Builtins/rlimits.c
@@ -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(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':
@@ -876,6 +888,11 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
res = RLIMIT_KQUEUES;
break;
# endif
+# ifdef HAVE_RLIMIT_PTHREAD
+ case 'T':
+ res = RLIMIT_PTHREAD;
+ break;
+# endif
default:
/* unrecognised limit */
zwarnnam(name, "bad option: -%c", *options);
next prev parent reply other threads:[~2014-06-25 11:12 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-16 12:04 tgoto issue in zsh-5.0.0 Thomas Klausner
2012-08-16 13:07 ` Peter Stephenson
2012-08-16 13:20 ` Thomas Klausner
2012-08-16 13:25 ` Peter Stephenson
2012-08-16 14:25 ` pkgsrc patches for zsh [was Re: tgoto issue in zsh-5.0.0] Thomas Klausner
2012-08-16 19:18 ` Peter Stephenson
2012-08-17 8:11 ` Thomas Klausner
2012-08-17 9:38 ` Peter Stephenson
2012-08-17 10:50 ` Thomas Klausner
2012-08-17 11:35 ` Peter Stephenson
2012-08-17 12:16 ` Thomas Klausner
2012-08-17 13:27 ` Peter Stephenson
2014-06-24 14:37 ` ulimit -a: -r vs -N [was Re: pkgsrc patches for zsh] Thomas Klausner
2014-06-24 15:07 ` Peter Stephenson
2014-06-24 16:11 ` Thomas Klausner
2014-06-24 16:26 ` Peter Stephenson
2014-06-24 17:09 ` Thomas Klausner
2014-06-25 8:26 ` Peter Stephenson
2014-06-25 8:36 ` Thomas Klausner
2014-06-25 10:33 ` Peter Stephenson
2014-06-25 11:00 ` Thomas Klausner
2014-06-25 11:11 ` Peter Stephenson [this message]
2014-06-25 12:18 ` Thomas Klausner
2014-06-26 8:31 ` Daniel Shahaf
2014-06-26 9:49 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140625121155.70228dab@pwslap01u.europe.root.pri \
--to=p.stephenson@samsung.com \
--cc=tk@giga.or.at \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).