ioctl.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:1k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * linux/arch/parisc/hpux/ioctl.c
  3.  *
  4.  * implements some necessary HPUX ioctls.
  5.  */
  6. /*
  7.  * Supported ioctls:
  8.  *   TCGETA
  9.  *   TCSETA
  10.  *   TCSETAW
  11.  *   TCSETAF
  12.  *   TCSBRK
  13.  *   TCXONC
  14.  *   TCFLSH
  15.  *   TIOCGWINSZ
  16.  *   TIOCSWINSZ
  17.  *   TIOCGPGRP
  18.  *   TIOCSPGRP
  19.  */
  20. #include <linux/sched.h>
  21. #include <linux/smp_lock.h>
  22. #include <asm/errno.h>
  23. #include <asm/ioctl.h>
  24. #include <asm/termios.h>
  25. #include <asm/uaccess.h>
  26. int sys_ioctl(unsigned int, unsigned int, unsigned long);
  27.  
  28. static int hpux_ioctl_t(int fd, unsigned long cmd, unsigned long arg)
  29. {
  30. int result = -EOPNOTSUPP;
  31. int nr = _IOC_NR(cmd);
  32. switch (nr) {
  33. case 106:
  34. result = sys_ioctl(fd, TIOCSWINSZ, arg);
  35. break;
  36. case 107:
  37. result = sys_ioctl(fd, TIOCGWINSZ, arg);
  38. break;
  39. }
  40. return result;
  41. }
  42. int hpux_ioctl(int fd, unsigned long cmd, unsigned long arg)
  43. {
  44. int result = -EOPNOTSUPP;
  45. int type = _IOC_TYPE(cmd);
  46. switch (type) {
  47. case 'T':
  48. /* Our structures are now compatible with HPUX's */
  49. result = sys_ioctl(fd, cmd, arg);
  50. break;
  51. case 't':
  52. result = hpux_ioctl_t(fd, cmd, arg);
  53. break;
  54. }
  55. return result;
  56. }