1 /* $Id: ioctl32.c,v 1.3 1997/05/27 19:30:13 jj Exp $
2 * ioctl32.c: Conversion between 32bit and 64bit native ioctls.
4 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
6 * These routines maintain argument size conversion between 32bit and 64bit
10 #include <linux/kernel.h>
11 #include <linux/sched.h>
12 #include <linux/smp.h>
13 #include <linux/smp_lock.h>
14 #include <linux/ioctl.h>
16 #include <asm/types.h>
17 #include <asm/uaccess.h>
19 /* As gcc will warn about casting u32 to some ptr, we have to cast it to unsigned long first, and that's what is A() for.
20 * You just do (void *)A(x), instead of having to type (void *)((unsigned long)x) or instead of just (void *)x, which will
22 #define A(x) ((unsigned long)x)
24 extern asmlinkage
int sys_ioctl(unsigned int fd
, unsigned int cmd
, unsigned long arg
);
26 asmlinkage
int sys32_ioctl(unsigned int fd
, unsigned int cmd
, u32 arg
)
32 if (fd
>= NR_OPEN
|| !(filp
= current
->files
->fd
[fd
]))
34 if (!filp
->f_op
|| !filp
->f_op
->ioctl
) {
35 error
= sys_ioctl (fd
, cmd
, (unsigned long)arg
);
41 error
= sys_ioctl (fd
, cmd
, (unsigned long)arg
);
45 if (error
== -EINVAL
) {
46 printk ("sys32_ioctl on %016lx's %08x returns EINVAL\n", filp
->f_op
? (long)filp
->f_op
->ioctl
: 0UL, cmd
);