Commit f93bb7d1 authored by Stephen Rothwell's avatar Stephen Rothwell Committed by David Mosberger

[PATCH] ia64: compat_sys_fcntl{,64}

Here is the ia64 part of the patch.  Pleas apply after Linus has applied
the generic part.
parent 04032d58
...@@ -253,7 +253,7 @@ ia32_syscall_table: ...@@ -253,7 +253,7 @@ ia32_syscall_table:
data8 sys_umount /* recycled never used phys( */ data8 sys_umount /* recycled never used phys( */
data8 sys32_ni_syscall /* old lock syscall holder */ data8 sys32_ni_syscall /* old lock syscall holder */
data8 sys32_ioctl data8 sys32_ioctl
data8 sys32_fcntl /* 55 */ data8 compat_sys_fcntl /* 55 */
data8 sys32_ni_syscall /* old mpx syscall holder */ data8 sys32_ni_syscall /* old mpx syscall holder */
data8 sys_setpgid data8 sys_setpgid
data8 sys32_ni_syscall /* old ulimit syscall holder */ data8 sys32_ni_syscall /* old ulimit syscall holder */
...@@ -419,7 +419,7 @@ ia32_syscall_table: ...@@ -419,7 +419,7 @@ ia32_syscall_table:
data8 sys_mincore data8 sys_mincore
data8 sys_madvise data8 sys_madvise
data8 sys_getdents64 /* 220 */ data8 sys_getdents64 /* 220 */
data8 sys32_fcntl64 data8 compat_sys_fcntl64
data8 sys_ni_syscall /* reserved for TUX */ data8 sys_ni_syscall /* reserved for TUX */
data8 sys_ni_syscall /* reserved for Security */ data8 sys_ni_syscall /* reserved for Security */
data8 sys_gettid data8 sys_gettid
......
...@@ -2267,38 +2267,6 @@ sys32_ptrace (int request, pid_t pid, unsigned int addr, unsigned int data, ...@@ -2267,38 +2267,6 @@ sys32_ptrace (int request, pid_t pid, unsigned int addr, unsigned int data,
return ret; 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 sys_ni_syscall(void);
asmlinkage long asmlinkage long
...@@ -2593,66 +2561,6 @@ sys32_setgroups16 (int gidsetsize, short *grouplist) ...@@ -2593,66 +2561,6 @@ sys32_setgroups16 (int gidsetsize, short *grouplist)
return ret; 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 asmlinkage long
sys32_truncate64 (unsigned int path, unsigned int len_lo, unsigned int len_hi) sys32_truncate64 (unsigned int path, unsigned int len_lo, unsigned int len_hi)
{ {
......
...@@ -68,6 +68,22 @@ struct compat_flock { ...@@ -68,6 +68,22 @@ struct compat_flock {
compat_pid_t l_pid; 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 { struct compat_statfs {
int f_type; int f_type;
int f_bsize; int f_bsize;
...@@ -88,4 +104,7 @@ typedef u32 compat_old_sigset_t; /* at least 32 bits */ ...@@ -88,4 +104,7 @@ typedef u32 compat_old_sigset_t; /* at least 32 bits */
typedef u32 compat_sigset_word; typedef u32 compat_sigset_word;
#define COMPAT_OFF_T_MAX 0x7fffffff
#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
#endif /* _ASM_IA64_COMPAT_H */ #endif /* _ASM_IA64_COMPAT_H */
...@@ -78,9 +78,6 @@ struct flock { ...@@ -78,9 +78,6 @@ struct flock {
pid_t l_pid; pid_t l_pid;
}; };
#ifdef __KERNEL__
# define flock64 flock
#endif
#define F_LINUX_SPECIFIC_BASE 1024 #define F_LINUX_SPECIFIC_BASE 1024
#endif /* _ASM_IA64_FCNTL_H */ #endif /* _ASM_IA64_FCNTL_H */
...@@ -18,10 +18,6 @@ ...@@ -18,10 +18,6 @@
#define IA32_PAGE_ALIGN(addr) (((addr) + IA32_PAGE_SIZE - 1) & IA32_PAGE_MASK) #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 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 */ /* sigcontext.h */
/* /*
* As documented in the iBCS2 standard.. * As documented in the iBCS2 standard..
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment