From owner-freebsd-arch Thu Jul 27 10: 8:29 2000 Delivered-To: freebsd-arch@freebsd.org Received: from merc94.us.sas.com (merc94.us.sas.com [149.173.6.4]) by hub.freebsd.org (Postfix) with ESMTP id 995C737B7B5; Thu, 27 Jul 2000 10:08:25 -0700 (PDT) (envelope-from brdean@unx.sas.com) Received: from merc94.us.sas.com ([127.0.0.1]) by merc94.us.sas.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2651.58) id PDG9FJZJ; Thu, 27 Jul 2000 13:08:23 -0400 Received: from 10.28.149.26 by merc94.us.sas.com (InterScan E-Mail VirusWall NT); Thu, 27 Jul 2000 13:08:22 -0400 (Eastern Daylight Time) Received: from tribble.unx.sas.com by mozart (5.65c/SAS/Domains/5-6-90) id AA03903; Thu, 27 Jul 2000 13:08:22 -0400 Received: from localhost (brdean@localhost) by tribble.unx.sas.com (8.9.3/8.9.1) with ESMTP id NAA62436; Thu, 27 Jul 2000 13:08:21 -0400 (EDT) (envelope-from brdean@unx.sas.com) X-Authentication-Warning: tribble.unx.sas.com: brdean owned process doing -bs Date: Thu, 27 Jul 2000 13:08:21 -0400 (EDT) From: Brian Dean To: Bruce Evans Cc: freebsd-arch@FreeBSD.ORG, luoqi@FreeBSD.ORG Subject: Re: isatty() reports false results In-Reply-To: Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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