Module Name:    src
Committed By:   kre
Date:           Mon Sep 30 01:26:48 UTC 2024

Modified Files:
        src/sys/compat/linux/common: linux_sched.c

Log Message:
Supply a missing cast, which fixes the i386 (other 32 bit too probably)
builds.

Note I used uintptr_t rather than intptr_t which other similar
lines nearby use - the int being converted to a ptr is uint64_t
so using unsigned seemed safer to me.   Feel free to change it.

Not sure if the code will work though - linux's clone3() is
being emulated via its clone() sys call - I know nothing about
linux sys calls, but my impression of these two is that in
clone() the "stack" arg points at the logical stack start
(usually the highest addr in the stack segment - though there
are some systems with upward growing stacks) whereas for
clone3() it looks to me as if the stack arg is always intended
to be the lowest addr in the stack segment (with a new size
field added to compute the top).  Simply copying that arg to the
clone() arg of the same name might not work.  (I am surmising).
I'd expect the code to need to vary based upon in which direction
the architecture's stack grows.   Maybe.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/compat/linux/common/linux_sched.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_sched.c
diff -u src/sys/compat/linux/common/linux_sched.c:1.80 src/sys/compat/linux/common/linux_sched.c:1.81
--- src/sys/compat/linux/common/linux_sched.c:1.80	Sun Sep 29 00:09:52 2024
+++ src/sys/compat/linux/common/linux_sched.c	Mon Sep 30 01:26:47 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_sched.c,v 1.80 2024/09/29 00:09:52 christos Exp $	*/
+/*	$NetBSD: linux_sched.c,v 1.81 2024/09/30 01:26:47 kre Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2019 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.80 2024/09/29 00:09:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.81 2024/09/30 01:26:47 kre Exp $");
 
 #include <sys/param.h>
 #include <sys/mount.h>
@@ -230,7 +230,7 @@ linux_sys_clone3(struct lwp *l, const st
 	// XXX: clone3 has stacksize, instead implement clone as a clone3
 	// wrapper.
 	SCARG(&clone_args, flags) = flags;
-	SCARG(&clone_args, stack) = (void *)cl_args.stack;
+	SCARG(&clone_args, stack) = (void *)(uintptr_t)cl_args.stack;
 	SCARG(&clone_args, parent_tidptr) =
 	    (void *)(intptr_t)cl_args.parent_tid;
 	SCARG(&clone_args, tls) =

Reply via email to