]> git.hungrycats.org Git - linux/commitdiff
[PATCH] ia64: compat_sys_fcntl{,64}
authorStephen Rothwell <sfr@canb.auug.org.au>
Tue, 8 Apr 2003 07:27:04 +0000 (00:27 -0700)
committerDavid Mosberger <davidm@tiger.hpl.hp.com>
Tue, 8 Apr 2003 07:27:04 +0000 (00:27 -0700)
Here is the ia64 part of the patch.  Pleas apply after Linus has applied
the generic part.

arch/ia64/ia32/ia32_entry.S
arch/ia64/ia32/sys_ia32.c
include/asm-ia64/compat.h
include/asm-ia64/fcntl.h
include/asm-ia64/ia32.h

index 7936458a553af2e30c15448fdfd63ef58ea1402f..a737824c7d5e000be508b3104e34c6da7599f0f5 100644 (file)
@@ -253,7 +253,7 @@ ia32_syscall_table:
        data8 sys_umount          /* recycled never used phys( */
        data8 sys32_ni_syscall    /* old lock syscall holder */
        data8 sys32_ioctl
-       data8 sys32_fcntl         /* 55 */
+       data8 compat_sys_fcntl    /* 55 */
        data8 sys32_ni_syscall    /* old mpx syscall holder */
        data8 sys_setpgid
        data8 sys32_ni_syscall    /* old ulimit syscall holder */
@@ -419,7 +419,7 @@ ia32_syscall_table:
        data8 sys_mincore
        data8 sys_madvise
        data8 sys_getdents64      /* 220 */
-       data8 sys32_fcntl64
+       data8 compat_sys_fcntl64
        data8 sys_ni_syscall            /* reserved for TUX */
        data8 sys_ni_syscall            /* reserved for Security */
        data8 sys_gettid
index cf9b0ea5ed9453591874b500f427c2f686958d44..61e5b05e2079db98d802f6c9e7a7b3c1c7df5463 100644 (file)
@@ -2267,38 +2267,6 @@ sys32_ptrace (int request, pid_t pid, unsigned int addr, unsigned int data,
        return ret;
 }
 
-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 int arg)
-{
-       mm_segment_t old_fs;
-       struct flock f;
-       long ret;
-
-       switch (cmd) {
-             case F_GETLK:
-             case F_SETLK:
-             case F_SETLKW:
-               if (get_compat_flock(&f, (struct compat_flock *) A(arg)))
-                       return -EFAULT;
-               old_fs = get_fs();
-               set_fs(KERNEL_DS);
-               ret = sys_fcntl(fd, cmd, (unsigned long) &f);
-               set_fs(old_fs);
-               if (cmd == F_GETLK && put_compat_flock(&f, (struct compat_flock *) A(arg)))
-                       return -EFAULT;
-               return ret;
-
-             default:
-               /*
-                *  `sys_fcntl' lies about arg, for the F_SETOWN
-                *  sub-function arg can have a negative value.
-                */
-               return sys_fcntl(fd, cmd, arg);
-       }
-}
-
 asmlinkage long sys_ni_syscall(void);
 
 asmlinkage long
@@ -2593,66 +2561,6 @@ sys32_setgroups16 (int gidsetsize, short *grouplist)
        return ret;
 }
 
