Date: Wed, 13 Feb 2002 06:20:03 -0800 (PST) From: Maxim Konovalov <maxim@freebsd.org> To: freebsd-bugs@FreeBSD.org Subject: Re: i386/34536: accept() blocks other threads Message-ID: <200202131420.g1DEK3988616@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR i386/34536; it has been noted by GNATS.
From: Maxim Konovalov <maxim@freebsd.org>
To: David Malone <dwmalone@maths.tcd.ie>
Cc: roam@freebsd.org, <yxpan@yahoo.com>,
<freebsd-gnats-submit@freebsd.org>
Subject: Re: i386/34536: accept() blocks other threads
Date: Wed, 13 Feb 2002 17:11:07 +0300 (MSK)
Hello,
I have finally realized where the problem is. It comes from
libc_r/uthread/uthread_exit.c:
/*
* Enter a loop to set all file descriptors to blocking
* if they were not created as non-blocking:
*/
for (i = 0; i < _thread_dtablesize; i++) {
/* Check if this file descriptor is in use: */
if (_thread_fd_table[i] != NULL &&
!(_thread_fd_table[i]->flags & O_NONBLOCK)) {
/* Get the current flags: */
flags = _thread_sys_fcntl(i, F_GETFL, NULL);
/* Clear the nonblocking file descriptor flag: */
_thread_sys_fcntl(i, F_SETFL, flags & ~O_NONBLOCK);
}
}
The parent calls exit(2) and changes flags of all open descriptors to
~O_NONBLOCK so the child gets a blocking socket and just blocks on
accept(2).
I made a patch but I am not sure at all is it correct or not. Btw,
who is our libc_r guru I can ask for review? At the moment I have no
clue why we should restore files flags at exit(2).
Index: libc_r/uthread/uthread_exit.c
===================================================================
RCS file: /home/ncvs/src/lib/libc_r/uthread/uthread_exit.c,v
retrieving revision 1.24
diff -u -r1.24 uthread_exit.c
--- libc_r/uthread/uthread_exit.c 2001/11/17 14:28:39 1.24
+++ libc_r/uthread/uthread_exit.c 2002/02/13 13:56:16
@@ -66,6 +66,7 @@
* Enter a loop to set all file descriptors to blocking
* if they were not created as non-blocking:
*/
+#ifdef 0
for (i = 0; i < _thread_dtablesize; i++) {
/* Check if this file descriptor is in use: */
if (_thread_fd_table[i] != NULL &&
@@ -76,6 +77,7 @@
__sys_fcntl(i, F_SETFL, flags & ~O_NONBLOCK);
}
}
+#endif
/* Call the _exit syscall: */
__sys_exit(status);
--
Maxim Konovalov, MAcomnet, Internet-Intranet Dept., system engineer
phone: +7 (095) 796-9079, mailto:maxim@macomnet.ru
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200202131420.g1DEK3988616>
