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/**
4 * the console's terminal settings (termios) and the job-control ioctls.
5 * the layout, flags and request numbers are ABI: the libc's <termios.h>
6 * and <sys/ioctl.h> have the same ones (the Linux i386 values).
7 */
8
9#include "common/stdint.h"
10
11#define NCCS 19
12
22
23// c_iflag
24#define INLCR 0x0040 // NL to CR on input
25#define IGNCR 0x0080 // ignore CR
26#define ICRNL 0x0100 // CR to NL on input
27
28// c_oflag
29#define OPOST 0x0001 // process output
30#define ONLCR 0x0004 // NL to CR NL on output
31
32// c_cflag
33#define CS8 0x0030
34#define CREAD 0x0080
35
36// c_lflag
37#define ISIG 0x0001 // INTR, QUIT and SUSP send signals
38#define ICANON 0x0002 // line by line input with editing
39#define ECHO 0x0008 // echo input
40#define ECHOE 0x0010 // erase echoes as backspace, space, backspace
41#define ECHOK 0x0020 // kill echoes a newline
42#define TOSTOP 0x0100 // background writes get SIGTTOU (not yet honored)
43#define IEXTEN 0x8000
44// ginnOS: reads return keyboard_event_t records (keys and special keys)
45// instead of bytes; this is what ttyctl(TTY_RAW) turns on
46#define XKEYEVENTS 0x40000000
47#define XKEYRAW 0x20000000 // with XKEYEVENTS: raw key down/up events
48
49// c_cc indexes
50#define VINTR 0
51#define VQUIT 1
52#define VERASE 2
53#define VKILL 3
54#define VEOF 4
55#define VTIME 5
56#define VMIN 6
57#define VSUSP 10
58
59// ioctl requests on the console and the pseudo-terminals
60#define TCGETS 0x5401
61#define TCSETS 0x5402
62#define TCSETSW 0x5403
63#define TCSETSF 0x5404 // set, and drop typed input not read yet
64#define TIOCSCTTY 0x540E
65#define TIOCGPGRP 0x540F
66#define TIOCSPGRP 0x5410
67#define TIOCGWINSZ 0x5413
68#define TIOCSWINSZ 0x5414 // set the window size (SIGWINCH to the foreground)
69#define TIOCGPTN 0x80045430 // pty master: the number N of /dev/pts/N
70#define TIOCSPTLCK 0x40045431 // pty master: lock (1) or unlock (0) the slave
71
79
80/**
81 * set up the console terminal: default settings, and init's session as
82 * the one it controls (with init's group in the foreground). call once at
83 * boot, before the first process runs.
84 * @param init_pid the pid init will have (its session and group id).
85 */
86void console_terminal_init(uint32_t init_pid);
void console_terminal_init(uint32_t init_pid)
set up the console terminal: default settings, and init's session as the one it controls (with init's...
Definition console_file.c:81
#define NCCS
the console's terminal settings (termios) and the job-control ioctls.
Definition termios.h:11
unsigned int uint32_t
Definition fb.h:17
unsigned char uint8_t
Definition fb.h:18
unsigned short uint16_t
Definition stdint.h:13
Definition termios.h:14
uint32_t c_lflag
Definition termios.h:18
uint32_t c_oflag
Definition termios.h:16
uint32_t c_iflag
Definition termios.h:15
uint8_t c_cc[NCCS]
Definition termios.h:20
uint8_t c_line
Definition termios.h:19
uint32_t c_cflag
Definition termios.h:17
Definition termios.h:73
uint16_t ws_xpixel
Definition termios.h:76
uint16_t ws_col
Definition termios.h:75
uint16_t ws_ypixel
Definition termios.h:77
uint16_t ws_row
Definition termios.h:74