tty ioctls after hangup - EIO - Why ?

Peter Fox (
Tue, 2 Apr 1996 20:35:39 GMT

I've been trying to write a program to behave like the front LEDs
on an external modem, and discovered that after a hangup, ioctls
return -EIO. This is a royal pain ita.

Is there any particular reason for this ?

My program opens the serial line and keeps doing a TIOCMGET to
track the modem control lines, but after ppp hangs up, the
ioctl gives I/O error until another process opens the device.
This prevents the program giving a correct display.

I can't see a good reason why ioctls should give EIO after hangup.
So I have modified the tty fops in tty_io.c to use the same ioctl
function whether the tty is hanged (hung ?) up or not, and that cures
my problem, but is this pukka ?

If not, is there a way to reset the hangup status without closing
and reopening the device ? And if not, should there be ?

I've also added a new IOCTL to return the number of characters
transmitted and received, but this is irrelevant to the issue
being moaned about.

Peter Fox