mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 04:29:30 -10:00
LibC: Implement tc{get,set}winsize functions
We already support the operation with ioctl, these functions are simply the POSIX-compatible way of doing it. They were added in POSIX 2024.
This commit is contained in:
1 parent
57d7d52024
commit
8e34c970b5
2 files changed
+16
No files matched your search
@@ -9,6 +9,7 @@
|
||||
#include <errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -154,4 +155,16 @@ void cfmakeraw(struct termios* tp)
|
||||
termios.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
|
||||
termios.c_cflag |= CS8;
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9799919799/functions/tcgetwinsize.html
|
||||
int tcgetwinsize(int fildes, winsize* winsize_p)
|
||||
{
|
||||
return ioctl(fildes, TIOCGWINSZ, winsize_p);
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9799919799/functions/tcsetwinsize.html
|
||||
int tcsetwinsize(int fildes, winsize const* winsize_p)
|
||||
{
|
||||
return ioctl(fildes, TIOCSWINSZ, winsize_p);
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,9 @@ int tcsendbreak(int fd, int duration);
|
||||
int tcflow(int fd, int action);
|
||||
int tcflush(int fd, int queue_selector);
|
||||
|
||||
int tcgetwinsize(int fildes, struct winsize* winsize_p);
|
||||
int tcsetwinsize(int fildes, const struct winsize* winsize_p);
|
||||
|
||||
speed_t cfgetispeed(const struct termios*);
|
||||
speed_t cfgetospeed(const struct termios*);
|
||||
int cfsetispeed(struct termios*, speed_t);
|
||||
|
||||
Reference in new issue
Block a user