termios.cpp 786 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #include <assert.h>
  2. #include <errno.h>
  3. #include <termios.h>
  4. #include <sys/ioctl.h>
  5. #include <Kernel/Syscall.h>
  6. extern "C" {
  7. int tcgetattr(int fd, struct termios* t)
  8. {
  9. return ioctl(fd, TCGETS, t);
  10. }
  11. int tcsetattr(int fd, int optional_actions, const struct termios* t)
  12. {
  13. switch (optional_actions) {
  14. case TCSANOW:
  15. return ioctl(fd, TCSETS, t);
  16. case TCSADRAIN:
  17. return ioctl(fd, TCSETSW, t);
  18. case TCSAFLUSH:
  19. return ioctl(fd, TCSETSF, t);
  20. }
  21. errno = EINVAL;
  22. return -1;
  23. }
  24. int tcflow(int fd, int action)
  25. {
  26. (void) fd;
  27. (void) action;
  28. assert(false);
  29. }
  30. int tcflush(int fd, int queue_selector)
  31. {
  32. (void)fd;
  33. (void)queue_selector;
  34. assert(false);
  35. }
  36. speed_t cfgetospeed(const struct termios*)
  37. {
  38. assert(false);
  39. }
  40. }