<s>
In	O
computing	O
,	O
"	O
Not	B-Error_Name
a	I-Error_Name
typewriter	I-Error_Name
"	O
or	O
ENOTTY	B-Error_Name
is	O
an	O
error	O
code	O
defined	O
in	O
the	O
errno.h	B-Error_Name
found	O
on	O
many	O
Unix	B-Application
systems	I-Application
.	O
</s>
<s>
This	O
code	O
is	O
now	O
used	O
to	O
indicate	O
that	O
an	O
invalid	O
ioctl	B-Operating_System
(	O
input/output	O
control	O
)	O
number	O
was	O
specified	O
in	O
an	O
ioctl	B-Operating_System
system	O
call	O
.	O
</s>
<s>
This	O
error	O
originated	O
in	O
early	O
UNIX	B-Application
.	O
</s>
<s>
In	O
Version	O
6	O
UNIX	B-Application
and	O
earlier	O
,	O
I/O	O
control	O
was	O
limited	O
to	O
serial-connected	O
terminal	B-General_Concept
devices	O
,	O
typically	O
a	O
teletype	O
(	O
abbreviated	O
TTY	O
)	O
,	O
through	O
the	O
gtty	O
and	O
stty	O
system	O
calls	O
.	O
</s>
<s>
If	O
an	O
attempt	O
was	O
made	O
to	O
use	O
these	O
calls	O
on	O
a	O
non-terminal	O
device	O
,	O
the	O
error	O
generated	O
was	O
ENOTTY	B-Error_Name
.	O
</s>
<s>
When	O
the	O
stty/gtty	O
system	O
calls	O
were	O
replaced	O
with	O
the	O
more	O
general	O
ioctl	B-Operating_System
(	O
I/O	O
control	O
)	O
call	O
,	O
the	O
ENOTTY	B-Error_Name
error	O
code	O
was	O
retained	O
.	O
</s>
<s>
Early	O
computers	O
and	O
Unix	B-Application
systems	I-Application
used	O
electromechanical	O
typewriters	O
as	O
terminals	B-General_Concept
.	O
</s>
<s>
The	O
abbreviation	O
TTY	O
,	O
which	O
occurs	O
widely	O
in	O
modern	O
UNIX	B-Application
systems	I-Application
,	O
stands	O
for	O
"	O
Teletypewriter.	O
"	O
</s>
<s>
For	O
example	O
,	O
the	O
original	O
meaning	O
of	O
the	O
SIGHUP	B-General_Concept
signal	B-Operating_System
is	O
that	O
it	O
Hangs	O
UP	O
the	O
phone	B-Application
line	I-Application
on	O
the	O
teletypewriter	O
which	O
uses	O
it	O
.	O
</s>
<s>
POSIX	O
sidesteps	O
this	O
issue	O
by	O
describing	O
ENOTTY	B-Error_Name
as	O
meaning	O
"	O
not	O
a	O
terminal	B-General_Concept
"	O
.	O
</s>
<s>
Because	O
ioctl	B-Operating_System
is	O
now	O
supported	O
on	O
other	O
devices	O
than	O
terminals	B-General_Concept
,	O
some	O
systems	O
display	O
a	O
different	O
message	O
such	O
as	O
"	O
Inappropriate	O
ioctl	B-Operating_System
for	O
device	O
"	O
instead	O
.	O
</s>
<s>
In	O
some	O
cases	O
,	O
this	O
message	O
will	O
occur	O
even	O
when	O
no	O
ioctl	B-Operating_System
has	O
been	O
issued	O
by	O
the	O
program	O
.	O
</s>
<s>
The	O
error	O
code	O
errno	B-Error_Name
is	O
only	O
set	O
when	O
a	O
system	O
call	O
fails	O
.	O
</s>
<s>
If	O
a	O
library	O
routine	O
fails	O
for	O
some	O
reason	O
unrelated	O
to	O
a	O
system	O
call	O
(	O
for	O
example	O
,	O
because	O
a	O
user	O
name	O
was	O
n't	O
found	O
in	O
the	O
password	O
file	O
)	O
and	O
a	O
naïve	O
programmer	O
blindly	O
calls	O
the	O
normal	O
error	O
reporting	O
routine	O
perror( )	O
on	O
every	O
failure	O
,	O
the	O
leftover	O
ENOTTY	B-Error_Name
will	O
result	O
in	O
an	O
utterly	O
inappropriate	O
"	O
Not	B-Error_Name
a	I-Error_Name
typewriter	I-Error_Name
"	O
(	O
or	O
"	O
Not	O
a	O
teletype	O
"	O
,	O
or	O
"	O
Inappropriate	O
ioctl	B-Operating_System
for	O
device	O
"	O
)	O
being	O
delivered	O
to	O
the	O
user	O
.	O
</s>
<s>
For	O
many	O
years	O
the	O
UNIX	B-Application
mail	B-Protocol
program	I-Protocol
sendmail	B-Application
contained	O
this	O
bug	O
:	O
when	O
mail	O
was	O
delivered	O
from	O
another	O
system	O
,	O
the	O
mail	B-Protocol
program	I-Protocol
was	O
being	O
run	O
non-interactively	O
.	O
</s>
<s>
If	O
the	O
destination	O
address	O
was	O
local	O
,	O
but	O
referred	O
to	O
a	O
user	O
name	O
not	O
found	O
in	O
the	O
local	O
password	O
file	O
,	O
the	O
message	O
sent	O
back	O
to	O
the	O
originator	O
of	O
the	O
email	O
was	O
the	O
announcement	O
that	O
the	O
person	O
they	O
were	O
attempting	O
to	O
communicate	O
with	O
was	O
not	B-Error_Name
a	I-Error_Name
typewriter	I-Error_Name
.	O
</s>
