The manual
ginnOS
The reference: libc, the libraries and the kernel
Toggle main menu visibility
Loading...
Searching...
No Matches
termios.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <
sys/types.h
>
4
5
/**
6
* @file termios.h
7
* @brief terminal settings.
8
*
9
* the layout, flags and values are ABI and must match the kernel side in
10
* src/kernel/console/termios.h exactly (they are the Linux i386 ones).
11
*/
12
13
typedef
unsigned
int
tcflag_t
;
14
typedef
unsigned
char
cc_t
;
15
typedef
unsigned
int
speed_t
;
16
#define NCCS 19
17
18
struct
termios
19
{
20
tcflag_t
c_iflag
;
21
tcflag_t
c_oflag
;
22
tcflag_t
c_cflag
;
23
tcflag_t
c_lflag
;
24
cc_t
c_line
;
25
cc_t
c_cc
[
NCCS
];
26
};
27
28
// c_iflag
29
#define INLCR 0x0040
30
#define IGNCR 0x0080
31
#define ICRNL 0x0100
32
#define IXON 0x0400
// accepted, has no effect
33
#define BRKINT 0x0002
// accepted, has no effect
34
#define INPCK 0x0010
// accepted, has no effect
35
#define ISTRIP 0x0020
// accepted, has no effect
36
37
// c_oflag
38
#define OPOST 0x0001
39
#define ONLCR 0x0004
40
41
// c_cflag
42
#define CS8 0x0030
43
#define CREAD 0x0080
44
45
// c_lflag
46
#define ISIG 0x0001
47
#define ICANON 0x0002
48
#define ECHO 0x0008
49
#define ECHOE 0x0010
50
#define ECHOK 0x0020
51
#define TOSTOP 0x0100
52
#define IEXTEN 0x8000
53
// ginnOS: reads return key_event_t records instead of bytes (unistd.h
54
// read_event); ttyctl(TTY_RAW) turns this on
55
#define XKEYEVENTS 0x40000000
56
#define XKEYRAW 0x20000000
// with XKEYEVENTS: every key down and up as a
57
// CONSOLE_KEY_EVENT_RAW event (unistd.h), for games
58
59
// c_cc indexes
60
#define VINTR 0
61
#define VQUIT 1
62
#define VERASE 2
63
#define VKILL 3
64
#define VEOF 4
65
#define VTIME 5
66
#define VMIN 6
67
#define VSUSP 10
68
69
// tcsetattr when
70
#define TCSANOW 0
71
#define TCSADRAIN 1
72
#define TCSAFLUSH 2
// also drop typed input not read yet
73
74
int
tcgetattr
(
int
fd,
struct
termios
*t);
75
int
tcsetattr
(
int
fd,
int
when,
const
struct
termios
*t);
76
77
/**
78
* settings for byte-by-byte input with no echo, no signals and no output
79
* processing.
80
*/
81
void
cfmakeraw
(
struct
termios
*t);
82
83
/**
84
* the foreground process group of the terminal on fd, and setting it.
85
*/
86
pid_t
tcgetpgrp
(
int
fd);
87
int
tcsetpgrp
(
int
fd,
pid_t
pgrp);
cc_t
unsigned char cc_t
Definition
termios.h:14
speed_t
unsigned int speed_t
Definition
termios.h:15
NCCS
#define NCCS
Definition
termios.h:16
tcgetpgrp
pid_t tcgetpgrp(int fd)
the foreground process group of the terminal on fd, and setting it.
cfmakeraw
void cfmakeraw(struct termios *t)
settings for byte-by-byte input with no echo, no signals and no output processing.
tcsetattr
int tcsetattr(int fd, int when, const struct termios *t)
tcgetattr
int tcgetattr(int fd, struct termios *t)
tcflag_t
unsigned int tcflag_t
Definition
termios.h:13
tcsetpgrp
int tcsetpgrp(int fd, pid_t pgrp)
termios
Definition
termios.h:19
termios::c_cflag
tcflag_t c_cflag
Definition
termios.h:22
termios::c_cc
cc_t c_cc[NCCS]
Definition
termios.h:25
termios::c_iflag
tcflag_t c_iflag
Definition
termios.h:20
termios::c_lflag
tcflag_t c_lflag
Definition
termios.h:23
termios::c_oflag
tcflag_t c_oflag
Definition
termios.h:21
termios::c_line
cc_t c_line
Definition
termios.h:24
types.h
basic system types.
pid_t
int pid_t
Definition
types.h:16
src
libc
include
termios.h
Generated by
1.18.0