From e206d2331c2256abcc3c849e152e3dca92913b75 Mon Sep 17 00:00:00 2001 From: millert Date: Mon, 1 May 2017 00:08:31 +0000 Subject: [PATCH] Document that wait3/waitpid can receive SIGCHILD when wpid does not exist or is not a child of the calling process. Document what happens when SIGCHLD is ignored or SA_NOCLDWAIT is set in sa_flags (this part from FreeBSD). OK guenther@ --- lib/libc/sys/wait.2 | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/lib/libc/sys/wait.2 b/lib/libc/sys/wait.2 index f8b82b4e959..5ae9f42fc8b 100644 --- a/lib/libc/sys/wait.2 +++ b/lib/libc/sys/wait.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: wait.2,v 1.29 2015/11/24 19:34:31 jmc Exp $ +.\" $OpenBSD: wait.2,v 1.30 2017/05/01 00:08:31 millert Exp $ .\" $NetBSD: wait.2,v 1.6 1995/02/27 12:39:37 cgd Exp $ .\" .\" Copyright (c) 1980, 1991, 1993, 1994 @@ -30,7 +30,7 @@ .\" .\" @(#)wait.2 8.2 (Berkeley) 4/19/94 .\" -.Dd $Mdocdate: November 24 2015 $ +.Dd $Mdocdate: May 1 2017 $ .Dt WAIT 2 .Os .Sh NAME @@ -261,11 +261,23 @@ is returned and .Va errno is set to indicate the error. .Sh ERRORS -.Fn wait +.Fn wait , +.Fn waitpid , +.Fn wait3 , +and +.Fn wait4 will fail and return immediately if: .Bl -tag -width Er .It Bq Er ECHILD The calling process has no existing unwaited-for child processes. +.It Bq Er ECHILD +No status from the terminated child process is available +because the calling process has asked the system to discard +such status by ignoring the signal +.Dv SIGCHLD +or setting the flag +.Dv SA_NOCLDWAIT +for that signal. .It Bq Er EFAULT The .Fa status @@ -277,6 +289,17 @@ arguments point to an illegal address. The call was interrupted by a caught signal, or the signal did not have the .Dv SA_RESTART flag set. +.El +.Pp +.Fn waitpid +and +.Fn wait4 +will fail and return immediately if: +.Bl -tag -width Er +.It Bq Er ECHILD +The process specified by the +.Ar wpid +argument does not exist or is not a child of the calling process. .It Bq Er EINVAL Invalid or undefined flags were passed in the .Fa options -- 2.20.1