.TH ct "" "" "Device Driver"
.PC "Controlling terminal driver"
.PP
.II /dev/tty
.II "terminal, controlling"
.II "controlling terminal"
.II "driver^controlling terminal"
.II "device driver^controlling terminal"
Most processes that the \*(CO kernel executes are associated with a
.IR "controlling terminal" .
(The only exceptions are daemon processes that are started by the process
.BR init .)
This terminal directs I/O to the physical device through which the user
who invoked the process is accessing \*(CO.
Usually, this is a serial port or the console, but it could also be a
socket (in the case of a
.B telnet
or
.B ftp
session), or some other device.
.PP
The driver
.B ct
lets a program access the controlling terminal automatically.
It is accessed through the device
.BR /dev/tty .
Thus, when a program invokes the system calls
.BR open() ,
.BR close() ,
.BR ioctl() ,
.BR read() ,
or
.B write()
on
.BR /dev/tty ,
driver
.B ct
directs those calls automatically to the appropriate driver for the
controlling terminal.
This spares applications from having to know the details of the controlling
device \(em all it has to do is manipulate
.B /dev/tty
and let
.B ct
take care of the details.
.SH Files
.B /dev/tty
.SH "See Also"
.Xr "device drivers," device_dr
.Xr "init" init
.SH Diagnostics
When a call finds no valid controlling terminal for a process,
it returns a value of \-1 and sets
.B errno
to
.B ENXIO.
