@@ -493,3 +493,4 @@
561 common cachestat sys_cachestat
562 common futex_wake sys_futex_wake
563 common futex_wait sys_futex_wait
+564 common futex_requeue sys_futex_requeue
@@ -467,3 +467,4 @@
451 common cachestat sys_cachestat
452 common futex_wake sys_futex_wake
453 common futex_wait sys_futex_wait
+454 common futex_requeue sys_futex_requeue
@@ -39,7 +39,7 @@
#define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE + 5)
#define __ARM_NR_COMPAT_END (__ARM_NR_COMPAT_BASE + 0x800)
-#define __NR_compat_syscalls 454
+#define __NR_compat_syscalls 455
#endif
#define __ARCH_WANT_SYS_CLONE
@@ -913,6 +913,8 @@ __SYSCALL(__NR_cachestat, sys_cachestat)
__SYSCALL(__NR_futex_wake, sys_futex_wake)
#define __NR_futex_wait 453
__SYSCALL(__NR_futex_wait, sys_futex_wait)
+#define __NR_futex_requeue 454
+__SYSCALL(__NR_futex_requeue, sys_futex_requeue)
/*
* Please add new compat syscalls above this comment and update
@@ -374,3 +374,4 @@
451 common cachestat sys_cachestat
452 common futex_wake sys_futex_wake
453 common futex_wait sys_futex_wait
+454 common futex_requeue sys_futex_requeue
@@ -453,3 +453,4 @@
451 common cachestat sys_cachestat
452 common futex_wake sys_futex_wake
453 common futex_wait sys_futex_wait
+454 common futex_requeue sys_futex_requeue
@@ -459,3 +459,4 @@
451 common cachestat sys_cachestat
452 common futex_wake sys_futex_wake
453 common futex_wait sys_futex_wait
+454 common futex_requeue sys_futex_requeue
@@ -392,3 +392,4 @@
451 n32 cachestat sys_cachestat
452 n32 futex_wake sys_futex_wake
453 n32 futex_wait sys_futex_wait
+454 n32 futex_requeue sys_futex_requeue
@@ -368,3 +368,4 @@
451 n64 cachestat sys_cachestat
452 n64 futex_wake sys_futex_wake
453 n64 futex_wait sys_futex_wait
+454 n64 futex_requeue sys_futex_requeue
@@ -441,3 +441,4 @@
451 o32 cachestat sys_cachestat
452 o32 futex_wake sys_futex_wake
453 o32 futex_wait sys_futex_wait
+454 o32 futex_requeue sys_futex_requeue
@@ -452,3 +452,4 @@
451 common cachestat sys_cachestat
452 common futex_wake sys_futex_wake
453 common futex_wait sys_futex_wait
+454 common futex_requeue sys_futex_requeue
@@ -540,3 +540,4 @@
451 common cachestat sys_cachestat
452 common futex_wake sys_futex_wake
453 common futex_wait sys_futex_wait
+454 common futex_requeue sys_futex_requeue
@@ -456,3 +456,4 @@
451 common cachestat sys_cachestat sys_cachestat
452 common futex_wake sys_futex_wake sys_futex_wake
453 common futex_wait sys_futex_wait sys_futex_wait
+454 common futex_requeue sys_futex_requeue sys_futex_requeue
@@ -456,3 +456,4 @@
451 common cachestat sys_cachestat
452 common futex_wake sys_futex_wake
453 common futex_wait sys_futex_wait
+454 common futex_requeue sys_futex_requeue
@@ -499,3 +499,4 @@
451 common cachestat sys_cachestat
452 common futex_wake sys_futex_wake
453 common futex_wait sys_futex_wait
+454 common futex_requeue sys_futex_requeue
@@ -458,3 +458,4 @@
451 i386 cachestat sys_cachestat
452 i386 futex_wake sys_futex_wake
453 i386 futex_wait sys_futex_wait
+454 i386 futex_requeue sys_futex_requeue
@@ -375,6 +375,7 @@
451 common cachestat sys_cachestat
452 common futex_wake sys_futex_wake
453 common futex_wait sys_futex_wait
+454 common futex_requeue sys_futex_requeue
#
# Due to a historical design error, certain syscalls are numbered differently
@@ -424,3 +424,4 @@
451 common cachestat sys_cachestat
452 common futex_wake sys_futex_wake
453 common futex_wait sys_futex_wait
+454 common futex_requeue sys_futex_requeue
@@ -570,6 +570,9 @@ asmlinkage long sys_futex_wait(void __us
unsigned int flags, struct __kernel_timespec __user *timespec,
clockid_t clockid);
+asmlinkage long sys_futex_requeue(struct futex_waitv __user *waiters,
+ unsigned int flags, int nr_wake, int nr_requeue);
+
asmlinkage long sys_nanosleep(struct __kernel_timespec __user *rqtp,
struct __kernel_timespec __user *rmtp);
asmlinkage long sys_nanosleep_time32(struct old_timespec32 __user *rqtp,
@@ -822,9 +822,11 @@ __SYSCALL(__NR_cachestat, sys_cachestat)
__SYSCALL(__NR_futex_wake, sys_futex_wake)
#define __NR_futex_wait 453
__SYSCALL(__NR_futex_wait, sys_futex_wait)
+#define __NR_futex_requeue 454
+__SYSCALL(__NR_futex_requeue, sys_futex_requeue)
#undef __NR_syscalls
-#define __NR_syscalls 454
+#define __NR_syscalls 455
/*
* 32 bit systems traditionally used different
@@ -396,6 +396,44 @@ SYSCALL_DEFINE6(futex_wait,
return ret;
}
+/*
+ * sys_futex_requeue - Requeue a waiter from one futex to another
+ * @waiters: array describing the source and destination futex
+ * @flags: unused
+ * @nr_wake: number of futexes to wake
+ * @nr_requeue: number of futexes to requeue
+ *
+ * Identical to the traditional FUTEX_CMP_REQUEUE op, except it is part of the
+ * futex2 family of calls.
+ */
+
+SYSCALL_DEFINE4(futex_requeue,
+ struct futex_waitv __user *, waiters,
+ unsigned int, flags,
+ int, nr_wake,
+ int, nr_requeue)
+{
+ struct futex_vector futexes[2];
+ u32 cmpval;
+ int ret;
+
+ if (flags)
+ return -EINVAL;
+
+ if (!waiters)
+ return -EINVAL;
+
+ ret = futex_parse_waitv(futexes, waiters, 2);
+ if (ret)
+ return ret;
+
+ cmpval = futexes[0].w.val;
+
+ return futex_requeue(u64_to_user_ptr(futexes[0].w.uaddr), futexes[0].w.flags,
+ u64_to_user_ptr(futexes[1].w.uaddr), futexes[1].w.flags,
+ nr_wake, nr_requeue, &cmpval, 0);
+}
+
#ifdef CONFIG_COMPAT
COMPAT_SYSCALL_DEFINE2(set_robust_list,
struct compat_robust_list_head __user *, head,
@@ -89,6 +89,7 @@ COND_SYSCALL_COMPAT(get_robust_list);
COND_SYSCALL(futex_waitv);
COND_SYSCALL(futex_wake);
COND_SYSCALL(futex_wait);
+COND_SYSCALL(futex_requeue);
COND_SYSCALL(kexec_load);
COND_SYSCALL_COMPAT(kexec_load);
COND_SYSCALL(init_module);