Module Name:    src
Committed By:   simonb
Date:           Thu Jan 14 02:51:52 UTC 2021

Modified Files:
        src/sys/compat/netbsd32: netbsd32_lwp.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/compat/netbsd32/netbsd32_lwp.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/netbsd32/netbsd32_lwp.c
diff -u src/sys/compat/netbsd32/netbsd32_lwp.c:1.22 src/sys/compat/netbsd32/netbsd32_lwp.c:1.23
--- src/sys/compat/netbsd32/netbsd32_lwp.c:1.22	Wed Jan 29 15:47:52 2020
+++ src/sys/compat/netbsd32/netbsd32_lwp.c	Thu Jan 14 02:51:52 2021
@@ -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 @@ netbsd32____lwp_park60(struct lwp *l,
 	} */
 	struct timespec ts, *tsp;
 	struct netbsd32_timespec ts32;
+	int ret;
 	int error;
 
 	if (SCARG_P32(uap, ts) == NULL)
@@ -188,7 +189,12 @@ netbsd32____lwp_park60(struct lwp *l,
 			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

Reply via email to