Re: Change select(2) to kevent(2) on script(1)...

From: Roman Divacky <rdivacky_at_FreeBSD.org>
Date: Mon, 22 Dec 2008 10:12:03 +0100
On Sun, Dec 21, 2008 at 10:19:49PM +0100, Ed Schouten wrote:
> * Norikatsu Shigemura <nork_at_FreeBSD.org> 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.
Received on Mon Dec 22 2008 - 08:17:09 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:39 UTC