Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/linux/common Do not make FUTEX_WAIT wait indefini...



details:   https://anonhg.NetBSD.org/src/rev/2b57ef9bdf1a
branches:  trunk
changeset: 788715:2b57ef9bdf1a
user:      njoly <njoly%NetBSD.org@localhost>
date:      Thu Jul 18 17:31:02 2013 +0000

description:
Do not make FUTEX_WAIT wait indefinitely for an invalid timeout
(tv_nsec = -1).

diffstat:

 sys/compat/linux/common/linux_futex.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r 63bbd0af9997 -r 2b57ef9bdf1a sys/compat/linux/common/linux_futex.c
--- a/sys/compat/linux/common/linux_futex.c     Thu Jul 18 17:02:58 2013 +0000
+++ b/sys/compat/linux/common/linux_futex.c     Thu Jul 18 17:31:02 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_futex.c,v 1.30 2013/04/17 14:39:40 christos Exp $ */
+/*     $NetBSD: linux_futex.c,v 1.31 2013/07/18 17:31:02 njoly Exp $ */
 
 /*-
  * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: linux_futex.c,v 1.30 2013/04/17 14:39:40 christos Exp $");
+__KERNEL_RCSID(1, "$NetBSD: linux_futex.c,v 1.31 2013/07/18 17:31:02 njoly Exp $");
 
 #include <sys/param.h>
 #include <sys/time.h>
@@ -195,6 +195,8 @@
                /*FALLTHROUGH*/
        case LINUX_FUTEX_WAIT_BITSET:
                if ((error = ts2timo(clk, 0, ts, &tout, NULL)) != 0) {
+                       if (error != ETIMEDOUT)
+                               return error;
                        /*
                         * If the user process requests a non null timeout,
                         * make sure we do not turn it into an infinite
@@ -203,7 +205,7 @@
                         * We use a minimal timeout of 1/hz. Maybe it would make
                         * sense to just return ETIMEDOUT without sleeping.
                         */
-                       if (error == ETIMEDOUT && SCARG(uap, timeout) != NULL)
+                       if (SCARG(uap, timeout) != NULL)
                                tout = 1;
                        else
                                tout = 0;



Home | Main Index | Thread Index | Old Index