Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Dec 2008 22:19:49 +0100
From:      Ed Schouten <ed@80386.nl>
To:        Norikatsu Shigemura <nork@FreeBSD.org>
Cc:        FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: Change select(2) to kevent(2) on script(1)...
Message-ID:  <20081221211949.GS1176@hoeg.nl>
In-Reply-To: <20081221012752.cdc5cbfc.nork@FreeBSD.org>
References:  <20081221012752.cdc5cbfc.nork@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--XabuzTTlKwS6ZQpP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* Norikatsu Shigemura <nork@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)
>=20
> 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).
>=20
> 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.

--=20
 Ed Schouten <ed@80386.nl>
 WWW: http://80386.nl/

--XabuzTTlKwS6ZQpP
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAklOsvUACgkQ52SDGA2eCwWXEQCfa4dSPStpxJeWU1hHi7V9h3pE
+D8An2aRhQI4wPpxb1iK4nI1XgaynZMT
=aqQG
-----END PGP SIGNATURE-----

--XabuzTTlKwS6ZQpP--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081221211949.GS1176>