Date: Sun, 29 Sep 2002 12:00:22 -0700 (PDT) From: Valentin Nechayev <netch@iv.nn.kiev.ua> To: freebsd-standards@FreeBSD.org Subject: Re: standards/43335: libc_r: execve() and close-on-exec flag, interrupted write() Message-ID: <200209291900.g8TJ0Mb7043912@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR standards/43335; it has been noted by GNATS. From: Valentin Nechayev <netch@iv.nn.kiev.ua> To: FreeBSD-gnats-submit@FreeBSD.ORG Cc: Subject: Re: standards/43335: libc_r: execve() and close-on-exec flag, interrupted write() Date: Sun, 29 Sep 2002 21:22:40 +0300 Tue, Sep 24, 2002 at 11:23:19, avg (Andriy Gapon) wrote about "standards/43335: libc_r: execve() and close-on-exec flag, interrupted write()": AG> 4. libc_r execve() sets all descriptors that were not set expicitely to AG> non-blocking mode to blocking mode before doing "real" execve, which is AG> good and done with non-multithreaded programs possibly being exec'ed in AG> mind. However, it has a painful effect if this is done as part of spawning AG> another process (fork+exec), obviously all descriptors in a parent become AG> blocking that effectively kills multithreading during IO. I think there is AG> no other option if a programmer really means to share descriptors between AG> a multithreaded and a singlethreaded program. However, in the case close-on-exec flag is set on the descriptor, I think, it's better to leave AG> the descriptor as is, in the non-blocking mode. I caught another variant of the same problem. A test program forked and than child closes stdin & stdout (and opened /dev/null instead of them). On closing, thread layer restores previous flags (without O_NONBLOCK) before _thread_sys_close(). Parent which works with the same objects assumes that O_NONBLOCK is set and hangs on _thread_sys_read(). uthread_close.c has note that nonblocking will be restored in parent on SIGCHLD. But in case of closing without exit this logic fails. /netch To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209291900.g8TJ0Mb7043912>