Not a typewriter

Last updated
"Not a Typewriter" error code in Linux. NotATypeWriter.png
"Not a Typewriter" error code in Linux.

In computing, "Not a typewriter " or ENOTTY [1] is an error code defined in the errno.h found on many Unix systems. This code is now used to indicate that an invalid ioctl (input/output control) number was specified in an ioctl system call.

Contents

Details

This error originated in early UNIX. In Version 6 UNIX and earlier, I/O control was limited to serial-connected terminal devices, typically a teletype (abbreviated TTY), through the gtty and stty system calls. [2] If an attempt was made to use these calls on a non-terminal device, the error generated was ENOTTY. When the stty/gtty system calls were replaced with the more general ioctl (I/O control) call, the ENOTTY error code was retained.

Early computers and Unix systems used electromechanical typewriters as terminals. [3] [4] The abbreviation TTY, which occurs widely in modern UNIX systems, stands for "Teletypewriter." For example, the original meaning of the SIGHUP signal is that it Hangs UP the phone line on the teletypewriter which uses it. The generic term "typewriter" was probably used because "Teletype" was a registered trademark of AT&T subsidiary Teletype Corporation and was too specific. The name "Teletype" was derived from the more general term, "teletypewriter"; using "typewriter" was a different contraction of the same original term.

POSIX sidesteps this issue by describing ENOTTY as meaning "not a terminal". [5]

Because ioctl is now supported on other devices than terminals, some systems display a different message such as "Inappropriate ioctl for device" instead. [6] [7]

Occurrence

