mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:27:35 +00:00
Reimplement tcsetattr/tcgetattr as ioctls.
This commit is contained in:
parent
c99f8af66d
commit
084287ca45
7 changed files with 55 additions and 49 deletions
|
@ -1,20 +1,26 @@
|
|||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <termios.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <Kernel/Syscall.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
int tcgetattr(int fd, struct termios* t)
|
||||
{
|
||||
int rc = Syscall::invoke(Syscall::SC_tcgetattr, (dword)fd, (dword)t);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
return ioctl(fd, TCGETS, t);
|
||||
}
|
||||
|
||||
int tcsetattr(int fd, int optional_actions, const struct termios* t)
|
||||
{
|
||||
int rc = Syscall::invoke(Syscall::SC_tcsetattr, (dword)fd, (dword)optional_actions, (dword)t);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
switch (optional_actions) {
|
||||
case TCSANOW:
|
||||
return ioctl(fd, TCSETS, t);
|
||||
case TCSADRAIN:
|
||||
return ioctl(fd, TCSETSW, t);
|
||||
case TCSAFLUSH:
|
||||
return ioctl(fd, TCSETSF, t);
|
||||
}
|
||||
}
|
||||
|
||||
int tcflow(int fd, int action)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue