zsh-workers
 help / color / mirror / code / Atom feed
From: Jun T <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] find RLIM_NLIMITS correctly on Cygwin
Date: Mon, 23 Mar 2020 14:31:34 +0900	[thread overview]
Message-ID: <944ABBFD-ED15-4638-9C23-E9E36BA80A30@kba.biglobe.ne.jp> (raw)
In-Reply-To: <20200320191846.3a4f5682@tarpaulin.shahaf.local2>

reply 1/2 to workers/45590⁩
> 2020/03/21 4:18, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> 
> Continuing my review:
> 
> Jun T wrote on Tue, 25 Feb 2020 18:38 +0900:
>> 
>> -END {
>> -    if (limrev["MEMLOCK"] != "") {
>> -        irss = limrev["RSS"]
>> -        msg[irss] = "Mmemoryuse"
>> -    }  
> 
> Question.  I compared the output before and after the patch and I see
> the following difference:
> 
>    % diff -U0 =(zsh-5.7.1 -fc 'limit') =(limit)
>    --- /tmp/zshZXxkUD      2020-03-20 18:00:04.239999929 +0000
>    +++ /tmp/zshxTTscg      2020-03-20 18:00:04.239999929 +0000
>    @@ -6 +6 @@
>    -memoryuse       unlimited
>    +resident        unlimited
>    zsh: exit 1     diff -U0 =(zsh-5.7.1 -fc 'limit') =(limit)
> 
> It seems to be caused by the C implementation not having an equivalent
> of the above piece of code. this difference intentional?

Sorry, I just lazily ignored that part of rlimits.awk because:
I didn't understand why existence of RLIMIT_MEMLOCK affects the name
of RLIMIT_RSS, and,
on Linux ulimit prints it as "resident set size", and,
RLIMIT_RSS is used only in kernel 2.4.29 or earlier (on Linux).

# bash's builtin ulimit prints it as "max memory size" on Linux.

If compatibility with the previous version of zsh is important
we may use the patch below.

zshbuiltin man page also needs be updated. Do we need to list all the
known resources? Or just list most common resources and mention that,
for example, exact list of resources supported on your system can
be shown by running 'limit' or 'ulimit -a'?


diff --git a/Src/Builtins/rlimits.c b/Src/Builtins/rlimits.c
index aa9b9dd48..8f1d4b306 100644
--- a/Src/Builtins/rlimits.c
+++ b/Src/Builtins/rlimits.c
@@ -65,18 +65,23 @@ static const resinfo_T known_resources[] = {
     {RLIMIT_NOFILE, "descriptors", ZLIMTYPE_NUMBER, 1,
 		'n', "file descriptors"},
 # endif
+# ifdef HAVE_RLIMIT_MEMLOCK
+#  define RSS_NAME "memoryuse"
+# else
+#  define RSS_NAME "resident"
+# endif
 # if defined(HAVE_RLIMIT_AS) && !defined(RLIMIT_VMEM_IS_AS)
     {RLIMIT_AS, "addressspace", ZLIMTYPE_MEMORY, 1024,
 		'v', "address space (kbytes)"},
 # endif
 # if defined(HAVE_RLIMIT_RSS) && !defined(RLIMIT_VMEM_IS_RSS) && !defined(RLIMIT_RSS_IS_AS)
-    {RLIMIT_RSS, "resident", ZLIMTYPE_MEMORY, 1024,
+    {RLIMIT_RSS, RSS_NAME, ZLIMTYPE_MEMORY, 1024,
 		'm', "resident set size (kbytes)"},
 # endif
 # if defined(HAVE_RLIMIT_VMEM)
     {RLIMIT_VMEM,
 #  if defined(RLIMIT_VMEM_IS_RSS)
-		 "resident", ZLIMTYPE_MEMORY, 1024,
+		 RSS_NAME, ZLIMTYPE_MEMORY, 1024,
 		 'm', "memory size (kbytes)"
 #  else
 		 "vmemorysize", ZLIMTYPE_MEMORY, 1024,









  reply	other threads:[~2020-03-23  5:32 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-08 10:39 Jun T
2020-01-08 21:33 ` Daniel Shahaf
2020-01-09 10:32   ` Jun T
2020-01-09 13:15     ` Daniel Shahaf
2020-01-10 10:24       ` Jun T
2020-01-11 20:15         ` Daniel Shahaf
2020-01-13 11:00           ` Jun T
2020-01-13 16:42             ` Daniel Shahaf
2020-01-14  4:44               ` Jun T
2020-01-14 16:25                 ` Daniel Shahaf
2020-02-25  9:38                   ` Jun T
2020-02-27 13:22                     ` Daniel Shahaf
2020-02-27 18:46                       ` Mikael Magnusson
2020-02-28  8:42                       ` Jun T
2020-02-28 14:19                         ` Daniel Shahaf
2020-02-28 14:31                           ` Daniel Shahaf
2020-03-03  9:23                           ` Jun T
2020-03-04 19:29                             ` Daniel Shahaf
2020-03-05 10:26                               ` Jun T
2020-03-05 14:58                                 ` Daniel Shahaf
2020-03-20 17:02                             ` Daniel Shahaf
2020-03-20 17:20                               ` Bart Schaefer
2020-03-20 17:39                                 ` Daniel Shahaf
2020-03-20 18:28                                   ` Daniel Shahaf
2020-03-20 18:36                                     ` Bart Schaefer
2020-03-20 19:38                                       ` Daniel Shahaf
2020-03-20 18:39                                     ` Bart Schaefer
2020-03-20 19:32                                       ` Daniel Shahaf
2020-03-20 19:18                     ` Daniel Shahaf
2020-03-23  5:31                       ` Jun T [this message]
2020-03-24  2:08                         ` Daniel Shahaf
2020-03-23  5:41                       ` Jun T
2020-03-24  1:33                         ` Jun T
2020-03-24  2:43                           ` Daniel Shahaf
2020-03-25  0:16                             ` Jun T
2020-03-25 22:04                               ` Daniel Shahaf
2020-03-25 23:42                                 ` [PATCH] find RLIM_NLIMITS correctly on CygwinjL Daniel Shahaf
2020-03-24  2:34                         ` [PATCH] find RLIM_NLIMITS correctly on Cygwin Daniel Shahaf

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=944ABBFD-ED15-4638-9C23-E9E36BA80A30@kba.biglobe.ne.jp \
    --to=takimoto-j@kba.biglobe.ne.jp \
    --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).