Source-Changes-HG archive

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

[src/trunk]: src/sys/kern mq_timed{send, receive}: as required by POSIX, retur...



details:   https://anonhg.NetBSD.org/src/rev/8a51252688ed
branches:  trunk
changeset: 754217:8a51252688ed
user:      rmind <rmind%NetBSD.org@localhost>
date:      Fri Apr 23 19:29:23 2010 +0000

description:
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.

diffstat:

 sys/kern/subr_time.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (35 lines):

diff -r a4ae2085f210 -r 8a51252688ed sys/kern/subr_time.c
--- a/sys/kern/subr_time.c      Fri Apr 23 19:27:35 2010 +0000
+++ b/sys/kern/subr_time.c      Fri Apr 23 19:29:23 2010 +0000
@@ -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);
 



Home | Main Index | Thread Index | Old Index