1tcgetattr(3C) Standard C Library Functions tcgetattr(3C)
2
3
4
6 tcgetattr - get the parameters associated with the terminal
7
9 #include <termios.h>
10
11 int tcgetattr(int fildes, struct termios *termios_p);
12
13
15 The tcgetattr() function gets the parameters associated with the termi‐
16 nal referred to by fildes and stores them in the termios structure (see
17 termio(7I)) referenced by termios_p. The fildes argument is an open
18 file descriptor associated with a terminal.
19
20
21 The termios_p argument is a pointer to a termios structure.
22
23
24 The tcgetattr() operation is allowed from any process.
25
26
27 If the terminal device supports different input and output baud rates,
28 the baud rates stored in the termios structure returned by tcgetattr()
29 reflect the actual baud rates, even if they are equal. If differing
30 baud rates are not supported, the rate returned as the output baud rate
31 is the actual baud rate. If the terminal device does not support split
32 baud rates, the input baud rate stored in the termios structure will be
33 0.
34
36 Upon successful completion, 0 is returned. Otherwise, −1 is returned
37 and errno is set to indicate the error.
38
40 The tcgetattr() function will fail if:
41
42 EBADF The fildes argument is not a valid file descriptor.
43
44
45 ENOTTY The file associated with fildes is not a terminal.
46
47
49 See attributes(5) for descriptions of the following attributes:
50
51
52
53
54 ┌─────────────────────────────┬───────────────────────────────┐
55 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
56 ├─────────────────────────────┼───────────────────────────────┤
57 │Interface Stability │Standard │
58 ├─────────────────────────────┼───────────────────────────────┤
59 │MT-Level │MT-Safe, and Async-Signal-Safe │
60 └─────────────────────────────┴───────────────────────────────┘
61
63 tcsetattr(3C), attributes(5), standards(5), termio(7I)
64
65
66
67SunOS 5.11 14 Aug 2002 tcgetattr(3C)