From f326d80655d10c29fbfb04dbfeb05fba84298739 Mon Sep 17 00:00:00 2001 From: claudio Date: Wed, 17 Jul 2024 13:29:05 +0000 Subject: [PATCH] Be clear that RUSAGE_CHILDREN only works for terminated children that have been waited for. If you SIG_IGN SIGCHLD or don't call any of the wait functions then RUSAGE_CHILDREN wont report anything. OK deraadt@ millert@ --- lib/libc/sys/getrusage.2 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/libc/sys/getrusage.2 b/lib/libc/sys/getrusage.2 index aeaf5c9d124..35eccf70b98 100644 --- a/lib/libc/sys/getrusage.2 +++ b/lib/libc/sys/getrusage.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: getrusage.2,v 1.17 2015/02/28 21:51:57 bentley Exp $ +.\" $OpenBSD: getrusage.2,v 1.18 2024/07/17 13:29:05 claudio Exp $ .\" .\" Copyright (c) 1985, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)getrusage.2 8.1 (Berkeley) 6/4/93 .\" -.Dd $Mdocdate: February 28 2015 $ +.Dd $Mdocdate: July 17 2024 $ .Dt GETRUSAGE 2 .Os .Sh NAME @@ -48,7 +48,10 @@ which can be one of the following: .It Dv RUSAGE_SELF Resources used by the current process. .It Dv RUSAGE_CHILDREN -Resources used by all the terminated children of the current process. +Resources used by all the terminated children of the current process which +were waited upon. +If the child is never waited for, the resource information for the child +process is discarded. .It Dv RUSAGE_THREAD Resources used by the current thread. .El @@ -186,4 +189,4 @@ flag has been available since .Ox 4.8 . .Sh BUGS There is no way to obtain information about a child process -that has not yet terminated. +that has not yet terminated or has not been waited for by the parent. -- 2.20.1