Date: Thu, 27 Jul 2000 13:08:21 -0400 (EDT) From: Brian Dean <brdean@unx.sas.com> To: Bruce Evans <bde@zeta.org.au> Cc: freebsd-arch@FreeBSD.ORG, luoqi@FreeBSD.ORG Subject: Re: isatty() reports false results Message-ID: <Pine.BSF.4.21.0007271246170.62370-100000@tribble.unx.sas.com> In-Reply-To: <Pine.BSF.4.21.0007271038001.4809-100000@besplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 27 Jul 2000, Bruce Evans wrote: > Probably not. POSIX.1 says that tcgetattr() shall return EBADF for non- > open files and ENOTTY for non-terminals. These are the only errors > mentioned in POSIX.1. Returning EAGAIN is probably a bug. OTOH, checking > for only EAGAIN is a bug if there are any other undocumented error returns. It looks like this behaviour of the pty ioctl() was introduced a little over a year ago in revision 1.58 of kern/tty_pty.c. The commit log (by luoqi) only says "Ignore some ioctls on the master until the slave is open." The commit log does not make clear any other reason regarding what was trying to be solved by this change. Can anyone (Luoqi?) elaborate on the reasons? Maybe we can solve the problem in another way that allows us to conform to the POSIX return codes that Bruce refers to above. I looked at my NetBSD box and they do not short circuit these ioctl()'s in this case. They must be handling this in another way, though I have not had a chance to dig into their code further. I do note that when I modified my local kernel to defeat this change, my system paniced pretty quickly when I attempt an incoming telnet connection which uses the ptys. And this is primarily why I was looking at modifying 'isatty()' to be smarter instead of messing around in the pty driver. I suppose, at worst, we could move the TIOCGETA handling to precede the check for the slave being open. Would that be valid? -Brian To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0007271246170.62370-100000>