summaryrefslogtreecommitdiff
path: root/kernel/futex.c
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2003-02-14 20:38:11 -0800
committerJens Axboe <axboe@suse.de>2003-02-14 20:38:11 -0800
commit424706ad4e048c933773cfabf0244cb80bbc8e64 (patch)
treeb4069ad4daf4578349912d7bcf1ab3a31f813465 /kernel/futex.c
parentfcc21ee29a39fd47d119e12997d2b09d97083e28 (diff)
[PATCH] compat_sys_futex 1/3 generic, parisc, ppc64, s390x and x86_64
This is the generic part of the patch and the architecture specific parts I have been asked to forward directly to you.
Diffstat (limited to 'kernel/futex.c')
-rw-r--r--kernel/futex.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/kernel/futex.c b/kernel/futex.c
index 16775292bdc4..9813932a6a0a 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -315,23 +315,6 @@ out:
return ret;
}
-static inline int futex_wait_utime(unsigned long uaddr,
- int offset,
- int val,
- struct timespec* utime)
-{
- unsigned long time = MAX_SCHEDULE_TIMEOUT;
-
- if (utime) {
- struct timespec t;
- if (copy_from_user(&t, utime, sizeof(t)) != 0)
- return -EFAULT;
- time = timespec_to_jiffies(&t) + 1;
- }
-
- return futex_wait(uaddr, offset, val, time);
-}
-
static int futex_close(struct inode *inode, struct file *filp)
{
struct futex_q *q = filp->private_data;
@@ -437,7 +420,7 @@ out:
return ret;
}
-asmlinkage int sys_futex(unsigned long uaddr, int op, int val, struct timespec *utime)
+long do_futex(unsigned long uaddr, int op, int val, unsinged long timeout)
{
unsigned long pos_in_page;
int ret;
@@ -445,12 +428,12 @@ asmlinkage int sys_futex(unsigned long uaddr, int op, int val, struct timespec *
pos_in_page = uaddr % PAGE_SIZE;
/* Must be "naturally" aligned */
- if (pos_in_page % sizeof(int))
+ if (pos_in_page % sizeof(u32))
return -EINVAL;
switch (op) {
case FUTEX_WAIT:
- ret = futex_wait_utime(uaddr, pos_in_page, val, utime);
+ ret = futex_wait(uaddr, pos_in_page, val, timeout);
break;
case FUTEX_WAKE:
ret = futex_wake(uaddr, pos_in_page, val);
@@ -465,6 +448,20 @@ asmlinkage int sys_futex(unsigned long uaddr, int op, int val, struct timespec *
return ret;
}
+asmlinkage long sys_futex(u32 *uaddr, int op, int val, struct timespec *utime)
+{
+ struct timespec t;
+ unsigned long timeout = MAX_SCHEDULE_TIMEOUT;
+
+
+ if ((op == FUTEX_WAIT) && utime) {
+ if (copy_from_user(&t, utime, sizeof(t)) != 0)
+ return -EFAULT;
+ timeout = timespec_to_jiffies(t) + 1;
+ }
+ return do_futex((unsigned long)uaddr, op, val, timeout);
+}
+
static struct super_block *
futexfs_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)