2019-06-07 09:49:03 +00:00
|
|
|
#include <Kernel/Syscall.h>
|
2018-11-11 14:36:40 +00:00
|
|
|
#include <assert.h>
|
2018-11-11 09:38:33 +00:00
|
|
|
#include <errno.h>
|
2018-11-16 14:41:48 +00:00
|
|
|
#include <sys/ioctl.h>
|
2019-06-07 09:49:03 +00:00
|
|
|
#include <termios.h>
|
2018-11-11 09:38:33 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
int tcgetattr(int fd, struct termios* t)
|
|
|
|
{
|
2018-11-16 14:41:48 +00:00
|
|
|
return ioctl(fd, TCGETS, t);
|
2018-11-11 09:38:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int tcsetattr(int fd, int optional_actions, const struct termios* t)
|
|
|
|
{
|
2018-11-16 14:41:48 +00:00
|
|
|
switch (optional_actions) {
|
|
|
|
case TCSANOW:
|
|
|
|
return ioctl(fd, TCSETS, t);
|
|
|
|
case TCSADRAIN:
|
|
|
|
return ioctl(fd, TCSETSW, t);
|
|
|
|
case TCSAFLUSH:
|
|
|
|
return ioctl(fd, TCSETSF, t);
|
|
|
|
}
|
2018-11-16 15:10:59 +00:00
|
|
|
errno = EINVAL;
|
|
|
|
return -1;
|
2018-11-11 09:38:33 +00:00
|
|
|
}
|
|
|
|
|
2018-11-11 14:36:40 +00:00
|
|
|
int tcflow(int fd, int action)
|
|
|
|
{
|
2019-06-07 09:49:03 +00:00
|
|
|
(void)fd;
|
|
|
|
(void)action;
|
2019-04-23 19:52:02 +00:00
|
|
|
ASSERT_NOT_REACHED();
|
2018-11-11 14:36:40 +00:00
|
|
|
}
|
|
|
|
|
2019-02-26 11:57:02 +00:00
|
|
|
int tcflush(int fd, int queue_selector)
|
|
|
|
{
|
|
|
|
(void)fd;
|
|
|
|
(void)queue_selector;
|
2019-04-23 19:52:02 +00:00
|
|
|
ASSERT_NOT_REACHED();
|
2019-02-26 11:57:02 +00:00
|
|
|
}
|
|
|
|
|
2019-02-26 14:57:59 +00:00
|
|
|
speed_t cfgetispeed(const struct termios* tp)
|
2019-02-26 11:57:02 +00:00
|
|
|
{
|
2019-02-26 14:57:59 +00:00
|
|
|
return tp->c_ispeed;
|
|
|
|
}
|
|
|
|
|
|
|
|
speed_t cfgetospeed(const struct termios* tp)
|
|
|
|
{
|
|
|
|
return tp->c_ospeed;
|
2019-02-26 11:57:02 +00:00
|
|
|
}
|
2018-11-11 09:38:33 +00:00
|
|
|
}
|