2 * irixioctl.c: A fucking mess...
4 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
7 #include <linux/kernel.h>
8 #include <linux/sched.h>
11 #include <linux/smp.h>
12 #include <linux/sockios.h>
13 #include <linux/syscalls.h>
14 #include <linux/tty.h>
15 #include <linux/file.h>
16 #include <linux/rcupdate.h>
18 #include <asm/uaccess.h>
19 #include <asm/ioctl.h>
20 #include <asm/ioctls.h>
23 #undef DEBUG_MISSING_IOCTL
26 tcflag_t c_iflag
, c_oflag
, c_cflag
, c_lflag
;
30 asmlinkage
int irix_ioctl(int fd
, unsigned long cmd
, unsigned long arg
)
32 struct tty_struct
*tp
, *rtp
;
37 printk("[%s:%d] irix_ioctl(%d, ", current
->comm
, current
->pid
, fd
);
42 printk("TCGETA, %08lx) ", arg
);
44 error
= sys_ioctl(fd
, TCGETA
, arg
);
49 struct irix_termios __user
*it
=
50 (struct irix_termios __user
*) arg
;
53 printk("TCGETS, %08lx) ", arg
);
55 if (!access_ok(VERIFY_WRITE
, it
, sizeof(*it
))) {
59 old_fs
= get_fs(); set_fs(get_ds());
60 error
= sys_ioctl(fd
, TCGETS
, (unsigned long) &kt
);
65 error
= __put_user(kt
.c_iflag
, &it
->c_iflag
);
66 error
|= __put_user(kt
.c_oflag
, &it
->c_oflag
);
67 error
|= __put_user(kt
.c_cflag
, &it
->c_cflag
);
68 error
|= __put_user(kt
.c_lflag
, &it
->c_lflag
);
70 for (i
= 0; i
< NCCS
; i
++)
71 error
|= __put_user(kt
.c_cc
[i
], &it
->c_cc
[i
]);
77 struct irix_termios
*it
= (struct irix_termios
*) arg
;
80 printk("TCSETS, %08lx) ", arg
);
82 if (!access_ok(VERIFY_READ
, it
, sizeof(*it
))) {
86 old_fs
= get_fs(); set_fs(get_ds());
87 error
= sys_ioctl(fd
, TCGETS
, (unsigned long) &kt
);
92 error
= __get_user(kt
.c_iflag
, &it
->c_iflag
);
93 error
|= __get_user(kt
.c_oflag
, &it
->c_oflag
);
94 error
|= __get_user(kt
.c_cflag
, &it
->c_cflag
);
95 error
|= __get_user(kt
.c_lflag
, &it
->c_lflag
);
97 for (i
= 0; i
< NCCS
; i
++)
98 error
|= __get_user(kt
.c_cc
[i
], &it
->c_cc
[i
]);
102 old_fs
= get_fs(); set_fs(get_ds());
103 error
= sys_ioctl(fd
, TCSETS
, (unsigned long) &kt
);
110 printk("TCSETSW, %08lx) ", arg
);
112 error
= sys_ioctl(fd
, TCSETSW
, arg
);
117 printk("TIOCNOTTY, %08lx) ", arg
);
119 error
= sys_ioctl(fd
, TIOCNOTTY
, arg
);
125 printk("TIOCGSID, %08lx) ", arg
);
127 old_fs
= get_fs(); set_fs(get_ds());
128 error
= sys_ioctl(fd
, TIOCGSID
, (unsigned long)&pid
);
131 error
= put_user(pid
, (unsigned long __user
*) arg
);
135 /* TIOCSTART, same effect as hitting ^Q */
137 printk("TIOCSTART, %08lx) ", arg
);
139 error
= sys_ioctl(fd
, TCXONC
, TCOON
);
144 printk("SIOCGETLABEL, %08lx) ", arg
);
151 printk("TIOCGPGRP, %08lx) ", arg
);
153 error
= sys_ioctl(fd
, TIOCGPGRP
, arg
);
155 printk("arg=%d ", *(int *)arg
);
161 printk("TIOCGWINSZ, %08lx) ", arg
);
163 error
= sys_ioctl(fd
, TIOCGWINSZ
, arg
);
167 error
= sys_ioctl(fd
, FIONBIO
, arg
);
171 error
= sys_ioctl(fd
, TIOCSPGRP
, arg
);
175 error
= sys_ioctl(fd
, SIOCSIFADDR
, arg
);
179 error
= sys_ioctl(fd
, SIOCSIFFLAGS
, arg
);
183 error
= sys_ioctl(fd
, SIOCGIFFLAGS
, arg
);
187 error
= sys_ioctl(fd
, SIOCGIFMETRIC
, arg
);
191 #ifdef DEBUG_MISSING_IOCTL
192 char *msg
= "Unimplemented IOCTL cmd tell linux-mips@linux-mips.org\n";
195 printk("UNIMP_IOCTL, %08lx)\n", arg
);
197 old_fs
= get_fs(); set_fs(get_ds());
198 sys_write(2, msg
, strlen(msg
));
200 printk("[%s:%d] Does unimplemented IRIX ioctl cmd %08lx\n",
201 current
->comm
, current
->pid
, cmd
);
204 error
= sys_ioctl(fd
, cmd
, arg
);
210 printk("error=%d\n", error
);