Module Name:    src
Committed By:   rmind
Date:           Fri Apr 23 19:29:23 UTC 2010

Modified Files:
        src/sys/kern: subr_time.c

Log Message:
mq_timed{send,receive}: as required by POSIX, return EINVAL on invalid
timeout and thread would have blocked, instead of ETIMEDOUT.  Change is
to abstimeout2timo(), thus also affects _lwp_park(2).

Reported by Stathis Kamperis some months ago.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/kern/subr_time.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/kern/subr_time.c
diff -u src/sys/kern/subr_time.c:1.5 src/sys/kern/subr_time.c:1.6
--- src/sys/kern/subr_time.c:1.5	Sun Nov  1 21:46:09 2009
+++ src/sys/kern/subr_time.c	Fri Apr 23 19:29:23 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_time.c,v 1.5 2009/11/01 21:46:09 rmind Exp $	*/
+/*	$NetBSD: subr_time.c,v 1.6 2010/04/23 19:29:23 rmind Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_time.c,v 1.5 2009/11/01 21:46:09 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_time.c,v 1.6 2010/04/23 19:29:23 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -208,13 +208,13 @@
 
 	getnanotime(&tsd);
 	timespecsub(ts, &tsd, &tsd);
-	if (tsd.tv_sec < 0 || (tsd.tv_sec == 0 && tsd.tv_nsec <= 0)) {
-		return ETIMEDOUT;
-	}
 	error = itimespecfix(&tsd);
 	if (error) {
 		return error;
 	}
+	if (tsd.tv_sec < 0 || (tsd.tv_sec == 0 && tsd.tv_nsec <= 0)) {
+		return ETIMEDOUT;
+	}
 	*timo = tstohz(&tsd);
 	KASSERT(*timo != 0);
 

Reply via email to