Skip to content

Commit

Permalink
Error handling for getrusage() is not very useful
Browse files Browse the repository at this point in the history
  • Loading branch information
jpco committed Dec 10, 2024
1 parent f5c6d50 commit 9aacd80
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions prim-sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,7 @@ PRIM(time) {

Ref(List *, lp, list);

if (getrusage(RUSAGE_CHILDREN, &ru_prev) == -1)
fail("es:ewait", "getrusage: %s", esstrerror(errno));

getrusage(RUSAGE_CHILDREN, &ru_prev);
gc(); /* do a garbage collection first to ensure reproducible results */
t0 = time(NULL);
pid = efork(TRUE, FALSE);
Expand All @@ -324,9 +322,7 @@ PRIM(time) {
SIGCHK();
printstatus(0, status);

if (getrusage(RUSAGE_CHILDREN, &ru_new) == -1)
fail("es:ewait", "getrusage: %s", esstrerror(errno));

getrusage(RUSAGE_CHILDREN, &ru_new);
timesub(&ru_new.ru_utime, &ru_prev.ru_utime, &ru_diff.ru_utime);
timesub(&ru_new.ru_stime, &ru_prev.ru_stime, &ru_diff.ru_stime);

Expand Down

0 comments on commit 9aacd80

Please sign in to comment.