From owner-freebsd-hackers Tue May 28 14:10:54 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id OAA29622 for hackers-outgoing; Tue, 28 May 1996 14:10:54 -0700 (PDT) Received: from who.cdrom.com (who.cdrom.com [204.216.27.3]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id OAA29600 for ; Tue, 28 May 1996 14:10:49 -0700 (PDT) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by who.cdrom.com (8.6.12/8.6.11) with ESMTP id NAA07905 for ; Tue, 28 May 1996 13:11:53 -0700 Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id NAA11719; Tue, 28 May 1996 13:10:02 -0700 From: Terry Lambert Message-Id: <199605282010.NAA11719@phaeton.artisoft.com> Subject: Re: Forgiving select() call. To: kaleb@x.org (Kaleb S. KEITHLEY) Date: Tue, 28 May 1996 13:10:02 -0700 (MST) Cc: terry@lambert.org, hackers@freefall.freebsd.org In-Reply-To: <199605281859.OAA19612@exalt.x.org> from "Kaleb S. KEITHLEY" at May 28, 96 02:59:45 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > > > And, FWIW, SVR4 select(3) is implemented using poll(2), so select on > > > SVR4, in and of itself, isn't going to have any better granularity > > > than poll. > > > > When Solaris 2.1 introduces SunOS 4.x binary compatability, I (within > > a day of receiving it) reported that it would not run statically > > linked SunOS 4.x binaries which used the select(2) (and a couple of > > other) system calls. > > > > Sun corrected this in Solaris 2.3. > > > There is no select(2) in Solaris 2.4 or 2.5. I statically linked a > trivial program that uses select on SunOS 4.1.3 and trussed it on > Solaris 2.4 -- it calls poll. Are you talking about a program that > used the syscall interface to call select rather than the C library? > I can easily imagine Sun getting that wrong in the early days of Solaris. > But guess what, trussing a program that uses syscall(SYS_select, ...) > on Solaris 2.4 shows that it's *still* calling poll. Trace it with the SunOS 4.1.3 trace instead. It will say "select". I suspect that there are different systent[] tables in use, just like the ABI support in FreeBSD uses. > > This, however, places their operating system in violation of SVID III, > > which specificies select(RT) will take a timeval struct argument. > > What are you talking about? select(3) takes a struct timeval argument. Sorry. will *USE* a struct timeval argument to the best of the systems ability (system clock frequency), not *TRUNCATE* it to what it feels like (system clock update frequency). > > Technically, then, SVR4 derived OS's which implement select() as > > select(3) instead of select(2) have converted it from system clock to > > system clock update. > > > > This is in violation of SVID III select(RT) definition. > > > Whether it is or not seems of little concern to the readers of > freebsd-hackers. You were using SVR4's implementation of select(3) on top of poll(2) as an argument for poll(2), with a presumption that the resoloution would move to 1ms (which is still too damn large for most useful things, like click-timing or mouse-motion accelerators). The select(3) argument is inherently flawed because the SVR4 systems that use the approach you suggest are in violation of their own specifications. "Here is a bad practice example of why this is an acceptable practice" just doesn't fly. > Not if it has a poll-like interface instead of fd_sets. Select just > isn't optimal for dealing with small sets of file descriptors, > particularly when the file descriptors are large numbers (which may > be a pathological case.) Okay, even in the worst case, FD_SETSIZE is > pretty small on FreeBSD -- only 256 bits. Is this a compromize for > speed, or because of a limited kernel stack space? Most other systems > have larger default values. The set size limitations are a result of the FD_SETSIZE, an advisory value, being used as a copyin limit in kernel space. In point of fact, the limit is derivable from the nfds argument to select. Use a -current kernel instead of a 2.1.0R kernel and I believe this has been fixed for you. The poll(2) interface does not save the copyin because it provides an array address. User space array contents are not directly addressable from kernel space, so you are still stuck. The only overhead it saves is the mask reset overhead in user space, which it trades for bit clearing overhead in kernel space. Big deal. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.