TCGETS |
Fetches and stores the current terminal parameters to a termios structure pointed to by the edx:
struc termios
{
.c_iflag rd 1 ; input mode flags
.c_oflag rd 1 ; output mode flags
.c_cflag rd 1 ; control mode flags
.c_lflag rd 1 ; local mode flags
.c_line rb 1 ; line discipline
.c_cc rb NCCS ; control characters
}
|
termios members:
c_iflags
IGNBRK |
Ignore a BREAK condition. A BREAK condition is defined to mean a character framing error with the data all zeroes. A framing error is one where the 'start' and 'stop' bits don't appear at the input of the UART in the time slot where they are expected by the circuitry. In order to guarantee a BREAK for any speed, the signal should be placed in the 'space' condition for at least 275-300 milliseconds. |
BRKINT |
Send an 'INTR' (interrupt) signal to the processes associated to this terminal. This definition would open a big bag of worms if I tried to explain all the implications of a 'signal', 'controlling terminal' etc here. |
IGNPAR |
Ignore parity or parity errors except for the 'BREAK condition'. |
PARMRK |
Mark the character as the result of a parity error. |
INPCK |
Enable input parity check. This bit controls the action of the device driver only and does not effect the hardware. If the hardware is set to check the parity bit the result is not processed by the driver.
While these definitions seem simple, there are some rather complex interactions. When:
IGNBRK set, BRKINT set or unset. A BREAK condition is completely ignored.
IGNBRK unset, BRKINT set, All data is flushed from the input and output queues. If the terminal associated with the device is a controlling terminal to a foreground process, a SIGINT is sent to that process.
IGNBRK unset, BRKINT unset. A BREAK condition is changed to a single NUL character.
However if PARMRK is set, then send the sequence '0x3f', '0x00', '0x00' is sent to the process.
IGNPAR unset, PARMRK set. A framing error or parity error is sent to the process as the sequence '0x3f', '0x00', char where 'char' is the character received. If ISTRIP is unset then the sequence becomes '0x3f', '0x3f' if the received 'char' is also '0x3f'.
IGNPAR unset, PARMRK unset. A framing or parity error is sent to the process as a single '0x00' unless the framing error is the result of a BREAK condition. |
ISTRIP |
Strip off the eighth bit of the incoming byte. |
INLCR |
An incoming new line character is translated to a carriage return. |
IGNCR |
Ignore an incoming carriage return. |
ICRNL |
Translate an incoming carriage return to a new line character. Of course if the IGNCR flag is set, this is another do nothing. |
IUCLC |
Translate incoming upper case alphabetic characters to lower case. This has no effect on control characters of non-alphabetic character. |
IXON |
Suspend sending output characters when the 'STOP' character is received. This character is conventionally the control-S, 0x13, character but is actually defined in 'c_cc' array later in this structure. |
IXANY |
Resume output of data when any character is received after data flow has been stopped with a STOP character. If the IXANY flag is not set, flow is resumed only when a 'START' character is received. By convention this is the control-Q character, 0x11. Like the STOP character, the actual character used is in the 'c_cc' field. |
IXOFF |
Send a STOP character on the output when the input buffer is nearly full. Then send a START character when the sufficient room is available to receive additional characters. |
IMAXBEL |
Echo the ASCII BEL character, 0x07 or as defined in 'c_cc' when the input stream overflows. Additional data is lost. If MAXBEL is not set, the BEL character is not sent but the data is lost anyhow. |
IUTF8 |
UTF-8 flag. If it is set, the “cooked” mode line editor will treat UTF-8 multi-byte sequences correctly. (supported only starting from kernel v2.6) |
c_oflags
OPOST |
Postprocess output. If set, output characters are post-processed as indicated by the remaining flags, otherwise characters are transmitted without change. |
OLCUC |
Map lower case to upper on output. If set, a lower-case alphabetic character is transmitted as the corresponding upper-case character. This function is often used in conjunction with IUCLC. |
ONLCR |
Map NL to CR-NL on output. If set, the NL character is transmitted as the CR-NL character pair. |
OCRNL |
Map CR to NL on output. If set, the CR character is transmitted as the NL character. |
ONOCR |
No CR output at column 0. If set, no CR character is transmitted when at column 0 (first position). |
ONLRET |
NL performs CR function. If set, the NL character is assumed to do the carriage-return function; the column pointer will be set to 0 and the delays specified for CR will be used. Otherwise the NL character is assumed to do just the line-feed function; the column pointer will remain unchanged. The column pointer is also set to 0 if the CR character is actually transmitted. |
OFILL |
Use fill characters for delay. If set, fill characters will be transmitted for delay instead of a timed delay. This is useful for high baud rate terminals which need only a minimal delay. |
OFDEL |
If set, the fill character is DEL, otherwise NUL. |
NLDLY |
Newline delay type 0 (NL0) selects no delay. Newline delay type 1 (NL1) lasts about 0.10 seconds. If ONLRET is set, the carriage-return delays are used instead of the new-line delays. If OFILL is set, two fill characters will be transmitted. Possible bit settings are as described above: NL0, NL1. |
CRDLY |
Carriage-return delay type 0 (CR0) selects no delay. Carriage-return delay type 1 (CR1) is dependent on the current column position, type 2 (CR2) is about 0.10 seconds, and type 3 (CR3) is about 0.15 seconds. If OFILL is set, delay type 1 transmits two fill characters, and type 2, four fill characters. Possible bit settings are as described above: CR0, CR1, CR2, CR3. |
TABDLY |
Horizontal-tab delay type 0 (TAB0) selects no delay. Horizontal-tab delay type 1 (TAB1) is dependent on the current column position. Type 2 (TAB2) is about 0.10 seconds. Type 3 (TAB3) specifies that tabs are to be expanded into spaces. If OFILL is set, two fill characters will be transmitted for any delay. Possible bits setting are as described above: TAB0, TAB1, TAB2, TAB3, XTABS (XTABS is identical to TAB3). |
BSDLY |
Backspace delay type 0 (BS0) selects no delay. Backspace delay type 1 (BS1) lasts about 0.05 seconds. If OFILL is set, one fill character will be transmitted. Possible bits settings are as described above: BS0, BS1. |
VTDLY |
Vertical-tab delay type 0 (VT0) selects no delay. Vertical- tab delay type 1 (VT1) lasts about 2.0 seconds. Possible bit settings are as described above: VT0, VT1. |
FFDLY |
Form-feed delay type 0 (FF0) selects no delay. Form-feed delay type 0 (FF0) lasts about 2.0 seconds. Possible bit settings are as described above: FF0, FF1. |
c_cflags
CBAUD |
Baud speed mask. Possible bit settings are:
B0 ; terminate the connection
B50 ; 50 baud
B75 ; 75 baud
B110 ; 110 baud
B134 ; 134 baud
B150 ; 150 baud
B200 ; 200 baud
B300 ; 300 baud
B600 ; 600 baud
B1200 ; 1200 baud
B1800 ; 1800 baud
B2400 ; 2400 baud
B4800 ; 4800 baud
B9600 ; 9600 baud
B19200 ; 19200 baud
B38400 ; 38400 baud
EXTA ; External A
EXTB ; External B |
CSIZE |
The CSIZE bits specify the character size in bits for both transmission and reception. This size does not include the parity bit, if any. Possible bit settings are:
CS5 ; 5 bits
CS6 ; 6 bits
CS7 ; 7 bits
CS8 ; 8 bits |
CSTOPB |
If set, two stop bits are used, otherwise one stop bit. For example, at 110 baud, two stops bits are required. |
CREAD |
If set, the receiver is enabled. Otherwise no characters will be received. |
PARENB |
If set, parity generation and detection is enabled and a parity bit is added to each character. |
PARODD |
If parity is enabled, the PARODD flag specifies odd parity if set, otherwise even parity is used. |
HUPCL |
If set, the line will be disconnected when the last process with the line open closes it or terminates. That is, the data-terminal-ready signal will not be asserted. |
CLOCAL |
If set, the line is assumed to be a local, direct connection with no modem control. Otherwise modem control is assumed. |
CBAUDEX |
Baud speed mask for speeds beyond 57600 baud (POSIX.1). Possible bit setting are:
B57600 ; 57600 baud
B115200 ; 115200 baud
B230400 ; 230400 baud
B460800 ; 460800 baud
B500000 ; 500000 baud
B576000 ; 576000 baud
B921600 ; 921600 baud
B1000000 ; 1000000 baud
B1152000 ; 11520000 baud
B1500000 ; 15000000 baud
B2000000 ; 20000000 baud
B2500000 ; 25000000 baud
B3000000 ; 30000000 baud
B3500000 ; 35000000 baud
B4000000 ; 40000000 baud |
CIBAUD |
Input baud speed mask. (not used) |
CMSPAR |
MARK or SPACE parity. |
CRTSCTS |
Enable RTS/CTS (hardware) flow control. |
c_lflags
ISIG |
If set, each input character is checked against the special control characters INTR, SUSP, DSUSP, and QUIT. If an input character matches one of these control characters, the function associated with that character is performed. If ISIG is not set, no checking is done. |
ICANON |
Enable canonical mode. This enables the special characters EOF, EOL, EOL2, ERASE, KILL, LNEXT, REPRINT, STATUS, and WERASE, and buffers by lines. |
XCASE |
If ICANON is also set, terminal is uppercase only. Input is converted to lowercase, except for characters preceded by \. On output, uppercase characters are preceded by \ and lowercase characters are converted to uppercase. |
ECHO |
If set, characters are echoed as received. |
ECHOE |
If ICANON is also set, the ERASE character erases the preceding input character, and WERASE erases the preceding word. |
ECHOK |
If ICANON is also set, the KILL character erases the current line. |
ECHONL |
If ICANON is also set, echo the NL character even if ECHO is not set. |
NOFLSH |
If set, disables flushing the input and output queues when generating the SIGINT and SIGQUIT signals, and flushing the input queue when generating the SIG- SUSP signal. |
TOSTOP |
If set, the signal SIGTTOU is sent to a process that tries to write to its controlling terminal if it is not in the foreground process group for that terminal. This signal normally stops the process. Otherwise, the output generated by that process is output to the current output stream. Processes that are blocking or ignoring SIGTTOU signals are excepted and allowed to produce output and the SIGTTOU signal is not sent. |
ECHOCTL |
If ECHO is also set, ASCII control signals other than TAB, NL, START, and STOP are echoed as ^X, where X is the character with ASCII code 0x10 greater than the control signal. For example, character 0x28 (BS) is echoed as ^H. |
ECHOPRT |
If ICANON and IECHO are also set, characters are printed as they are being erased. |
ECHOKE |
If ICANON is also set, KILL is echoed by erasing each character on the line, as specified by ECHOE and ECHOPRT. |
FLUSHO |
If set, data written to the terminal is discarded. This bit is set when the FLUSH/DISCARD character is typed. A program can cancel the effect of typing the FLUSH/DISCARD character by clearing FLUSHO.. |
PENDIN |
If set, all characters in the input queue are reprinted when the next character is read. (bash handles typeahead this way.) |
IEXTEN |
If set, enables implementation-defined input processing. |
Upon success 0 is returned, otherwise -EFAULT is returned.
|
TCSETS |
Set the current terminal parameters according to the values in the termios structure pointed to by the argument.
edx should contain a pointer to a properly initialized termios structure (see TCGETS). |
TCSETSW |
Same as TCSETS except it doesn't take effect until all the characters queued for output have been transmitted. |
TCSETSF |
Same as TCSETSW except that all characters queued for input are discarded. |
TCGETA |
Fetches and stores the current terminal parameters to a termio structure pointed to by the argument (see TSGETS). |
TCSETA |
Set the current terminal parameters according to the values in the termio structure pointed to by the argument (see TSSETS). |
TCSETAW |
Same a TCSET except it doesn't take effect until all the characters queued for output have been transmitted. |
TCSETAF |
Same as TCSETAW except that all characters queued for input are discarded. |
TCSBRK |
Wait for the output to drain. If edx is 0, then send a break (zero bits for 0.25 seconds). |
TCXONC |
Start/stop control. edx should specify the action to take:
0 - suspend output
1 - restart suspended output
2 - suspend input
3 - restart suspended input |
TCFLSH |
Flush the queue. Possible values for edx:
0 - flush the input queue
1 - flush the output queue
2 - flush both the input and output queues |
TIOCEXCL |
If set, no further open operations on the terminal are permitted. (They will fail with -EBUSY, except for root.) edx value is ignored. |
TIOCNXCL |
If set, tty exclusive mode is disabled. edx value is ignored. |
TIOCSCTTY |
Make the given tty the controlling tty of the current process. The current process must be a session leader and not have a controlling tty already. If this tty is already the controlling tty of a different session group then the ioctl fails with -EPERM, unless the caller is root and edx equals 1, in which case the tty is stolen, and all processes that had it as controlling tty lose it. |
TIOCGPGRP |
Get the process group ID of the foreground process group on this tty. edx should point to an integer representing the process group ID of the process group. |
TIOCSPGRP |
Set the foreground process group ID of this tty. edx should point to an integer to which the process group ID for the terminal specified by the file descriptor parameter will be set. |
TIOCOUTQ |
Returns the number of characters queued for output to the terminal. edx should point to an integer which will receive the result. |
TIOCSTI |
Insert the given byte in the input queue. edx should point to a character to be inserted. |
TIOCGWINSZ |
Gets window size information. edx should point to a winsize structure which will receive the information:
struct winsize
ws_row dw ?
ws_col dw ?
ws_xpixel dw ?
ws_ypixel dw ?
ends |
TIOCSWINSZ |
Sets window size information. edx should point to a properly initialized winsize structure. When the window size changes, a SIGWINCH signal is sent to the foreground process group. (see TIOCGWINSZ for the winsize structure definition) |
TIOCMGET |
Gets the status of modem bits. edx should point to an integer which will receive the information. Used bits are:
TIOCM_LE - DSR (data set ready/line enable)
TIOCM_DTR - DTR (data terminal ready)
TIOCM_RTS - RTS (request to send)
TIOCM_ST - Secondary TXD
(transmit)
TIOCM_SR - Secondary RXD (receive)
TIOCM_CTS - CTS (clear to send)
TIOCM_CAR - DCD (data carrier detect)
TIOCM_CD - see TIOCM_CAR
TIOCM_RNG - RNG (ring)
TIOCM_RI - see TIOCM_RNG
TIOCM_DSR - DSR (data set ready) |
TIOCMBIS |
Set particular modem bits. edx should point to an integer specifying the bits to be set. |
TIOCMBIC |
Clear particular modem bits. edx should point to an integer specifying the bits to be cleared. |
TIOCMSET |
Set the status of modem bits. edx should point to an integer with modem bits status to be set. |
TIOCGSOFTCAR |
Get software carrier detect mode. edx should point to an integer which will receive the mode status: 0 or 1, representing off and on mode respectively. |
TIOCSSOFTCAR |
Set software carrier detect mode. edx should point to an integer initialized to the required mode: 0 or 1, representing off and on mode respectively. |
FIONREAD |
Return the number of characters immediately readable from the argument descriptor. This works for files, pipes, and terminals. edx should point to an integer which will receive the information. |
TIOCINQ |
This command code is identical to FIONREAD. |
TIOCLINUX |
Operation of this command depends on the value of the first byte (also referred as subcode) in the array pointed by edx. It should be one of the following values:
0 |
Dump the screen. Disappeared in kernel v1.1.92. (With kernel 1.1.92 or later, read from /dev/vcsN or /dev/vcsaN instead.) |
1 |
Get task information. Disappeared in kernel v1.1.92. |
2 |
Set selection. Next item after the subcode is the selection parameters which can be represented by the following structure: (This structure is not defined in the kernel source and therefore also not included in the structs.inc)
struc selection
{
.xs rw 1
.ys rw 1
.xe rw 1
.ye rw 1
.sel_mode rw 1
}
xs and ys are the starting column and row. xe and ye are the ending column and row. (Upper left corner is row=column=1.) sel_mode is 0 for character-by-character selection, 1 for word- by-word selection, or 2 for line-by-line selection. The indicated screen characters are highlighted and saved in the static array sel_buffer in devices/char/console.c. |
3 |
Paste selection. The characters in the selection buffer are written to the specified file descriptor. |
4 |
Unblank the screen. |
5 |
Sets contents of a 256-bit look up table defining characters in a "word", for word-by-word selection. (Available since kernel v1.1.32.) |
6 |
Next item after the subcode should be a char which will be set to the value of the kernel variable shift_state. (Available since kernel v1.1.32.) |
7 |
Next item after the subcode should be a char which will be set to the value of the kernel variable report_mouse. (Available since kernel v1.1.33.) |
8 |
Dump screen width and height, cursor position, and all the character-attribute pairs. (Kernels 1.1.67 through 1.1.91 only. With kernel 1.1.92 or later, read from /dev/vcsa* instead.) |
9 |
Restore screen width and height, cursor position, and all the character-attribute pairs. (Kernels 1.1.67 through 1.1.91 only. With kernel 1.1.92 or later, write to /dev/vcsa* instead.) |
10 |
Handles the Power Saving feature of the new generation of monitors.VESA screen blanking mode is set the next byte after the subcode, which governs what screen blanking does (Available since 1.1.76):
0 |
Screen blanking is disabled. |
1 |
The current video adapter register settings are saved, then the controller is programmed to turn off the vertical synchronization pulses. This puts the monitor into "standby" mode. If your monitor has an Off_Mode timer, then it will eventually power down by itself. |
2 |
The current settings are saved, then both the vertical and horizontal synchronization pulses are turned off. This puts the monitor into "off" mode. If your monitor has no Off_Mode timer, or if you want your monitor to power down immediately when the blank_timer times out, then you choose this option. (Caution: Powering down frequently will damage the monitor.) |
|
(This command is legal only for the superuser or the owner of the current tty.)
|
TIOCCONS |
Redirect output that would have gone to /dev/console or /dev/tty0 to the given tty. If that was a pty master, send it to the slave. Anybody can do this as long as the output was not redirected yet. If it was redirected already -EBUSY is returned, but root may stop redirection by using this ioctl with fd pointing at /dev/console or /dev/tty0. |
TIOCGSERIAL |
Get serial lines parameters. edx should point to a serial_struct structure which will be receive the information:
struc serial_struct
{
.type rd 1
.line rd 1
.port rd 1
.irq rd 1
.flags rd 1
.xmit_fifo_size rd 1
.custom_divisor rd 1
.baud_base rd 1
.close_delay rw 1
.io_type rb 1
.reserved_char rb 1
.hub6 rd 1
.closing_wait rw 1
.closing_wait2 rw 1
.iomem_base rd 1
.iomem_reg_shift rw 1
.port_high rd 1
.iomap_base rd 1
}
|
|
TIOCSSERIAL |
Set serial lines parameters. edx should point to a properly initialized serial_struct structure (See TIOCGSERIAL). |
TIOCPKT |
Enable/disable packet mode. Enable (when edx points to a non-zero integer) or disable packet mode. Can be applied to the master side of a pseudo-terminal only (and will return -ENOTTY otherwise). In packet mode, each subsequent sys_read will return a packet that either contains a single non-zero control byte, or has a single byte containing zero ('' ') followed by data written on the slave side of the pty. If the first byte is not TIOCPKT_DATA (0), it is an OR of one or more of the following bits:
TIOCPKT_FLUSHREAD |
The read queue for the terminal is flushed. |
TIOCPKT_FLUSHWRITE |
The write queue for the terminal is flushed. |
TIOCPKT_STOP |
Output to the terminal is stopped a la `^S'. |
TIOCPKT_START |
Output to the terminal is restarted. |
TIOCPKT_DOSTOP |
t_stopc is `^S' and t_startc is `^Q'. |
TIOCPKT_NOSTOP |
The start and stop characters are not `^S/^Q'. |
|
FIONBIO |
Enable or disable non-blocking mode, according to the boolean value of the contents of an integer pointed by edx Enabling this mode has the same effect as the O_NDELAY flag for sys_open. |
TIOCNOTTY |
If the given tty was the controlling tty of the current process, give up this controlling tty. If the process was session leader, then send SIGHUP and SIGCONT to the foreground process group and all processes in the current session lose their controlling tty. |
TIOCSETD |
Set the line discipline of the tty. edx should point to an integer value identifying the discipline. |
TIOCGETD |
Get the line discipline of the tty. edx should point to an location which will receive the returning integer value. |
TCSBRKP |
So-called "POSIX version" of TCSBRK. It treats non-zero value in edx as a timeinterval measured in deciseconds, and does nothing when the driver does not support breaks. |
TIOCSBRK |
Turn break on, that is, start sending zero bits. edx is ignored. |
TIOCCBRK |
Turn break off, that is, stop sending zero bits. edx is ignored. |
TIOCGSID |
Get the session ID of the given tty. This will fail with -ENOTTY in case the tty is not a master pty and not our controlling tty. Strange. edx should point to a integer value which will receive the session ID. |
TIOCGPTN |
Get the pty number. edx should point to a location which will receive the returning integer value. |
TIOCSPTLCK |
Lock/unlock pty. *to be documented* |
FIONCLEX |
Clear close-on-exec flag. edx is ignored. |
FIOCLEX |
Set close-on-exec flag. edx is ignored. |
FIOASYNC |
Enable or disable asynchronous IO mode (change the O_ASYNC flag). Asynchronous IO mode means that the SIGIO signal or the signal set with F_SETSIG is raised when a new I/O event occurs. edx should point to an integer boolean flag. |
TIOCSERCONFIG |
*to be documented* |
TIOCSERGWILD |
*to be documented* |
TIOCSERSWILD |
*to be documented* |
TIOCGLCKTRMIOS |
Gets the locking status of the termios structure of the terminal (The termios structure of a tty can be locked. The lock is itself a termios structure, with non-zero bits or fields indicating a locked value.). edx should point to a termios structure which will receive the information (See TCGETS for more details about the termios structure). |
TIOCSLCKTRMIOS |
Sets the locking status of the termios structure of the terminal. Only root can do this. edx should to a properly initialized termios structure (See TCGETS for more details about the termios structure). |
TIOCSERGSTRUCT |
*to be documented* |
TIOCSERGETLSR |
Get information about the state of the serial transmission line. edx should point to an integer which will receive the information. |
TIOCSERGETMULTI |
Get multiport configuration. edx should point to a serial_multiport_struct structure which will receive the information:
struc serial_multiport_struct
{
.irq rd 1
.port1 rd 1
.mask1 rb 1
.match1 rb 1
.port2 rd 1
.mask2 rb 1
.match2 rb 1
.port3 rd 1
.mask3 rb 1
.match3 rb 1
.port4 rd 1
.mask4 rb 1
.match4 rb 1
.port_monitor rd 1
.reserved rd 32
}
|
|
TIOCSERSETMULTI |
Set multiport configuration. edx should point to a properly initialized serial_multiport_struct structure. (See TIOCSERGETMULTI) |
TIOCMIWAIT |
Wait for a change on serial input line(s). *to be documented* |
TIOCGICOUNT |
Read serial port inline interrupt counts. *to be documented* |
TIOCGHAYESESP |
Get Hayes ESP configuration. *to be documented* |
TIOCSHAYESESP |
Set Hayes ESP configuration. *to be documented* |
FIOQSIZE |
Return the size of a file or directory; when applied to a device file, however, it yields an -ENOTTY error. edx should point to an integer which will receive the return value. |