ioctl.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Implements some necessary HPUX ioctls.
  3. *
  4. * Copyright (C) 1999-2002 Matthew Wilcox <willy with parisc-linux.org>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. /*
  21. * Supported ioctls:
  22. * TCGETA
  23. * TCSETA
  24. * TCSETAW
  25. * TCSETAF
  26. * TCSBRK
  27. * TCXONC
  28. * TCFLSH
  29. * TIOCGWINSZ
  30. * TIOCSWINSZ
  31. * TIOCGPGRP
  32. * TIOCSPGRP
  33. */
  34. #include <linux/sched.h>
  35. #include <linux/syscalls.h>
  36. #include <asm/errno.h>
  37. #include <asm/ioctl.h>
  38. #include <asm/termios.h>
  39. #include <asm/uaccess.h>
  40. static int hpux_ioctl_t(int fd, unsigned long cmd, unsigned long arg)
  41. {
  42. int result = -EOPNOTSUPP;
  43. int nr = _IOC_NR(cmd);
  44. switch (nr) {
  45. case 106:
  46. result = sys_ioctl(fd, TIOCSWINSZ, arg);
  47. break;
  48. case 107:
  49. result = sys_ioctl(fd, TIOCGWINSZ, arg);
  50. break;
  51. }
  52. return result;
  53. }
  54. int hpux_ioctl(int fd, unsigned long cmd, unsigned long arg)
  55. {
  56. int result = -EOPNOTSUPP;
  57. int type = _IOC_TYPE(cmd);
  58. switch (type) {
  59. case 'T':
  60. /* Our structures are now compatible with HPUX's */
  61. result = sys_ioctl(fd, cmd, arg);
  62. break;
  63. case 't':
  64. result = hpux_ioctl_t(fd, cmd, arg);
  65. break;
  66. }
  67. return result;
  68. }