Module Name: src
Committed By: njoly
Date: Thu Jul 18 17:31:02 UTC 2013
Modified Files:
src/sys/compat/linux/common: linux_futex.c
Log Message:
Do not make FUTEX_WAIT wait indefinitely for an invalid timeout
(tv_nsec = -1).
To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/compat/linux/common/linux_futex.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/compat/linux/common/linux_futex.c
diff -u src/sys/compat/linux/common/linux_futex.c:1.30 src/sys/compat/linux/common/linux_futex.c:1.31
--- src/sys/compat/linux/common/linux_futex.c:1.30 Wed Apr 17 14:39:40 2013
+++ src/sys/compat/linux/common/linux_futex.c Thu Jul 18 17:31:02 2013
@@ -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 @@ linux_do_futex(struct lwp *l, const stru
/*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 @@ linux_do_futex(struct lwp *l, const stru
* 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;