From owner-freebsd-hackers Mon Dec 15 22:08:59 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id WAA27861 for hackers-outgoing; Mon, 15 Dec 1997 22:08:59 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: from noether.blah.org (slmel12p25.ozemail.com.au [203.108.200.113]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id WAA27829 for ; Mon, 15 Dec 1997 22:08:43 -0800 (PST) (envelope-from ada@not-enough.bandwidth.org) Received: (from ada@localhost) by noether.blah.org (8.8.7/8.8.8) id RAA03776 for hackers@FreeBSD.ORG; Tue, 16 Dec 1997 17:08:18 +1100 (EST) From: Ada Message-Id: <199712160608.RAA03776@noether.blah.org> Subject: Re: Why FIONREAD has no dual for write ? In-Reply-To: <199712091520.HAA09154@hub.freebsd.org> from "owner-hackers-digest@FreeBSD.ORG" at "Dec 9, 97 07:20:23 am" To: hackers@FreeBSD.ORG Date: Tue, 16 Dec 1997 17:08:18 +1100 (EST) Reply-To: ada@bsd.org X-Mailer: ELM [version 2.4ME+ PL32 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > From: Bakul Shah > Date: Mon, 08 Dec 1997 19:45:05 -0500 > Subject: Re: Why FIONREAD has no dual for write ? > > Perhaps one solution is to add an ioctl to set high/low > watermarks on a device and add new event bits POLLIN_WM and > POLLLOUT_WM for the poll() syscall. > > In pollfd->events you set these bits instead of (or in > addition to) POLLIN/POLLOUT. On return the corresponding bit > in pollfd->revents is set only if there are _greater than low > watermark_ bytes on input and _less than high watermark_ > bytes on output. This guarantees that you can transfer some > minimum number of bytes on read/write (provided you use the > O_EXCL mode). > > This is a more general solution that allows finer control > over when to schedule IO and is useful in all sorts of > situations. How about a counterpart to select() which can request a minimum number of bytes {free,ready} in the buffer? This could also be useful in situations where one does not wish to implement buffering; instead the kernel buffers could be used. Is this feasable in light of how select() works? Ada.