Skip to main content

relibc/header/sys_ioctl/
constants.rs

1// These constants have the same values on both redox and linux.
2// TODO add more from linux as and when redox supports them.
3
4use crate::platform::types::c_ulong;
5
6/// Equivalent to `tcgetattr(fd, argp)`.
7/// Get the current serial port settings.
8pub const TCGETS: c_ulong = 0x5401;
9/// Equivalent to `tcsetattr(fd, TCSANOW, argp)`.
10/// Set the current serial port settings.
11pub const TCSETS: c_ulong = 0x5402;
12/// Equivalent to `tcsetattr(fd, TCSADRAIN, argp)`.
13/// Allow the output buffer to drain, and set the current serial port settings.
14pub const TCSETSW: c_ulong = 0x5403;
15/// Equivalent to `tcsetattr(fd, TCSAFLUSH, argp)`.
16/// Allow the output buffer to drain, discard pending input, and set the
17/// current serial port settings.
18pub const TCSETSF: c_ulong = 0x5404;
19
20/// Equivalent to `tcsendbreak(fd, arg)`.
21pub const TCSBRK: c_ulong = 0x5409;
22/// Equivalent to `tcflow(fd, arg)`.
23pub const TCXONC: c_ulong = 0x540A;
24/// Equivalent to `tcflush(fd, arg)`.
25pub const TCFLSH: c_ulong = 0x540B;
26
27/// Make the given terminal the controlling terminal of the calling process.
28pub const TIOCSCTTY: c_ulong = 0x540E;
29/// When successful, equivalent to `*argp = tcgetpgrp(fd)`.
30/// Get the process group ID of the foreground process group on this terminal.
31pub const TIOCGPGRP: c_ulong = 0x540F;
32/// Equivalent to `tcsetpgrp(fd, *argp)`.
33pub const TIOCSPGRP: c_ulong = 0x5410;
34
35/// Get window size.
36pub const TIOCGWINSZ: c_ulong = 0x5413;
37/// Set window size.
38pub const TIOCSWINSZ: c_ulong = 0x5414;
39
40//TODO: used by tcgetsid, not implemented yet on redox
41/// When successful, equivalent to `*argp = tcgetsid(fd)`.
42/// Get the session ID of the given terminal.
43pub const TIOCGSID: c_ulong = 0x5429;
44
45/// Get the number of bytes in the input buffer.
46pub const FIONREAD: c_ulong = 0x541B;
47
48/// Not recommended, should use POSIX `O_NONBLOCK` instead.
49pub const FIONBIO: c_ulong = 0x5421;
50
51/// Set (if `*lock` is nonzero) or remove (if `*lock` is zero) the lock on
52/// the pseudoterminal slave device.
53pub const TIOCSPTLCK: c_ulong = 0x4004_5431;
54/// Place the current lock state of the pseudoterminal slave device in the
55/// location pointed to by `lock`.
56pub const TIOCGPTLCK: c_ulong = 0x8004_5439;
57
58/// Obtain device unit number, which can be used to generate the filename of
59/// the pseudo-terminal slave device.
60pub const TIOCGPTN: c_ulong = 0x8004_5430;
61/// POSIX `sockatmark()` from `sys/socket.h` is intended to replace this.
62pub const SIOCATMARK: c_ulong = 0x8905;