summaryrefslogtreecommitdiffstats
path: root/sys/i386/linux
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>1999-08-14 13:26:44 +0000
committermarcel <marcel@FreeBSD.org>1999-08-14 13:26:44 +0000
commit9e447c4d1afaa9b661201e2fd64d7dbc1f7590d8 (patch)
treeee07eb0c28ca5e5fdac6d5d0c1852afd12c13912 /sys/i386/linux
parent723d911b2c192462b433e52a068cb6a82963ed37 (diff)
downloadFreeBSD-src-9e447c4d1afaa9b661201e2fd64d7dbc1f7590d8.zip
FreeBSD-src-9e447c4d1afaa9b661201e2fd64d7dbc1f7590d8.tar.gz
Fix LINUX_TIOC{S|G}SERIAL implementation. Both do not copy data in or out
of kernel space. Remove the ioctl supporting functions, and move the actual code to the switch-statement. Now everybody can clearly see that the implementation is really poor. Also fix a typo in LINUX_TIOCGETD. The underlying function was given command TIOCSETD instead op TIOCGETD...
Diffstat (limited to 'sys/i386/linux')
-rw-r--r--sys/i386/linux/linux_ioctl.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/sys/i386/linux/linux_ioctl.c b/sys/i386/linux/linux_ioctl.c
index ea9cb6f..b65b2fa 100644
--- a/sys/i386/linux/linux_ioctl.c
+++ b/sys/i386/linux/linux_ioctl.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: linux_ioctl.c,v 1.38 1999/08/14 10:05:50 marcel Exp $
+ * $Id: linux_ioctl.c,v 1.39 1999/08/14 10:30:38 marcel Exp $
*/
#include <sys/param.h>
@@ -436,24 +436,6 @@ linux_to_bsd_termio(struct linux_termio *linux_termio,
linux_to_bsd_termios(&tmios, bsd_termios);
}
-static void
-linux_tiocgserial(struct file *fp, struct linux_serial_struct *lss)
-{
- if (!fp || !lss)
- return;
-
- lss->type = LINUX_PORT_16550A;
- lss->flags = 0;
- lss->close_delay = 0;
-}
-
-static void
-linux_tiocsserial(struct file *fp, struct linux_serial_struct *lss)
-{
- if (!fp || !lss)
- return;
-}
-
struct linux_cdrom_msf
{
u_char cdmsf_min0;
@@ -803,7 +785,7 @@ linux_ioctl(struct proc *p, struct linux_ioctl_args *args)
case LINUX_TIOCGETD:
bsd_line = TTYDISC;
- error =(*func)(fp, TIOCSETD, (caddr_t)&bsd_line, p);
+ error =(*func)(fp, TIOCGETD, (caddr_t)&bsd_line, p);
if (error)
return error;
switch (bsd_line) {
@@ -1031,13 +1013,27 @@ linux_ioctl(struct proc *p, struct linux_ioctl_args *args)
args->cmd = SOUND_MIXER_READ_DEVMASK;
return ioctl(p, (struct ioctl_args *)args);
- case LINUX_TIOCGSERIAL:
- linux_tiocgserial(fp, (struct linux_serial_struct *)args->arg);
- return 0;
+ case LINUX_TIOCGSERIAL: {
+ struct linux_serial_struct lss;
+
+ lss.type = LINUX_PORT_16550A;
+ lss.flags = 0;
+ lss.close_delay = 0;
+ return copyout((caddr_t)&lss, (caddr_t)args->arg, sizeof(lss));
+ }
+
+ case LINUX_TIOCSSERIAL: {
+ struct linux_serial_struct lss;
- case LINUX_TIOCSSERIAL:
- linux_tiocsserial(fp, (struct linux_serial_struct *)args->arg);
+ error = copyin((caddr_t)args->arg, (caddr_t)&lss, sizeof(lss));
+ if (error)
+ return error;
+ /*
+ * XXX - It really helps to have an implementation that does nothing.
+ * NOT!
+ */
return 0;
+ }
case LINUX_TCXONC:
switch (args->arg) {
OpenPOWER on IntegriCloud