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/smp_lock.h>
  36. #include <linux/syscalls.h>
  37. #include <asm/errno.h>
  38. #include <asm/ioctl.h>
  39. #include <asm/termios.h>
  40. #include <asm/uaccess.h>
  41. static int hpux_ioctl_t(int fd, unsigned long cmd, unsigned long arg)
  42. {
  43. int result = -EOPNOTSUPP;
  44. int nr = _IOC_NR(cmd);
  45. switch (nr) {
  46. case 106:
  47. result = sys_ioctl(fd, TIOCSWINSZ, arg);
  48. break;
  49. case 107:
  50. result = sys_ioctl(fd, TIOCGWINSZ, arg);
  51. break;
  52. }
  53. return result;
  54. }
  55. int hpux_ioctl(int fd, unsigned long cmd, unsigned long arg)
  56. {
  57. int result = -EOPNOTSUPP;
  58. int type = _IOC_TYPE(cmd);
  59. switch (type) {
  60. case 'T':
  61. /* Our structures are now compatible with HPUX's */
  62. result = sys_ioctl(fd, cmd, arg);
  63. break;
  64. case 't':
  65. result = hpux_ioctl_t(fd, cmd, arg);
  66. break;
  67. }
  68. return result;
  69. }