Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | /* |
| 22 | * Supported ioctls: |
| 23 | * TCGETA |
| 24 | * TCSETA |
| 25 | * TCSETAW |
| 26 | * TCSETAF |
| 27 | * TCSBRK |
| 28 | * TCXONC |
| 29 | * TCFLSH |
| 30 | * TIOCGWINSZ |
| 31 | * TIOCSWINSZ |
| 32 | * TIOCGPGRP |
| 33 | * TIOCSPGRP |
| 34 | */ |
| 35 | |
| 36 | #include <linux/sched.h> |
| 37 | #include <linux/smp_lock.h> |
| 38 | #include <linux/syscalls.h> |
| 39 | #include <asm/errno.h> |
| 40 | #include <asm/ioctl.h> |
| 41 | #include <asm/termios.h> |
| 42 | #include <asm/uaccess.h> |
| 43 | |
| 44 | static int hpux_ioctl_t(int fd, unsigned long cmd, unsigned long arg) |
| 45 | { |
| 46 | int result = -EOPNOTSUPP; |
| 47 | int nr = _IOC_NR(cmd); |
| 48 | switch (nr) { |
| 49 | case 106: |
| 50 | result = sys_ioctl(fd, TIOCSWINSZ, arg); |
| 51 | break; |
| 52 | case 107: |
| 53 | result = sys_ioctl(fd, TIOCGWINSZ, arg); |
| 54 | break; |
| 55 | } |
| 56 | return result; |
| 57 | } |
| 58 | |
| 59 | int hpux_ioctl(int fd, unsigned long cmd, unsigned long arg) |
| 60 | { |
| 61 | int result = -EOPNOTSUPP; |
| 62 | int type = _IOC_TYPE(cmd); |
| 63 | switch (type) { |
| 64 | case 'T': |
| 65 | /* Our structures are now compatible with HPUX's */ |
| 66 | result = sys_ioctl(fd, cmd, arg); |
| 67 | break; |
| 68 | case 't': |
| 69 | result = hpux_ioctl_t(fd, cmd, arg); |
| 70 | break; |
| 71 | } |
| 72 | return result; |
| 73 | } |