In some cases, this message will occur even when no ioctl has been issued by the program. This is due to the way the isatty() library routine works. The error code errno is only set when a system call fails. One of the first system calls made by the C standard I/O library is in an isatty() call used to determine if the program is being run interactively by a human (in which case isatty() will succeed and the library will write its output a line at a time so the user sees a regular flow of text) or as part of a pipeline (in which case it writes a block at a time for efficiency). If a library routine fails for some reason unrelated to a system call (for example, because a user name wasn't found in the password file) and a naïve programmer blindly calls the normal error reporting routine perror() on every failure, the leftover ENOTTY will result in an utterly inappropriate "Not a typewriter" (or "Not a teletype", or "Inappropriate ioctl for device") being delivered to the user.

For many years the UNIX mail program sendmail [8] contained this bug: when mail was delivered from another system, the mail program was being run non-interactively. If the destination address was local, but referred to a user name not found in the local password file, the message sent back to the originator of the email was the announcement that the person they were attempting to communicate with was not a typewriter.

See also

Related Research Articles

<span class="mw-page-title-main">ASCII</span> American character encoding standard

ASCII, an acronym for American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. ASCII has just 128 code points, of which only 95 are printable characters, which severely limit its scope. The set of available punctuation had significant impact on the syntax of computer languages and text markup. ASCII hugely influenced the design of character sets used by modern computers, including Unicode which has over a million code points, but the first 128 of these are the same as ASCII.

<span class="mw-page-title-main">Teleprinter</span> Device for transmitting messages in written form by electrical signals

A teleprinter is an electromechanical device that can be used to send and receive typed messages through various communications channels, in both point-to-point and point-to-multipoint configurations.

<span class="mw-page-title-main">Terminal emulator</span> Program that emulates a video terminal

A terminal emulator, or terminal application, is a computer program that emulates a video terminal within some other display architecture. Though typically synonymous with a shell or text terminal, the term terminal covers all remote terminals, including graphical interfaces. A terminal emulator inside a graphical user interface is often called a terminal window.

man page Unix software documentation

A man page is a form of software documentation usually found on a Unix or Unix-like operating system. Topics covered include computer programs, formal standards and conventions, and even abstract concepts. A user may invoke a man page by issuing the man command.

<span class="mw-page-title-main">Computer terminal</span> Computer input/output device for users

A computer terminal is an electronic or electromechanical hardware device that can be used for entering data into, and transcribing data from, a computer or a computing system. Most early computers only had a front panel to input or display bits and had to be connected to a terminal to print or input text through a keyboard. Teleprinters were used as early-day hard-copy terminals and predated the use of a computer screen by decades. The computer would typically transmit a line of data which would be printed on paper, and accept a line of data from a keyboard over a serial or other interface. Starting in the mid-1970s with microcomputers such as the Sphere 1, Sol-20, and Apple I, display circuitry and keyboards began to be integrated into personal and workstation computer systems, with the computer handling character generation and outputting to a CRT display such as a computer monitor or, sometimes, a consumer TV, but most larger computers continued to require terminals.

<span class="mw-page-title-main">Version 7 Unix</span> 1979 minicomputer operating system

Version 7 Unix, also called Seventh Edition Unix, Version 7 or just V7, was an important early release of the Unix operating system. V7, released in 1979, was the last Bell Laboratories release to see widespread distribution before the commercialization of Unix by AT&T Corporation in the early 1980s. V7 was originally developed for Digital Equipment Corporation's PDP-11 minicomputers and was later ported to other platforms.

The C standard library or libc is the standard library for the C programming language, as specified in the ISO C standard. Starting from the original ANSI C standard, it was developed at the same time as the C library POSIX specification, which is a superset of it. Since ANSI C was adopted by the International Organization for Standardization, the C standard library is also called the ISO C library.

errno.h is a header file in the standard library of the C programming language. It defines macros for reporting and retrieving error conditions using the symbol errno.

<span class="mw-page-title-main">Pseudoterminal</span> Pair of pseudo-device endpoints

In some operating systems, including Unix-like systems, a pseudoterminal, pseudotty, or PTY is a pair of pseudo-device endpoints (files) which establish asynchronous, bidirectional communication (IPC) channel between two or more processes.

<span class="mw-page-title-main">Teletype Model 33</span> 1963–1981 ASCII communications/computer terminal device

The Teletype Model 33 is an electromechanical teleprinter designed for light-duty office use. It is less rugged and cost less than earlier Teletype models. The Teletype Corporation introduced the Model 33 as a commercial product in 1963, after it had originally been designed for the United States Navy. The Model 33 was produced in three versions:

In computer networking, STREAMS is the native framework in Unix System V for implementing character device drivers, network protocols, and inter-process communication. In this framework, a stream is a chain of coroutines that pass messages between a program and a device driver. STREAMS originated in Version 8 Research Unix, as Streams.

In computing, ioctl is a system call for device-specific input/output operations and other operations which cannot be expressed by regular file semantics. It takes a parameter specifying a request code; the effect of a call depends completely on the request code. Request codes are often device-specific. For instance, a CD-ROM device driver which can instruct a physical device to eject a disc would provide an ioctl request code to do so. Device-independent request codes are sometimes used to give userspace access to kernel functions which are only used by core system software or still under development.

<span class="mw-page-title-main">Error message</span> Computer message indicating an error

An error message is the information displayed when an unforeseen problem occurs, usually on a computer or other device. Modern operating systems with graphical user interfaces, often display error messages using dialog boxes. Error messages are used when user intervention is required, to indicate that a desired operation has failed, or to relay important warnings. Error messages are seen widely throughout computing, and are part of every operating system or computer hardware device. The proper design of error messages is an important topic in usability and other fields of human–computer interaction.

getty, short for "get tty", is a Unix program running on a host computer that manages physical or virtual terminals (TTYs). When it detects a connection, it prompts for a username and runs the 'login' program to authenticate the user.

A line discipline (LDISC) is a layer in the terminal subsystem in some Unix-like systems. The terminal subsystem consists of three layers: the upper layer to provide the character device interface, the lower hardware driver to communicate with the hardware or pseudo terminal, and the middle line discipline to implement behavior common to terminal devices.

In Unix-like operating systems, a device file, device node, or special file is an interface to a device driver that appears in a file system as if it were an ordinary file. There are also special files in DOS, OS/2, and Windows. These special files allow an application program to interact with a device by using its device driver via standard input/output system calls. Using standard system calls simplifies many programming tasks, and leads to consistent user-space I/O mechanisms regardless of device features and functions.

The POSIX terminal interface is the generalized abstraction, comprising both an application programming interface for programs, and a set of behavioural expectations for users of a terminal, as defined by the POSIX standard and the Single Unix Specification. It is a historical development from the terminal interfaces of BSD version 4 and Seventh Edition Unix.

The Seventh Edition Unix terminal interface is the generalized abstraction, comprising both an application programming interface for programs and a set of behavioural expectations for users, of a terminal as historically available in Seventh Edition Unix. It has been largely superseded by the POSIX terminal interface.

In computing, an error code is a numeric or alphanumeric code that indicates the nature of an error and, when possible, why it occurred. Error codes can be reported to end users of software, returned from communication protocols, or used within programs as a method of representing anomalous conditions.

In computing, tty is a command in Unix and Unix-like operating systems to print the file name of the terminal connected to standard input.

References

  1. "What does ENOTTY stand for?". www.abbreviations.com. Retrieved 2020-07-16.
  2. Version 6 UNIX manual, section 2, system calls
  3. Unix Programmer's Manual. November 3, 1971.
  4. RFC   1, Host Software, Steve Crocker (7 April 1969). Page 3, section "Simple use".
  5. "The Open Group Base Specifications Issue 7, 2018 edition/IEEE Std 1003.1-2017: isatty".
  6. "OpenBSD manual: intro, errno — introduction to system calls and error numbers".
  7. "FreeBSD manual: intro -- introduction to system calls and error numbers".
  8. A/UX: mail and "not a typewriter" (2/95) article TA31349 on support.apple.com (February 27, 1995)