Close more superfluous file descriptors

GitHub Actions leaks file descriptors with numbers greater than a
hundred. But our test runner only checked for FDs up to 64.
This commit is contained in:
Justine Tunney 2022-06-21 07:22:39 -07:00
parent b8e9f71d33
commit ff28e38ef1
2 changed files with 30 additions and 5 deletions

View file

@ -18,6 +18,7 @@
*/
#include "libc/calls/calls.h"
#include "libc/calls/strace.internal.h"
#include "libc/calls/struct/rlimit.h"
#include "libc/calls/struct/sigset.h"
#include "libc/calls/struct/termios.h"
#include "libc/calls/struct/utsname.h"
@ -49,6 +50,7 @@
#include "libc/sysv/consts/auxv.h"
#include "libc/sysv/consts/f.h"
#include "libc/sysv/consts/poll.h"
#include "libc/sysv/consts/rlim.h"
#include "libc/sysv/consts/sig.h"
#include "libc/sysv/consts/termios.h"
#include "tool/decode/lib/idname.h"
@ -140,6 +142,7 @@ textstartup void __printargs(const char *prologue) {
unsigned i, n;
int e, x, flags;
uintptr_t *auxp;
struct rlimit rlim;
struct utsname uts;
struct termios termios;
struct AuxiliaryValue *auxinfo;
@ -276,6 +279,17 @@ textstartup void __printargs(const char *prologue) {
PRINT(" error: sigprocmask() failed %m");
}
PRINT("");
PRINT("RESOURCE LIMITS");
for (i = 0; i < RLIM_NLIMITS; ++i) {
if (!getrlimit(i, &rlim)) {
if (rlim.rlim_cur == RLIM_INFINITY) rlim.rlim_cur = -1;
if (rlim.rlim_max == RLIM_INFINITY) rlim.rlim_max = -1;
PRINT(" ☼ %-20s %,16ld %,16ld", DescribeRlimitName(i), rlim.rlim_cur,
rlim.rlim_max);
}
}
PRINT("");
PRINT("ARGUMENTS (%p)", __argv);
if (*__argv) {