Files
oldlinux-files/Linux-0.98/Yggdrasil-0.98.3/usr/man/man2/waitpid.2
2024-02-19 00:21:16 -05:00

70 lines
1.3 KiB
Groff

.TH WAITPID 2
.UC 4
.SH NAME
waitpid \- wait for a given pid
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.B int waitpid (pid_t pid, unsigned long *stat_addr, int options);
.fi
.SH DESCRIPTION
.B waitpid()
waits for
.I pid
as specified in
.I options.
.PP
Alowable options are:
.br
.B WUNTRACED
- set when we want to be notified of successful exit of
.I pid
.br
.B WNOHANG
- set if we don't want to wait around for a long time.
.PP
.B waitpid()
will exit when :
.nf
1. The waited for process terminates or enters a ZOMBIE state.
2. An unblocked signal, or SIGCHLD is caught.
3. An error condition occurs.
.fi
.PP
.I stat_addr is non NULL, then unless
.B WUNTRACED
is set and the status of
.I pid
is not
.B TASKSTOPPED
then
.I *stat_addr
will be set to the exit code of
.I pid.
.PP
.B waitpid()
will return one of the following :
.br
.nf
1. pid if the process terminates.
2. 0 if we told it to not hang, and the process hasn't terminated.
3. A negative value indicating an error.
.fi
.SH ERRORS
.B -ERESTARTSYS
is returned if
.B WNOHANG
was not set, when an unblocked signal or SGICHLD was caught.
.PP
.B -ECHILD
is returned if the child process didn't exist,
or WUNTRACED was unclear and there was no exit code.
.SH FILES
linux/kernel/signal.c
.br
/usr/include/linux/sys.h
.br
/usr/include/unistd.h
.SH SEE ALSO
wait(3)