The manual
ginnOS
The reference: libc, the libraries and the kernel
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
13typedef unsigned int tcflag_t;
14typedef unsigned char cc_t;
15typedef unsigned int speed_t;
16#define NCCS 19
17
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
74int tcgetattr(int fd, struct termios *t);
75int 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 */
81void cfmakeraw(struct termios *t);
82
83/**
84 * the foreground process group of the terminal on fd, and setting it.
85 */
87int tcsetpgrp(int fd, pid_t pgrp);
unsigned char cc_t
Definition termios.h:14
unsigned int speed_t
Definition termios.h:15
#define NCCS
Definition termios.h:16
pid_t tcgetpgrp(int fd)
the foreground process group of the terminal on fd, and setting it.
void cfmakeraw(struct termios *t)
settings for byte-by-byte input with no echo, no signals and no output processing.
int tcsetattr(int fd, int when, const struct termios *t)
int tcgetattr(int fd, struct termios *t)
unsigned int tcflag_t
Definition termios.h:13
int tcsetpgrp(int fd, pid_t pgrp)
Definition termios.h:19
tcflag_t c_cflag
Definition termios.h:22
cc_t c_cc[NCCS]
Definition termios.h:25
tcflag_t c_iflag
Definition termios.h:20
tcflag_t c_lflag
Definition termios.h:23
tcflag_t c_oflag
Definition termios.h:21
cc_t c_line
Definition termios.h:24
basic system types.
int pid_t
Definition types.h:16