mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:27:44 +00:00
LibC: Implement tcflush(3)
This commit is contained in:
parent
f4ddca0a73
commit
7a27fa3df8
3 changed files with 11 additions and 3 deletions
|
@ -329,6 +329,14 @@ int TTY::ioctl(FileDescription&, unsigned request, FlatPtr arg)
|
||||||
if (request == TCSETSF)
|
if (request == TCSETSF)
|
||||||
flush_input();
|
flush_input();
|
||||||
return 0;
|
return 0;
|
||||||
|
case TCFLSH:
|
||||||
|
// Serenity's TTY implementation does not use an output buffer, so ignore TCOFLUSH.
|
||||||
|
if (arg == TCIFLUSH || arg == TCIOFLUSH) {
|
||||||
|
flush_input();
|
||||||
|
} else if (arg != TCOFLUSH) {
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
case TIOCGWINSZ:
|
case TIOCGWINSZ:
|
||||||
ws = reinterpret_cast<winsize*>(arg);
|
ws = reinterpret_cast<winsize*>(arg);
|
||||||
if (!current_process.validate_write(ws, sizeof(winsize)))
|
if (!current_process.validate_write(ws, sizeof(winsize)))
|
||||||
|
|
|
@ -52,6 +52,7 @@ enum IOCtlNumber {
|
||||||
TCSETS,
|
TCSETS,
|
||||||
TCSETSW,
|
TCSETSW,
|
||||||
TCSETSF,
|
TCSETSF,
|
||||||
|
TCFLSH,
|
||||||
TIOCGWINSZ,
|
TIOCGWINSZ,
|
||||||
TIOCSCTTY,
|
TIOCSCTTY,
|
||||||
TIOCNOTTY,
|
TIOCNOTTY,
|
||||||
|
@ -75,6 +76,7 @@ enum IOCtlNumber {
|
||||||
#define TCSETS TCSETS
|
#define TCSETS TCSETS
|
||||||
#define TCSETSW TCSETSW
|
#define TCSETSW TCSETSW
|
||||||
#define TCSETSF TCSETSF
|
#define TCSETSF TCSETSF
|
||||||
|
#define TCFLSH TCFLSH
|
||||||
#define TIOCGWINSZ TIOCGWINSZ
|
#define TIOCGWINSZ TIOCGWINSZ
|
||||||
#define TIOCSCTTY TIOCSCTTY
|
#define TIOCSCTTY TIOCSCTTY
|
||||||
#define TIOCNOTTY TIOCNOTTY
|
#define TIOCNOTTY TIOCNOTTY
|
||||||
|
|
|
@ -60,9 +60,7 @@ int tcflow(int fd, int action)
|
||||||
|
|
||||||
int tcflush(int fd, int queue_selector)
|
int tcflush(int fd, int queue_selector)
|
||||||
{
|
{
|
||||||
(void)fd;
|
return ioctl(fd, TCFLSH, queue_selector);
|
||||||
(void)queue_selector;
|
|
||||||
ASSERT_NOT_REACHED();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
speed_t cfgetispeed(const struct termios* tp)
|
speed_t cfgetispeed(const struct termios* tp)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue