aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-05-02 14:23:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-05-02 14:23:14 -0400
commitb66e1f11ebc429569a3784aaf64123633d9e3ed1 (patch)
treed49f96acc682aaf29416921428110da5fd78fea4 /arch/mips/kernel
parent1be1d6b7f3f6e3a87f872dd5e7a867d03d8a6851 (diff)
parent5c598b3428c372a1209597cee99a70da20625876 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: [PATCH] fix sysctl_nr_open bugs [PATCH] sanitize anon_inode_getfd() [PATCH] split linux/file.h [PATCH] make osf_select() use core_sys_select() [PATCH] remove horrors with irix tty ioctls handling [PATCH] fix file and descriptor handling in perfmon
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r--arch/mips/kernel/irixioctl.c55
-rw-r--r--arch/mips/kernel/kspd.c1
2 files changed, 10 insertions, 46 deletions
diff --git a/arch/mips/kernel/irixioctl.c b/arch/mips/kernel/irixioctl.c
index 2bde200d5ad0..b39bdba82e02 100644
--- a/arch/mips/kernel/irixioctl.c
+++ b/arch/mips/kernel/irixioctl.c
@@ -27,33 +27,6 @@ struct irix_termios {
27 cc_t c_cc[NCCS]; 27 cc_t c_cc[NCCS];
28}; 28};
29 29
30extern void start_tty(struct tty_struct *tty);
31static struct tty_struct *get_tty(int fd)
32{
33 struct file *filp;
34 struct tty_struct *ttyp = NULL;
35
36 rcu_read_lock();
37 filp = fcheck(fd);
38 if(filp && filp->private_data) {
39 ttyp = (struct tty_struct *) filp->private_data;
40
41 if(ttyp->magic != TTY_MAGIC)
42 ttyp =NULL;
43 }
44 rcu_read_unlock();
45 return ttyp;
46}
47
48static struct tty_struct *get_real_tty(struct tty_struct *tp)
49{
50 if (tp->driver->type == TTY_DRIVER_TYPE_PTY &&
51 tp->driver->subtype == PTY_TYPE_MASTER)
52 return tp->link;
53 else
54 return tp;
55}
56
57asmlinkage int irix_ioctl(int fd, unsigned long cmd, unsigned long arg) 30asmlinkage int irix_ioctl(int fd, unsigned long cmd, unsigned long arg)
58{ 31{
59 struct tty_struct *tp, *rtp; 32 struct tty_struct *tp, *rtp;
@@ -146,34 +119,24 @@ asmlinkage int irix_ioctl(int fd, unsigned long cmd, unsigned long arg)
146 error = sys_ioctl(fd, TIOCNOTTY, arg); 119 error = sys_ioctl(fd, TIOCNOTTY, arg);
147 break; 120 break;
148 121
149 case 0x00007416: 122 case 0x00007416: {
123 pid_t pid;
150#ifdef DEBUG_IOCTLS 124#ifdef DEBUG_IOCTLS
151 printk("TIOCGSID, %08lx) ", arg); 125 printk("TIOCGSID, %08lx) ", arg);
152#endif 126#endif
153 tp = get_tty(fd); 127 old_fs = get_fs(); set_fs(get_ds());
154 if(!tp) { 128 error = sys_ioctl(fd, TIOCGSID, (unsigned long)&pid);
155 error = -EINVAL; 129 set_fs(old_fs);
156 break; 130 if (!error)
157 } 131 error = put_user(pid, (unsigned long __user *) arg);
158 rtp = get_real_tty(tp);
159#ifdef DEBUG_IOCTLS
160 printk("rtp->session=%d ", rtp->session);
161#endif
162 error = put_user(rtp->session, (unsigned long __user *) arg);
163 break; 132 break;
164 133 }
165 case 0x746e: 134 case 0x746e:
166 /* TIOCSTART, same effect as hitting ^Q */ 135 /* TIOCSTART, same effect as hitting ^Q */
167#ifdef DEBUG_IOCTLS 136#ifdef DEBUG_IOCTLS
168 printk("TIOCSTART, %08lx) ", arg); 137 printk("TIOCSTART, %08lx) ", arg);
169#endif 138#endif
170 tp = get_tty(fd); 139 error = sys_ioctl(fd, TCXONC, TCOON);
171 if(!tp) {
172 error = -EINVAL;
173 break;
174 }
175 rtp = get_real_tty(tp);
176 start_tty(rtp);
177 break; 140 break;
178 141
179 case 0x20006968: 142 case 0x20006968:
diff --git a/arch/mips/kernel/kspd.c b/arch/mips/kernel/kspd.c
index 998c4efcce88..ceb62dce1c9c 100644
--- a/arch/mips/kernel/kspd.c
+++ b/arch/mips/kernel/kspd.c
@@ -20,6 +20,7 @@
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/unistd.h> 21#include <linux/unistd.h>
22#include <linux/file.h> 22#include <linux/file.h>
23#include <linux/fdtable.h>
23#include <linux/fs.h> 24#include <linux/fs.h>
24#include <linux/syscalls.h> 25#include <linux/syscalls.h>
25#include <linux/workqueue.h> 26#include <linux/workqueue.h>