From owner-freebsd-java Mon May 15 10:35:22 2000 Delivered-To: freebsd-java@freebsd.org Received: from ns.rim.or.jp (ns.rim.or.jp [202.247.128.2]) by hub.freebsd.org (Postfix) with ESMTP id 3572D37B623 for ; Mon, 15 May 2000 10:35:18 -0700 (PDT) (envelope-from kumabu@t3.rim.or.jp) Received: from rayearth.rim.or.jp (uucp@rayearth.rim.or.jp [202.247.130.242]) by ns.rim.or.jp (8.9.3/3.6W-RIMNET-98-06-09) with ESMTP id CAA03255 for ; Tue, 16 May 2000 02:35:13 +0900 (JST) Received: (from uucp@localhost) by rayearth.rim.or.jp (8.8.8/3.5Wpl2-uucp1/RIMNET) with UUCP id CAA08465 for freebsd-java@FreeBSD.ORG; Tue, 16 May 2000 02:35:12 +0900 (JST) Received: from localhost (localhost [127.0.0.1]) by red.snark.rim.or.jp (8.9.3/3.5Wpl7-98011205) with ESMTP id CAA08111 for ; Tue, 16 May 2000 02:31:21 +0900 (JST) To: freebsd-java@FreeBSD.ORG Subject: RE: Socket read problem in 1.2.2? From: "Shin'ya Kumabuchi" In-Reply-To: Your message of "Sun, 14 May 2000 15:54:07 +0100" <59063B5B4D98D311BC0D0001FA7E4522026D7503@l04.research.kpn.com> References: <59063B5B4D98D311BC0D0001FA7E4522026D7503@l04.research.kpn.com> X-Mailer: Mew version 1.93 on Emacs 20.4 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Tue_May_16_02:31:15_2000_809)--" Content-Transfer-Encoding: 7bit Message-Id: <20000516023120B.kumabu@t3.rim.or.jp> Date: Tue, 16 May 2000 02:31:20 +0900 X-Dispatcher: imput version 980905(IM100) Lines: 111 Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org ----Next_Part(Tue_May_16_02:31:15_2000_809)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi. Koster, K J wrote: >> HANDLER THREAD PROBLEM: java.net.SocketException: Resource >> temporarily unavailable: Resource temporarily unavailable >> > As Greg says, this is a socket bug in the current JDK port. I have included > a description of this problem on my web site: > http://web.inter.nl.net/users/kjkoster/java/index.html Try attached patch. (for patchset 7) Summary: There's two kinds of file flags, one is system(OS) level's and the other is green thread's. Patchset 7 uses fcntl(2) system call directly for F_{GET,SET}FL, and this makes status of green thread's file flag incorrect in some cases. In addition, I changed file flags from FXXX to O_XXX, since /usr/include/sys/fcntl.h says * Open/fcntl flags begin with O_; kernel-internal flags begin with F. Regards. -- ----Next_Part(Tue_May_16_02:31:15_2000_809)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=iomgr.c.patch --- src/freebsd/hpi/green_threads/src/iomgr.c.~1~ Mon May 15 14:07:41 2000 +++ src/freebsd/hpi/green_threads/src/iomgr.c Mon May 15 22:10:29 2000 @@ -567,18 +567,15 @@ /* if it's already non-blocking, do nothing... */ #ifdef __FreeBSD__ struct stat inode; - if ((flgs = (*systable[SYS_FCNTL].addr)(desc, F_GETFL, 0)) == -1) { - err: -#else - if ((flgs = fcntl(desc, F_GETFL, 0)) == -1) { #endif + if ((flgs = fcntl(desc, F_GETFL, 0)) == -1) { IO_UNLOCK(self); sysMonitorExit(self, fdmon[desc]); return -1; } #ifdef __FreeBSD__ - if (flgs & (FNONBLOCK|FASYNC)) { + if (flgs & (O_NONBLOCK | O_ASYNC)) { #else if (flgs & O_NONBLOCK) { #endif @@ -592,7 +589,7 @@ * Make the fd non-blocking for use by the wrappers */ #ifdef __FreeBSD__ - systable[SYS_FCNTL].addr(desc, F_SETFL, flgs | FNONBLOCK|FASYNC); + systable[SYS_FCNTL].addr(desc, F_SETFL, flgs | O_NONBLOCK | O_ASYNC); #else systable[SYS_FCNTL].addr(desc, F_SETFL, flgs | O_NONBLOCK); #endif @@ -617,18 +614,14 @@ * If it's already blocking, do nothing... * otherwise make fd blocking. */ -#ifdef __FreeBSD__ - if ((flgs = systable[SYS_FCNTL].addr(desc, F_GETFL, 0)) == -1) { -#else if ((flgs = fcntl(desc, F_GETFL, 0)) == -1) { -#endif IO_UNLOCK(self); sysMonitorExit(self, fdmon[desc]); return -1; } #ifdef __FreeBSD__ - systable[SYS_FCNTL].addr(desc, F_SETFL, flgs & ~(FNONBLOCK|FASYNC)); + fcntl(desc, F_SETFL, flgs & ~(O_NONBLOCK | O_ASYNC)); systable[SYS_FCNTL].addr(desc, F_SETOWN, 0); #else fcntl(desc, F_SETFL, flgs & ~O_NONBLOCK); @@ -2153,7 +2146,7 @@ * to be non-blocking by adding O_NONBLOCK to the flags. */ #ifdef __FreeBSD__ - arg |= FNONBLOCK|FASYNC; + arg |= (O_NONBLOCK | O_ASYNC); #else arg |= O_NONBLOCK; #endif @@ -2188,7 +2181,11 @@ * state and not ours. */ if (!(fd_flags[fd] & FD_NONBLOCKING)) +#ifdef __FreeBSD__ + ret &= ~(O_NONBLOCK | O_ASYNC); +#else ret &= ~O_NONBLOCK; +#endif } IO_UNLOCK(self); ----Next_Part(Tue_May_16_02:31:15_2000_809)---- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message