[COMPAT] compat_sys_fcntl{,64} 8/9 parisc part

[COMPAT] compat_sys_fcntl{,64} 8/9 parisc part

Post by Stephen Rothwel » Wed, 12 Mar 2003 03:10:07



Hi Linus,

Here is the parisc part of the patch with Willy's blessing.  Please apply.
--
Cheers,

http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.64-2003030918-32bit.1/arch/parisc/kernel/sys_parisc32.c 2.5.64-2003030918-32bit.2/arch/parisc/kernel/sys_parisc32.c
--- 2.5.64-2003030918-32bit.1/arch/parisc/kernel/sys_parisc32.c 2003-02-18 11:46:33.000000000 +1100

     return -ENOSYS;
 }

-extern asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg);
-
-asmlinkage long sys32_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-       switch (cmd) {
-       case F_GETLK:
-       case F_SETLK:
-       case F_SETLKW:
-               {
-                       struct flock f;
-                       long ret;
-                      
-                       if (get_compat_flock(&f, (struct compat_flock *)arg))
-                               return -EFAULT;
-                       KERNEL_SYSCALL(ret, sys_fcntl, fd, cmd, (unsigned long)&f);
-                       if (ret) return ret;
-                       if (f.l_start >= 0x7fffffffUL ||
-                           f.l_len >= 0x7fffffffUL ||
-                           f.l_start + f.l_len >= 0x7fffffffUL)
-                               return -EOVERFLOW;
-                       if (put_compat_flock(&f, (struct compat_flock *)arg))
-                               return -EFAULT;
-                       return 0;
-               }
-       default:
-               return sys_fcntl(fd, cmd, (unsigned long)arg);
-       }
-}
-
 #ifdef CONFIG_SYSCTL


        return err;
 }

-/* LFS */
-
-extern asmlinkage long sys_fcntl(unsigned int, unsigned int, unsigned long);
-
-asmlinkage long sys32_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-       switch (cmd) {
-               case F_GETLK64:
-                       cmd = F_GETLK;
-                       break;
-               case F_SETLK64:
-                       cmd = F_SETLK;
-                       break;
-               case F_SETLKW64:
-                       cmd = F_SETLKW;
-                       break;
-               default:
-                       break;
-       }
-       return sys32_fcntl(fd, cmd, arg);
-}
-
 /* EXPORT/UNEXPORT */
 struct nfsctl_export32 {
        char            ex_client[NFSCLNT_IDMAX+1];
diff -ruN 2.5.64-2003030918-32bit.1/arch/parisc/kernel/syscall.S 2.5.64-2003030918-32bit.2/arch/parisc/kernel/syscall.S
--- 2.5.64-2003030918-32bit.1/arch/parisc/kernel/syscall.S      2003-02-18 11:46:33.000000000 +1100

        ENTRY_SAME(getpeername)
        /* This one's a huge ugly mess */
        ENTRY_DIFF(ioctl)
-       /* struct flock? */
-       ENTRY_DIFF(fcntl)               /* 55 */
+       ENTRY_COMP(fcntl)               /* 55 */
        ENTRY_SAME(socketpair)
        ENTRY_SAME(setpgid)

        ENTRY_OURS(truncate64)
        ENTRY_OURS(ftruncate64)         /* 200 */
        ENTRY_SAME(getdents64)
-       ENTRY_DIFF(fcntl64)
+       ENTRY_COMP(fcntl64)
        ENTRY_SAME(ni_syscall)
        ENTRY_SAME(ni_syscall)
        ENTRY_SAME(ni_syscall)          /* 205 */
diff -ruN 2.5.64-2003030918-32bit.1/include/asm-parisc/compat.h 2.5.64-2003030918-32bit.2/include/asm-parisc/compat.h
--- 2.5.64-2003030918-32bit.1/include/asm-parisc/compat.h       2003-02-11 09:39:59.000000000 +1100

        compat_pid_t            l_pid;
 };

+struct compat_flock64 {
+       short                   l_type;
+       short                   l_whence;
+       compat_loff_t           l_start;
+       compat_loff_t           l_len;
+       compat_pid_t            l_pid;
+};
+
 struct compat_statfs {
        s32             f_type;

 typedef u32            compat_sigset_word;

+#define COMPAT_OFF_T_MAX       0x7fffffff
+#define COMPAT_LOFF_T_MAX      0x7fffffffffffffffL
+
 #endif /* _ASM_PARISC_COMPAT_H */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/