ldisc = TTYDISC;
ioctl(0, TIOCSETD, &ldisc);
Change to the new line discipline pointed to by The available line
disciplines are listed in and currently are: Termios interactive line
discipline. Tablet line discipline. Serial IP line discipline. Return
the current line discipline in the integer pointed to by Set the terminal
hardware into BREAK condition. Clear the terminal hardware BREAK condition.
Assert data terminal ready (DTR). Clear data terminal ready (DTR). Return
the current process group the terminal is associated with in the integer
pointed to by This is the underlying call that implements the call.
Associate the terminal with the process group (as an integer) pointed to
by This is the underlying call that implements the call. Place the current
value of the termios state associated with the device in the termios structure
pointed to by This is the underlying call that implements the call.
Set the termios state associated with the device immediately. This is the
underlying call that implements the call with the option. First wait
for any output to complete, then set the termios state associated with
the device. This is the underlying call that implements the call with
the option. First wait for any output to complete, clear any pending input,
then set the termios state associated with the device. This is the underlying
call that implements the call with the option. Place the current number
of characters in the output queue in the integer pointed to by Simulate
typed input. Pretend as if the terminal received the character pointed
to by This call is obsolete but left for compatibility. In the past,
when a process that didn’t have a controlling terminal (see in first opened
a terminal device, it acquired that terminal as its controlling terminal.
For some programs this was a hazard as they didn’t want a controlling terminal
in the first place, and this provided a mechanism to disassociate the controlling
terminal from the calling process. It be called by opening the file and
calling on that file descriptor. The current system does not allocate
a controlling terminal to a process on an call: there is a specific ioctl
called to make a terminal the controlling terminal. In addition, a program
can and call the system call which will place the process into its own
session - which has the effect of disassociating it from the controlling
terminal. This is the new and preferred method for programs to lose their
controlling terminal. Stop output on the terminal (like typing ^S at the
keyboard). Start output on the terminal (like typing ^Q at the keyboard).
Make the terminal the controlling terminal for the process (the process
must not currently have a controlling terminal). Wait until all output
is drained. Set exclusive use on the terminal. No further opens are permitted
except by root. Of course, this means that programs that are run by root
(or setuid) will not obey the exclusive setting - which limits the usefulness
of this feature. Clear exclusive use of the terminal. Further opens are
permitted. If the value of the int pointed to by contains the bit as
defined in then all characters in the input queue are cleared. If it contains
the bit, then all characters in the output queue are cleared. If the value
of the integer is zero, then it behaves as if both the and bits were
set (i.e. clears both queues). Put the window size information associated
with the terminal in the structure pointed to by The window size structure
contains the number of rows and columns (and pixels if appropriate) of
the devices attached to the terminal. It is set by user software and is
the means by which most full-screen oriented programs determine the screen
size. The structure is defined in Set the window size associated with
the terminal to be the value in the structure pointed to by (see above).
If points to a non-zero integer, redirect kernel console output (kernel
printf’s) to this terminal. If points to a zero integer, redirect kernel
console output back to the normal console. This is usually used on workstations
to redirect kernel messages to a particular window. The integer pointed
to by contains bits that correspond to modem state. Following is a list
of defined variables and the modem state they represent: Line Enable.
Data Terminal Ready. Request To Send. Secondary Transmit. Secondary Receive.
Clear To Send. Carrier Detect. Carier Detect (synonym). Ring Indication.
Ring Indication (synonym). Data Set Ready. This call sets the terminal
modem state to that represented by Not all terminals may support this.
Return the current state of the terminal modem lines as represented above
in the integer pointed to by The bits in the integer pointed to by represent
modem state as described above, however the state is OR-ed in with the current
state. The bits in the integer pointed to by represent modem state as
described above, however each bit which is on in is cleared in the terminal.