Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site ulysses.UUCP Path: utzoo!watmath!clyde!burl!ulysses!dgk From: dgk@ulysses.UUCP (David Korn) Newsgroups: net.unix,net.unix-wizards Subject: Re: Not a typewriter Message-ID: <1296@ulysses.UUCP> Date: Sun, 15-Jun-86 23:35:20 EDT Article-I.D.: ulysses.1296 Posted: Sun Jun 15 23:35:20 1986 Date-Received: Tue, 17-Jun-86 22:29:14 EDT References: <1683@homxb.UUCP> <542@codas.ATT.UUCP> Organization: AT&T Bell Laboratories, Murray Hill Lines: 31 Xref: watmath net.unix:8164 net.unix-wizards:18413 > > What does the sys_errlist message 'Not a typewriter' *really* mean?? > > Errno 25 is usually generated when a program tries to execute an > ioctl command that expects the file descriptor to be a terminal. > (ie: you can't set the baud rate on a file). > > However I have also noticed that some aplications aren't very > carefull when they use errno. For example, Informix may give > you this message if it cannot open a database file because it > does not exist! > > I think there may be one or two system calls that will alter > errno to be 25, without returning a non-zero value, when in > fact there was no error. > -- > Mikel Manitius @ AT&T-IS Altamonte Springs, FL > ...{seismo!akgua|ihnp4|cbosgd}!codas!mikel.ATT.UUCP Things can be even worse than this. I recently ran across a problem where an ioctl worked fine and I was able to change the tty mode. When I went to restore the mode, I got an ENOTTY error from ioctl(). Appearantly, being a 'tty' is not an invariant of a file stream. The line was actually a pseudo-tty and the process which was processing characters died. It appears that you can't do an isatty at the beginning of a program and trust the result. The only safe thing that you can do is to check the error status of ioctl() and see if it changes. David Korn ulysses!dgk