Subject: Bug or expected behavior?
To: None <tech-kern@netbsd.org>
From: Seth Kurtzberg <seth@cql.com>
List: tech-kern
Date: 10/16/2001 21:17:16
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I have a set of circumstances that I believe is a bug, provided I understand
the semantics of the situation.
I have a parent process that spawns child processes using fork/exec.
Periodically, the parent process calls waitpid with the WNOHANG option.
Most of the time this works as expected. However, if a child process is
blocked on a select() call at the time the parent calls waitpid(), then
waitpid() does not return despite the WNOHANG option. The nature of the
operation is that there are circumstances in which the child process will
block on a select for several minutes.
Is this behavior correct for waitpid()? Shouldn't it return immediately
(with the WNOHANG option) regardless of the state of the child?
I've worked around the problem by using select() with a timeout in the child
process, and calling it repeatedly. This is inefficient, however, and causes
unnecessary context switching.
TIA
- --
Seth Kurtzberg
Machine Independent Software
Office: (480) 661-1849
Fax: (480) 614-8909
email: seth@cql.com
pager: 888-605-9296 or email 6059296@skytel.com
-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.8
iQA/AwUBO80GTXhkmRgYZUCaEQJ49wCfedREoHK8g+LcMT+3YudiBCLsvn4AoIOK
7lV21bXjYdND8acBMsj9SYIH
=5pWi
-----END PGP SIGNATURE-----