Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/netbsd32 Handle rev 1.62 of kern/sys_lwp.c



details:   https://anonhg.NetBSD.org/src/rev/07b30c1b79e6
branches:  trunk
changeset: 958612:07b30c1b79e6
user:      simonb <simonb%NetBSD.org@localhost>
date:      Thu Jan 14 02:51:52 2021 +0000

description:
Handle rev 1.62 of kern/sys_lwp.c
   make _lwp_park return the remaining time to sleep in the "ts" argument
   if it is a relative timestamp, as discussed in tech-kern.
for compat32.  Thanks skrll@ for some cleanup tips.

diffstat:

 sys/compat/netbsd32/netbsd32_lwp.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (40 lines):

diff -r c6acb6110c28 -r 07b30c1b79e6 sys/compat/netbsd32/netbsd32_lwp.c
--- a/sys/compat/netbsd32/netbsd32_lwp.c        Thu Jan 14 02:43:04 2021 +0000
+++ b/sys/compat/netbsd32/netbsd32_lwp.c        Thu Jan 14 02:51:52 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_lwp.c,v 1.22 2020/01/29 15:47:52 ad Exp $     */
+/*     $NetBSD: netbsd32_lwp.c,v 1.23 2021/01/14 02:51:52 simonb Exp $ */
 
 /*
  *  Copyright (c) 2005, 2006, 2007, 2020 The NetBSD Foundation.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_lwp.c,v 1.22 2020/01/29 15:47:52 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_lwp.c,v 1.23 2021/01/14 02:51:52 simonb Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -170,6 +170,7 @@
        } */
        struct timespec ts, *tsp;
        struct netbsd32_timespec ts32;
+       int ret;
        int error;
 
        if (SCARG_P32(uap, ts) == NULL)
@@ -188,7 +189,12 @@
                        return error;
        }
 
-       return lwp_park(SCARG(uap, clock_id), SCARG(uap, flags), tsp);
+       ret = lwp_park(SCARG(uap, clock_id), SCARG(uap, flags), tsp);
+       if (SCARG_P32(uap, ts) != NULL && (SCARG(uap, flags) & TIMER_ABSTIME) == 0) {
+               netbsd32_from_timespec(&ts, &ts32);
+               (void)copyout(&ts32, SCARG_P32(uap, ts), sizeof(ts32));
+       }
+       return ret;
 }
 
 int



Home | Main Index | Thread Index | Old Index