From: Eric Wong <e@yhbt.net> To: meta@public-inbox.org Subject: [PATCH 1/5] spawn: make @RLIMITS an array Date: Wed, 1 Jul 2020 21:06:15 +0000 [thread overview] Message-ID: <20200701210619.29601-2-e@yhbt.net> (raw) In-Reply-To: <20200701210619.29601-1-e@yhbt.net> Making the RLIMITS list a function doesn't allow constant folding, so just make it an array accessible to other modules. --- lib/PublicInbox/Qspawn.pm | 4 ++-- lib/PublicInbox/Spawn.pm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/Qspawn.pm b/lib/PublicInbox/Qspawn.pm index c09e8d2c227..d395a10b3b1 100644 --- a/lib/PublicInbox/Qspawn.pm +++ b/lib/PublicInbox/Qspawn.pm @@ -48,7 +48,7 @@ sub _do_spawn { my ($cmd, $cmd_env, $opt) = @{delete $self->{args}}; my %o = %{$opt || {}}; $self->{limiter} = $limiter; - foreach my $k (PublicInbox::Spawn::RLIMITS()) { + foreach my $k (@PublicInbox::Spawn::RLIMITS) { if (defined(my $rlimit = $limiter->{$k})) { $o{$k} = $rlimit; } @@ -358,7 +358,7 @@ sub new { sub setup_rlimit { my ($self, $name, $config) = @_; - foreach my $rlim (PublicInbox::Spawn::RLIMITS()) { + foreach my $rlim (@PublicInbox::Spawn::RLIMITS) { my $k = lc($rlim); $k =~ tr/_//d; $k = "publicinboxlimiter.$name.$k"; diff --git a/lib/PublicInbox/Spawn.pm b/lib/PublicInbox/Spawn.pm index f90d8f6d3dd..ba6e73675fe 100644 --- a/lib/PublicInbox/Spawn.pm +++ b/lib/PublicInbox/Spawn.pm @@ -18,7 +18,7 @@ use base qw(Exporter); use Symbol qw(gensym); use PublicInbox::ProcessPipe; our @EXPORT_OK = qw/which spawn popen_rd/; -sub RLIMITS () { qw(RLIMIT_CPU RLIMIT_CORE RLIMIT_DATA) } +our @RLIMITS = qw(RLIMIT_CPU RLIMIT_CORE RLIMIT_DATA); my $vfork_spawn = <<'VFORK_SPAWN'; #include <sys/types.h> @@ -209,7 +209,7 @@ sub spawn ($;$$) { } my $rlim = []; - foreach my $l (RLIMITS()) { + foreach my $l (@RLIMITS) { defined(my $v = $opts->{$l}) or next; my $r = eval "require BSD::Resource; BSD::Resource::$l();"; unless (defined $r) {
next prev parent reply other threads:[~2020-07-01 21:06 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-07-01 21:06 [PATCH 0/5] some random minor fixes Eric Wong 2020-07-01 21:06 ` Eric Wong [this message] 2020-07-01 21:06 ` [PATCH 2/5] spawn: modernize with parent.pm, drop warnings.pm Eric Wong 2020-07-01 21:06 ` [PATCH 3/5] watch: retry signals to kill IDLE and polling processes Eric Wong 2020-07-01 21:06 ` [PATCH 4/5] tests: add use/require statements for TEST_RUN_MODE=0 Eric Wong 2020-07-01 21:06 ` [PATCH 5/5] overidx: document why we don't use SQLite WAL Eric Wong 2020-07-02 20:12 ` [PATCH 6/5] spawn: drop unused sys/uio.h include Eric Wong
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 List information: https://public-inbox.org/README * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200701210619.29601-2-e@yhbt.net \ --to=e@yhbt.net \ --cc=meta@public-inbox.org \ --subject='Re: [PATCH 1/5] spawn: make @RLIMITS an array' \ /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
Code repositories for project(s) associated with this inbox: https://80x24.org/public-inbox.git 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 read-only IMAP folder(s) and NNTP newsgroup(s).