From owner-freebsd-questions Tue Apr 9 14:42:40 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id OAA17178 for questions-outgoing; Tue, 9 Apr 1996 14:42:40 -0700 (PDT) Received: from news.IAEhv.nl (news.IAEhv.nl [194.151.64.4]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id OAA17166 for ; Tue, 9 Apr 1996 14:42:33 -0700 (PDT) Received: by news.IAEhv.nl (8.6.13/1.63) id XAA11341; Tue, 9 Apr 1996 23:42:31 +0200 Received: from localhost (localhost [127.0.0.1]) by nietzsche.bowtie.nl (8.6.12/8.6.9) with ESMTP id XAA11392 for ; Tue, 9 Apr 1996 23:43:53 +0200 Message-Id: <199604092143.XAA11392@nietzsche.bowtie.nl> X-Mailer: exmh version 1.6.1 5/23/95 To: questions@freebsd.org Subject: select question Date: Tue, 09 Apr 1996 23:43:53 +0200 From: Marc van Kempen Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hi, This is not really FreeBSD related, unless it's a FreeBSD bug. But I wonder under which conditions a select will fail? I have opened a comport read-write and want to wait for characters to become available, so I do a: tm.tv_sec = 0; tm.tv_usec = timeout; /* timeout to wait for reply */ FD_ZERO(&readfds); /* clear the read filedescriptor set */ FD_SET(_comfd, &readfds); /* select the _comfd to wait for */ if (select(1, &readfds, NULL, NULL, &tm)) { ... ... } However, this piece of code will wait until a timeout occurs, when I replace the '&tm' with NULL, it will even wait forever. When I inspect the _comfd with ioctl(_comfd, FIONREAD, &ret) it will show me that a character is available to be read, in fact when I try to read it with read(_comfd, &ch, 1) It will read the character just fine. Are there any settings of the filedescriptor that will influence the select behaviour? Or am I overlooking something else? Regards, Marc. ---------------------------------------------------- Marc van Kempen BowTie Technology Email: marc@bowtie.nl WWW & Databases tel. +31 40 2 43 20 65 fax. +31 40 2 44 21 86 http://www.bowtie.nl ----------------------------------------------------