From owner-freebsd-questions Fri Jan 7 10:25:45 2000 Delivered-To: freebsd-questions@freebsd.org Received: from bomber.avantgo.com (ws1.avantgo.com [207.214.200.194]) by hub.freebsd.org (Postfix) with ESMTP id 4CA8B15808 for ; Fri, 7 Jan 2000 10:25:36 -0800 (PST) (envelope-from scott@avantgo.com) Received: from river ([10.0.128.30]) by bomber.avantgo.com (Netscape Messaging Server 3.5) with SMTP id 223; Fri, 7 Jan 2000 10:21:43 -0800 Message-ID: <04a501bf593c$72930210$1e80000a@avantgo.com> From: "Scott Hess" To: "Zhihui Zhang" , References: Subject: Re: Questions about select() and O_NONBLOCK Date: Fri, 7 Jan 2000 10:24:34 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Zhihui Zhang wrote: > I hope that someone will clarify the following questions for me: > > (1) Can select() be used with regular files, like myfile.txt? > > (2) Does O_NONBLOCK or O_NDELAY work on regular files? > > Any help is appreciated. At this time, regular files are _always_ ready for I/O, and _always_ fulfill your complete request (barring other problems, such as end-of-file our out-of-space conditions). This is actually the case for all Unix implementations I'm aware of, though there are sometimes ways to work around the problem (async I/O, for instance). [I've been spending the past week working around this problem in the pthreads library - since file I/O blocks below the pthreads library, disk I/O is effectively serialized when using pthreads. I'm working on integrating rfork() threads to handle disk I/O instead, so that multiple requests can be pending at a given time.] Later, scott To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message