source: trunk/minix/man/man3/termios.3@ 10

Last change on this file since 10 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 4.2 KB
RevLine 
[9]1.TH TERMIOS 3
2.SH NAME
3termios, tcgetattr, tcsetattr, cfgetispeed, cfgetospeed, cfsetispeed, cfsetospeed, tcsendbreak, tcdrain, tcflush, tcflow \- change terminal attributes
4.SH SYNOPSIS
5.ft B
6.nf
7#include <termios.h>
8
9int tcgetattr(int \fIfd\fP, struct termios *\fItp\fP)
10int tcsetattr(int \fIfd\fP, int \fIaction\fP, const struct termios *\fItp\fP)
11
12speed_t cfgetispeed(const struct termios *\fItp\fP)
13speed_t cfgetospeed(const struct termios *\fItp\fP)
14int cfsetispeed(struct termios *\fItp\fP, speed_t \fIspeed\fP)
15int cfsetospeed(struct termios *\fItp\fP, speed_t \fIspeed\fP)
16
17int tcsendbreak(int \fIfd\fP, int \fIduration\fP)
18int tcdrain(int \fIfd\fP)
19int tcflush(int \fIfd\fP, int \fIqueue_selector\fP)
20int tcflow(int \fIfd\fP, int \fIaction\fP)
21.fi
22.ft P
23.SH DESCRIPTION
24.de SP
25.if t .sp 0.4
26.if n .sp
27..
28These are the user functions that modify the tty attributes mentioned in
29.BR tty (4).
30In the following,
31.I fd
32refers to an open terminal device file,
33.I tp
34is the address of a
35.BR "struct termios" ,
36and
37.I speed
38and values of type
39.B speed_t
40are equal to one of the
41.BR B0 ,
42.BR B50 ,
43etc. baud rate symbols. All functions, symbols, and types are declared in
44.BR <termios.h> .
45.PP
46The effects of the tty functions are:
47.TP
48.B tcgetattr(\fIfd\fP, \fItp\fP)
49Get the current settings of the tty attributes.
50.TP
51.B tcsetattr(\fIfd\fP, TCSANOW, \fItp\fP)
52Set the terminal attributes. The change occurs immediately.
53.TP
54.B tcsetattr(\fIfd\fP, TCSADRAIN, \fItp\fP)
55Set the terminal attributes. The change occurs once all the output waiting
56in the output queues has been transmitted. This should be used when options
57affecting output are changed.
58.TP
59.B tcsetattr(\fIfd\fP, TCSAFLUSH, \fItp\fP)
60Set the terminal attributes. But first wait until all the output waiting
61in the output queues has been transmitted. All input waiting in the input
62queues is then discarded and the change is made. This should be used when
63switching from canonical to non-canonical mode or vice-versa. (Oddly
64enough, this is seldom what you want, because it discards typeahead. An
65editing shell does the Right Thing if it uses
66.B TCSANOW
67instead. \s-2POSIX\s+2 may not guarantee good results, but in practice most
68systems make the canonical input available in raw mode.)
69.TP
70.B cfgetispeed(\fItp\fP)
71Return the input baud rate encoded in the termios structure.
72.TP
73.B cfgetospeed(\fItp\fP)
74Return the output baud rate encoded in the termios structure.
75.TP
76.B cfsetispeed(\fItp\fP, \fIspeed\fP)
77Encode the new input baud rate into the termios structure.
78.TP
79.B cfsetospeed(\fItp\fP, \fIspeed\fP)
80Encode the new output baud rate into the termios structure.
81.TP
82.B tcsendbreak(\fIfd\fP, \fIduration\fP)
83Emit a break condition on a serial line for a time indicated by
84.IR duration .
85(Always 0.4 seconds under MINIX 3,
86.I duration
87is ignored.)
88.TP
89.B tcdrain(\fIfd\fP)
90Wait until all output waiting in the output queues has been transmitted.
91.TP
92.B tcflush(\fIfd\fP, TCIFLUSH)
93Flush the input queue. (I.e. discard it.)
94.TP
95.B tcflush(\fIfd\fP, TCOFLUSH)
96Flush the output queue.
97.TP
98.B tcflush(\fIfd\fP, TCIOFLUSH)
99Flush the input and output queues.
100.TP
101.B tcflow(\fIfd\fP, TCOOFF)
102Suspend output. (Like the effect of
103.BR STOP .)
104.TP
105.B tcflow(\fIfd\fP, TCOON)
106Restart output. (Like the effect of
107.BR START .)
108.TP
109.B tcflow(\fIfd\fP, TCIOFF)
110Transmit a
111.B STOP
112character intended to make the remote device stop transmitting data.
113.TP
114.B tcflow(\fIfd\fP, TCION)
115Transmit a
116.B START
117character to restart the remote device.
118.SH "SEE ALSO"
119.BR stty (1),
120.BR tty (4).
121.SH DIAGNOSTICS
122All functions return 0 unless otherwise specified, and \-1 on error with
123.B errno
124set to indicate the type of error. The most notable errors are
125.B ENOTTY
126if
127.I fd
128does not refer to a terminal device, and
129.B EINTR
130if one of the functions waiting for output to drain is interrupted.
131.SH NOTES
132It may be interesting to know that the functions operating on the tty are
133directly translated into the following MINIX 3
134.B ioctl
135requests:
136.BR TCGETS ,
137.BR TCSETS
138(now),
139.BR TCSETSW
140(drain),
141.BR TCSETSF ,
142(flush),
143.BR TCSBRK ,
144.BR TCDRAIN ,
145.BR TCFLSH ,
146and
147.BR TCFLOW .
148You should only use this knowledge when trying to understand the tty driver
149code, of course.
150.SH BUGS
151.SH AUTHOR
152Kees J. Bot (kjb@cs.vu.nl)
153
154.\"
155.\" $PchId: termios.3,v 1.2 1996/04/11 06:41:24 philip Exp $
Note: See TracBrowser for help on using the repository browser.