s6

Mirror/fork of https://skarnet.org/software/s6/
git clone https://ccx.te2000.cz/git/s6
Log | Files | Refs | README | LICENSE

commit 5ec0b70b9b0cc387287a1eb3e7aef06a42706eae
parent fd69f337d8bf6ba3aa1c8418edc07ee899f84eb2
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date:   Sun, 26 Feb 2023 03:52:56 +0000

 Prepare for 2.11.3.1, rlimit shenanigans

Signed-off-by: Laurent Bercot <ska@appnovation.com>

Diffstat:
MINSTALL | 2+-
MNEWS | 6++++++
Mdoc/index.html | 4++--
Mdoc/upgrade.html | 7+++++++
Mpackage/info | 2+-
Msrc/daemontools-extras/s6-softlimit.c | 20++++++++++++++++----
6 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/INSTALL b/INSTALL @@ -7,7 +7,7 @@ Build Instructions - A POSIX-compliant C development environment - GNU make version 3.81 or later - skalibs version 2.13.1.0 or later: https://skarnet.org/software/skalibs/ - - execline version 2.9.2.0 or later: https://skarnet.org/software/execline/ + - execline version 2.9.2.1 or later: https://skarnet.org/software/execline/ (You can disable this requirement at configure time, but will lose some functionality.) - Optional: nsss version 0.2.0.3 or later: https://skarnet.org/software/nsss/ diff --git a/NEWS b/NEWS @@ -1,5 +1,11 @@ Changelog for s6. +In 2.11.3.1 +----------- + + - Resource limit shenanigans. + + In 2.11.3.0 ----------- diff --git a/doc/index.html b/doc/index.html @@ -88,7 +88,7 @@ requirement if you link against the shared version of the skalibs library. </li> <li> (Optional, but really recommended for full functionality): <a href="//skarnet.org/software/execline/">execline</a> version -2.9.2.0 or later. When s6 is built with execline support (which is the default), +2.9.2.1 or later. When s6 is built with execline support (which is the default), execline is a build-time requirement, and also a run-time requirement for certain binaries that spawn scripts interpreted with <a href="//skarnet.org/software/execline/execlineb.html">execlineb</a>. </li> @@ -115,7 +115,7 @@ want nsswitch-like functionality: <h3> Download </h3> <ul> - <li> The current released version of s6 is <a href="s6-2.11.3.0.tar.gz">2.11.3.0</a>. </li> + <li> The current released version of s6 is <a href="s6-2.11.3.1.tar.gz">2.11.3.1</a>. </li> <li> Alternatively, you can checkout a copy of the <a href="//git.skarnet.org/cgi-bin/cgit.cgi/s6/">s6 git repository</a>: diff --git a/doc/upgrade.html b/doc/upgrade.html @@ -18,6 +18,13 @@ <h1> What has changed in s6 </h1> +<h2> in 2.11.3.1 </h2> + +<ul> + <li> <a href="//skarnet.org/software/execline/">execline</a> +recommended dependency bumped to 2.9.2.1. </li> +</ul> + <h2> in 2.11.3.0 </h2> <ul> diff --git a/package/info b/package/info @@ -1,4 +1,4 @@ package=s6 -version=2.11.3.0 +version=2.11.3.1 category=admin package_macro_name=S6 diff --git a/src/daemontools-extras/s6-softlimit.c b/src/daemontools-extras/s6-softlimit.c @@ -10,17 +10,27 @@ #define USAGE "s6-softlimit [ -a allbytes ] [ -c corebytes ] [ -d databytes ] [ -f filebytes ] [ -l lockbytes ] [ -m membytes ] [ -o openfiles ] [ -p processes ] [ -r residentbytes ] [ -s stackbytes ] [ -t cpusecs ] prog..." +static int what = 1 ; + static void doit (int res, char const *arg) { struct rlimit r ; if (getrlimit(res, &r) < 0) strerr_diefu1sys(111, "getrlimit") ; - if ((arg[0] == '=') && !arg[1]) r.rlim_cur = r.rlim_max ; + if ((arg[0] == '=') && !arg[1]) + { + if (what & 2) r.rlim_max = RLIM_INFINITY ; + if (what & 1) r.rlim_cur = r.rlim_max ; + } else { uint64_t n ; if (!uint640_scan(arg, &n)) strerr_dieusage(100, USAGE) ; - if (n > (uint64_t)r.rlim_max) n = (uint64_t)r.rlim_max ; - r.rlim_cur = (rlim_t)n ; + if (what & 2) r.rlim_max = n ; + if (what & 1) + { + if (n > r.rlim_max) n = r.rlim_max ; + r.rlim_cur = n ; + } } if (setrlimit(res, &r) < 0) strerr_diefu1sys(111, "setrlimit") ; } @@ -31,10 +41,12 @@ int main (int argc, char const *const *argv) PROG = "s6-softlimit" ; for (;;) { - int opt = subgetopt_r(argc, argv, "a:c:d:f:l:m:o:p:r:s:t:", &l) ; + int opt = subgetopt_r(argc, argv, "hHa:c:d:f:l:m:o:p:r:s:t:", &l) ; if (opt == -1) break ; switch (opt) { + case 'h' : what = 2 ; break ; + case 'H' : what = 3 ; break ; case 'a' : #ifdef RLIMIT_AS doit(RLIMIT_AS, l.arg) ;