<s>
A	O
line	B-Operating_System
discipline	I-Operating_System
(	O
LDISC	O
)	O
is	O
a	O
layer	O
in	O
the	O
terminal	B-General_Concept
subsystem	O
in	O
some	O
Unix-like	B-Operating_System
systems	I-Operating_System
.	O
</s>
<s>
The	O
terminal	B-General_Concept
subsystem	O
consists	O
of	O
three	O
layers	O
:	O
the	O
upper	O
layer	O
to	O
provide	O
the	O
character	O
device	O
interface	O
,	O
the	O
lower	O
hardware	O
driver	O
to	O
communicate	O
with	O
the	O
hardware	O
or	O
pseudo	B-Protocol
terminal	I-Protocol
,	O
and	O
the	O
middle	O
line	B-Operating_System
discipline	I-Operating_System
to	O
implement	O
behavior	O
common	O
to	O
terminal	B-General_Concept
devices	O
.	O
</s>
<s>
The	O
line	B-Operating_System
discipline	I-Operating_System
glues	O
the	O
low	O
level	O
device	O
driver	O
code	O
with	O
the	O
high	O
level	O
generic	O
interface	O
routines	O
(	O
such	O
as	O
read(2 )	O
,	O
write(2 )	O
and	O
ioctl(2 )	O
)	O
,	O
and	O
is	O
responsible	O
for	O
implementing	O
the	O
semantics	O
associated	O
with	O
the	O
device	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
standard	O
line	B-Operating_System
discipline	I-Operating_System
processes	O
the	O
data	O
it	O
receives	O
from	O
the	O
hardware	O
driver	O
and	O
from	O
applications	O
writing	O
to	O
the	O
device	O
according	O
to	O
the	O
requirements	O
of	O
a	O
terminal	B-General_Concept
on	O
a	O
Unix-like	B-Operating_System
system	I-Operating_System
.	O
</s>
<s>
On	O
input	O
,	O
it	O
handles	O
special	O
characters	O
such	O
as	O
the	O
interrupt	O
character	O
(	O
typically	O
Control-C	B-Device
)	O
and	O
the	O
erase	O
and	O
kill	O
characters	O
(	O
typically	O
backspace	B-Device
or	O
delete	B-Device
,	O
and	O
Control-U	O
,	O
respectively	O
)	O
and	O
,	O
on	O
output	O
,	O
it	O
replaces	O
all	O
the	O
LF	O
characters	O
with	O
a	O
CR/LF	O
sequence	O
.	O
</s>
<s>
A	O
serial	O
port	O
could	O
also	O
be	O
used	O
for	O
a	O
dial-up	O
Internet	O
connection	O
using	O
a	O
serial	O
modem	O
and	O
PPP	B-Protocol
.	O
</s>
<s>
In	O
this	O
case	O
,	O
a	O
PPP	B-Protocol
line	B-Operating_System
discipline	I-Operating_System
would	O
be	O
used	O
;	O
it	O
would	O
accumulate	O
input	O
data	O
from	O
the	O
serial	O
line	O
into	O
PPP	B-Protocol
input	O
packets	O
,	O
delivering	O
them	O
to	O
the	O
networking	O
stack	O
rather	O
than	O
to	O
the	O
character	O
device	O
,	O
and	O
would	O
transmit	O
packets	O
delivered	O
to	O
it	O
by	O
the	O
networking	O
stack	O
on	O
the	O
serial	O
line	O
.	O
</s>
<s>
Some	O
Unix-like	B-Operating_System
systems	I-Operating_System
use	O
STREAMS	B-Operating_System
to	O
implement	O
line	B-Operating_System
disciplines	I-Operating_System
.	O
</s>