-/*
- * Unfortunately, the x86 compiler aligns variables of type "long long" to a 4 byte boundary
- * only, which means that the x86 version of "struct flock64" doesn't match the ia64 version
- * of struct flock.
- */
-
-static inline long
-ia32_put_flock (struct flock *l, unsigned long addr)
-{
-       return (put_user(l->l_type, (short *) addr)
-               | put_user(l->l_whence, (short *) (addr + 2))
-               | put_user(l->l_start, (long *) (addr + 4))
-               | put_user(l->l_len, (long *) (addr + 12))
-               | put_user(l->l_pid, (int *) (addr + 20)));
-}
-
-static inline long
-ia32_get_flock (struct flock *l, unsigned long addr)
-{
-       unsigned int start_lo, start_hi, len_lo, len_hi;
-       int err = (get_user(l->l_type, (short *) addr)
-                  | get_user(l->l_whence, (short *) (addr + 2))
-                  | get_user(start_lo, (int *) (addr + 4))
-                  | get_user(start_hi, (int *) (addr + 8))
-                  | get_user(len_lo, (int *) (addr + 12))
-                  | get_user(len_hi, (int *) (addr + 16))
-                  | get_user(l->l_pid, (int *) (addr + 20)));
-       l->l_start = ((unsigned long) start_hi << 32) | start_lo;
-       l->l_len = ((unsigned long) len_hi << 32) | len_lo;
-       return err;
-}
-
-asmlinkage long
-sys32_fcntl64 (unsigned int fd, unsigned int cmd, unsigned int arg)
-{
-       mm_segment_t old_fs;
-       struct flock f;
-       long ret;
-
-       switch (cmd) {
-             case F_GETLK64:
-             case F_SETLK64:
-             case F_SETLKW64:
-               if (ia32_get_flock(&f, arg))
-                       return -EFAULT;
-               old_fs = get_fs();
-               set_fs(KERNEL_DS);
-               ret = sys_fcntl(fd, cmd, (unsigned long) &f);
-               set_fs(old_fs);
-               if (cmd == F_GETLK && ia32_put_flock(&f, arg))
-                       return -EFAULT;
-               break;
-
-             default:
-               ret = sys32_fcntl(fd, cmd, arg);
-               break;
-       }
-       return ret;
-}
-
 asmlinkage long
 sys32_truncate64 (unsigned int path, unsigned int len_lo, unsigned int len_hi)
 {
index 4dbbbf499800b7287c91e28a3718079cf727d6c2..678c481a449c67c5ca6e7c6a77d1a98606fa6119 100644 (file)
@@ -68,6 +68,22 @@ struct compat_flock {
        compat_pid_t    l_pid;
 };
 
+#define F_GETLK64      12
+#define F_SETLK64      13
+#define F_SETLKW64     14
+
+/*
+ * IA32 uses 4 byte alignment for 64 bit quantities,
+ * so we need to pack this structure.
+ */
+struct compat_flock64 {
+       short           l_type;
+       short           l_whence;
+       compat_loff_t   l_start;
+       compat_loff_t   l_len;
+       compat_pid_t    l_pid;
+} __attribute__((packed));
+
 struct compat_statfs {
        int             f_type;
        int             f_bsize;
@@ -88,4 +104,7 @@ typedef u32          compat_old_sigset_t;    /* at least 32 bits */
 
 typedef u32            compat_sigset_word;
 
+#define COMPAT_OFF_T_MAX       0x7fffffff
+#define COMPAT_LOFF_T_MAX      0x7fffffffffffffffL
+
 #endif /* _ASM_IA64_COMPAT_H */
index eeb42f793e6194b95463d1e2c9d2ad9d2d0623dc..fdb98be5134ccf93ff182c5c4aac0c193cb226cf 100644 (file)
@@ -78,9 +78,6 @@ struct flock {
        pid_t l_pid;
 };
 
-#ifdef __KERNEL__
-# define flock64       flock
-#endif
-
 #define F_LINUX_SPECIFIC_BASE  1024
+
 #endif /* _ASM_IA64_FCNTL_H */
index 42841cd400032e8a2bb6e3237b704e7edae878ce..298dfc4936691bce12b7d3d6ec057e165d7da204 100644 (file)
 #define IA32_PAGE_ALIGN(addr)  (((addr) + IA32_PAGE_SIZE - 1) & IA32_PAGE_MASK)
 #define IA32_CLOCKS_PER_SEC    100     /* Cast in stone for IA32 Linux */
 
-#define F_GETLK64      12
-#define F_SETLK64      13
-#define F_SETLKW64     14
-
 /* sigcontext.h */
 /*
  * As documented in the iBCS2 standard..