Not a typewriter

David Korn dgk at ulysses.UUCP
Mon Jun 16 13:35:20 AEST 1986


> > 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



More information about the Comp.unix mailing list