From owner-freebsd-current@FreeBSD.ORG Mon Dec 22 09:17:09 2008 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6FBD01065673 for ; Mon, 22 Dec 2008 09:17:09 +0000 (UTC) (envelope-from rdivacky@lev.vlakno.cz) Received: from vlakno.cz (77-93-215-190.static.masterinter.net [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id 24F6E8FC18 for ; Mon, 22 Dec 2008 09:17:08 +0000 (UTC) (envelope-from rdivacky@lev.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 0C0CB9CB19B; Mon, 22 Dec 2008 10:12:06 +0100 (CET) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M34eaFtrGu1Z; Mon, 22 Dec 2008 10:12:03 +0100 (CET) Received: from lev.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id A39069CB298; Mon, 22 Dec 2008 10:12:03 +0100 (CET) Received: (from rdivacky@localhost) by lev.vlakno.cz (8.14.2/8.14.2/Submit) id mBM9C3oq029428; Mon, 22 Dec 2008 10:12:03 +0100 (CET) (envelope-from rdivacky) Date: Mon, 22 Dec 2008 10:12:03 +0100 From: Roman Divacky To: Ed Schouten Message-ID: <20081222091203.GA28920@freebsd.org> References: <20081221012752.cdc5cbfc.nork@FreeBSD.org> <20081221211949.GS1176@hoeg.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20081221211949.GS1176@hoeg.nl> User-Agent: Mutt/1.4.2.3i Cc: FreeBSD Current , Norikatsu Shigemura Subject: Re: Change select(2) to kevent(2) on script(1)... X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Dec 2008 09:17:09 -0000 On Sun, Dec 21, 2008 at 10:19:49PM +0100, Ed Schouten wrote: > * Norikatsu Shigemura wrote: > > I inspired by your 'kqueue()-support to pseudo-terminal master > > devices' (svn commit: r185942). So I'm trying to use kevent(2) > > on script(1). (SEE ALSO following patch) > > > > But it doesn't work. Because 'master' file descriptor (from > > openpty(3)) doesn't return last 0 byte data readable when shell > > exit. In this case of select(2), 'master' file descriptor > > gets 0 byte data and exit script(1). > > > > Do you have any idea? > > I sure have. It turns out there is a small bug in the pts(4) driver. > Inside ptsdrv_close() (called when the TTY is being closed), we set a > flag to mark the pseudo-terminal as `finished' (which causes it to > return EOF's). > > A difference between select() and kqueue() is that the knote handlers > are executed syncrhonously, while select() calls ptsdev_poll() later on. > This should be fixed as of r186382. Thanks for reporting this issue! > > Are you planning to commit the patch for script(1) to SVN? I'm not sure > if we should port applications to kqueue(). Right now script(1) should > almost cleanly compile/work on other versions of FreeBSD and other > Unix-like operating systems. I believe other OSes should be able to do the porting effort when they want to use FreeBSD software. if kqueue-in-script makes any improvement go for it.