From 89be7a1b89a60446fc0a385c5c1cfaeec2f92c88 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 11 Mar 2019 23:53:02 +0000 Subject: qspawn: wire up RLIMIT_* handling to limiters This allows users to configure RLIMIT_{CORE,CPU,DATA} using our "limiter" config directive when spawning external processes. --- lib/PublicInbox/Spawn.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/Spawn.pm') diff --git a/lib/PublicInbox/Spawn.pm b/lib/PublicInbox/Spawn.pm index 202cfcae..fd981608 100644 --- a/lib/PublicInbox/Spawn.pm +++ b/lib/PublicInbox/Spawn.pm @@ -18,6 +18,7 @@ use Symbol qw(gensym); use IO::Handle; use PublicInbox::ProcessPipe; our @EXPORT_OK = qw/which spawn popen_rd/; +sub RLIMITS () { qw(RLIMIT_CPU RLIMIT_CORE RLIMIT_DATA) } my $vfork_spawn = <<'VFORK_SPAWN'; #include @@ -202,7 +203,7 @@ sub spawn ($;$$) { my $err = $opts->{2} || 2; my $rlim = []; - foreach my $l (qw(RLIMIT_CPU RLIMIT_CORE RLIMIT_DATA)) { + foreach my $l (RLIMITS()) { defined(my $v = $opts->{$l}) or next; my ($soft, $hard); if (ref($v)) { -- cgit v1.2.3-24-ge0c7