Wed Jun 21 21:04:03 2023 UTC ()
Pull up following revision(s) (requested by riastradh in ticket #1836):

	sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
	sys/compat/sunos/sunos_misc.c: revision 1.177
	sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
	sys/compat/common/kern_resource_43.c: revision 1.23
	sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
	sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
	sys/compat/common/vfs_syscalls_12.c: revision 1.38
	sys/compat/ultrix/ultrix_misc.c: revision 1.126
	sys/compat/common/kern_sig_43.c: revision 1.37
	sys/compat/linux/common/linux_mtio.c: revision 1.8
	sys/compat/freebsd/freebsd_misc.c: revision 1.34
	sys/compat/linux/common/linux_olduname.c: revision 1.67
	sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
	sys/compat/freebsd/freebsd_sched.c: revision 1.23
	sys/compat/ossaudio/ossaudio.c: revision 1.84
	sys/compat/sys/time_types.h: revision 1.6
	sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
	sys/compat/linux/common/linux_file.c: revision 1.119
	sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
	sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
	sys/compat/linux32/common/linux32_time.c: revision 1.38
	sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
	sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
	sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
	sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
	sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
	sys/compat/linux/common/linux_misc.c: revision 1.252
	sys/compat/linux/common/linux_hdio.c: revision 1.19
	sys/compat/sunos/sunos_ioctl.c: revision 1.71
	sys/compat/linux/common/linux_sched.c: revision 1.79
	sys/compat/common/kern_info_43.c: revision 1.40
	sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
	sys/compat/linux/common/linux_socket.c: revision 1.153
	sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
	sys/compat/common/vfs_syscalls_43.c: revision 1.68
	sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
	sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
	sys/compat/common/kern_time_50.c: revision 1.37
	sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
	sys/compat/linux/common/linux_cdrom.c: revision 1.28
	sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
	sys/compat/common/kern_info_09.c: revision 1.22
	sys/compat/linux32/common/linux32_resource.c: revision 1.12
	sys/compat/linux/common/linux_oldolduname.c: revision 1.67
	sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
	sys/compat/linux32/common/linux32_signal.c: revision 1.21
	sys/compat/common/kern_sig_13.c: revision 1.22
	sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
	sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
	sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
	sys/compat/netbsd32/netbsd32_time.c: revision 1.56
	sys/compat/linux/common/linux_signal.c: revision 1.84
	sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
	sys/compat/sunos32/sunos32_misc.c: revision 1.85
	sys/compat/linux/common/linux_time.c: revision 1.40
	sys/compat/linux/common/linux_fdio.c: revision 1.14
	sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure.  If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.


(martin)
diff -r1.20 -r1.20.90.1 src/sys/compat/common/kern_info_09.c
diff -r1.35 -r1.35.22.1 src/sys/compat/common/kern_info_43.c
diff -r1.21 -r1.21.90.1 src/sys/compat/common/kern_resource_43.c
diff -r1.20 -r1.20.50.1 src/sys/compat/common/kern_sig_13.c
diff -r1.34.50.1 -r1.34.50.2 src/sys/compat/common/kern_sig_43.c
diff -r1.31 -r1.31.10.1 src/sys/compat/common/kern_time_50.c
diff -r1.33.8.2 -r1.33.8.3 src/sys/compat/common/vfs_syscalls_12.c
diff -r1.36.12.1 -r1.36.12.2 src/sys/compat/common/vfs_syscalls_30.c
diff -r1.59.8.3 -r1.59.8.4 src/sys/compat/common/vfs_syscalls_43.c
diff -r1.33 -r1.33.12.1 src/sys/compat/freebsd/freebsd_misc.c
diff -r1.22 -r1.22.20.1 src/sys/compat/freebsd/freebsd_sched.c
diff -r1.50 -r1.50.12.1 src/sys/compat/linux/arch/alpha/linux_machdep.c
diff -r1.51.6.3 -r1.51.6.4 src/sys/compat/linux/arch/amd64/linux_machdep.c
diff -r1.32 -r1.32.12.1 src/sys/compat/linux/arch/arm/linux_machdep.c
diff -r1.19.10.1 -r1.19.10.2 src/sys/compat/linux/arch/arm/linux_ptrace.c
diff -r1.163 -r1.163.6.1 src/sys/compat/linux/arch/i386/linux_machdep.c
diff -r1.31.10.1 -r1.31.10.2 src/sys/compat/linux/arch/i386/linux_ptrace.c
diff -r1.42 -r1.42.52.1 src/sys/compat/linux/arch/m68k/linux_machdep.c
diff -r1.43 -r1.43.12.1 src/sys/compat/linux/arch/mips/linux_machdep.c
diff -r1.24 -r1.24.32.1 src/sys/compat/linux/arch/powerpc/linux_exec_powerpc.c
diff -r1.50 -r1.50.2.1 src/sys/compat/linux/arch/powerpc/linux_machdep.c
diff -r1.29.10.1 -r1.29.10.2 src/sys/compat/linux/arch/powerpc/linux_ptrace.c
diff -r1.27 -r1.27.80.1 src/sys/compat/linux/common/linux_cdrom.c
diff -r1.13 -r1.13.84.1 src/sys/compat/linux/common/linux_fdio.c
diff -r1.115 -r1.115.10.1 src/sys/compat/linux/common/linux_file.c
diff -r1.17 -r1.17.10.1 src/sys/compat/linux/common/linux_hdio.c
diff -r1.238.2.2 -r1.238.2.3 src/sys/compat/linux/common/linux_misc.c
diff -r1.7 -r1.7.84.1 src/sys/compat/linux/common/linux_mtio.c
diff -r1.66 -r1.66.80.1 src/sys/compat/linux/common/linux_oldolduname.c
diff -r1.66 -r1.66.80.1 src/sys/compat/linux/common/linux_olduname.c
diff -r1.69 -r1.69.4.1 src/sys/compat/linux/common/linux_sched.c
diff -r1.79.6.1 -r1.79.6.2 src/sys/compat/linux/common/linux_signal.c
diff -r1.138.6.6 -r1.138.6.7 src/sys/compat/linux/common/linux_socket.c
diff -r1.37.22.1 -r1.37.22.2 src/sys/compat/linux/common/linux_time.c
diff -r1.38.6.2 -r1.38.6.3 src/sys/compat/linux32/arch/amd64/linux32_machdep.c
diff -r1.19 -r1.19.8.1 src/sys/compat/linux32/common/linux32_exec_elf32.c
diff -r1.11 -r1.11.30.1 src/sys/compat/linux32/common/linux32_resource.c
diff -r1.18.10.1 -r1.18.10.2 src/sys/compat/linux32/common/linux32_signal.c
diff -r1.37 -r1.37.30.1 src/sys/compat/linux32/common/linux32_time.c
diff -r1.33 -r1.33.30.1 src/sys/compat/netbsd32/netbsd32_compat_12.c
diff -r1.36.4.1 -r1.36.4.2 src/sys/compat/netbsd32/netbsd32_compat_20.c
diff -r1.54.8.1 -r1.54.8.2 src/sys/compat/netbsd32/netbsd32_compat_43.c
diff -r1.32.10.1 -r1.32.10.2 src/sys/compat/netbsd32/netbsd32_compat_50.c
diff -r1.31.8.4 -r1.31.8.5 src/sys/compat/netbsd32/netbsd32_conv.h
diff -r1.5 -r1.5.8.1 src/sys/compat/netbsd32/netbsd32_nfssvc.c
diff -r1.4.6.1 -r1.4.6.2 src/sys/compat/netbsd32/netbsd32_ptrace.c
diff -r1.43.8.1 -r1.43.8.2 src/sys/compat/netbsd32/netbsd32_signal.c
diff -r1.49 -r1.49.6.1 src/sys/compat/netbsd32/netbsd32_time.c
diff -r1.23 -r1.23.8.1 src/sys/compat/netbsd32/netbsd32_wait.c
diff -r1.70.6.3 -r1.70.6.4 src/sys/compat/ossaudio/ossaudio.c
diff -r1.68 -r1.68.8.1 src/sys/compat/sunos/sunos_ioctl.c
diff -r1.170.10.1 -r1.170.10.2 src/sys/compat/sunos/sunos_misc.c
diff -r1.34 -r1.34.10.1 src/sys/compat/sunos32/sunos32_ioctl.c
diff -r1.77.10.1 -r1.77.10.2 src/sys/compat/sunos32/sunos32_misc.c
diff -r1.1.58.1 -r1.1.58.2 src/sys/compat/sys/time_types.h
diff -r1.37 -r1.37.8.1 src/sys/compat/ultrix/ultrix_ioctl.c
diff -r1.122 -r1.122.32.1 src/sys/compat/ultrix/ultrix_misc.c

cvs diff -r1.20 -r1.20.90.1 src/sys/compat/common/kern_info_09.c (expand / switch to unified diff)

--- src/sys/compat/common/kern_info_09.c 2007/12/20 23:02:44 1.20
+++ src/sys/compat/common/kern_info_09.c 2023/06/21 21:04:01 1.20.90.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: kern_info_09.c,v 1.20 2007/12/20 23:02:44 dsl Exp $ */ 1/* $NetBSD: kern_info_09.c,v 1.20.90.1 2023/06/21 21:04:01 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1982, 1986, 1991, 1993 4 * Copyright (c) 1982, 1986, 1991, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -22,27 +22,27 @@ @@ -22,27 +22,27 @@
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 * 30 *
31 * @(#)subr_xxx.c 8.1 (Berkeley) 6/10/93 31 * @(#)subr_xxx.c 8.1 (Berkeley) 6/10/93
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35__KERNEL_RCSID(0, "$NetBSD: kern_info_09.c,v 1.20 2007/12/20 23:02:44 dsl Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: kern_info_09.c,v 1.20.90.1 2023/06/21 21:04:01 martin Exp $");
36 36
37#include <sys/param.h> 37#include <sys/param.h>
38#include <sys/systm.h> 38#include <sys/systm.h>
39#include <sys/filedesc.h> 39#include <sys/filedesc.h>
40#include <sys/kernel.h> 40#include <sys/kernel.h>
41#include <sys/proc.h> 41#include <sys/proc.h>
42#include <sys/syslog.h> 42#include <sys/syslog.h>
43#include <sys/unistd.h> 43#include <sys/unistd.h>
44#include <uvm/uvm_extern.h> 44#include <uvm/uvm_extern.h>
45#include <sys/sysctl.h> 45#include <sys/sysctl.h>
46 46
47#include <sys/mount.h> 47#include <sys/mount.h>
48#include <sys/syscallargs.h> 48#include <sys/syscallargs.h>
@@ -90,26 +90,27 @@ struct outsname { @@ -90,26 +90,27 @@ struct outsname {
90}; 90};
91 91
92/* ARGSUSED */ 92/* ARGSUSED */
93int 93int
94compat_09_sys_uname(struct lwp *l, const struct compat_09_sys_uname_args *uap, register_t *retval) 94compat_09_sys_uname(struct lwp *l, const struct compat_09_sys_uname_args *uap, register_t *retval)
95{ 95{
96 /* { 96 /* {
97 syscallarg(struct outsname *) name; 97 syscallarg(struct outsname *) name;
98 } */ 98 } */
99 struct outsname outsname; 99 struct outsname outsname;
100 const char *cp; 100 const char *cp;
101 char *dp, *ep; 101 char *dp, *ep;
102 102
 103 memset(&outsname, 0, sizeof(outsname));
103 strncpy(outsname.sysname, ostype, sizeof(outsname.sysname)); 104 strncpy(outsname.sysname, ostype, sizeof(outsname.sysname));
104 strncpy(outsname.nodename, hostname, sizeof(outsname.nodename)); 105 strncpy(outsname.nodename, hostname, sizeof(outsname.nodename));
105 strncpy(outsname.release, osrelease, sizeof(outsname.release)); 106 strncpy(outsname.release, osrelease, sizeof(outsname.release));
106 dp = outsname.version; 107 dp = outsname.version;
107 ep = &outsname.version[sizeof(outsname.version) - 1]; 108 ep = &outsname.version[sizeof(outsname.version) - 1];
108 for (cp = version; *cp && *cp != '('; cp++) 109 for (cp = version; *cp && *cp != '('; cp++)
109 ; 110 ;
110 for (cp++; *cp && *cp != ')' && dp < ep; cp++) 111 for (cp++; *cp && *cp != ')' && dp < ep; cp++)
111 *dp++ = *cp; 112 *dp++ = *cp;
112 for (; *cp && *cp != '#'; cp++) 113 for (; *cp && *cp != '#'; cp++)
113 ; 114 ;
114 for (; *cp && *cp != ':' && dp < ep; cp++) 115 for (; *cp && *cp != ':' && dp < ep; cp++)
115 *dp++ = *cp; 116 *dp++ = *cp;

cvs diff -r1.35 -r1.35.22.1 src/sys/compat/common/kern_info_43.c (expand / switch to unified diff)

--- src/sys/compat/common/kern_info_43.c 2014/03/24 20:08:08 1.35
+++ src/sys/compat/common/kern_info_43.c 2023/06/21 21:04:01 1.35.22.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: kern_info_43.c,v 1.35 2014/03/24 20:08:08 christos Exp $ */ 1/* $NetBSD: kern_info_43.c,v 1.35.22.1 2023/06/21 21:04:01 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1982, 1986, 1991, 1993 4 * Copyright (c) 1982, 1986, 1991, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -22,27 +22,27 @@ @@ -22,27 +22,27 @@
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 * 30 *
31 * @(#)subr_xxx.c 8.1 (Berkeley) 6/10/93 31 * @(#)subr_xxx.c 8.1 (Berkeley) 6/10/93
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35__KERNEL_RCSID(0, "$NetBSD: kern_info_43.c,v 1.35 2014/03/24 20:08:08 christos Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: kern_info_43.c,v 1.35.22.1 2023/06/21 21:04:01 martin Exp $");
36 36
37#include <sys/param.h> 37#include <sys/param.h>
38#include <sys/systm.h> 38#include <sys/systm.h>
39#include <sys/filedesc.h> 39#include <sys/filedesc.h>
40#include <sys/kernel.h> 40#include <sys/kernel.h>
41#include <sys/vnode.h> 41#include <sys/vnode.h>
42#include <sys/proc.h> 42#include <sys/proc.h>
43#include <sys/file.h> 43#include <sys/file.h>
44#include <sys/socket.h> 44#include <sys/socket.h>
45#include <sys/socketvar.h> 45#include <sys/socketvar.h>
46#include <sys/stat.h> 46#include <sys/stat.h>
47#include <sys/ioctl.h> 47#include <sys/ioctl.h>
48#include <sys/fcntl.h> 48#include <sys/fcntl.h>
@@ -223,26 +223,28 @@ compat_43_sys_getkerninfo(struct lwp *l, @@ -223,26 +223,28 @@ compat_43_sys_getkerninfo(struct lwp *l,
223 struct timeval tv; 223 struct timeval tv;
224 const char *cpu_model = cpu_getmodel(); 224 const char *cpu_model = cpu_getmodel();
225 char *us = (char *) &usi[1]; 225 char *us = (char *) &usi[1];
226 226
227 if (usi == NULL) { 227 if (usi == NULL) {
228 size = sizeof(ksi) + 228 size = sizeof(ksi) +
229 strlen(ostype) + strlen(cpu_model) + 229 strlen(ostype) + strlen(cpu_model) +
230 strlen(osrelease) + strlen(machine) + 230 strlen(osrelease) + strlen(machine) +
231 strlen(version) + strlen(hostname) + 6; 231 strlen(version) + strlen(hostname) + 6;
232 error = 0; 232 error = 0;
233 break; 233 break;
234 } 234 }
235 235
 236 memset(&ksi, 0, sizeof(ksi));
 237
236#define COPY(fld) \ 238#define COPY(fld) \
237 ksi.fld = us - (u_long) usi; \ 239 ksi.fld = us - (u_long) usi; \
238 if ((error = copyoutstr(fld, us, 1024, &len)) != 0)\ 240 if ((error = copyoutstr(fld, us, 1024, &len)) != 0)\
239 return error; \ 241 return error; \
240 us += len 242 us += len
241 243
242 COPY(machine); 244 COPY(machine);
243 COPY(cpu_model); 245 COPY(cpu_model);
244 ksi.ncpu = ncpu; /* XXX */ 246 ksi.ncpu = ncpu; /* XXX */
245 ksi.cpuspeed = 40; /* XXX */ 247 ksi.cpuspeed = 40; /* XXX */
246 ksi.hwflags = 0; /* XXX */ 248 ksi.hwflags = 0; /* XXX */
247 ksi.physmem = ctob(physmem); 249 ksi.physmem = ctob(physmem);
248 ksi.usermem = ctob(physmem); /* XXX */ 250 ksi.usermem = ctob(physmem); /* XXX */

cvs diff -r1.21 -r1.21.90.1 src/sys/compat/common/kern_resource_43.c (expand / switch to unified diff)

--- src/sys/compat/common/kern_resource_43.c 2007/12/20 23:02:44 1.21
+++ src/sys/compat/common/kern_resource_43.c 2023/06/21 21:04:01 1.21.90.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: kern_resource_43.c,v 1.21 2007/12/20 23:02:44 dsl Exp $ */ 1/* $NetBSD: kern_resource_43.c,v 1.21.90.1 2023/06/21 21:04:01 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1982, 1986, 1991, 1993 4 * Copyright (c) 1982, 1986, 1991, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc. 6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed 7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph 8 * to the University of California by American Telephone and Telegraph
9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10 * the permission of UNIX System Laboratories, Inc. 10 * the permission of UNIX System Laboratories, Inc.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -27,52 +27,53 @@ @@ -27,52 +27,53 @@
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE. 34 * SUCH DAMAGE.
35 * 35 *
36 * @(#)kern_resource.c 8.5 (Berkeley) 1/21/94 36 * @(#)kern_resource.c 8.5 (Berkeley) 1/21/94
37 */ 37 */
38 38
39#include <sys/cdefs.h> 39#include <sys/cdefs.h>
40__KERNEL_RCSID(0, "$NetBSD: kern_resource_43.c,v 1.21 2007/12/20 23:02:44 dsl Exp $"); 40__KERNEL_RCSID(0, "$NetBSD: kern_resource_43.c,v 1.21.90.1 2023/06/21 21:04:01 martin Exp $");
41 41
42#include <sys/param.h> 42#include <sys/param.h>
43#include <sys/systm.h> 43#include <sys/systm.h>
44#include <sys/kernel.h> 44#include <sys/kernel.h>
45#include <sys/file.h> 45#include <sys/file.h>
46#include <sys/resourcevar.h> 46#include <sys/resourcevar.h>
47#include <sys/proc.h> 47#include <sys/proc.h>
48 48
49#include <sys/mount.h> 49#include <sys/mount.h>
50#include <sys/syscallargs.h> 50#include <sys/syscallargs.h>
51 51
52/* ARGSUSED */ 52/* ARGSUSED */
53int 53int
54compat_43_sys_getrlimit(struct lwp *l, const struct compat_43_sys_getrlimit_args *uap, register_t *retval) 54compat_43_sys_getrlimit(struct lwp *l, const struct compat_43_sys_getrlimit_args *uap, register_t *retval)
55{ 55{
56 /* { 56 /* {
57 syscallarg(int) which; 57 syscallarg(int) which;
58 syscallarg(struct orlimit *) rlp; 58 syscallarg(struct orlimit *) rlp;
59 } */ 59 } */
60 struct proc *p = l->l_proc; 60 struct proc *p = l->l_proc;
61 int which = SCARG(uap, which); 61 int which = SCARG(uap, which);
62 struct orlimit olim; 62 struct orlimit olim;
63 63
64 if ((u_int)which >= RLIM_NLIMITS) 64 if ((u_int)which >= RLIM_NLIMITS)
65 return (EINVAL); 65 return (EINVAL);
 66 memset(&olim, 0, sizeof(olim));
66 olim.rlim_cur = p->p_rlimit[which].rlim_cur; 67 olim.rlim_cur = p->p_rlimit[which].rlim_cur;
67 if (olim.rlim_cur == -1) 68 if (olim.rlim_cur == -1)
68 olim.rlim_cur = 0x7fffffff; 69 olim.rlim_cur = 0x7fffffff;
69 olim.rlim_max = p->p_rlimit[which].rlim_max; 70 olim.rlim_max = p->p_rlimit[which].rlim_max;
70 if (olim.rlim_max == -1) 71 if (olim.rlim_max == -1)
71 olim.rlim_max = 0x7fffffff; 72 olim.rlim_max = 0x7fffffff;
72 return copyout(&olim, SCARG(uap, rlp), sizeof(olim)); 73 return copyout(&olim, SCARG(uap, rlp), sizeof(olim));
73} 74}
74 75
75/* ARGSUSED */ 76/* ARGSUSED */
76int 77int
77compat_43_sys_setrlimit(struct lwp *l, const struct compat_43_sys_setrlimit_args *uap, register_t *retval) 78compat_43_sys_setrlimit(struct lwp *l, const struct compat_43_sys_setrlimit_args *uap, register_t *retval)
78{ 79{

cvs diff -r1.20 -r1.20.50.1 src/sys/compat/common/kern_sig_13.c (expand / switch to unified diff)

--- src/sys/compat/common/kern_sig_13.c 2011/01/19 10:21:16 1.20
+++ src/sys/compat/common/kern_sig_13.c 2023/06/21 21:04:01 1.20.50.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: kern_sig_13.c,v 1.20 2011/01/19 10:21:16 tsutsui Exp $ */ 1/* $NetBSD: kern_sig_13.c,v 1.20.50.1 2023/06/21 21:04:01 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Charles M. Hannum. 8 * by Charles M. Hannum.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,73 +20,76 @@ @@ -20,73 +20,76 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: kern_sig_13.c,v 1.20 2011/01/19 10:21:16 tsutsui Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: kern_sig_13.c,v 1.20.50.1 2023/06/21 21:04:01 martin Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/proc.h> 36#include <sys/proc.h>
37#include <sys/signal.h> 37#include <sys/signal.h>
38#include <sys/signalvar.h> 38#include <sys/signalvar.h>
39#include <sys/systm.h> 39#include <sys/systm.h>
40 40
41#include <sys/syscallargs.h> 41#include <sys/syscallargs.h>
42 42
43#include <machine/limits.h> 43#include <machine/limits.h>
44 44
45#include <compat/sys/signal.h> 45#include <compat/sys/signal.h>
46#include <compat/sys/signalvar.h> 46#include <compat/sys/signalvar.h>
47#include <compat/common/compat_util.h> 47#include <compat/common/compat_util.h>
48#include <compat/common/compat_sigaltstack.h> 48#include <compat/common/compat_sigaltstack.h>
49 49
50void 50void
51native_sigset13_to_sigset(const sigset13_t *oss, sigset_t *ss) 51native_sigset13_to_sigset(const sigset13_t *oss, sigset_t *ss)
52{ 52{
53 53
 54 memset(ss, 0, sizeof(*ss));
54 ss->__bits[0] = *oss; 55 ss->__bits[0] = *oss;
55 ss->__bits[1] = 0; 56 ss->__bits[1] = 0;
56 ss->__bits[2] = 0; 57 ss->__bits[2] = 0;
57 ss->__bits[3] = 0; 58 ss->__bits[3] = 0;
58} 59}
59 60
60void 61void
61native_sigset_to_sigset13(const sigset_t *ss, sigset13_t *oss) 62native_sigset_to_sigset13(const sigset_t *ss, sigset13_t *oss)
62{ 63{
63 64
64 *oss = ss->__bits[0]; 65 *oss = ss->__bits[0];
65} 66}
66 67
67void 68void
68native_sigaction13_to_sigaction(const struct sigaction13 *osa, struct sigaction *sa) 69native_sigaction13_to_sigaction(const struct sigaction13 *osa, struct sigaction *sa)
69{ 70{
70 71
 72 memset(sa, 0, sizeof(*sa));
71 sa->sa_handler = osa->osa_handler; 73 sa->sa_handler = osa->osa_handler;
72 native_sigset13_to_sigset(&osa->osa_mask, &sa->sa_mask); 74 native_sigset13_to_sigset(&osa->osa_mask, &sa->sa_mask);
73 sa->sa_flags = osa->osa_flags; 75 sa->sa_flags = osa->osa_flags;
74} 76}
75 77
76void 78void
77native_sigaction_to_sigaction13(const struct sigaction *sa, struct sigaction13 *osa) 79native_sigaction_to_sigaction13(const struct sigaction *sa, struct sigaction13 *osa)
78{ 80{
79 81
 82 memset(osa, 0, sizeof(*osa));
80 osa->osa_handler = sa->sa_handler; 83 osa->osa_handler = sa->sa_handler;
81 native_sigset_to_sigset13(&sa->sa_mask, &osa->osa_mask); 84 native_sigset_to_sigset13(&sa->sa_mask, &osa->osa_mask);
82 osa->osa_flags = sa->sa_flags; 85 osa->osa_flags = sa->sa_flags;
83} 86}
84 87
85int 88int
86compat_13_sys_sigaltstack(struct lwp *l, const struct compat_13_sys_sigaltstack_args *uap, register_t *retval) 89compat_13_sys_sigaltstack(struct lwp *l, const struct compat_13_sys_sigaltstack_args *uap, register_t *retval)
87{ 90{
88 /* { 91 /* {
89 syscallarg(const struct sigaltstack13 *) nss; 92 syscallarg(const struct sigaltstack13 *) nss;
90 syscallarg(struct sigaltstack13 *) oss; 93 syscallarg(struct sigaltstack13 *) oss;
91 } */ 94 } */
92 compat_sigaltstack(uap, sigaltstack13, SS_ONSTACK, SS_DISABLE); 95 compat_sigaltstack(uap, sigaltstack13, SS_ONSTACK, SS_DISABLE);

cvs diff -r1.34.50.1 -r1.34.50.2 src/sys/compat/common/kern_sig_43.c (expand / switch to unified diff)

--- src/sys/compat/common/kern_sig_43.c 2020/01/21 18:12:53 1.34.50.1
+++ src/sys/compat/common/kern_sig_43.c 2023/06/21 21:04:01 1.34.50.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: kern_sig_43.c,v 1.34.50.1 2020/01/21 18:12:53 martin Exp $ */ 1/* $NetBSD: kern_sig_43.c,v 1.34.50.2 2023/06/21 21:04:01 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Charles M. Hannum. 8 * by Charles M. Hannum.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: kern_sig_43.c,v 1.34.50.1 2020/01/21 18:12:53 martin Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: kern_sig_43.c,v 1.34.50.2 2023/06/21 21:04:01 martin Exp $");
34 34
35#if defined(_KERNEL_OPT) 35#if defined(_KERNEL_OPT)
36#include "opt_compat_netbsd.h" 36#include "opt_compat_netbsd.h"
37#endif 37#endif
38 38
39#include <sys/param.h> 39#include <sys/param.h>
40#include <sys/signalvar.h> 40#include <sys/signalvar.h>
41#include <sys/resourcevar.h> 41#include <sys/resourcevar.h>
42#include <sys/namei.h> 42#include <sys/namei.h>
43#include <sys/vnode.h> 43#include <sys/vnode.h>
44#include <sys/proc.h> 44#include <sys/proc.h>
45#include <sys/systm.h> 45#include <sys/systm.h>
46#include <sys/timeb.h> 46#include <sys/timeb.h>
@@ -63,58 +63,64 @@ __KERNEL_RCSID(0, "$NetBSD: kern_sig_43. @@ -63,58 +63,64 @@ __KERNEL_RCSID(0, "$NetBSD: kern_sig_43.
63#include <compat/sys/signal.h> 63#include <compat/sys/signal.h>
64 64
65void compat_43_sigmask_to_sigset(const int *, sigset_t *); 65void compat_43_sigmask_to_sigset(const int *, sigset_t *);
66void compat_43_sigset_to_sigmask(const sigset_t *, int *); 66void compat_43_sigset_to_sigmask(const sigset_t *, int *);
67void compat_43_sigvec_to_sigaction(const struct sigvec *, struct sigaction *); 67void compat_43_sigvec_to_sigaction(const struct sigvec *, struct sigaction *);
68void compat_43_sigaction_to_sigvec(const struct sigaction *, struct sigvec *); 68void compat_43_sigaction_to_sigvec(const struct sigaction *, struct sigvec *);
69void compat_43_sigstack_to_sigaltstack(const struct sigstack *, struct sigaltstack *); 69void compat_43_sigstack_to_sigaltstack(const struct sigstack *, struct sigaltstack *);
70void compat_43_sigaltstack_to_sigstack(const struct sigaltstack *, struct sigstack *); 70void compat_43_sigaltstack_to_sigstack(const struct sigaltstack *, struct sigstack *);
71 71
72void 72void
73compat_43_sigmask_to_sigset(const int *sm, sigset_t *ss) 73compat_43_sigmask_to_sigset(const int *sm, sigset_t *ss)
74{ 74{
75 75
 76 memset(ss, 0, sizeof(*ss));
76 ss->__bits[0] = *sm; 77 ss->__bits[0] = *sm;
77 ss->__bits[1] = 0; 78 ss->__bits[1] = 0;
78 ss->__bits[2] = 0; 79 ss->__bits[2] = 0;
79 ss->__bits[3] = 0; 80 ss->__bits[3] = 0;
80} 81}
81 82
82void 83void
83compat_43_sigset_to_sigmask(const sigset_t *ss, int *sm) 84compat_43_sigset_to_sigmask(const sigset_t *ss, int *sm)
84{ 85{
85 86
86 *sm = ss->__bits[0]; 87 *sm = ss->__bits[0];
87} 88}
88 89
89void 90void
90compat_43_sigvec_to_sigaction(const struct sigvec *sv, struct sigaction *sa) 91compat_43_sigvec_to_sigaction(const struct sigvec *sv, struct sigaction *sa)
91{ 92{
 93
 94 memset(sa, 0, sizeof(*sa));
92 sa->sa_handler = sv->sv_handler; 95 sa->sa_handler = sv->sv_handler;
93 compat_43_sigmask_to_sigset(&sv->sv_mask, &sa->sa_mask); 96 compat_43_sigmask_to_sigset(&sv->sv_mask, &sa->sa_mask);
94 sa->sa_flags = sv->sv_flags ^ SA_RESTART; 97 sa->sa_flags = sv->sv_flags ^ SA_RESTART;
95} 98}
96 99
97void 100void
98compat_43_sigaction_to_sigvec(const struct sigaction *sa, struct sigvec *sv) 101compat_43_sigaction_to_sigvec(const struct sigaction *sa, struct sigvec *sv)
99{ 102{
 103
 104 memset(sv, 0, sizeof(*sv));
100 sv->sv_handler = sa->sa_handler; 105 sv->sv_handler = sa->sa_handler;
101 compat_43_sigset_to_sigmask(&sa->sa_mask, &sv->sv_mask); 106 compat_43_sigset_to_sigmask(&sa->sa_mask, &sv->sv_mask);
102 sv->sv_flags = sa->sa_flags ^ SA_RESTART; 107 sv->sv_flags = sa->sa_flags ^ SA_RESTART;
103} 108}
104 109
105void 110void
106compat_43_sigstack_to_sigaltstack(const struct sigstack *ss, struct sigaltstack *sa) 111compat_43_sigstack_to_sigaltstack(const struct sigstack *ss, struct sigaltstack *sa)
107{ 112{
 113 memset(sa, 0, sizeof(*sa));
108 sa->ss_sp = ss->ss_sp; 114 sa->ss_sp = ss->ss_sp;
109 sa->ss_size = SIGSTKSZ; /* Use the recommended size */ 115 sa->ss_size = SIGSTKSZ; /* Use the recommended size */
110 sa->ss_flags = 0; 116 sa->ss_flags = 0;
111 if (ss->ss_onstack) 117 if (ss->ss_onstack)
112 sa->ss_flags |= SS_ONSTACK; 118 sa->ss_flags |= SS_ONSTACK;
113} 119}
114 120
115void 121void
116compat_43_sigaltstack_to_sigstack(const struct sigaltstack *sa, struct sigstack *ss) 122compat_43_sigaltstack_to_sigstack(const struct sigaltstack *sa, struct sigstack *ss)
117{ 123{
118 memset(ss, 0, sizeof(*ss)); 124 memset(ss, 0, sizeof(*ss));
119 ss->ss_sp = sa->ss_sp; 125 ss->ss_sp = sa->ss_sp;
120 if (sa->ss_flags & SS_ONSTACK) 126 if (sa->ss_flags & SS_ONSTACK)

cvs diff -r1.31 -r1.31.10.1 src/sys/compat/common/kern_time_50.c (expand / switch to unified diff)

--- src/sys/compat/common/kern_time_50.c 2016/03/11 18:32:29 1.31
+++ src/sys/compat/common/kern_time_50.c 2023/06/21 21:04:01 1.31.10.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: kern_time_50.c,v 1.31 2016/03/11 18:32:29 christos Exp $ */ 1/* $NetBSD: kern_time_50.c,v 1.31.10.1 2023/06/21 21:04:01 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Christos Zoulas. 8 * by Christos Zoulas.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -19,27 +19,27 @@ @@ -19,27 +19,27 @@
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31#include <sys/cdefs.h> 31#include <sys/cdefs.h>
32__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.31 2016/03/11 18:32:29 christos Exp $"); 32__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.31.10.1 2023/06/21 21:04:01 martin Exp $");
33 33
34#ifdef _KERNEL_OPT 34#ifdef _KERNEL_OPT
35#include "opt_aio.h" 35#include "opt_aio.h"
36#include "opt_ntp.h" 36#include "opt_ntp.h"
37#include "opt_mqueue.h" 37#include "opt_mqueue.h"
38#endif 38#endif
39 39
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/conf.h> 41#include <sys/conf.h>
42#include <sys/systm.h> 42#include <sys/systm.h>
43#include <sys/namei.h> 43#include <sys/namei.h>
44#include <sys/filedesc.h> 44#include <sys/filedesc.h>
45#include <sys/kernel.h> 45#include <sys/kernel.h>
@@ -181,26 +181,27 @@ compat_50_sys_gettimeofday(struct lwp *l @@ -181,26 +181,27 @@ compat_50_sys_gettimeofday(struct lwp *l
181 181
182 if (SCARG(uap, tp)) { 182 if (SCARG(uap, tp)) {
183 microtime(&atv); 183 microtime(&atv);
184 timeval_to_timeval50(&atv, &atv50); 184 timeval_to_timeval50(&atv, &atv50);
185 error = copyout(&atv50, SCARG(uap, tp), sizeof(*SCARG(uap, tp))); 185 error = copyout(&atv50, SCARG(uap, tp), sizeof(*SCARG(uap, tp)));
186 if (error) 186 if (error)
187 return error; 187 return error;
188 } 188 }
189 if (SCARG(uap, tzp)) { 189 if (SCARG(uap, tzp)) {
190 /* 190 /*
191 * NetBSD has no kernel notion of time zone, so we just 191 * NetBSD has no kernel notion of time zone, so we just
192 * fake up a timezone struct and return it if demanded. 192 * fake up a timezone struct and return it if demanded.
193 */ 193 */
 194 memset(&tzfake, 0, sizeof(tzfake));
194 tzfake.tz_minuteswest = 0; 195 tzfake.tz_minuteswest = 0;
195 tzfake.tz_dsttime = 0; 196 tzfake.tz_dsttime = 0;
196 error = copyout(&tzfake, SCARG(uap, tzp), sizeof(tzfake)); 197 error = copyout(&tzfake, SCARG(uap, tzp), sizeof(tzfake));
197 } 198 }
198 return error; 199 return error;
199} 200}
200 201
201/* ARGSUSED */ 202/* ARGSUSED */
202int 203int
203compat_50_sys_settimeofday(struct lwp *l, 204compat_50_sys_settimeofday(struct lwp *l,
204 const struct compat_50_sys_settimeofday_args *uap, register_t *retval) 205 const struct compat_50_sys_settimeofday_args *uap, register_t *retval)
205{ 206{
206 /* { 207 /* {
@@ -415,26 +416,27 @@ compat_50_sys_mq_timedreceive(struct lwp @@ -415,26 +416,27 @@ compat_50_sys_mq_timedreceive(struct lwp
415 SCARG(uap, msg_len), SCARG(uap, msg_prio), tsp, &mlen); 416 SCARG(uap, msg_len), SCARG(uap, msg_prio), tsp, &mlen);
416 if (error == 0) 417 if (error == 0)
417 *retval = mlen; 418 *retval = mlen;
418 419
419 return error; 420 return error;
420#else 421#else
421 return ENOSYS; 422 return ENOSYS;
422#endif 423#endif
423} 424}
424 425
425void 426void
426rusage_to_rusage50(const struct rusage *ru, struct rusage50 *ru50) 427rusage_to_rusage50(const struct rusage *ru, struct rusage50 *ru50)
427{ 428{
 429 memset(ru50, 0, sizeof(*ru50));
428 (void)memcpy(&ru50->ru_first, &ru->ru_first, 430 (void)memcpy(&ru50->ru_first, &ru->ru_first,
429 (char *)&ru50->ru_last - (char *)&ru50->ru_first + 431 (char *)&ru50->ru_last - (char *)&ru50->ru_first +
430 sizeof(ru50->ru_last)); 432 sizeof(ru50->ru_last));
431 ru50->ru_maxrss = ru->ru_maxrss; 433 ru50->ru_maxrss = ru->ru_maxrss;
432 timeval_to_timeval50(&ru->ru_utime, &ru50->ru_utime); 434 timeval_to_timeval50(&ru->ru_utime, &ru50->ru_utime);
433 timeval_to_timeval50(&ru->ru_stime, &ru50->ru_stime); 435 timeval_to_timeval50(&ru->ru_stime, &ru50->ru_stime);
434} 436}
435 437
436int 438int
437compat_50_sys_getrusage(struct lwp *l, 439compat_50_sys_getrusage(struct lwp *l,
438 const struct compat_50_sys_getrusage_args *uap, register_t *retval) 440 const struct compat_50_sys_getrusage_args *uap, register_t *retval)
439{ 441{
440 /* { 442 /* {

cvs diff -r1.33.8.2 -r1.33.8.3 src/sys/compat/common/vfs_syscalls_12.c (expand / switch to unified diff)

--- src/sys/compat/common/vfs_syscalls_12.c 2017/12/10 09:36:36 1.33.8.2
+++ src/sys/compat/common/vfs_syscalls_12.c 2023/06/21 21:04:01 1.33.8.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: vfs_syscalls_12.c,v 1.33.8.2 2017/12/10 09:36:36 snj Exp $ */ 1/* $NetBSD: vfs_syscalls_12.c,v 1.33.8.3 2023/06/21 21:04:01 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1989, 1993 4 * Copyright (c) 1989, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc. 6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed 7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph 8 * to the University of California by American Telephone and Telegraph
9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10 * the permission of UNIX System Laboratories, Inc. 10 * the permission of UNIX System Laboratories, Inc.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -27,27 +27,27 @@ @@ -27,27 +27,27 @@
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE. 34 * SUCH DAMAGE.
35 * 35 *
36 * From: @(#)vfs_syscalls.c 8.28 (Berkeley) 12/10/94 36 * From: @(#)vfs_syscalls.c 8.28 (Berkeley) 12/10/94
37 */ 37 */
38 38
39#include <sys/cdefs.h> 39#include <sys/cdefs.h>
40__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.33.8.2 2017/12/10 09:36:36 snj Exp $"); 40__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.33.8.3 2023/06/21 21:04:01 martin Exp $");
41 41
42#include <sys/param.h> 42#include <sys/param.h>
43#include <sys/systm.h> 43#include <sys/systm.h>
44#include <sys/namei.h> 44#include <sys/namei.h>
45#include <sys/filedesc.h> 45#include <sys/filedesc.h>
46#include <sys/kernel.h> 46#include <sys/kernel.h>
47#include <sys/file.h> 47#include <sys/file.h>
48#include <sys/stat.h> 48#include <sys/stat.h>
49#include <sys/socketvar.h> 49#include <sys/socketvar.h>
50#include <sys/vnode.h> 50#include <sys/vnode.h>
51#include <sys/proc.h> 51#include <sys/proc.h>
52#include <sys/uio.h> 52#include <sys/uio.h>
53#include <sys/dirent.h> 53#include <sys/dirent.h>
@@ -55,26 +55,27 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls @@ -55,26 +55,27 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls
55 55
56#include <sys/syscallargs.h> 56#include <sys/syscallargs.h>
57 57
58#include <compat/sys/stat.h> 58#include <compat/sys/stat.h>
59#include <compat/sys/dirent.h> 59#include <compat/sys/dirent.h>
60 60
61/* 61/*
62 * Convert from a new to an old stat structure. 62 * Convert from a new to an old stat structure.
63 */ 63 */
64void 64void
65compat_12_stat_conv(const struct stat *st, struct stat12 *ost) 65compat_12_stat_conv(const struct stat *st, struct stat12 *ost)
66{ 66{
67 67
 68 memset(ost, 0, sizeof(*ost));
68 ost->st_dev = st->st_dev; 69 ost->st_dev = st->st_dev;
69 ost->st_ino = st->st_ino; 70 ost->st_ino = st->st_ino;
70 ost->st_mode = st->st_mode & 0xffff; 71 ost->st_mode = st->st_mode & 0xffff;
71 if (st->st_nlink >= (1 << 15)) 72 if (st->st_nlink >= (1 << 15))
72 ost->st_nlink = (1 << 15) - 1; 73 ost->st_nlink = (1 << 15) - 1;
73 else 74 else
74 ost->st_nlink = st->st_nlink; 75 ost->st_nlink = st->st_nlink;
75 ost->st_uid = st->st_uid; 76 ost->st_uid = st->st_uid;
76 ost->st_gid = st->st_gid; 77 ost->st_gid = st->st_gid;
77 ost->st_rdev = st->st_rdev; 78 ost->st_rdev = st->st_rdev;
78 timespec_to_timespec50(&st->st_atimespec, &ost->st_atimespec); 79 timespec_to_timespec50(&st->st_atimespec, &ost->st_atimespec);
79 timespec_to_timespec50(&st->st_mtimespec, &ost->st_mtimespec); 80 timespec_to_timespec50(&st->st_mtimespec, &ost->st_mtimespec);
80 timespec_to_timespec50(&st->st_ctimespec, &ost->st_ctimespec); 81 timespec_to_timespec50(&st->st_ctimespec, &ost->st_ctimespec);
@@ -173,26 +174,27 @@ again: @@ -173,26 +174,27 @@ again:
173 reclen = bdp->d_reclen; 174 reclen = bdp->d_reclen;
174 if (reclen & 3) { 175 if (reclen & 3) {
175 error = EIO; 176 error = EIO;
176 goto out; 177 goto out;
177 } 178 }
178 if (bdp->d_fileno == 0) { 179 if (bdp->d_fileno == 0) {
179 inp += reclen; /* it is a hole; squish it out */ 180 inp += reclen; /* it is a hole; squish it out */
180 if (cookie) 181 if (cookie)
181 off = *cookie++; 182 off = *cookie++;
182 else 183 else
183 off += reclen; 184 off += reclen;
184 continue; 185 continue;
185 } 186 }
 187 memset(&idb, 0, sizeof(idb));
186 if (bdp->d_namlen >= sizeof(idb.d_name)) 188 if (bdp->d_namlen >= sizeof(idb.d_name))
187 idb.d_namlen = sizeof(idb.d_name) - 1; 189 idb.d_namlen = sizeof(idb.d_name) - 1;
188 else 190 else
189 idb.d_namlen = bdp->d_namlen; 191 idb.d_namlen = bdp->d_namlen;
190 old_reclen = _DIRENT_RECLEN(&idb, bdp->d_namlen); 192 old_reclen = _DIRENT_RECLEN(&idb, bdp->d_namlen);
191 if (reclen > len || resid < old_reclen) { 193 if (reclen > len || resid < old_reclen) {
192 /* entry too big for buffer, so just stop */ 194 /* entry too big for buffer, so just stop */
193 outp++; 195 outp++;
194 break; 196 break;
195 } 197 }
196 /* 198 /*
197 * Massage in place to make a Dirent12-shaped dirent (otherwise 199 * Massage in place to make a Dirent12-shaped dirent (otherwise
198 * we have to worry about touching user memory outside of 200 * we have to worry about touching user memory outside of

cvs diff -r1.36.12.1 -r1.36.12.2 src/sys/compat/common/vfs_syscalls_30.c (expand / switch to unified diff)

--- src/sys/compat/common/vfs_syscalls_30.c 2021/08/15 10:03:46 1.36.12.1
+++ src/sys/compat/common/vfs_syscalls_30.c 2023/06/21 21:04:01 1.36.12.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: vfs_syscalls_30.c,v 1.36.12.1 2021/08/15 10:03:46 martin Exp $ */ 1/* $NetBSD: vfs_syscalls_30.c,v 1.36.12.2 2023/06/21 21:04:01 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Christos Zoulas. 8 * by Christos Zoulas.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -19,27 +19,27 @@ @@ -19,27 +19,27 @@
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31#include <sys/cdefs.h> 31#include <sys/cdefs.h>
32__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.36.12.1 2021/08/15 10:03:46 martin Exp $"); 32__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.36.12.2 2023/06/21 21:04:01 martin Exp $");
33 33
34#include <sys/param.h> 34#include <sys/param.h>
35#include <sys/systm.h> 35#include <sys/systm.h>
36#include <sys/namei.h> 36#include <sys/namei.h>
37#include <sys/filedesc.h> 37#include <sys/filedesc.h>
38#include <sys/kernel.h> 38#include <sys/kernel.h>
39#include <sys/file.h> 39#include <sys/file.h>
40#include <sys/stat.h> 40#include <sys/stat.h>
41#include <sys/socketvar.h> 41#include <sys/socketvar.h>
42#include <sys/vnode.h> 42#include <sys/vnode.h>
43#include <sys/mount.h> 43#include <sys/mount.h>
44#include <sys/proc.h> 44#include <sys/proc.h>
45#include <sys/uio.h> 45#include <sys/uio.h>
@@ -242,26 +242,27 @@ again: @@ -242,26 +242,27 @@ again:
242 bdp = (struct dirent *)inp; 242 bdp = (struct dirent *)inp;
243 reclen = bdp->d_reclen; 243 reclen = bdp->d_reclen;
244 if (reclen & _DIRENT_ALIGN(bdp)) 244 if (reclen & _DIRENT_ALIGN(bdp))
245 panic("%s: bad reclen %d", __func__, reclen); 245 panic("%s: bad reclen %d", __func__, reclen);
246 if (cookie) 246 if (cookie)
247 off = *cookie++; /* each entry points to the next */ 247 off = *cookie++; /* each entry points to the next */
248 else 248 else
249 off += reclen; 249 off += reclen;
250 if ((off >> 32) != 0) { 250 if ((off >> 32) != 0) {
251 compat_offseterr(vp, "netbsd30_getdents"); 251 compat_offseterr(vp, "netbsd30_getdents");
252 error = EINVAL; 252 error = EINVAL;
253 goto out; 253 goto out;
254 } 254 }
 255 memset(&idb, 0, sizeof(idb));
255 if (bdp->d_namlen >= sizeof(idb.d_name)) 256 if (bdp->d_namlen >= sizeof(idb.d_name))
256 idb.d_namlen = sizeof(idb.d_name) - 1; 257 idb.d_namlen = sizeof(idb.d_name) - 1;
257 else 258 else
258 idb.d_namlen = bdp->d_namlen; 259 idb.d_namlen = bdp->d_namlen;
259 idb.d_reclen = _DIRENT_SIZE(&idb); 260 idb.d_reclen = _DIRENT_SIZE(&idb);
260 if (reclen > len || resid < idb.d_reclen) { 261 if (reclen > len || resid < idb.d_reclen) {
261 /* entry too big for buffer, so just stop */ 262 /* entry too big for buffer, so just stop */
262 outp++; 263 outp++;
263 break; 264 break;
264 } 265 }
265 /* 266 /*
266 * Massage in place to make a NetBSD-3.0-shaped dirent 267 * Massage in place to make a NetBSD-3.0-shaped dirent
267 * (otherwise we have to worry about touching user memory 268 * (otherwise we have to worry about touching user memory
@@ -331,26 +332,27 @@ compat_30_sys_getfh(struct lwp *l, const @@ -331,26 +332,27 @@ compat_30_sys_getfh(struct lwp *l, const
331 if (error) { 332 if (error) {
332 return error; 333 return error;
333 } 334 }
334 NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | TRYEMULROOT, pb); 335 NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | TRYEMULROOT, pb);
335 error = namei(&nd); 336 error = namei(&nd);
336 pathbuf_destroy(pb); 337 pathbuf_destroy(pb);
337 if (error) 338 if (error)
338 return error; 339 return error;
339 vp = nd.ni_vp; 340 vp = nd.ni_vp;
340 341
341 sz = sizeof(struct compat_30_fhandle); 342 sz = sizeof(struct compat_30_fhandle);
342 error = vfs_composefh(vp, (void *)&fh, &sz); 343 error = vfs_composefh(vp, (void *)&fh, &sz);
343 vput(vp); 344 vput(vp);
 345 CTASSERT(FHANDLE_SIZE_COMPAT == sizeof(struct compat_30_fhandle));
344 if (sz != FHANDLE_SIZE_COMPAT) { 346 if (sz != FHANDLE_SIZE_COMPAT) {
345 error = EINVAL; 347 error = EINVAL;
346 } 348 }
347 if (error) 349 if (error)
348 return error; 350 return error;
349 return copyout(&fh, SCARG(uap, fhp), sizeof(fh)); 351 return copyout(&fh, SCARG(uap, fhp), sizeof(fh));
350} 352}
351 353
352/* 354/*
353 * Open a file given a file handle. 355 * Open a file given a file handle.
354 * 356 *
355 * Check permissions, allocate an open file structure, 357 * Check permissions, allocate an open file structure,
356 * and call the device open routine if any. 358 * and call the device open routine if any.

cvs diff -r1.59.8.3 -r1.59.8.4 src/sys/compat/common/vfs_syscalls_43.c (expand / switch to unified diff)

--- src/sys/compat/common/vfs_syscalls_43.c 2021/08/15 10:03:46 1.59.8.3
+++ src/sys/compat/common/vfs_syscalls_43.c 2023/06/21 21:04:01 1.59.8.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: vfs_syscalls_43.c,v 1.59.8.3 2021/08/15 10:03:46 martin Exp $ */ 1/* $NetBSD: vfs_syscalls_43.c,v 1.59.8.4 2023/06/21 21:04:01 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1989, 1993 4 * Copyright (c) 1989, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc. 6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed 7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph 8 * to the University of California by American Telephone and Telegraph
9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10 * the permission of UNIX System Laboratories, Inc. 10 * the permission of UNIX System Laboratories, Inc.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -27,27 +27,27 @@ @@ -27,27 +27,27 @@
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE. 34 * SUCH DAMAGE.
35 * 35 *
36 * @(#)vfs_syscalls.c 8.28 (Berkeley) 12/10/94 36 * @(#)vfs_syscalls.c 8.28 (Berkeley) 12/10/94
37 */ 37 */
38 38
39#include <sys/cdefs.h> 39#include <sys/cdefs.h>
40__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.59.8.3 2021/08/15 10:03:46 martin Exp $"); 40__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.59.8.4 2023/06/21 21:04:01 martin Exp $");
41 41
42#if defined(_KERNEL_OPT) 42#if defined(_KERNEL_OPT)
43#include "opt_compat_netbsd.h" 43#include "opt_compat_netbsd.h"
44#endif 44#endif
45 45
46#include <sys/param.h> 46#include <sys/param.h>
47#include <sys/systm.h> 47#include <sys/systm.h>
48#include <sys/filedesc.h> 48#include <sys/filedesc.h>
49#include <sys/kernel.h> 49#include <sys/kernel.h>
50#include <sys/proc.h> 50#include <sys/proc.h>
51#include <sys/file.h> 51#include <sys/file.h>
52#include <sys/vnode.h> 52#include <sys/vnode.h>
53#include <sys/namei.h> 53#include <sys/namei.h>
@@ -446,26 +446,27 @@ again: @@ -446,26 +446,27 @@ again:
446 reclen = bdp->d_reclen; 446 reclen = bdp->d_reclen;
447 if (reclen & 3) { 447 if (reclen & 3) {
448 error = EIO; 448 error = EIO;
449 goto out; 449 goto out;
450 } 450 }
451 if (bdp->d_fileno == 0) { 451 if (bdp->d_fileno == 0) {
452 inp += reclen; /* it is a hole; squish it out */ 452 inp += reclen; /* it is a hole; squish it out */
453 if (cookie) 453 if (cookie)
454 off = *cookie++; 454 off = *cookie++;
455 else 455 else
456 off += reclen; 456 off += reclen;
457 continue; 457 continue;
458 } 458 }
 459 memset(&idb, 0, sizeof(idb));
459 if (bdp->d_namlen >= sizeof(idb.d_name)) 460 if (bdp->d_namlen >= sizeof(idb.d_name))
460 idb.d_namlen = sizeof(idb.d_name) - 1; 461 idb.d_namlen = sizeof(idb.d_name) - 1;
461 else 462 else
462 idb.d_namlen = bdp->d_namlen; 463 idb.d_namlen = bdp->d_namlen;
463 old_reclen = _DIRENT_RECLEN(&idb, bdp->d_namlen); 464 old_reclen = _DIRENT_RECLEN(&idb, bdp->d_namlen);
464 if (reclen > len || resid < old_reclen) { 465 if (reclen > len || resid < old_reclen) {
465 /* entry too big for buffer, so just stop */ 466 /* entry too big for buffer, so just stop */
466 outp++; 467 outp++;
467 break; 468 break;
468 } 469 }
469 /* 470 /*
470 * Massage in place to make a Dirent12-shaped dirent (otherwise 471 * Massage in place to make a Dirent12-shaped dirent (otherwise
471 * we have to worry about touching user memory outside of 472 * we have to worry about touching user memory outside of

cvs diff -r1.33 -r1.33.12.1 src/sys/compat/freebsd/freebsd_misc.c (expand / switch to unified diff)

--- src/sys/compat/freebsd/freebsd_misc.c 2014/11/09 18:30:38 1.33
+++ src/sys/compat/freebsd/freebsd_misc.c 2023/06/21 21:04:02 1.33.12.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: freebsd_misc.c,v 1.33 2014/11/09 18:30:38 maxv Exp $ */ 1/* $NetBSD: freebsd_misc.c,v 1.33.12.1 2023/06/21 21:04:02 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1995 Frank van der Linden 4 * Copyright (c) 1995 Frank van der Linden
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -26,27 +26,27 @@ @@ -26,27 +26,27 @@
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34/* 34/*
35 * FreeBSD compatibility module. Try to deal with various FreeBSD system calls. 35 * FreeBSD compatibility module. Try to deal with various FreeBSD system calls.
36 */ 36 */
37 37
38#include <sys/cdefs.h> 38#include <sys/cdefs.h>
39__KERNEL_RCSID(0, "$NetBSD: freebsd_misc.c,v 1.33 2014/11/09 18:30:38 maxv Exp $"); 39__KERNEL_RCSID(0, "$NetBSD: freebsd_misc.c,v 1.33.12.1 2023/06/21 21:04:02 martin Exp $");
40 40
41#if defined(_KERNEL_OPT) 41#if defined(_KERNEL_OPT)
42#include "opt_ntp.h" 42#include "opt_ntp.h"
43#endif 43#endif
44 44
45#include <sys/param.h> 45#include <sys/param.h>
46#include <sys/systm.h> 46#include <sys/systm.h>
47#include <sys/proc.h> 47#include <sys/proc.h>
48#include <sys/mount.h> 48#include <sys/mount.h>
49#include <sys/signal.h> 49#include <sys/signal.h>
50#include <sys/signalvar.h> 50#include <sys/signalvar.h>
51#include <sys/mman.h> 51#include <sys/mman.h>
52#include <sys/ktrace.h> 52#include <sys/ktrace.h>
@@ -173,26 +173,27 @@ freebsd_sys_sigaction4(struct lwp *l, co @@ -173,26 +173,27 @@ freebsd_sys_sigaction4(struct lwp *l, co
173 error = copyin(SCARG(uap, nsa), &nesa, sizeof(nesa)); 173 error = copyin(SCARG(uap, nsa), &nesa, sizeof(nesa));
174 if (error) 174 if (error)
175 return (error); 175 return (error);
176 nbsa.sa_handler = nesa.freebsd_sa_handler; 176 nbsa.sa_handler = nesa.freebsd_sa_handler;
177 nbsa.sa_mask = nesa.freebsd_sa_mask; 177 nbsa.sa_mask = nesa.freebsd_sa_mask;
178 nbsa.sa_flags = nesa.freebsd_sa_flags; 178 nbsa.sa_flags = nesa.freebsd_sa_flags;
179 } 179 }
180 error = sigaction1(l, SCARG(uap, signum), 180 error = sigaction1(l, SCARG(uap, signum),
181 SCARG(uap, nsa) ? &nbsa : 0, SCARG(uap, osa) ? &obsa : 0, 181 SCARG(uap, nsa) ? &nbsa : 0, SCARG(uap, osa) ? &obsa : 0,
182 NULL, 0); 182 NULL, 0);
183 if (error) 183 if (error)
184 return (error); 184 return (error);
185 if (SCARG(uap, osa)) { 185 if (SCARG(uap, osa)) {
 186 memset(&oesa, 0, sizeof(oesa));
186 oesa.freebsd_sa_handler = obsa.sa_handler; 187 oesa.freebsd_sa_handler = obsa.sa_handler;
187 oesa.freebsd_sa_mask = obsa.sa_mask; 188 oesa.freebsd_sa_mask = obsa.sa_mask;
188 oesa.freebsd_sa_flags = obsa.sa_flags; 189 oesa.freebsd_sa_flags = obsa.sa_flags;
189 error = copyout(&oesa, SCARG(uap, osa), sizeof(oesa)); 190 error = copyout(&oesa, SCARG(uap, osa), sizeof(oesa));
190 if (error) 191 if (error)
191 return (error); 192 return (error);
192 } 193 }
193 return (0); 194 return (0);
194} 195}
195 196
196int 197int
197freebsd_sys_utrace(struct lwp *l, const struct freebsd_sys_utrace_args *uap, register_t *retval) 198freebsd_sys_utrace(struct lwp *l, const struct freebsd_sys_utrace_args *uap, register_t *retval)
198{ 199{

cvs diff -r1.22 -r1.22.20.1 src/sys/compat/freebsd/freebsd_sched.c (expand / switch to unified diff)

--- src/sys/compat/freebsd/freebsd_sched.c 2014/06/28 11:06:31 1.22
+++ src/sys/compat/freebsd/freebsd_sched.c 2023/06/21 21:04:02 1.22.20.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: freebsd_sched.c,v 1.22 2014/06/28 11:06:31 maxv Exp $ */ 1/* $NetBSD: freebsd_sched.c,v 1.22.20.1 2023/06/21 21:04:02 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1999 The NetBSD Foundation, Inc. 4 * Copyright (c) 1999 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 * NASA Ames Research Center; by Matthias Scheler. 9 * NASA Ames Research Center; by Matthias Scheler.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -25,27 +25,27 @@ @@ -25,27 +25,27 @@
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE. 30 * POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33/* 33/*
34 * FreeBSD compatibility module. Try to deal with scheduler related syscalls. 34 * FreeBSD compatibility module. Try to deal with scheduler related syscalls.
35 */ 35 */
36 36
37#include <sys/cdefs.h> 37#include <sys/cdefs.h>
38__KERNEL_RCSID(0, "$NetBSD: freebsd_sched.c,v 1.22 2014/06/28 11:06:31 maxv Exp $"); 38__KERNEL_RCSID(0, "$NetBSD: freebsd_sched.c,v 1.22.20.1 2023/06/21 21:04:02 martin Exp $");
39 39
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/mount.h> 41#include <sys/mount.h>
42#include <sys/proc.h> 42#include <sys/proc.h>
43#include <sys/systm.h> 43#include <sys/systm.h>
44#include <sys/syscallargs.h> 44#include <sys/syscallargs.h>
45#include <sys/kauth.h> 45#include <sys/kauth.h>
46 46
47#include <sys/cpu.h> 47#include <sys/cpu.h>
48 48
49#include <compat/freebsd/freebsd_syscallargs.h> 49#include <compat/freebsd/freebsd_syscallargs.h>
50#include <compat/freebsd/freebsd_sched.h> 50#include <compat/freebsd/freebsd_sched.h>
51 51
@@ -112,26 +112,27 @@ sched_native2freebsd(int native_policy,  @@ -112,26 +112,27 @@ sched_native2freebsd(int native_policy,
112 case SCHED_RR: 112 case SCHED_RR:
113 p = FREEBSD_SCHED_RR; 113 p = FREEBSD_SCHED_RR;
114 break; 114 break;
115 115
116 default: 116 default:
117 return EINVAL; 117 return EINVAL;
118 } 118 }
119  119
120 if (freebsd_policy != NULL) 120 if (freebsd_policy != NULL)
121 *freebsd_policy = p; 121 *freebsd_policy = p;
122 122
123 if (native_params != NULL && freebsd_params != NULL) { 123 if (native_params != NULL && freebsd_params != NULL) {
124 /* XXX: Needs adjustment to do a proper conversion. */ 124 /* XXX: Needs adjustment to do a proper conversion. */
 125 memset(freebsd_params, 0, sizeof(*freebsd_params));
125 freebsd_params->sched_priority = native_params->sched_priority; 126 freebsd_params->sched_priority = native_params->sched_priority;
126 } 127 }
127 128
128 return 0; 129 return 0;
129} 130}
130 131
131int 132int
132freebsd_sys_sched_setparam(struct lwp *l, const struct freebsd_sys_sched_setparam_args *uap, register_t *retval) 133freebsd_sys_sched_setparam(struct lwp *l, const struct freebsd_sys_sched_setparam_args *uap, register_t *retval)
133{ 134{
134 /* { 135 /* {
135 syscallarg(pid_t) pid; 136 syscallarg(pid_t) pid;
136 syscallarg(const struct freebsd_sched_param *) sp; 137 syscallarg(const struct freebsd_sched_param *) sp;
137 } */ 138 } */

cvs diff -r1.50 -r1.50.12.1 src/sys/compat/linux/arch/alpha/linux_machdep.c (expand / switch to unified diff)

--- src/sys/compat/linux/arch/alpha/linux_machdep.c 2014/11/09 17:48:07 1.50
+++ src/sys/compat/linux/arch/alpha/linux_machdep.c 2023/06/21 21:04:03 1.50.12.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_machdep.c,v 1.50 2014/11/09 17:48:07 maxv Exp $ */ 1/* $NetBSD: linux_machdep.c,v 1.50.12.1 2023/06/21 21:04:03 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Eric Haszlakiewicz. 8 * by Eric Haszlakiewicz.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -25,27 +25,27 @@ @@ -25,27 +25,27 @@
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 * 30 *
31 * Based on sys/arch/i386/i386/linux_machdep.c: 31 * Based on sys/arch/i386/i386/linux_machdep.c:
32 * linux_machdep.c,v 1.42 1998/09/11 12:50:06 mycroft Exp 32 * linux_machdep.c,v 1.42 1998/09/11 12:50:06 mycroft Exp
33 * written by Frank van der Linden 33 * written by Frank van der Linden
34 * 34 *
35 */ 35 */
36 36
37#include <sys/cdefs.h> 37#include <sys/cdefs.h>
38__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.50 2014/11/09 17:48:07 maxv Exp $"); 38__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.50.12.1 2023/06/21 21:04:03 martin Exp $");
39 39
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/systm.h> 41#include <sys/systm.h>
42#include <sys/signalvar.h> 42#include <sys/signalvar.h>
43#include <sys/kernel.h> 43#include <sys/kernel.h>
44#include <sys/proc.h> 44#include <sys/proc.h>
45#include <sys/buf.h> 45#include <sys/buf.h>
46#include <sys/reboot.h> 46#include <sys/reboot.h>
47#include <sys/conf.h> 47#include <sys/conf.h>
48#include <sys/exec.h> 48#include <sys/exec.h>
49#include <sys/file.h> 49#include <sys/file.h>
50#include <sys/callout.h> 50#include <sys/callout.h>
51#include <sys/mbuf.h> 51#include <sys/mbuf.h>
@@ -129,26 +129,28 @@ setup_linux_rt_sigframe(struct trapframe @@ -129,26 +129,28 @@ setup_linux_rt_sigframe(struct trapframe
129 if (onstack) 129 if (onstack)
130 sfp = (struct linux_rt_sigframe *) 130 sfp = (struct linux_rt_sigframe *)
131 ((char *)l->l_sigstk.ss_sp + l->l_sigstk.ss_size); 131 ((char *)l->l_sigstk.ss_sp + l->l_sigstk.ss_size);
132 else 132 else
133 sfp = (struct linux_rt_sigframe *)(alpha_pal_rdusp()); 133 sfp = (struct linux_rt_sigframe *)(alpha_pal_rdusp());
134 sfp = (struct linux_rt_sigframe *)((char *)sfp - rndfsize); 134 sfp = (struct linux_rt_sigframe *)((char *)sfp - rndfsize);
135 135
136#ifdef DEBUG 136#ifdef DEBUG
137 if ((sigdebug & SDB_KSTACK) && (p->p_pid == sigpid)) 137 if ((sigdebug & SDB_KSTACK) && (p->p_pid == sigpid))
138 printf("linux_sendsig(%d): sig %d ssp %p usp %p\n", p->p_pid, 138 printf("linux_sendsig(%d): sig %d ssp %p usp %p\n", p->p_pid,
139 sig, &onstack, sfp); 139 sig, &onstack, sfp);
140#endif /* DEBUG */ 140#endif /* DEBUG */
141 141
 142 memset(&sigframe, 0, sizeof(sigframe));
 143
142 /* 144 /*
143 * Build the signal context to be used by sigreturn. 145 * Build the signal context to be used by sigreturn.
144 */ 146 */
145 memset(&sigframe.uc, 0, sizeof(struct linux_ucontext)); 147 memset(&sigframe.uc, 0, sizeof(struct linux_ucontext));
146 sigframe.uc.uc_mcontext.sc_onstack = onstack; 148 sigframe.uc.uc_mcontext.sc_onstack = onstack;
147 149
148 /* Setup potentially partial signal mask in sc_mask. */ 150 /* Setup potentially partial signal mask in sc_mask. */
149 /* But get all of it in uc_sigmask */ 151 /* But get all of it in uc_sigmask */
150 native_to_linux_old_sigset(&sigframe.uc.uc_mcontext.sc_mask, mask); 152 native_to_linux_old_sigset(&sigframe.uc.uc_mcontext.sc_mask, mask);
151 native_to_linux_sigset(&sigframe.uc.uc_sigmask, mask); 153 native_to_linux_sigset(&sigframe.uc.uc_sigmask, mask);
152 154
153 sigframe.uc.uc_mcontext.sc_pc = tf->tf_regs[FRAME_PC]; 155 sigframe.uc.uc_mcontext.sc_pc = tf->tf_regs[FRAME_PC];
154 sigframe.uc.uc_mcontext.sc_ps = ALPHA_PSL_USERMODE; 156 sigframe.uc.uc_mcontext.sc_ps = ALPHA_PSL_USERMODE;
@@ -222,26 +224,28 @@ void setup_linux_sigframe(struct trapfra @@ -222,26 +224,28 @@ void setup_linux_sigframe(struct trapfra
222 if (onstack) 224 if (onstack)
223 sfp = (struct linux_sigframe *) 225 sfp = (struct linux_sigframe *)
224 ((char *)l->l_sigstk.ss_sp + l->l_sigstk.ss_size); 226 ((char *)l->l_sigstk.ss_sp + l->l_sigstk.ss_size);
225 else 227 else
226 sfp = (struct linux_sigframe *)(alpha_pal_rdusp()); 228 sfp = (struct linux_sigframe *)(alpha_pal_rdusp());
227 sfp = (struct linux_sigframe *)((char *)sfp - rndfsize); 229 sfp = (struct linux_sigframe *)((char *)sfp - rndfsize);
228 230
229#ifdef DEBUG 231#ifdef DEBUG
230 if ((sigdebug & SDB_KSTACK) && (p->p_pid == sigpid)) 232 if ((sigdebug & SDB_KSTACK) && (p->p_pid == sigpid))
231 printf("linux_sendsig(%d): sig %d ssp %p usp %p\n", p->p_pid, 233 printf("linux_sendsig(%d): sig %d ssp %p usp %p\n", p->p_pid,
232 sig, &onstack, sfp); 234 sig, &onstack, sfp);
233#endif /* DEBUG */ 235#endif /* DEBUG */
234 236
 237 memset(&sigframe, 0, sizeof(sigframe));
 238
235 /* 239 /*
236 * Build the signal context to be used by sigreturn. 240 * Build the signal context to be used by sigreturn.
237 */ 241 */
238 memset(&sigframe.sf_sc, 0, sizeof(struct linux_sigcontext)); 242 memset(&sigframe.sf_sc, 0, sizeof(struct linux_sigcontext));
239 sigframe.sf_sc.sc_onstack = onstack; 243 sigframe.sf_sc.sc_onstack = onstack;
240 native_to_linux_old_sigset(&sigframe.sf_sc.sc_mask, mask); 244 native_to_linux_old_sigset(&sigframe.sf_sc.sc_mask, mask);
241 sigframe.sf_sc.sc_pc = tf->tf_regs[FRAME_PC]; 245 sigframe.sf_sc.sc_pc = tf->tf_regs[FRAME_PC];
242 sigframe.sf_sc.sc_ps = ALPHA_PSL_USERMODE; 246 sigframe.sf_sc.sc_ps = ALPHA_PSL_USERMODE;
243 frametoreg(tf, (struct reg *)sigframe.sf_sc.sc_regs); 247 frametoreg(tf, (struct reg *)sigframe.sf_sc.sc_regs);
244 sigframe.sf_sc.sc_regs[R_SP] = alpha_pal_rdusp(); 248 sigframe.sf_sc.sc_regs[R_SP] = alpha_pal_rdusp();
245 249
246 if (l == fpcurlwp) { 250 if (l == fpcurlwp) {
247 struct pcb *pcb = lwp_getpcb(l); 251 struct pcb *pcb = lwp_getpcb(l);

cvs diff -r1.51.6.3 -r1.51.6.4 src/sys/compat/linux/arch/amd64/linux_machdep.c (expand / switch to unified diff)

--- src/sys/compat/linux/arch/amd64/linux_machdep.c 2020/01/21 18:12:54 1.51.6.3
+++ src/sys/compat/linux/arch/amd64/linux_machdep.c 2023/06/21 21:04:03 1.51.6.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_machdep.c,v 1.51.6.3 2020/01/21 18:12:54 martin Exp $ */ 1/* $NetBSD: linux_machdep.c,v 1.51.6.4 2023/06/21 21:04:03 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved. 4 * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software 14 * 3. All advertising materials mentioning features or use of this software
@@ -23,27 +23,27 @@ @@ -23,27 +23,27 @@
23 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS  24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE. 31 * POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35 35
36__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.51.6.3 2020/01/21 18:12:54 martin Exp $"); 36__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.51.6.4 2023/06/21 21:04:03 martin Exp $");
37 37
38#include <sys/param.h> 38#include <sys/param.h>
39#include <sys/types.h> 39#include <sys/types.h>
40#include <sys/systm.h> 40#include <sys/systm.h>
41#include <sys/signal.h> 41#include <sys/signal.h>
42#include <sys/exec.h> 42#include <sys/exec.h>
43#include <sys/proc.h> 43#include <sys/proc.h>
44#include <sys/ptrace.h> /* for process_read_fpregs() */ 44#include <sys/ptrace.h> /* for process_read_fpregs() */
45#include <sys/ucontext.h> 45#include <sys/ucontext.h>
46#include <sys/conf.h> 46#include <sys/conf.h>
47 47
48#include <machine/reg.h> 48#include <machine/reg.h>
49#include <machine/pcb.h> 49#include <machine/pcb.h>
@@ -215,26 +215,27 @@ linux_sendsig(const ksiginfo_t *ksi, con @@ -215,26 +215,27 @@ linux_sendsig(const ksiginfo_t *ksi, con
215 sigframe.uc.luc_mcontext.fpstate = fpsp; 215 sigframe.uc.luc_mcontext.fpstate = fpsp;
216 native_to_linux_sigset(&sigframe.uc.luc_sigmask, mask); 216 native_to_linux_sigset(&sigframe.uc.luc_sigmask, mask);
217 native_to_linux_siginfo(&sigframe.info, &ksi->ksi_info); 217 native_to_linux_siginfo(&sigframe.info, &ksi->ksi_info);
218 sendsig_reset(l, sig); 218 sendsig_reset(l, sig);
219 mutex_exit(p->p_lock); 219 mutex_exit(p->p_lock);
220 error = 0; 220 error = 0;
221 221
222 /*  222 /*
223 * Save FPU state, if any  223 * Save FPU state, if any
224 */ 224 */
225 if (fpsp != NULL) { 225 if (fpsp != NULL) {
226 size_t fp_size = sizeof fpregs; 226 size_t fp_size = sizeof fpregs;
227 /* The netbsd and linux structures both match the fxsave data */ 227 /* The netbsd and linux structures both match the fxsave data */
 228 memset(&fpregs, 0, sizeof(fpregs));
228 (void)process_read_fpregs(l, &fpregs, &fp_size); 229 (void)process_read_fpregs(l, &fpregs, &fp_size);
229 error = copyout(&fpregs, fpsp, sizeof(*fpsp)); 230 error = copyout(&fpregs, fpsp, sizeof(*fpsp));
230 } 231 }
231 232
232 if (error == 0) 233 if (error == 0)
233 error = copyout(&sigframe, sp, sizeof(sigframe)); 234 error = copyout(&sigframe, sp, sizeof(sigframe));
234 235
235 mutex_enter(p->p_lock); 236 mutex_enter(p->p_lock);
236 237
237 if (error != 0) { 238 if (error != 0) {
238 sigexit(l, SIGILL); 239 sigexit(l, SIGILL);
239 return; 240 return;
240 } 241 }

cvs diff -r1.32 -r1.32.12.1 src/sys/compat/linux/arch/arm/linux_machdep.c (expand / switch to unified diff)

--- src/sys/compat/linux/arch/arm/linux_machdep.c 2014/11/09 17:48:07 1.32
+++ src/sys/compat/linux/arch/arm/linux_machdep.c 2023/06/21 21:04:02 1.32.12.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_machdep.c,v 1.32 2014/11/09 17:48:07 maxv Exp $ */ 1/* $NetBSD: linux_machdep.c,v 1.32.12.1 2023/06/21 21:04:02 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1995, 2000 The NetBSD Foundation, Inc. 4 * Copyright (c) 1995, 2000 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Frank van der Linden. 8 * by Frank van der Linden.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33 33
34__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.32 2014/11/09 17:48:07 maxv Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.32.12.1 2023/06/21 21:04:02 martin Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/signalvar.h> 38#include <sys/signalvar.h>
39#include <sys/kernel.h> 39#include <sys/kernel.h>
40#include <sys/proc.h> 40#include <sys/proc.h>
41#include <sys/buf.h> 41#include <sys/buf.h>
42#include <sys/reboot.h> 42#include <sys/reboot.h>
43#include <sys/conf.h> 43#include <sys/conf.h>
44#include <sys/exec.h> 44#include <sys/exec.h>
45#include <sys/file.h> 45#include <sys/file.h>
46#include <sys/callout.h> 46#include <sys/callout.h>
47#include <sys/mbuf.h> 47#include <sys/mbuf.h>
@@ -97,26 +97,28 @@ linux_sendsig(const ksiginfo_t *ksi, con @@ -97,26 +97,28 @@ linux_sendsig(const ksiginfo_t *ksi, con
97 (l->l_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 && 97 (l->l_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 &&
98 (SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0; 98 (SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0;
99 99
100 /* Allocate space for the signal handler context. */ 100 /* Allocate space for the signal handler context. */
101 if (onstack) 101 if (onstack)
102 fp = (struct linux_sigframe *)((char *)l->l_sigstk.ss_sp + 102 fp = (struct linux_sigframe *)((char *)l->l_sigstk.ss_sp +
103 l->l_sigstk.ss_size); 103 l->l_sigstk.ss_size);
104 else 104 else
105 fp = (struct linux_sigframe *)tf->tf_usr_sp; 105 fp = (struct linux_sigframe *)tf->tf_usr_sp;
106 fp--; 106 fp--;
107 107
108 /* Build stack frame for signal trampoline. */ 108 /* Build stack frame for signal trampoline. */
109 109
 110 memset(&frame, 0, sizeof(frame));
 111
110 /* Save register context. */ 112 /* Save register context. */
111 frame.sf_sc.sc_r0 = tf->tf_r0; 113 frame.sf_sc.sc_r0 = tf->tf_r0;
112 frame.sf_sc.sc_r1 = tf->tf_r1; 114 frame.sf_sc.sc_r1 = tf->tf_r1;
113 frame.sf_sc.sc_r2 = tf->tf_r2; 115 frame.sf_sc.sc_r2 = tf->tf_r2;
114 frame.sf_sc.sc_r3 = tf->tf_r3; 116 frame.sf_sc.sc_r3 = tf->tf_r3;
115 frame.sf_sc.sc_r4 = tf->tf_r4; 117 frame.sf_sc.sc_r4 = tf->tf_r4;
116 frame.sf_sc.sc_r5 = tf->tf_r5; 118 frame.sf_sc.sc_r5 = tf->tf_r5;
117 frame.sf_sc.sc_r6 = tf->tf_r6; 119 frame.sf_sc.sc_r6 = tf->tf_r6;
118 frame.sf_sc.sc_r7 = tf->tf_r7; 120 frame.sf_sc.sc_r7 = tf->tf_r7;
119 frame.sf_sc.sc_r8 = tf->tf_r8; 121 frame.sf_sc.sc_r8 = tf->tf_r8;
120 frame.sf_sc.sc_r9 = tf->tf_r9; 122 frame.sf_sc.sc_r9 = tf->tf_r9;
121 frame.sf_sc.sc_r10 = tf->tf_r10; 123 frame.sf_sc.sc_r10 = tf->tf_r10;
122 frame.sf_sc.sc_r11 = tf->tf_r11; 124 frame.sf_sc.sc_r11 = tf->tf_r11;

cvs diff -r1.19.10.1 -r1.19.10.2 src/sys/compat/linux/arch/arm/linux_ptrace.c (expand / switch to unified diff)

--- src/sys/compat/linux/arch/arm/linux_ptrace.c 2018/04/12 13:42:49 1.19.10.1
+++ src/sys/compat/linux/arch/arm/linux_ptrace.c 2023/06/21 21:04:02 1.19.10.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_ptrace.c,v 1.19.10.1 2018/04/12 13:42:49 martin Exp $ */ 1/* $NetBSD: linux_ptrace.c,v 1.19.10.2 2023/06/21 21:04:02 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1999 The NetBSD Foundation, Inc. 4 * Copyright (c) 1999 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matthias Scheler. 8 * by Matthias Scheler.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.19.10.1 2018/04/12 13:42:49 martin Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.19.10.2 2023/06/21 21:04:02 martin Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/mount.h> 37#include <sys/mount.h>
38#include <sys/proc.h> 38#include <sys/proc.h>
39#include <sys/ptrace.h> 39#include <sys/ptrace.h>
40#include <sys/systm.h> 40#include <sys/systm.h>
41#include <sys/syscallargs.h> 41#include <sys/syscallargs.h>
42#include <uvm/uvm_extern.h> 42#include <uvm/uvm_extern.h>
43 43
44#include <machine/reg.h> 44#include <machine/reg.h>
45#include <machine/pcb.h> 45#include <machine/pcb.h>
46 46
47#include <compat/linux/common/linux_types.h> 47#include <compat/linux/common/linux_types.h>
@@ -170,26 +170,27 @@ linux_sys_ptrace_arch(struct lwp *l, con @@ -170,26 +170,27 @@ linux_sys_ptrace_arch(struct lwp *l, con
170 error = ENOSYS; 170 error = ENOSYS;
171 goto out; 171 goto out;
172 } 172 }
173 lt = LIST_FIRST(&t->p_lwps); 173 lt = LIST_FIRST(&t->p_lwps);
174 *retval = 0; 174 *retval = 0;
175 175
176 switch (request) { 176 switch (request) {
177 case LINUX_PTRACE_GETREGS: 177 case LINUX_PTRACE_GETREGS:
178 error = process_read_regs(lt, regs); 178 error = process_read_regs(lt, regs);
179 mutex_exit(t->p_lock); 179 mutex_exit(t->p_lock);
180 if (error) { 180 if (error) {
181 break; 181 break;
182 } 182 }
 183 memset(linux_regs, 0, sizeof(*linux_regs));
183 memcpy(linux_regs->uregs, regs->r, 13 * sizeof(register_t)); 184 memcpy(linux_regs->uregs, regs->r, 13 * sizeof(register_t));
184 linux_regs->uregs[LINUX_REG_SP] = regs->r_sp; 185 linux_regs->uregs[LINUX_REG_SP] = regs->r_sp;
185 linux_regs->uregs[LINUX_REG_LR] = regs->r_lr; 186 linux_regs->uregs[LINUX_REG_LR] = regs->r_lr;
186 linux_regs->uregs[LINUX_REG_PC] = regs->r_pc; 187 linux_regs->uregs[LINUX_REG_PC] = regs->r_pc;
187 linux_regs->uregs[LINUX_REG_CPSR] = regs->r_cpsr; 188 linux_regs->uregs[LINUX_REG_CPSR] = regs->r_cpsr;
188 linux_regs->uregs[LINUX_REG_ORIG_R0] = regs->r[0]; 189 linux_regs->uregs[LINUX_REG_ORIG_R0] = regs->r[0];
189 190
190 error = copyout(linux_regs, (void *)SCARG(uap, data), 191 error = copyout(linux_regs, (void *)SCARG(uap, data),
191 sizeof(struct linux_reg)); 192 sizeof(struct linux_reg));
192 break; 193 break;
193 194
194 case LINUX_PTRACE_SETREGS: 195 case LINUX_PTRACE_SETREGS:
195 memcpy(regs->r, linux_regs->uregs, 13 * sizeof(register_t)); 196 memcpy(regs->r, linux_regs->uregs, 13 * sizeof(register_t));

cvs diff -r1.163 -r1.163.6.1 src/sys/compat/linux/arch/i386/linux_machdep.c (expand / switch to unified diff)

--- src/sys/compat/linux/arch/i386/linux_machdep.c 2017/02/05 10:42:22 1.163
+++ src/sys/compat/linux/arch/i386/linux_machdep.c 2023/06/21 21:04:01 1.163.6.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_machdep.c,v 1.163 2017/02/05 10:42:22 maxv Exp $ */ 1/* $NetBSD: linux_machdep.c,v 1.163.6.1 2023/06/21 21:04:01 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1995, 2000, 2008, 2009 The NetBSD Foundation, Inc. 4 * Copyright (c) 1995, 2000, 2008, 2009 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Frank van der Linden, and by Andrew Doran. 8 * by Frank van der Linden, and by Andrew Doran.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.163 2017/02/05 10:42:22 maxv Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.163.6.1 2023/06/21 21:04:01 martin Exp $");
34 34
35#if defined(_KERNEL_OPT) 35#if defined(_KERNEL_OPT)
36#include "opt_vm86.h" 36#include "opt_vm86.h"
37#include "opt_user_ldt.h" 37#include "opt_user_ldt.h"
38#endif 38#endif
39 39
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/systm.h> 41#include <sys/systm.h>
42#include <sys/signalvar.h> 42#include <sys/signalvar.h>
43#include <sys/kernel.h> 43#include <sys/kernel.h>
44#include <sys/proc.h> 44#include <sys/proc.h>
45#include <sys/buf.h> 45#include <sys/buf.h>
46#include <sys/reboot.h> 46#include <sys/reboot.h>
@@ -254,26 +254,28 @@ linux_rt_sendsig(const ksiginfo_t *ksi,  @@ -254,26 +254,28 @@ linux_rt_sendsig(const ksiginfo_t *ksi,
254 254
255 /* Allocate space for the signal handler context. */ 255 /* Allocate space for the signal handler context. */
256 if (onstack) 256 if (onstack)
257 fp = (struct linux_rt_sigframe *)((char *)sas->ss_sp + 257 fp = (struct linux_rt_sigframe *)((char *)sas->ss_sp +
258 sas->ss_size); 258 sas->ss_size);
259 else 259 else
260 fp = (struct linux_rt_sigframe *)tf->tf_esp; 260 fp = (struct linux_rt_sigframe *)tf->tf_esp;
261 fp--; 261 fp--;
262 262
263 DPRINTF(("rt: onstack = %d, fp = %p sig = %d eip = 0x%x cr2 = 0x%x\n", 263 DPRINTF(("rt: onstack = %d, fp = %p sig = %d eip = 0x%x cr2 = 0x%x\n",
264 onstack, fp, sig, tf->tf_eip, 264 onstack, fp, sig, tf->tf_eip,
265 ((struct pcb *)lwp_getpcb(l))->pcb_cr2)); 265 ((struct pcb *)lwp_getpcb(l))->pcb_cr2));
266 266
 267 memset(&frame, 0, sizeof(frame));
 268
267 /* Build stack frame for signal trampoline. */ 269 /* Build stack frame for signal trampoline. */
268 frame.sf_handler = catcher; 270 frame.sf_handler = catcher;
269 frame.sf_sig = native_to_linux_signo[sig]; 271 frame.sf_sig = native_to_linux_signo[sig];
270 frame.sf_sip = &fp->sf_si; 272 frame.sf_sip = &fp->sf_si;
271 frame.sf_ucp = &fp->sf_uc; 273 frame.sf_ucp = &fp->sf_uc;
272 274
273 /* 275 /*
274 * XXX: the following code assumes that the constants for 276 * XXX: the following code assumes that the constants for
275 * siginfo are the same between linux and NetBSD. 277 * siginfo are the same between linux and NetBSD.
276 */ 278 */
277 native_to_linux_siginfo(&frame.sf_si, &ksi->ksi_info); 279 native_to_linux_siginfo(&frame.sf_si, &ksi->ksi_info);
278 280
279 /* Save register context. */ 281 /* Save register context. */
@@ -331,26 +333,28 @@ linux_old_sendsig(const ksiginfo_t *ksi, @@ -331,26 +333,28 @@ linux_old_sendsig(const ksiginfo_t *ksi,
331 333
332 /* Allocate space for the signal handler context. */ 334 /* Allocate space for the signal handler context. */
333 if (onstack) 335 if (onstack)
334 fp = (struct linux_sigframe *) ((char *)sas->ss_sp + 336 fp = (struct linux_sigframe *) ((char *)sas->ss_sp +
335 sas->ss_size); 337 sas->ss_size);
336 else 338 else
337 fp = (struct linux_sigframe *)tf->tf_esp; 339 fp = (struct linux_sigframe *)tf->tf_esp;
338 fp--; 340 fp--;
339 341
340 DPRINTF(("old: onstack = %d, fp = %p sig = %d eip = 0x%x cr2 = 0x%x\n", 342 DPRINTF(("old: onstack = %d, fp = %p sig = %d eip = 0x%x cr2 = 0x%x\n",
341 onstack, fp, sig, tf->tf_eip, 343 onstack, fp, sig, tf->tf_eip,
342 ((struct pcb *)lwp_getpcb(l))->pcb_cr2)); 344 ((struct pcb *)lwp_getpcb(l))->pcb_cr2));
343 345
 346 memset(&frame, 0, sizeof(frame));
 347
344 /* Build stack frame for signal trampoline. */ 348 /* Build stack frame for signal trampoline. */
345 frame.sf_handler = catcher; 349 frame.sf_handler = catcher;
346 frame.sf_sig = native_to_linux_signo[sig]; 350 frame.sf_sig = native_to_linux_signo[sig];
347 351
348 linux_save_sigcontext(l, tf, mask, &frame.sf_sc); 352 linux_save_sigcontext(l, tf, mask, &frame.sf_sc);
349 sendsig_reset(l, sig); 353 sendsig_reset(l, sig);
350 354
351 mutex_exit(p->p_lock); 355 mutex_exit(p->p_lock);
352 error = copyout(&frame, fp, sizeof(frame)); 356 error = copyout(&frame, fp, sizeof(frame));
353 mutex_enter(p->p_lock); 357 mutex_enter(p->p_lock);
354 358
355 if (error != 0) { 359 if (error != 0) {
356 /* 360 /*
@@ -856,26 +860,27 @@ linux_machdepioctl(struct lwp *l, const  @@ -856,26 +860,27 @@ linux_machdepioctl(struct lwp *l, const
856 case LINUX_KDDISABIO: 860 case LINUX_KDDISABIO:
857 com = KDDISABIO; 861 com = KDDISABIO;
858 break; 862 break;
859 case LINUX_KDGETLED: 863 case LINUX_KDGETLED:
860 com = KDGETLED; 864 com = KDGETLED;
861 break; 865 break;
862 case LINUX_KDSETLED: 866 case LINUX_KDSETLED:
863 com = KDSETLED; 867 com = KDSETLED;
864 break; 868 break;
865 case LINUX_VT_OPENQRY: 869 case LINUX_VT_OPENQRY:
866 com = VT_OPENQRY; 870 com = VT_OPENQRY;
867 break; 871 break;
868 case LINUX_VT_GETMODE: 872 case LINUX_VT_GETMODE:
 873 memset(&lvt, 0, sizeof(lvt));
869 error = fp->f_ops->fo_ioctl(fp, VT_GETMODE, &lvt); 874 error = fp->f_ops->fo_ioctl(fp, VT_GETMODE, &lvt);
870 if (error != 0) 875 if (error != 0)
871 goto out; 876 goto out;
872 lvt.relsig = native_to_linux_signo[lvt.relsig]; 877 lvt.relsig = native_to_linux_signo[lvt.relsig];
873 lvt.acqsig = native_to_linux_signo[lvt.acqsig]; 878 lvt.acqsig = native_to_linux_signo[lvt.acqsig];
874 lvt.frsig = native_to_linux_signo[lvt.frsig]; 879 lvt.frsig = native_to_linux_signo[lvt.frsig];
875 error = copyout(&lvt, SCARG(uap, data), sizeof (lvt)); 880 error = copyout(&lvt, SCARG(uap, data), sizeof (lvt));
876 goto out; 881 goto out;
877 case LINUX_VT_SETMODE: 882 case LINUX_VT_SETMODE:
878 error = copyin(SCARG(uap, data), &lvt, sizeof (lvt)); 883 error = copyin(SCARG(uap, data), &lvt, sizeof (lvt));
879 if (error != 0) 884 if (error != 0)
880 goto out; 885 goto out;
881 lvt.relsig = linux_to_native_signo[lvt.relsig]; 886 lvt.relsig = linux_to_native_signo[lvt.relsig];
@@ -951,33 +956,35 @@ linux_machdepioctl(struct lwp *l, const  @@ -951,33 +956,35 @@ linux_machdepioctl(struct lwp *l, const
951 sectors = bip->bi_sec; 956 sectors = bip->bi_sec;
952 cylinders = bip->bi_cyl; 957 cylinders = bip->bi_cyl;
953 biostotal = heads * sectors * cylinders; 958 biostotal = heads * sectors * cylinders;
954 realtotal = label.d_ntracks * label.d_nsectors * 959 realtotal = label.d_ntracks * label.d_nsectors *
955 label.d_ncylinders; 960 label.d_ncylinders;
956 if (realtotal > biostotal) 961 if (realtotal > biostotal)
957 cylinders = realtotal / (heads * sectors); 962 cylinders = realtotal / (heads * sectors);
958 } else { 963 } else {
959 heads = label.d_ntracks; 964 heads = label.d_ntracks;
960 cylinders = label.d_ncylinders; 965 cylinders = label.d_ncylinders;
961 sectors = label.d_nsectors; 966 sectors = label.d_nsectors;
962 } 967 }
963 if (com == LINUX_HDIO_GETGEO) { 968 if (com == LINUX_HDIO_GETGEO) {
 969 memset(&hdg, 0, sizeof(hdg));
964 hdg.start = start; 970 hdg.start = start;
965 hdg.heads = heads; 971 hdg.heads = heads;
966 hdg.cylinders = cylinders; 972 hdg.cylinders = cylinders;
967 hdg.sectors = sectors; 973 hdg.sectors = sectors;
968 error = copyout(&hdg, SCARG(uap, data), sizeof hdg); 974 error = copyout(&hdg, SCARG(uap, data), sizeof hdg);
969 goto out; 975 goto out;
970 } else { 976 } else {
 977 memset(&hdg_big, 0, sizeof(hdg_big));
971 hdg_big.start = start; 978 hdg_big.start = start;
972 hdg_big.heads = heads; 979 hdg_big.heads = heads;
973 hdg_big.cylinders = cylinders; 980 hdg_big.cylinders = cylinders;
974 hdg_big.sectors = sectors; 981 hdg_big.sectors = sectors;
975 error = copyout(&hdg_big, SCARG(uap, data), 982 error = copyout(&hdg_big, SCARG(uap, data),
976 sizeof hdg_big); 983 sizeof hdg_big);
977 goto out; 984 goto out;
978 } 985 }
979 986
980 default: 987 default:
981 /* 988 /*
982 * Unknown to us. If it's on a device, just pass it through 989 * Unknown to us. If it's on a device, just pass it through
983 * using PTIOCLINUX, the device itself might be able to 990 * using PTIOCLINUX, the device itself might be able to

cvs diff -r1.31.10.1 -r1.31.10.2 src/sys/compat/linux/arch/i386/linux_ptrace.c (expand / switch to unified diff)

--- src/sys/compat/linux/arch/i386/linux_ptrace.c 2018/04/12 13:42:48 1.31.10.1
+++ src/sys/compat/linux/arch/i386/linux_ptrace.c 2023/06/21 21:04:01 1.31.10.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_ptrace.c,v 1.31.10.1 2018/04/12 13:42:48 martin Exp $ */ 1/* $NetBSD: linux_ptrace.c,v 1.31.10.2 2023/06/21 21:04:01 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1999 The NetBSD Foundation, Inc. 4 * Copyright (c) 1999 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matthias Scheler. 8 * by Matthias Scheler.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.31.10.1 2018/04/12 13:42:48 martin Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.31.10.2 2023/06/21 21:04:01 martin Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/mount.h> 36#include <sys/mount.h>
37#include <sys/proc.h> 37#include <sys/proc.h>
38#include <sys/ptrace.h> 38#include <sys/ptrace.h>
39#include <sys/systm.h> 39#include <sys/systm.h>
40#include <sys/syscall.h> 40#include <sys/syscall.h>
41#include <sys/syscallargs.h> 41#include <sys/syscallargs.h>
42#include <uvm/uvm_extern.h> 42#include <uvm/uvm_extern.h>
43 43
44#include <machine/reg.h> 44#include <machine/reg.h>
45 45
46#include <compat/linux/common/linux_types.h> 46#include <compat/linux/common/linux_types.h>
@@ -213,26 +213,27 @@ linux_sys_ptrace_arch(struct lwp *l, con @@ -213,26 +213,27 @@ linux_sys_ptrace_arch(struct lwp *l, con
213 error = ENOSYS; 213 error = ENOSYS;
214 goto out; 214 goto out;
215 } 215 }
216 lt = LIST_FIRST(&t->p_lwps); 216 lt = LIST_FIRST(&t->p_lwps);
217 *retval = 0; 217 *retval = 0;
218 218
219 switch (request) { 219 switch (request) {
220 case LINUX_PTRACE_GETREGS: 220 case LINUX_PTRACE_GETREGS:
221 error = process_read_regs(lt, regs); 221 error = process_read_regs(lt, regs);
222 mutex_exit(t->p_lock); 222 mutex_exit(t->p_lock);
223 if (error) { 223 if (error) {
224 break; 224 break;
225 } 225 }
 226 memset(linux_regs, 0, sizeof(*linux_regs));
226 linux_regs->ebx = regs->r_ebx; 227 linux_regs->ebx = regs->r_ebx;
227 linux_regs->ecx = regs->r_ecx; 228 linux_regs->ecx = regs->r_ecx;
228 linux_regs->edx = regs->r_edx; 229 linux_regs->edx = regs->r_edx;
229 linux_regs->esi = regs->r_esi; 230 linux_regs->esi = regs->r_esi;
230 linux_regs->edi = regs->r_edi; 231 linux_regs->edi = regs->r_edi;
231 linux_regs->ebp = regs->r_ebp; 232 linux_regs->ebp = regs->r_ebp;
232 linux_regs->eax = regs->r_eax; 233 linux_regs->eax = regs->r_eax;
233 linux_regs->xds = regs->r_ds; 234 linux_regs->xds = regs->r_ds;
234 linux_regs->xes = regs->r_es; 235 linux_regs->xes = regs->r_es;
235 linux_regs->orig_eax = regs->r_eax; /* XXX is this correct? */ 236 linux_regs->orig_eax = regs->r_eax; /* XXX is this correct? */
236 linux_regs->eip = regs->r_cs + regs->r_eip; 237 linux_regs->eip = regs->r_cs + regs->r_eip;
237 linux_regs->xcs = regs->r_cs; 238 linux_regs->xcs = regs->r_cs;
238 linux_regs->eflags = regs->r_eflags; 239 linux_regs->eflags = regs->r_eflags;

cvs diff -r1.42 -r1.42.52.1 src/sys/compat/linux/arch/m68k/linux_machdep.c (expand / switch to unified diff)

--- src/sys/compat/linux/arch/m68k/linux_machdep.c 2010/07/07 01:30:34 1.42
+++ src/sys/compat/linux/arch/m68k/linux_machdep.c 2023/06/21 21:04:03 1.42.52.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_machdep.c,v 1.42 2010/07/07 01:30:34 chs Exp $ */ 1/* $NetBSD: linux_machdep.c,v 1.42.52.1 2023/06/21 21:04:03 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by ITOH Yasufumi. 8 * by ITOH Yasufumi.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.42 2010/07/07 01:30:34 chs Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.42.52.1 2023/06/21 21:04:03 martin Exp $");
34 34
35#define COMPAT_LINUX 1 35#define COMPAT_LINUX 1
36 36
37#include <sys/param.h> 37#include <sys/param.h>
38#include <sys/systm.h> 38#include <sys/systm.h>
39#include <sys/kernel.h> 39#include <sys/kernel.h>
40#include <sys/proc.h> 40#include <sys/proc.h>
41#include <sys/exec.h> 41#include <sys/exec.h>
42#include <sys/ioctl.h> 42#include <sys/ioctl.h>
43#include <sys/mount.h> 43#include <sys/mount.h>
44#include <sys/signal.h> 44#include <sys/signal.h>
45#include <sys/signalvar.h> 45#include <sys/signalvar.h>
46#include <sys/syscallargs.h> 46#include <sys/syscallargs.h>
@@ -108,26 +108,28 @@ setup_linux_sigframe(struct frame *frame @@ -108,26 +108,28 @@ setup_linux_sigframe(struct frame *frame
108 108
109 ft = frame->f_format; 109 ft = frame->f_format;
110 110
111 /* Allocate space for the signal handler context on the user stack. */ 111 /* Allocate space for the signal handler context on the user stack. */
112 fp = (struct linux_sigframe *) usp; 112 fp = (struct linux_sigframe *) usp;
113 fp--; 113 fp--;
114 114
115#ifdef DEBUG 115#ifdef DEBUG
116 if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) 116 if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
117 printf("setup_linux_sigframe(%d): sig %d ssp %p usp %p scp %p ft %d\n", 117 printf("setup_linux_sigframe(%d): sig %d ssp %p usp %p scp %p ft %d\n",
118 p->p_pid, sig, &ft, fp, &fp->sf_c.c_sc, ft); 118 p->p_pid, sig, &ft, fp, &fp->sf_c.c_sc, ft);
119#endif 119#endif
120 120
 121 memset(&kf, 0, sizeof(kf));
 122
121 /* Build stack frame. */ 123 /* Build stack frame. */
122 kf.sf_psigtramp = fp->sf_sigtramp; /* return addr for handler */ 124 kf.sf_psigtramp = fp->sf_sigtramp; /* return addr for handler */
123 kf.sf_signum = native_to_linux_signo[sig]; 125 kf.sf_signum = native_to_linux_signo[sig];
124 kf.sf_code = frame->f_vector; /* Does anyone use it? */ 126 kf.sf_code = frame->f_vector; /* Does anyone use it? */
125 kf.sf_scp = &fp->sf_c.c_sc; 127 kf.sf_scp = &fp->sf_c.c_sc;
126 128
127 /* The sigtramp code is on the stack frame on Linux/m68k. */ 129 /* The sigtramp code is on the stack frame on Linux/m68k. */
128 kf.sf_sigtramp[0] = LINUX_SF_SIGTRAMP0; 130 kf.sf_sigtramp[0] = LINUX_SF_SIGTRAMP0;
129 kf.sf_sigtramp[1] = LINUX_SF_SIGTRAMP1; 131 kf.sf_sigtramp[1] = LINUX_SF_SIGTRAMP1;
130 132
131 /* 133 /*
132 * Save necessary hardware state. Currently this includes: 134 * Save necessary hardware state. Currently this includes:
133 * - scratch registers 135 * - scratch registers
@@ -270,26 +272,28 @@ setup_linux_rt_sigframe(struct frame *fr @@ -270,26 +272,28 @@ setup_linux_rt_sigframe(struct frame *fr
270 272
271 ft = frame->f_format; 273 ft = frame->f_format;
272 274
273 /* Allocate space for the signal handler context on the user stack. */ 275 /* Allocate space for the signal handler context on the user stack. */
274 fp = (struct linux_rt_sigframe *) usp; 276 fp = (struct linux_rt_sigframe *) usp;
275 fp--; 277 fp--;
276 278
277#ifdef DEBUG 279#ifdef DEBUG
278 if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) 280 if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
279 printf("setup_linux_rt_sigframe(%d): sig %d ssp %p usp %p ucp %p ft %d\n", 281 printf("setup_linux_rt_sigframe(%d): sig %d ssp %p usp %p ucp %p ft %d\n",
280 p->p_pid, sig, &ft, fp, &fp->sf_uc, ft); 282 p->p_pid, sig, &ft, fp, &fp->sf_uc, ft);
281#endif 283#endif
282 284
 285 memset(&kf, 0, sizeof(kf));
 286
283 /* Build stack frame. */ 287 /* Build stack frame. */
284 kf.sf_psigtramp = fp->sf_sigtramp; /* return addr for handler */ 288 kf.sf_psigtramp = fp->sf_sigtramp; /* return addr for handler */
285 kf.sf_signum = native_to_linux_signo[sig]; 289 kf.sf_signum = native_to_linux_signo[sig];
286 kf.sf_pinfo = &fp->sf_info; 290 kf.sf_pinfo = &fp->sf_info;
287 kf.sf_puc = &fp->sf_uc; 291 kf.sf_puc = &fp->sf_uc;
288 292
289 /* The sigtramp code is on the stack frame on Linux/m68k. */ 293 /* The sigtramp code is on the stack frame on Linux/m68k. */
290 kf.sf_sigtramp[0] = LINUX_RT_SF_SIGTRAMP0; 294 kf.sf_sigtramp[0] = LINUX_RT_SF_SIGTRAMP0;
291 kf.sf_sigtramp[1] = LINUX_RT_SF_SIGTRAMP1; 295 kf.sf_sigtramp[1] = LINUX_RT_SF_SIGTRAMP1;
292 296
293 /* clear for security (and initialize uc_flags, ss_format, etc.). */ 297 /* clear for security (and initialize uc_flags, ss_format, etc.). */
294 memset(&kf.sf_uc, 0, sizeof(struct linux_ucontext)); 298 memset(&kf.sf_uc, 0, sizeof(struct linux_ucontext));
295 299

cvs diff -r1.43 -r1.43.12.1 src/sys/compat/linux/arch/mips/linux_machdep.c (expand / switch to unified diff)

--- src/sys/compat/linux/arch/mips/linux_machdep.c 2014/11/09 17:48:07 1.43
+++ src/sys/compat/linux/arch/mips/linux_machdep.c 2023/06/21 21:04:02 1.43.12.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_machdep.c,v 1.43 2014/11/09 17:48:07 maxv Exp $ */ 1/* $NetBSD: linux_machdep.c,v 1.43.12.1 2023/06/21 21:04:02 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1995, 2000, 2001 The NetBSD Foundation, Inc. 4 * Copyright (c) 1995, 2000, 2001 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Frank van der Linden and Emmanuel Dreyfus. 8 * by Frank van der Linden and Emmanuel Dreyfus.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.43 2014/11/09 17:48:07 maxv Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.43.12.1 2023/06/21 21:04:02 martin Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/systm.h> 36#include <sys/systm.h>
37#include <sys/signalvar.h> 37#include <sys/signalvar.h>
38#include <sys/kernel.h> 38#include <sys/kernel.h>
39#include <sys/proc.h> 39#include <sys/proc.h>
40#include <sys/buf.h> 40#include <sys/buf.h>
41#include <sys/reboot.h> 41#include <sys/reboot.h>
42#include <sys/conf.h> 42#include <sys/conf.h>
43#include <sys/exec.h> 43#include <sys/exec.h>
44#include <sys/file.h> 44#include <sys/file.h>
45#include <sys/callout.h> 45#include <sys/callout.h>
46#include <sys/mbuf.h> 46#include <sys/mbuf.h>
@@ -391,26 +391,27 @@ linux_sys_ioperm(struct lwp *l, const st @@ -391,26 +391,27 @@ linux_sys_ioperm(struct lwp *l, const st
391int 391int
392linux_sys_new_uname(struct lwp *l, const struct linux_sys_new_uname_args *uap, register_t *retval) 392linux_sys_new_uname(struct lwp *l, const struct linux_sys_new_uname_args *uap, register_t *retval)
393{ 393{
394/* 394/*
395 * Use this if you want to try Linux emulation with a glibc-2.2 395 * Use this if you want to try Linux emulation with a glibc-2.2
396 * or higher. Note that signals will not work 396 * or higher. Note that signals will not work
397 */ 397 */
398#if 0 398#if 0
399 struct linux_sys_uname_args /* { 399 struct linux_sys_uname_args /* {
400 syscallarg(struct linux_utsname *) up; 400 syscallarg(struct linux_utsname *) up;
401 } */ *uap = v; 401 } */ *uap = v;
402 struct linux_utsname luts; 402 struct linux_utsname luts;
403 403
 404 memset(&luts, 0, sizeof(luts));
404 strlcpy(luts.l_sysname, linux_sysname, sizeof(luts.l_sysname)); 405 strlcpy(luts.l_sysname, linux_sysname, sizeof(luts.l_sysname));
405 strlcpy(luts.l_nodename, hostname, sizeof(luts.l_nodename)); 406 strlcpy(luts.l_nodename, hostname, sizeof(luts.l_nodename));
406 strlcpy(luts.l_release, "2.4.0", sizeof(luts.l_release)); 407 strlcpy(luts.l_release, "2.4.0", sizeof(luts.l_release));
407 strlcpy(luts.l_version, linux_version, sizeof(luts.l_version)); 408 strlcpy(luts.l_version, linux_version, sizeof(luts.l_version));
408 strlcpy(luts.l_machine, machine, sizeof(luts.l_machine)); 409 strlcpy(luts.l_machine, machine, sizeof(luts.l_machine));
409 strlcpy(luts.l_domainname, domainname, sizeof(luts.l_domainname)); 410 strlcpy(luts.l_domainname, domainname, sizeof(luts.l_domainname));
410 411
411 return copyout(&luts, SCARG(uap, up), sizeof(luts)); 412 return copyout(&luts, SCARG(uap, up), sizeof(luts));
412#else 413#else
413 return linux_sys_uname(l, (const void *)uap, retval); 414 return linux_sys_uname(l, (const void *)uap, retval);
414#endif 415#endif
415} 416}
416 417

cvs diff -r1.24 -r1.24.32.1 src/sys/compat/linux/arch/powerpc/linux_exec_powerpc.c (expand / switch to unified diff)

--- src/sys/compat/linux/arch/powerpc/linux_exec_powerpc.c 2012/02/21 18:10:00 1.24
+++ src/sys/compat/linux/arch/powerpc/linux_exec_powerpc.c 2023/06/21 21:04:02 1.24.32.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_exec_powerpc.c,v 1.24 2012/02/21 18:10:00 rjs Exp $ */ 1/* $NetBSD: linux_exec_powerpc.c,v 1.24.32.1 2023/06/21 21:04:02 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2001 The NetBSD Foundation, Inc. 4 * Copyright (c) 2001 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Emmanuel Dreyfus. 8 * by Emmanuel Dreyfus.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -31,27 +31,27 @@ @@ -31,27 +31,27 @@
31 31
32/* 32/*
33 * From NetBSD's sys/compat/arch/alpha/linux_exec_alpha.c, with some 33 * From NetBSD's sys/compat/arch/alpha/linux_exec_alpha.c, with some
34 * powerpc add-ons (ifdef LINUX_SHIFT). 34 * powerpc add-ons (ifdef LINUX_SHIFT).
35 * 35 *
36 * This code is to be common to alpha and powerpc. If it works on alpha, it 36 * This code is to be common to alpha and powerpc. If it works on alpha, it
37 * should be moved to common/linux_exec_elf32.c. Beware that it needs 37 * should be moved to common/linux_exec_elf32.c. Beware that it needs
38 * LINUX_ELF_AUX_ENTRIES in arch/<arch>/linux_exec.h to also be moved to common 38 * LINUX_ELF_AUX_ENTRIES in arch/<arch>/linux_exec.h to also be moved to common
39 * 39 *
40 * Emmanuel Dreyfus <p99dreyf@criens.u-psud.fr> 40 * Emmanuel Dreyfus <p99dreyf@criens.u-psud.fr>
41 */ 41 */
42 42
43#include <sys/cdefs.h> 43#include <sys/cdefs.h>
44__KERNEL_RCSID(0, "$NetBSD: linux_exec_powerpc.c,v 1.24 2012/02/21 18:10:00 rjs Exp $"); 44__KERNEL_RCSID(0, "$NetBSD: linux_exec_powerpc.c,v 1.24.32.1 2023/06/21 21:04:02 martin Exp $");
45 45
46#define ELFSIZE 32 46#define ELFSIZE 32
47 47
48#include <sys/param.h> 48#include <sys/param.h>
49#include <sys/systm.h> 49#include <sys/systm.h>
50#include <sys/kernel.h> 50#include <sys/kernel.h>
51#include <sys/proc.h> 51#include <sys/proc.h>
52#include <sys/exec.h> 52#include <sys/exec.h>
53#include <sys/exec_elf.h> 53#include <sys/exec_elf.h>
54#include <sys/resourcevar.h> 54#include <sys/resourcevar.h>
55#include <sys/kauth.h> 55#include <sys/kauth.h>
56 56
57#include <uvm/uvm_extern.h> 57#include <uvm/uvm_extern.h>
@@ -83,27 +83,27 @@ ELFNAME2(linux,copyargs)(struct lwp *l,  @@ -83,27 +83,27 @@ ELFNAME2(linux,copyargs)(struct lwp *l,
83 if ((error = copyargs(l, pack, arginfo, stackp, argp)) != 0) 83 if ((error = copyargs(l, pack, arginfo, stackp, argp)) != 0)
84 return error; 84 return error;
85 85
86#ifdef LINUX_SHIFT 86#ifdef LINUX_SHIFT
87 /* 87 /*
88 * From Linux's arch/ppc/kernel/process.c:shove_aux_table(). GNU ld.so 88 * From Linux's arch/ppc/kernel/process.c:shove_aux_table(). GNU ld.so
89 * expects the ELF auxiliary table to start on a 16 bytes boundary on 89 * expects the ELF auxiliary table to start on a 16 bytes boundary on
90 * the PowerPC. 90 * the PowerPC.
91 */ 91 */
92 *stackp = (char *)(((unsigned long)(*stackp) + LINUX_SHIFT) 92 *stackp = (char *)(((unsigned long)(*stackp) + LINUX_SHIFT)
93 & ~LINUX_SHIFT); 93 & ~LINUX_SHIFT);
94#endif 94#endif
95 95
96 memset(ai, 0, sizeof(AuxInfo) * LINUX_ELF_AUX_ENTRIES); 96 memset(ai, 0, sizeof(ai));
97 97
98 a = ai; 98 a = ai;
99 99
100 /* 100 /*
101 * Push extra arguments on the stack needed by dynamically 101 * Push extra arguments on the stack needed by dynamically
102 * linked binaries. 102 * linked binaries.
103 */ 103 */
104 if ((ap = (struct elf_args *)pack->ep_emul_arg)) { 104 if ((ap = (struct elf_args *)pack->ep_emul_arg)) {
105#if 1 105#if 1
106 /* 106 /*
107 * The exec_package doesn't have a proc pointer and it's not 107 * The exec_package doesn't have a proc pointer and it's not
108 * exactly trivial to add one since the credentials are 108 * exactly trivial to add one since the credentials are
109 * changing. XXX Linux uses curlwp's credentials. 109 * changing. XXX Linux uses curlwp's credentials.

cvs diff -r1.50 -r1.50.2.1 src/sys/compat/linux/arch/powerpc/linux_machdep.c (expand / switch to unified diff)

--- src/sys/compat/linux/arch/powerpc/linux_machdep.c 2017/05/03 00:23:42 1.50
+++ src/sys/compat/linux/arch/powerpc/linux_machdep.c 2023/06/21 21:04:02 1.50.2.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_machdep.c,v 1.50 2017/05/03 00:23:42 chs Exp $ */ 1/* $NetBSD: linux_machdep.c,v 1.50.2.1 2023/06/21 21:04:02 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1995, 2000, 2001 The NetBSD Foundation, Inc. 4 * Copyright (c) 1995, 2000, 2001 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Frank van der Linden and Emmanuel Dreyfus. 8 * by Frank van der Linden and Emmanuel Dreyfus.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.50 2017/05/03 00:23:42 chs Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.50.2.1 2023/06/21 21:04:02 martin Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/systm.h> 36#include <sys/systm.h>
37#include <sys/signalvar.h> 37#include <sys/signalvar.h>
38#include <sys/kernel.h> 38#include <sys/kernel.h>
39#include <sys/proc.h> 39#include <sys/proc.h>
40#include <sys/buf.h> 40#include <sys/buf.h>
41#include <sys/reboot.h> 41#include <sys/reboot.h>
42#include <sys/conf.h> 42#include <sys/conf.h>
43#include <sys/exec.h> 43#include <sys/exec.h>
44#include <sys/file.h> 44#include <sys/file.h>
45#include <sys/callout.h> 45#include <sys/callout.h>
46#include <sys/mbuf.h> 46#include <sys/mbuf.h>
@@ -152,26 +152,27 @@ linux_sendsig(const ksiginfo_t *ksi, con @@ -152,26 +152,27 @@ linux_sendsig(const ksiginfo_t *ksi, con
152 */ 152 */
153 memset(&sc, 0, sizeof sc); 153 memset(&sc, 0, sizeof sc);
154 sc.lsignal = (int)native_to_linux_signo[sig]; 154 sc.lsignal = (int)native_to_linux_signo[sig];
155 sc.lhandler = (unsigned long)catcher; 155 sc.lhandler = (unsigned long)catcher;
156 native_to_linux_old_extra_sigset(&sc.lmask, &sc._unused[3], mask); 156 native_to_linux_old_extra_sigset(&sc.lmask, &sc._unused[3], mask);
157 sc.lregs = (struct linux_pt_regs*)fp; 157 sc.lregs = (struct linux_pt_regs*)fp;
158 158
159 /* 159 /*
160 * Setup the signal stack frame as Linux does it in 160 * Setup the signal stack frame as Linux does it in
161 * arch/ppc/kernel/signal.c:setup_frame() 161 * arch/ppc/kernel/signal.c:setup_frame()
162 * 162 *
163 * Save register context. 163 * Save register context.
164 */ 164 */
 165 memset(&linux_regs, 0, sizeof(linux_regs));
165 for (i = 0; i < 32; i++) 166 for (i = 0; i < 32; i++)
166 linux_regs.lgpr[i] = tf->tf_fixreg[i]; 167 linux_regs.lgpr[i] = tf->tf_fixreg[i];
167 linux_regs.lnip = tf->tf_srr0; 168 linux_regs.lnip = tf->tf_srr0;
168 linux_regs.lmsr = tf->tf_srr1 & PSL_USERSRR1; 169 linux_regs.lmsr = tf->tf_srr1 & PSL_USERSRR1;
169 linux_regs.lorig_gpr3 = tf->tf_fixreg[3]; /* XXX Is that right? */ 170 linux_regs.lorig_gpr3 = tf->tf_fixreg[3]; /* XXX Is that right? */
170 linux_regs.lctr = tf->tf_ctr; 171 linux_regs.lctr = tf->tf_ctr;
171 linux_regs.llink = tf->tf_lr; 172 linux_regs.llink = tf->tf_lr;
172 linux_regs.lxer = tf->tf_xer; 173 linux_regs.lxer = tf->tf_xer;
173 linux_regs.lccr = tf->tf_cr; 174 linux_regs.lccr = tf->tf_cr;
174 linux_regs.lmq = 0; /* Unused, 601 only */ 175 linux_regs.lmq = 0; /* Unused, 601 only */
175 linux_regs.ltrap = tf->tf_exc; 176 linux_regs.ltrap = tf->tf_exc;
176 linux_regs.ldar = tf->tf_dar; 177 linux_regs.ldar = tf->tf_dar;
177 linux_regs.ldsisr = tf->tf_dsisr; 178 linux_regs.ldsisr = tf->tf_dsisr;

cvs diff -r1.29.10.1 -r1.29.10.2 src/sys/compat/linux/arch/powerpc/linux_ptrace.c (expand / switch to unified diff)

--- src/sys/compat/linux/arch/powerpc/linux_ptrace.c 2018/04/12 13:42:49 1.29.10.1
+++ src/sys/compat/linux/arch/powerpc/linux_ptrace.c 2023/06/21 21:04:02 1.29.10.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_ptrace.c,v 1.29.10.1 2018/04/12 13:42:49 martin Exp $ */ 1/* $NetBSD: linux_ptrace.c,v 1.29.10.2 2023/06/21 21:04:02 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc. 4 * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matthias Scheler and Emmanuel Dreyfus. 8 * by Matthias Scheler and Emmanuel Dreyfus.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.29.10.1 2018/04/12 13:42:49 martin Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.29.10.2 2023/06/21 21:04:02 martin Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/mount.h> 36#include <sys/mount.h>
37#include <sys/proc.h> 37#include <sys/proc.h>
38#include <sys/ptrace.h> 38#include <sys/ptrace.h>
39#include <sys/systm.h> 39#include <sys/systm.h>
40#include <sys/syscallargs.h> 40#include <sys/syscallargs.h>
41#include <uvm/uvm_extern.h> 41#include <uvm/uvm_extern.h>
42 42
43#include <machine/reg.h> 43#include <machine/reg.h>
44 44
45#include <compat/linux/common/linux_types.h> 45#include <compat/linux/common/linux_types.h>
46#include <compat/linux/common/linux_ptrace.h> 46#include <compat/linux/common/linux_ptrace.h>
@@ -190,26 +190,27 @@ linux_sys_ptrace_arch(struct lwp *l, con @@ -190,26 +190,27 @@ linux_sys_ptrace_arch(struct lwp *l, con
190 error = ENOSYS; 190 error = ENOSYS;
191 goto out; 191 goto out;
192 } 192 }
193 lt = LIST_FIRST(&t->p_lwps); 193 lt = LIST_FIRST(&t->p_lwps);
194 *retval = 0; 194 *retval = 0;
195 195
196 switch (request) { 196 switch (request) {
197 case LINUX_PTRACE_GETREGS: 197 case LINUX_PTRACE_GETREGS:
198 error = process_read_regs(lt, regs); 198 error = process_read_regs(lt, regs);
199 mutex_exit(t->p_lock); 199 mutex_exit(t->p_lock);
200 if (error) { 200 if (error) {
201 break; 201 break;
202 } 202 }
 203 memset(linux_regs, 0, sizeof(*linux_regs));
203 for (i = 0; i <= 31; i++) { 204 for (i = 0; i <= 31; i++) {
204 linux_regs->lgpr[i] = regs->fixreg[i]; 205 linux_regs->lgpr[i] = regs->fixreg[i];
205 } 206 }
206 linux_regs->lnip = regs->pc; 207 linux_regs->lnip = regs->pc;
207 linux_regs->lmsr = 0; 208 linux_regs->lmsr = 0;
208 /* XXX Is that right? */ 209 /* XXX Is that right? */
209 linux_regs->lorig_gpr3 = regs->fixreg[3]; 210 linux_regs->lorig_gpr3 = regs->fixreg[3];
210 linux_regs->lctr = regs->ctr; 211 linux_regs->lctr = regs->ctr;
211 linux_regs->llink = regs->lr; 212 linux_regs->llink = regs->lr;
212 linux_regs->lxer = regs->xer; 213 linux_regs->lxer = regs->xer;
213 linux_regs->lccr = regs->cr; 214 linux_regs->lccr = regs->cr;
214 linux_regs->lmq = 0; 215 linux_regs->lmq = 0;
215 linux_regs->ltrap = 0; 216 linux_regs->ltrap = 0;
@@ -299,27 +300,27 @@ linux_sys_ptrace_arch(struct lwp *l, con @@ -299,27 +300,27 @@ linux_sys_ptrace_arch(struct lwp *l, con
299 error = 1; 300 error = 1;
300 else if (addr == LUSR_OFF(u_comm)) 301 else if (addr == LUSR_OFF(u_comm))
301 error = 1; 302 error = 1;
302 else { 303 else {
303#ifdef DEBUG_LINUX 304#ifdef DEBUG_LINUX
304 printf("linux_ptrace: unsupported address: %d\n", addr); 305 printf("linux_ptrace: unsupported address: %d\n", addr);
305#endif 306#endif
306 error = 1; 307 error = 1;
307 } 308 }
308 if (error) { 309 if (error) {
309 break; 310 break;
310 } 311 }
311 error = copyout (retval, (void *)SCARG(uap, data), 312 error = copyout (retval, (void *)SCARG(uap, data),
312 sizeof(retval)); 313 sizeof(*retval));
313 *retval = SCARG(uap, data); 314 *retval = SCARG(uap, data);
314 break; 315 break;
315 316
316 case LINUX_PTRACE_POKEUSR: /* XXX Not tested */ 317 case LINUX_PTRACE_POKEUSR: /* XXX Not tested */
317 addr = SCARG(uap, addr); 318 addr = SCARG(uap, addr);
318 error = process_read_regs(lt, regs); 319 error = process_read_regs(lt, regs);
319 if (error) { 320 if (error) {
320 mutex_exit(t->p_lock); 321 mutex_exit(t->p_lock);
321 break; 322 break;
322 } 323 }
323 error = 0; 324 error = 0;
324 if ((addr < LUSR_OFF(lusr_startgdb)) || 325 if ((addr < LUSR_OFF(lusr_startgdb)) ||
325 (addr > LUSR_OFF(lu_comm_end))) 326 (addr > LUSR_OFF(lu_comm_end)))

cvs diff -r1.27 -r1.27.80.1 src/sys/compat/linux/common/linux_cdrom.c (expand / switch to unified diff)

--- src/sys/compat/linux/common/linux_cdrom.c 2008/04/28 20:23:43 1.27
+++ src/sys/compat/linux/common/linux_cdrom.c 2023/06/21 21:04:02 1.27.80.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_cdrom.c,v 1.27 2008/04/28 20:23:43 martin Exp $ */ 1/* $NetBSD: linux_cdrom.c,v 1.27.80.1 2023/06/21 21:04:02 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: linux_cdrom.c,v 1.27 2008/04/28 20:23:43 martin Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: linux_cdrom.c,v 1.27.80.1 2023/06/21 21:04:02 martin Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/systm.h> 33#include <sys/systm.h>
34#include <sys/ioctl.h> 34#include <sys/ioctl.h>
35#include <sys/file.h> 35#include <sys/file.h>
36#include <sys/filedesc.h> 36#include <sys/filedesc.h>
37#include <sys/mount.h> 37#include <sys/mount.h>
38#include <sys/proc.h> 38#include <sys/proc.h>
39#include <sys/cdio.h> 39#include <sys/cdio.h>
40#include <sys/dvdio.h> 40#include <sys/dvdio.h>
41#include <sys/malloc.h> 41#include <sys/malloc.h>
42 42
43#include <sys/syscallargs.h> 43#include <sys/syscallargs.h>
@@ -176,26 +176,27 @@ linux_ioctl_cdrom(struct lwp *l, const s @@ -176,26 +176,27 @@ linux_ioctl_cdrom(struct lwp *l, const s
176 t_track.start_track = l_ti.cdti_trk0; 176 t_track.start_track = l_ti.cdti_trk0;
177 t_track.start_index = l_ti.cdti_ind0; 177 t_track.start_index = l_ti.cdti_ind0;
178 t_track.end_track = l_ti.cdti_trk1; 178 t_track.end_track = l_ti.cdti_trk1;
179 t_track.end_index = l_ti.cdti_ind1; 179 t_track.end_index = l_ti.cdti_ind1;
180 180
181 error = ioctlf(fp, CDIOCPLAYTRACKS, &t_track); 181 error = ioctlf(fp, CDIOCPLAYTRACKS, &t_track);
182 break; 182 break;
183 183
184 case LINUX_CDROMREADTOCHDR: 184 case LINUX_CDROMREADTOCHDR:
185 error = ioctlf(fp, CDIOREADTOCHEADER, &t_header); 185 error = ioctlf(fp, CDIOREADTOCHEADER, &t_header);
186 if (error) 186 if (error)
187 break; 187 break;
188 188
 189 memset(&l_tochdr, 0, sizeof(l_tochdr));
189 l_tochdr.cdth_trk0 = t_header.starting_track; 190 l_tochdr.cdth_trk0 = t_header.starting_track;
190 l_tochdr.cdth_trk1 = t_header.ending_track; 191 l_tochdr.cdth_trk1 = t_header.ending_track;
191 192
192 error = copyout(&l_tochdr, SCARG(uap, data), sizeof l_tochdr); 193 error = copyout(&l_tochdr, SCARG(uap, data), sizeof l_tochdr);
193 break; 194 break;
194 195
195 case LINUX_CDROMREADTOCENTRY: 196 case LINUX_CDROMREADTOCENTRY:
196 error = copyin(SCARG(uap, data), &l_tocentry, 197 error = copyin(SCARG(uap, data), &l_tocentry,
197 sizeof l_tocentry); 198 sizeof l_tocentry);
198 if (error) 199 if (error)
199 break; 200 break;
200 201
201 t_toc_entry.req.address_format = l_tocentry.cdte_format; 202 t_toc_entry.req.address_format = l_tocentry.cdte_format;
@@ -228,26 +229,27 @@ linux_ioctl_cdrom(struct lwp *l, const s @@ -228,26 +229,27 @@ linux_ioctl_cdrom(struct lwp *l, const s
228 t_vol.vol[0] = l_volctrl.channel0; 229 t_vol.vol[0] = l_volctrl.channel0;
229 t_vol.vol[1] = l_volctrl.channel1; 230 t_vol.vol[1] = l_volctrl.channel1;
230 t_vol.vol[2] = l_volctrl.channel2; 231 t_vol.vol[2] = l_volctrl.channel2;
231 t_vol.vol[3] = l_volctrl.channel3; 232 t_vol.vol[3] = l_volctrl.channel3;
232 233
233 error = ioctlf(fp, CDIOCSETVOL, &t_vol); 234 error = ioctlf(fp, CDIOCSETVOL, &t_vol);
234 break; 235 break;
235 236
236 case LINUX_CDROMVOLREAD: 237 case LINUX_CDROMVOLREAD:
237 error = ioctlf(fp, CDIOCGETVOL, &t_vol); 238 error = ioctlf(fp, CDIOCGETVOL, &t_vol);
238 if (error) 239 if (error)
239 break; 240 break;
240 241
 242 memset(&l_volctrl, 0, sizeof(l_volctrl));
241 l_volctrl.channel0 = t_vol.vol[0]; 243 l_volctrl.channel0 = t_vol.vol[0];
242 l_volctrl.channel1 = t_vol.vol[1]; 244 l_volctrl.channel1 = t_vol.vol[1];
243 l_volctrl.channel2 = t_vol.vol[2]; 245 l_volctrl.channel2 = t_vol.vol[2];
244 l_volctrl.channel3 = t_vol.vol[3]; 246 l_volctrl.channel3 = t_vol.vol[3];
245 247
246 error = copyout(&l_volctrl, SCARG(uap, data), sizeof l_volctrl); 248 error = copyout(&l_volctrl, SCARG(uap, data), sizeof l_volctrl);
247 break; 249 break;
248 250
249 case LINUX_CDROMSUBCHNL: 251 case LINUX_CDROMSUBCHNL:
250 error = copyin(SCARG(uap, data), &l_subchnl, sizeof l_subchnl); 252 error = copyin(SCARG(uap, data), &l_subchnl, sizeof l_subchnl);
251 if (error) 253 if (error)
252 break; 254 break;
253 255

cvs diff -r1.13 -r1.13.84.1 src/sys/compat/linux/common/linux_fdio.c (expand / switch to unified diff)

--- src/sys/compat/linux/common/linux_fdio.c 2008/03/21 21:54:58 1.13
+++ src/sys/compat/linux/common/linux_fdio.c 2023/06/21 21:04:02 1.13.84.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_fdio.c,v 1.13 2008/03/21 21:54:58 ad Exp $ */ 1/* $NetBSD: linux_fdio.c,v 1.13.84.1 2023/06/21 21:04:02 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000 Wasabi Systems, Inc. 4 * Copyright (c) 2000 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Frank van der Linden for Wasabi Systems, Inc. 7 * Written by Frank van der Linden for Wasabi Systems, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -26,27 +26,27 @@ @@ -26,27 +26,27 @@
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE. 35 * POSSIBILITY OF SUCH DAMAGE.
36 */ 36 */
37 37
38#include <sys/cdefs.h> 38#include <sys/cdefs.h>
39__KERNEL_RCSID(0, "$NetBSD: linux_fdio.c,v 1.13 2008/03/21 21:54:58 ad Exp $"); 39__KERNEL_RCSID(0, "$NetBSD: linux_fdio.c,v 1.13.84.1 2023/06/21 21:04:02 martin Exp $");
40 40
41#include <sys/param.h> 41#include <sys/param.h>
42#include <sys/systm.h> 42#include <sys/systm.h>
43#include <sys/ioctl.h> 43#include <sys/ioctl.h>
44#include <sys/file.h> 44#include <sys/file.h>
45#include <sys/filedesc.h> 45#include <sys/filedesc.h>
46#include <sys/mount.h> 46#include <sys/mount.h>
47#include <sys/proc.h> 47#include <sys/proc.h>
48#include <sys/disklabel.h> 48#include <sys/disklabel.h>
49 49
50#include <sys/fdio.h> 50#include <sys/fdio.h>
51 51
52#include <sys/syscallargs.h> 52#include <sys/syscallargs.h>
@@ -97,26 +97,27 @@ linux_ioctl_fdio(struct lwp *l, const st @@ -97,26 +97,27 @@ linux_ioctl_fdio(struct lwp *l, const st
97 * Just fill in some innocent defaults. 97 * Just fill in some innocent defaults.
98 */ 98 */
99 memset(&ldrive, 0, sizeof ldrive); 99 memset(&ldrive, 0, sizeof ldrive);
100 ldrive.fd_ref = 1; 100 ldrive.fd_ref = 1;
101 ldrive.maxblock = 2; 101 ldrive.maxblock = 2;
102 ldrive.maxtrack = ldrive.track = 1; 102 ldrive.maxtrack = ldrive.track = 1;
103 ldrive.flags = LINUX_FD_DISK_WRITABLE; 103 ldrive.flags = LINUX_FD_DISK_WRITABLE;
104 error = copyout(&ldrive, SCARG(uap, data), sizeof ldrive); 104 error = copyout(&ldrive, SCARG(uap, data), sizeof ldrive);
105 break; 105 break;
106 case LINUX_FDGETPRM: 106 case LINUX_FDGETPRM:
107 error = ioctlf(fp, FDIOCGETFORMAT, &fparams); 107 error = ioctlf(fp, FDIOCGETFORMAT, &fparams);
108 if (error != 0) 108 if (error != 0)
109 break; 109 break;
 110 memset(&lflop, 0, sizeof(lflop));
110 lflop.size = fparams.ncyl * fparams.nspt * fparams.ntrk; 111 lflop.size = fparams.ncyl * fparams.nspt * fparams.ntrk;
111 lflop.sect = fparams.nspt; 112 lflop.sect = fparams.nspt;
112 lflop.head = fparams.ntrk; 113 lflop.head = fparams.ntrk;
113 lflop.track = fparams.ncyl; 114 lflop.track = fparams.ncyl;
114 lflop.stretch = fparams.stepspercyl == 2 ? 1 : 0; 115 lflop.stretch = fparams.stepspercyl == 2 ? 1 : 0;
115 lflop.fmt_gap = fparams.gaplen; 116 lflop.fmt_gap = fparams.gaplen;
116 /* 117 /*
117 * XXXX Use knowledge of floppy for these fields. 118 * XXXX Use knowledge of floppy for these fields.
118 * FDIOCGETFORMAT does not provide enough information. 119 * FDIOCGETFORMAT does not provide enough information.
119 * It would be better to have FDIOCGETFORMAT return more 120 * It would be better to have FDIOCGETFORMAT return more
120 * information. 121 * information.
121 */ 122 */
122 switch (fparams.xfer_rate) { 123 switch (fparams.xfer_rate) {

cvs diff -r1.115 -r1.115.10.1 src/sys/compat/linux/common/linux_file.c (expand / switch to unified diff)

--- src/sys/compat/linux/common/linux_file.c 2015/03/01 13:19:39 1.115
+++ src/sys/compat/linux/common/linux_file.c 2023/06/21 21:04:02 1.115.10.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_file.c,v 1.115 2015/03/01 13:19:39 njoly Exp $ */ 1/* $NetBSD: linux_file.c,v 1.115.10.1 2023/06/21 21:04:02 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Frank van der Linden and Eric Haszlakiewicz. 8 * by Frank van der Linden and Eric Haszlakiewicz.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -25,27 +25,27 @@ @@ -25,27 +25,27 @@
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32/* 32/*
33 * Functions in multiarch: 33 * Functions in multiarch:
34 * linux_sys_llseek : linux_llseek.c 34 * linux_sys_llseek : linux_llseek.c
35 */ 35 */
36 36
37#include <sys/cdefs.h> 37#include <sys/cdefs.h>
38__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.115 2015/03/01 13:19:39 njoly Exp $"); 38__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.115.10.1 2023/06/21 21:04:02 martin Exp $");
39 39
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/systm.h> 41#include <sys/systm.h>
42#include <sys/namei.h> 42#include <sys/namei.h>
43#include <sys/proc.h> 43#include <sys/proc.h>
44#include <sys/file.h> 44#include <sys/file.h>
45#include <sys/fcntl.h> 45#include <sys/fcntl.h>
46#include <sys/stat.h> 46#include <sys/stat.h>
47#include <sys/filedesc.h> 47#include <sys/filedesc.h>
48#include <sys/ioctl.h> 48#include <sys/ioctl.h>
49#include <sys/kernel.h> 49#include <sys/kernel.h>
50#include <sys/mount.h> 50#include <sys/mount.h>
51#include <sys/namei.h> 51#include <sys/namei.h>
@@ -435,26 +435,27 @@ linux_sys_fcntl(struct lwp *l, const str @@ -435,26 +435,27 @@ linux_sys_fcntl(struct lwp *l, const str
435#if !defined(__amd64__) 435#if !defined(__amd64__)
436/* 436/*
437 * Convert a NetBSD stat structure to a Linux stat structure. 437 * Convert a NetBSD stat structure to a Linux stat structure.
438 * Only the order of the fields and the padding in the structure 438 * Only the order of the fields and the padding in the structure
439 * is different. linux_fakedev is a machine-dependent function 439 * is different. linux_fakedev is a machine-dependent function
440 * which optionally converts device driver major/minor numbers 440 * which optionally converts device driver major/minor numbers
441 * (XXX horrible, but what can you do against code that compares 441 * (XXX horrible, but what can you do against code that compares
442 * things against constant major device numbers? sigh) 442 * things against constant major device numbers? sigh)
443 */ 443 */
444static void 444static void
445bsd_to_linux_stat(struct stat *bsp, struct linux_stat *lsp) 445bsd_to_linux_stat(struct stat *bsp, struct linux_stat *lsp)
446{ 446{
447 447
 448 memset(lsp, 0, sizeof(*lsp));
448 lsp->lst_dev = linux_fakedev(bsp->st_dev, 0); 449 lsp->lst_dev = linux_fakedev(bsp->st_dev, 0);
449 lsp->lst_ino = bsp->st_ino; 450 lsp->lst_ino = bsp->st_ino;
450 lsp->lst_mode = (linux_mode_t)bsp->st_mode; 451 lsp->lst_mode = (linux_mode_t)bsp->st_mode;
451 if (bsp->st_nlink >= (1 << 15)) 452 if (bsp->st_nlink >= (1 << 15))
452 lsp->lst_nlink = (1 << 15) - 1; 453 lsp->lst_nlink = (1 << 15) - 1;
453 else 454 else
454 lsp->lst_nlink = (linux_nlink_t)bsp->st_nlink; 455 lsp->lst_nlink = (linux_nlink_t)bsp->st_nlink;
455 lsp->lst_uid = bsp->st_uid; 456 lsp->lst_uid = bsp->st_uid;
456 lsp->lst_gid = bsp->st_gid; 457 lsp->lst_gid = bsp->st_gid;
457 lsp->lst_rdev = linux_fakedev(bsp->st_rdev, 1); 458 lsp->lst_rdev = linux_fakedev(bsp->st_rdev, 1);
458 lsp->lst_size = bsp->st_size; 459 lsp->lst_size = bsp->st_size;
459 lsp->lst_blksize = bsp->st_blksize; 460 lsp->lst_blksize = bsp->st_blksize;
460 lsp->lst_blocks = bsp->st_blocks; 461 lsp->lst_blocks = bsp->st_blocks;

cvs diff -r1.17 -r1.17.10.1 src/sys/compat/linux/common/linux_hdio.c (expand / switch to unified diff)

--- src/sys/compat/linux/common/linux_hdio.c 2015/12/08 20:36:14 1.17
+++ src/sys/compat/linux/common/linux_hdio.c 2023/06/21 21:04:02 1.17.10.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_hdio.c,v 1.17 2015/12/08 20:36:14 christos Exp $ */ 1/* $NetBSD: linux_hdio.c,v 1.17.10.1 2023/06/21 21:04:02 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000 Wasabi Systems, Inc. 4 * Copyright (c) 2000 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Frank van der Linden for Wasabi Systems, Inc. 7 * Written by Frank van der Linden for Wasabi Systems, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -26,27 +26,27 @@ @@ -26,27 +26,27 @@
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE. 35 * POSSIBILITY OF SUCH DAMAGE.
36 */ 36 */
37 37
38#include <sys/cdefs.h> 38#include <sys/cdefs.h>
39__KERNEL_RCSID(0, "$NetBSD: linux_hdio.c,v 1.17 2015/12/08 20:36:14 christos Exp $"); 39__KERNEL_RCSID(0, "$NetBSD: linux_hdio.c,v 1.17.10.1 2023/06/21 21:04:02 martin Exp $");
40 40
41#include <sys/param.h> 41#include <sys/param.h>
42#include <sys/systm.h> 42#include <sys/systm.h>
43#include <sys/ioctl.h> 43#include <sys/ioctl.h>
44#include <sys/file.h> 44#include <sys/file.h>
45#include <sys/filedesc.h> 45#include <sys/filedesc.h>
46#include <sys/mount.h> 46#include <sys/mount.h>
47#include <sys/proc.h> 47#include <sys/proc.h>
48#include <sys/disklabel.h> 48#include <sys/disklabel.h>
49 49
50#include <dev/ata/atareg.h> 50#include <dev/ata/atareg.h>
51#include <dev/ic/wdcreg.h> 51#include <dev/ic/wdcreg.h>
52#include <sys/ataio.h> 52#include <sys/ataio.h>
@@ -103,43 +103,45 @@ linux_ioctl_hdio(struct lwp *l, const st @@ -103,43 +103,45 @@ linux_ioctl_hdio(struct lwp *l, const st
103 if (req.retsts != ATACMD_OK) 103 if (req.retsts != ATACMD_OK)
104 error = EIO; 104 error = EIO;
105 break; 105 break;
106 case LINUX_HDIO_GETGEO: 106 case LINUX_HDIO_GETGEO:
107 error = linux_machdepioctl(l, uap, retval); 107 error = linux_machdepioctl(l, uap, retval);
108 if (error == 0) 108 if (error == 0)
109 break; 109 break;
110 error = ioctlf(fp, DIOCGDINFO, &label); 110 error = ioctlf(fp, DIOCGDINFO, &label);
111 error1 = ioctlf(fp, DIOCGPARTINFO, &pi); 111 error1 = ioctlf(fp, DIOCGPARTINFO, &pi);
112 if (error != 0 && error1 != 0) { 112 if (error != 0 && error1 != 0) {
113 error = error1; 113 error = error1;
114 break; 114 break;
115 } 115 }
 116 memset(&hdg, 0, sizeof(hdg));
116 hdg.start = error1 != 0 ? pi.pi_offset : 0; 117 hdg.start = error1 != 0 ? pi.pi_offset : 0;
117 hdg.heads = label.d_ntracks; 118 hdg.heads = label.d_ntracks;
118 hdg.cylinders = label.d_ncylinders; 119 hdg.cylinders = label.d_ncylinders;
119 hdg.sectors = label.d_nsectors; 120 hdg.sectors = label.d_nsectors;
120 error = copyout(&hdg, SCARG(uap, data), sizeof hdg); 121 error = copyout(&hdg, SCARG(uap, data), sizeof hdg);
121 break; 122 break;
122 case LINUX_HDIO_GETGEO_BIG: 123 case LINUX_HDIO_GETGEO_BIG:
123 error = linux_machdepioctl(l, uap, retval); 124 error = linux_machdepioctl(l, uap, retval);
124 if (error == 0) 125 if (error == 0)
125 break; 126 break;
126 case LINUX_HDIO_GETGEO_BIG_RAW: 127 case LINUX_HDIO_GETGEO_BIG_RAW:
127 error = ioctlf(fp, DIOCGDINFO, &label); 128 error = ioctlf(fp, DIOCGDINFO, &label);
128 error1 = ioctlf(fp, DIOCGPARTINFO, &pi); 129 error1 = ioctlf(fp, DIOCGPARTINFO, &pi);
129 if (error != 0 && error1 != 0) { 130 if (error != 0 && error1 != 0) {
130 error = error1; 131 error = error1;
131 break; 132 break;
132 } 133 }
 134 memset(&hdg_big, 0, sizeof(hdg_big));
133 hdg_big.start = error1 != 0 ? pi.pi_offset : 0; 135 hdg_big.start = error1 != 0 ? pi.pi_offset : 0;
134 hdg_big.heads = label.d_ntracks; 136 hdg_big.heads = label.d_ntracks;
135 hdg_big.cylinders = label.d_ncylinders; 137 hdg_big.cylinders = label.d_ncylinders;
136 hdg_big.sectors = label.d_nsectors; 138 hdg_big.sectors = label.d_nsectors;
137 error = copyout(&hdg_big, SCARG(uap, data), sizeof hdg_big); 139 error = copyout(&hdg_big, SCARG(uap, data), sizeof hdg_big);
138 break; 140 break;
139 case LINUX_HDIO_GET_UNMASKINTR: 141 case LINUX_HDIO_GET_UNMASKINTR:
140 case LINUX_HDIO_GET_MULTCOUNT: 142 case LINUX_HDIO_GET_MULTCOUNT:
141 case LINUX_HDIO_GET_KEEPSETTINGS: 143 case LINUX_HDIO_GET_KEEPSETTINGS:
142 case LINUX_HDIO_GET_32BIT: 144 case LINUX_HDIO_GET_32BIT:
143 case LINUX_HDIO_GET_NOWERR: 145 case LINUX_HDIO_GET_NOWERR:
144 case LINUX_HDIO_GET_DMA: 146 case LINUX_HDIO_GET_DMA:
145 case LINUX_HDIO_GET_NICE: 147 case LINUX_HDIO_GET_NICE:

cvs diff -r1.238.2.2 -r1.238.2.3 src/sys/compat/linux/common/linux_misc.c (expand / switch to unified diff)

--- src/sys/compat/linux/common/linux_misc.c 2020/01/21 18:12:54 1.238.2.2
+++ src/sys/compat/linux/common/linux_misc.c 2023/06/21 21:04:02 1.238.2.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_misc.c,v 1.238.2.2 2020/01/21 18:12:54 martin Exp $ */ 1/* $NetBSD: linux_misc.c,v 1.238.2.3 2023/06/21 21:04:02 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1995, 1998, 1999, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 1995, 1998, 1999, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Frank van der Linden and Eric Haszlakiewicz; by Jason R. Thorpe 8 * by Frank van der Linden and Eric Haszlakiewicz; by Jason R. Thorpe
9 * of the Numerical Aerospace Simulation Facility, NASA Ames Research Center. 9 * of the Numerical Aerospace Simulation Facility, NASA Ames Research Center.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -47,27 +47,27 @@ @@ -47,27 +47,27 @@
47 * linux_sys_readdir : linux_misc_notalpha.c 47 * linux_sys_readdir : linux_misc_notalpha.c
48 * linux_sys_setresgid : linux_misc_notalpha.c 48 * linux_sys_setresgid : linux_misc_notalpha.c
49 * linux_sys_time : linux_misc_notalpha.c 49 * linux_sys_time : linux_misc_notalpha.c
50 * linux_sys_utime : linux_misc_notalpha.c 50 * linux_sys_utime : linux_misc_notalpha.c
51 * linux_sys_waitpid : linux_misc_notalpha.c 51 * linux_sys_waitpid : linux_misc_notalpha.c
52 * linux_sys_old_mmap : linux_oldmmap.c 52 * linux_sys_old_mmap : linux_oldmmap.c
53 * linux_sys_oldolduname : linux_oldolduname.c 53 * linux_sys_oldolduname : linux_oldolduname.c
54 * linux_sys_oldselect : linux_oldselect.c 54 * linux_sys_oldselect : linux_oldselect.c
55 * linux_sys_olduname : linux_olduname.c 55 * linux_sys_olduname : linux_olduname.c
56 * linux_sys_pipe : linux_pipe.c 56 * linux_sys_pipe : linux_pipe.c
57 */ 57 */
58 58
59#include <sys/cdefs.h> 59#include <sys/cdefs.h>
60__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.238.2.2 2020/01/21 18:12:54 martin Exp $"); 60__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.238.2.3 2023/06/21 21:04:02 martin Exp $");
61 61
62#include <sys/param.h> 62#include <sys/param.h>
63#include <sys/systm.h> 63#include <sys/systm.h>
64#include <sys/namei.h> 64#include <sys/namei.h>
65#include <sys/proc.h> 65#include <sys/proc.h>
66#include <sys/dirent.h> 66#include <sys/dirent.h>
67#include <sys/file.h> 67#include <sys/file.h>
68#include <sys/stat.h> 68#include <sys/stat.h>
69#include <sys/filedesc.h> 69#include <sys/filedesc.h>
70#include <sys/ioctl.h> 70#include <sys/ioctl.h>
71#include <sys/kernel.h> 71#include <sys/kernel.h>
72#include <sys/malloc.h> 72#include <sys/malloc.h>
73#include <sys/mbuf.h> 73#include <sys/mbuf.h>
@@ -618,26 +618,28 @@ int @@ -618,26 +618,28 @@ int
618linux_sys_times(struct lwp *l, const struct linux_sys_times_args *uap, register_t *retval) 618linux_sys_times(struct lwp *l, const struct linux_sys_times_args *uap, register_t *retval)
619{ 619{
620 /* { 620 /* {
621 syscallarg(struct times *) tms; 621 syscallarg(struct times *) tms;
622 } */ 622 } */
623 struct proc *p = l->l_proc; 623 struct proc *p = l->l_proc;
624 struct timeval t; 624 struct timeval t;
625 int error; 625 int error;
626 626
627 if (SCARG(uap, tms)) { 627 if (SCARG(uap, tms)) {
628 struct linux_tms ltms; 628 struct linux_tms ltms;
629 struct rusage ru; 629 struct rusage ru;
630 630
 631 memset(&ltms, 0, sizeof(ltms));
 632
631 mutex_enter(p->p_lock); 633 mutex_enter(p->p_lock);
632 calcru(p, &ru.ru_utime, &ru.ru_stime, NULL, NULL); 634 calcru(p, &ru.ru_utime, &ru.ru_stime, NULL, NULL);
633 ltms.ltms_utime = CONVTCK(ru.ru_utime); 635 ltms.ltms_utime = CONVTCK(ru.ru_utime);
634 ltms.ltms_stime = CONVTCK(ru.ru_stime); 636 ltms.ltms_stime = CONVTCK(ru.ru_stime);
635 ltms.ltms_cutime = CONVTCK(p->p_stats->p_cru.ru_utime); 637 ltms.ltms_cutime = CONVTCK(p->p_stats->p_cru.ru_utime);
636 ltms.ltms_cstime = CONVTCK(p->p_stats->p_cru.ru_stime); 638 ltms.ltms_cstime = CONVTCK(p->p_stats->p_cru.ru_stime);
637 mutex_exit(p->p_lock); 639 mutex_exit(p->p_lock);
638 640
639 if ((error = copyout(&ltms, SCARG(uap, tms), sizeof ltms))) 641 if ((error = copyout(&ltms, SCARG(uap, tms), sizeof ltms)))
640 return error; 642 return error;
641 } 643 }
642 644
643 getmicrouptime(&t); 645 getmicrouptime(&t);
@@ -1382,26 +1384,27 @@ linux_sys_getrlimit(struct lwp *l, const @@ -1382,26 +1384,27 @@ linux_sys_getrlimit(struct lwp *l, const
1382# endif 1384# endif
1383 } */ 1385 } */
1384# ifdef LINUX_LARGEFILE64 1386# ifdef LINUX_LARGEFILE64
1385 struct rlimit orl; 1387 struct rlimit orl;
1386# else 1388# else
1387 struct orlimit orl; 1389 struct orlimit orl;
1388# endif 1390# endif
1389 int which; 1391 int which;
1390 1392
1391 which = linux_to_bsd_limit(SCARG(uap, which)); 1393 which = linux_to_bsd_limit(SCARG(uap, which));
1392 if (which < 0) 1394 if (which < 0)
1393 return -which; 1395 return -which;
1394 1396
 1397 memset(&orl, 0, sizeof(orl));
1395 bsd_to_linux_rlimit(&orl, &l->l_proc->p_rlimit[which]); 1398 bsd_to_linux_rlimit(&orl, &l->l_proc->p_rlimit[which]);
1396 1399
1397 return copyout(&orl, SCARG(uap, rlp), sizeof(orl)); 1400 return copyout(&orl, SCARG(uap, rlp), sizeof(orl));
1398} 1401}
1399 1402
1400int 1403int
1401linux_sys_setrlimit(struct lwp *l, const struct linux_sys_setrlimit_args *uap, register_t *retval) 1404linux_sys_setrlimit(struct lwp *l, const struct linux_sys_setrlimit_args *uap, register_t *retval)
1402{ 1405{
1403 /* { 1406 /* {
1404 syscallarg(int) which; 1407 syscallarg(int) which;
1405# ifdef LINUX_LARGEFILE64 1408# ifdef LINUX_LARGEFILE64
1406 syscallarg(struct rlimit *) rlp; 1409 syscallarg(struct rlimit *) rlp;
1407# else 1410# else

cvs diff -r1.7 -r1.7.84.1 src/sys/compat/linux/common/linux_mtio.c (expand / switch to unified diff)

--- src/sys/compat/linux/common/linux_mtio.c 2008/03/21 21:54:58 1.7
+++ src/sys/compat/linux/common/linux_mtio.c 2023/06/21 21:04:02 1.7.84.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_mtio.c,v 1.7 2008/03/21 21:54:58 ad Exp $ */ 1/* $NetBSD: linux_mtio.c,v 1.7.84.1 2023/06/21 21:04:02 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2005 Soren S. Jorvang. All rights reserved. 4 * Copyright (c) 2005 Soren S. Jorvang. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions, and the following disclaimer. 10 * notice, this list of conditions, and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -16,27 +16,27 @@ @@ -16,27 +16,27 @@
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE. 25 * SUCH DAMAGE.
26 */ 26 */
27 27
28#include <sys/cdefs.h> 28#include <sys/cdefs.h>
29__KERNEL_RCSID(0, "$NetBSD: linux_mtio.c,v 1.7 2008/03/21 21:54:58 ad Exp $"); 29__KERNEL_RCSID(0, "$NetBSD: linux_mtio.c,v 1.7.84.1 2023/06/21 21:04:02 martin Exp $");
30 30
31#include <sys/param.h> 31#include <sys/param.h>
32#include <sys/systm.h> 32#include <sys/systm.h>
33#include <sys/ioctl.h> 33#include <sys/ioctl.h>
34#include <sys/file.h> 34#include <sys/file.h>
35#include <sys/filedesc.h> 35#include <sys/filedesc.h>
36#include <sys/mount.h> 36#include <sys/mount.h>
37#include <sys/proc.h> 37#include <sys/proc.h>
38 38
39#include <sys/mtio.h> 39#include <sys/mtio.h>
40 40
41#include <sys/syscallargs.h> 41#include <sys/syscallargs.h>
42 42
@@ -96,26 +96,27 @@ linux_ioctl_mtio(struct lwp *l, const st @@ -96,26 +96,27 @@ linux_ioctl_mtio(struct lwp *l, const st
96 break; 96 break;
97 } 97 }
98 98
99 if (mtop_map[i].lop == -1) { 99 if (mtop_map[i].lop == -1) {
100 error = EINVAL; 100 error = EINVAL;
101 break; 101 break;
102 } 102 }
103  103
104 mt.mt_op = mtop_map[i].op; 104 mt.mt_op = mtop_map[i].op;
105 mt.mt_count = lmtop.mt_count; 105 mt.mt_count = lmtop.mt_count;
106 error = ioctlf(fp, MTIOCTOP, &mt); 106 error = ioctlf(fp, MTIOCTOP, &mt);
107 break; 107 break;
108 case LINUX_MTIOCGET: 108 case LINUX_MTIOCGET:
 109 memset(&lmtget, 0, sizeof(lmtget));
109 lmtget.mt_type = LINUX_MT_ISUNKNOWN; 110 lmtget.mt_type = LINUX_MT_ISUNKNOWN;
110 lmtget.mt_resid = 0; 111 lmtget.mt_resid = 0;
111 lmtget.mt_dsreg = 0; 112 lmtget.mt_dsreg = 0;
112 lmtget.mt_gstat = 0; 113 lmtget.mt_gstat = 0;
113 lmtget.mt_erreg = 0; 114 lmtget.mt_erreg = 0;
114 lmtget.mt_fileno = 0; 115 lmtget.mt_fileno = 0;
115 lmtget.mt_blkno = 0; 116 lmtget.mt_blkno = 0;
116 error = copyout(&lmtget, SCARG(uap, data), sizeof lmtget); 117 error = copyout(&lmtget, SCARG(uap, data), sizeof lmtget);
117 break; 118 break;
118 case LINUX_MTIOCPOS: 119 case LINUX_MTIOCPOS:
119 default: 120 default:
120 printf("linux_mtio unsupported ioctl 0x%lx\n", com); 121 printf("linux_mtio unsupported ioctl 0x%lx\n", com);
121 error = ENODEV; 122 error = ENODEV;

cvs diff -r1.66 -r1.66.80.1 src/sys/compat/linux/common/linux_oldolduname.c (expand / switch to unified diff)

--- src/sys/compat/linux/common/linux_oldolduname.c 2008/04/28 20:23:43 1.66
+++ src/sys/compat/linux/common/linux_oldolduname.c 2023/06/21 21:04:02 1.66.80.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_oldolduname.c,v 1.66 2008/04/28 20:23:43 martin Exp $ */ 1/* $NetBSD: linux_oldolduname.c,v 1.66.80.1 2023/06/21 21:04:02 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. 4 * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Frank van der Linden and Eric Haszlakiewicz. 8 * by Frank van der Linden and Eric Haszlakiewicz.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: linux_oldolduname.c,v 1.66 2008/04/28 20:23:43 martin Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: linux_oldolduname.c,v 1.66.80.1 2023/06/21 21:04:02 martin Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/systm.h> 36#include <sys/systm.h>
37#include <sys/kernel.h> 37#include <sys/kernel.h>
38#include <sys/mount.h> 38#include <sys/mount.h>
39 39
40#include <sys/syscallargs.h> 40#include <sys/syscallargs.h>
41 41
42#include <compat/linux/common/linux_types.h> 42#include <compat/linux/common/linux_types.h>
43#include <compat/linux/common/linux_mmap.h> 43#include <compat/linux/common/linux_mmap.h>
44#include <compat/linux/common/linux_signal.h> 44#include <compat/linux/common/linux_signal.h>
45#include <compat/linux/common/linux_oldolduname.h> 45#include <compat/linux/common/linux_oldolduname.h>
46#include <compat/linux/common/linux_machdep.h> 46#include <compat/linux/common/linux_machdep.h>
@@ -48,21 +48,23 @@ __KERNEL_RCSID(0, "$NetBSD: linux_oldold @@ -48,21 +48,23 @@ __KERNEL_RCSID(0, "$NetBSD: linux_oldold
48#include <compat/linux/linux_syscallargs.h> 48#include <compat/linux/linux_syscallargs.h>
49 49
50/* Used on: arm, i386, mips, ppc */ 50/* Used on: arm, i386, mips, ppc */
51/* Not used on: alpha, m68k, sparc, sparc64 */ 51/* Not used on: alpha, m68k, sparc, sparc64 */
52 52
53int 53int
54linux_sys_oldolduname(struct lwp *l, const struct linux_sys_oldolduname_args *uap, register_t *retval) 54linux_sys_oldolduname(struct lwp *l, const struct linux_sys_oldolduname_args *uap, register_t *retval)
55{ 55{
56 /* { 56 /* {
57 syscallarg(struct linux_oldoldutsname *) up; 57 syscallarg(struct linux_oldoldutsname *) up;
58 } */ 58 } */
59 struct linux_oldoldutsname luts; 59 struct linux_oldoldutsname luts;
60 60
 61 memset(&luts, 0, sizeof(luts));
 62
61 strlcpy(luts.l_sysname, linux_sysname, sizeof(luts.l_sysname)); 63 strlcpy(luts.l_sysname, linux_sysname, sizeof(luts.l_sysname));
62 strlcpy(luts.l_nodename, hostname, sizeof(luts.l_nodename)); 64 strlcpy(luts.l_nodename, hostname, sizeof(luts.l_nodename));
63 strlcpy(luts.l_release, linux_release, sizeof(luts.l_release)); 65 strlcpy(luts.l_release, linux_release, sizeof(luts.l_release));
64 strlcpy(luts.l_version, linux_version, sizeof(luts.l_version)); 66 strlcpy(luts.l_version, linux_version, sizeof(luts.l_version));
65 strlcpy(luts.l_machine, LINUX_UNAME_ARCH, sizeof(luts.l_machine)); 67 strlcpy(luts.l_machine, LINUX_UNAME_ARCH, sizeof(luts.l_machine));
66 68
67 return copyout(&luts, SCARG(uap, up), sizeof(luts)); 69 return copyout(&luts, SCARG(uap, up), sizeof(luts));
68} 70}

cvs diff -r1.66 -r1.66.80.1 src/sys/compat/linux/common/linux_olduname.c (expand / switch to unified diff)

--- src/sys/compat/linux/common/linux_olduname.c 2008/04/28 20:23:43 1.66
+++ src/sys/compat/linux/common/linux_olduname.c 2023/06/21 21:04:02 1.66.80.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_olduname.c,v 1.66 2008/04/28 20:23:43 martin Exp $ */ 1/* $NetBSD: linux_olduname.c,v 1.66.80.1 2023/06/21 21:04:02 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. 4 * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Frank van der Linden and Eric Haszlakiewicz. 8 * by Frank van der Linden and Eric Haszlakiewicz.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: linux_olduname.c,v 1.66 2008/04/28 20:23:43 martin Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: linux_olduname.c,v 1.66.80.1 2023/06/21 21:04:02 martin Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/systm.h> 36#include <sys/systm.h>
37#include <sys/kernel.h> 37#include <sys/kernel.h>
38#include <sys/mbuf.h> 38#include <sys/mbuf.h>
39#include <sys/mman.h> 39#include <sys/mman.h>
40#include <sys/mount.h> 40#include <sys/mount.h>
41 41
42#include <sys/syscallargs.h> 42#include <sys/syscallargs.h>
43 43
44#include <compat/linux/common/linux_types.h> 44#include <compat/linux/common/linux_types.h>
45#include <compat/linux/common/linux_mmap.h> 45#include <compat/linux/common/linux_mmap.h>
46#include <compat/linux/common/linux_signal.h> 46#include <compat/linux/common/linux_signal.h>
@@ -51,21 +51,23 @@ __KERNEL_RCSID(0, "$NetBSD: linux_olduna @@ -51,21 +51,23 @@ __KERNEL_RCSID(0, "$NetBSD: linux_olduna
51 51
52/* Used on: (alpha), arm, i386, mips, ppc */ 52/* Used on: (alpha), arm, i386, mips, ppc */
53/* Not used on: sparc */ 53/* Not used on: sparc */
54/* Alpha: XXX Only if we assume osf_utsname is used by Linux programs. */ 54/* Alpha: XXX Only if we assume osf_utsname is used by Linux programs. */
55 55
56int 56int
57linux_sys_olduname(struct lwp *l, const struct linux_sys_olduname_args *uap, register_t *retval) 57linux_sys_olduname(struct lwp *l, const struct linux_sys_olduname_args *uap, register_t *retval)
58{ 58{
59 /* { 59 /* {
60 syscallarg(struct linux_oldutsname *) up; 60 syscallarg(struct linux_oldutsname *) up;
61 } */ 61 } */
62 struct linux_oldutsname luts; 62 struct linux_oldutsname luts;
63 63
 64 memset(&luts, 0, sizeof(luts));
 65
64 strlcpy(luts.l_sysname, linux_sysname, sizeof(luts.l_sysname)); 66 strlcpy(luts.l_sysname, linux_sysname, sizeof(luts.l_sysname));
65 strlcpy(luts.l_nodename, hostname, sizeof(luts.l_nodename)); 67 strlcpy(luts.l_nodename, hostname, sizeof(luts.l_nodename));
66 strlcpy(luts.l_release, linux_release, sizeof(luts.l_release)); 68 strlcpy(luts.l_release, linux_release, sizeof(luts.l_release));
67 strlcpy(luts.l_version, linux_version, sizeof(luts.l_version)); 69 strlcpy(luts.l_version, linux_version, sizeof(luts.l_version));
68 strlcpy(luts.l_machine, LINUX_UNAME_ARCH, sizeof(luts.l_machine)); 70 strlcpy(luts.l_machine, LINUX_UNAME_ARCH, sizeof(luts.l_machine));
69 71
70 return copyout(&luts, SCARG(uap, up), sizeof(luts)); 72 return copyout(&luts, SCARG(uap, up), sizeof(luts));
71} 73}

cvs diff -r1.69 -r1.69.4.1 src/sys/compat/linux/common/linux_sched.c (expand / switch to unified diff)

--- src/sys/compat/linux/common/linux_sched.c 2017/04/21 15:10:34 1.69
+++ src/sys/compat/linux/common/linux_sched.c 2023/06/21 21:04:02 1.69.4.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_sched.c,v 1.69 2017/04/21 15:10:34 christos Exp $ */ 1/* $NetBSD: linux_sched.c,v 1.69.4.1 2023/06/21 21:04:02 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1999 The NetBSD Foundation, Inc. 4 * Copyright (c) 1999 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 * NASA Ames Research Center; by Matthias Scheler. 9 * NASA Ames Research Center; by Matthias Scheler.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -25,27 +25,27 @@ @@ -25,27 +25,27 @@
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE. 30 * POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33/* 33/*
34 * Linux compatibility module. Try to deal with scheduler related syscalls. 34 * Linux compatibility module. Try to deal with scheduler related syscalls.
35 */ 35 */
36 36
37#include <sys/cdefs.h> 37#include <sys/cdefs.h>
38__KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.69 2017/04/21 15:10:34 christos Exp $"); 38__KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.69.4.1 2023/06/21 21:04:02 martin Exp $");
39 39
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/mount.h> 41#include <sys/mount.h>
42#include <sys/proc.h> 42#include <sys/proc.h>
43#include <sys/systm.h> 43#include <sys/systm.h>
44#include <sys/sysctl.h> 44#include <sys/sysctl.h>
45#include <sys/syscallargs.h> 45#include <sys/syscallargs.h>
46#include <sys/wait.h> 46#include <sys/wait.h>
47#include <sys/kauth.h> 47#include <sys/kauth.h>
48#include <sys/ptrace.h> 48#include <sys/ptrace.h>
49#include <sys/atomic.h> 49#include <sys/atomic.h>
50 50
51#include <sys/cpu.h> 51#include <sys/cpu.h>
@@ -371,26 +371,28 @@ sched_native2linux(int native_policy, st @@ -371,26 +371,28 @@ sched_native2linux(int native_policy, st
371 break; 371 break;
372 372
373 default: 373 default:
374 panic("%s: unknown policy %d\n", __func__, native_policy); 374 panic("%s: unknown policy %d\n", __func__, native_policy);
375 } 375 }
376 376
377 if (native_params != NULL) { 377 if (native_params != NULL) {
378 int prio = native_params->sched_priority; 378 int prio = native_params->sched_priority;
379 379
380 KASSERT(prio >= SCHED_PRI_MIN); 380 KASSERT(prio >= SCHED_PRI_MIN);
381 KASSERT(prio <= SCHED_PRI_MAX); 381 KASSERT(prio <= SCHED_PRI_MAX);
382 KASSERT(linux_params != NULL); 382 KASSERT(linux_params != NULL);
383 383
 384 memset(linux_params, 0, sizeof(*linux_params));
 385
384 DPRINTF(("%s: native: policy %d, priority %d\n", 386 DPRINTF(("%s: native: policy %d, priority %d\n",
385 __func__, native_policy, prio)); 387 __func__, native_policy, prio));
386 388
387 if (native_policy == SCHED_OTHER) { 389 if (native_policy == SCHED_OTHER) {
388 linux_params->sched_priority = 0; 390 linux_params->sched_priority = 0;
389 } else { 391 } else {
390 linux_params->sched_priority = 392 linux_params->sched_priority =
391 (prio - SCHED_PRI_MIN) 393 (prio - SCHED_PRI_MIN)
392 * (LINUX_SCHED_RTPRIO_MAX - LINUX_SCHED_RTPRIO_MIN) 394 * (LINUX_SCHED_RTPRIO_MAX - LINUX_SCHED_RTPRIO_MIN)
393 / (SCHED_PRI_MAX - SCHED_PRI_MIN) 395 / (SCHED_PRI_MAX - SCHED_PRI_MIN)
394 + LINUX_SCHED_RTPRIO_MIN; 396 + LINUX_SCHED_RTPRIO_MIN;
395 } 397 }
396 DPRINTF(("%s: linux: policy %d, priority %d\n", 398 DPRINTF(("%s: linux: policy %d, priority %d\n",

cvs diff -r1.79.6.1 -r1.79.6.2 src/sys/compat/linux/common/linux_signal.c (expand / switch to unified diff)

--- src/sys/compat/linux/common/linux_signal.c 2020/01/21 18:12:54 1.79.6.1
+++ src/sys/compat/linux/common/linux_signal.c 2023/06/21 21:04:02 1.79.6.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_signal.c,v 1.79.6.1 2020/01/21 18:12:54 martin Exp $ */ 1/* $NetBSD: linux_signal.c,v 1.79.6.2 2023/06/21 21:04:02 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. 4 * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Frank van der Linden and Eric Haszlakiewicz. 8 * by Frank van der Linden and Eric Haszlakiewicz.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -38,27 +38,27 @@ @@ -38,27 +38,27 @@
38 * linux_sys_siggetmask : linux_sig_notalpha.c 38 * linux_sys_siggetmask : linux_sig_notalpha.c
39 * linux_sys_sigsetmask : linux_sig_notalpha.c 39 * linux_sys_sigsetmask : linux_sig_notalpha.c
40 * linux_sys_pause : linux_sig_notalpha.c 40 * linux_sys_pause : linux_sig_notalpha.c
41 * linux_sys_sigaction : linux_sigaction.c 41 * linux_sys_sigaction : linux_sigaction.c
42 * 42 *
43 */ 43 */
44 44
45/* 45/*
46 * Unimplemented: 46 * Unimplemented:
47 * linux_sys_rt_sigtimedwait : sigsuspend w/timeout. 47 * linux_sys_rt_sigtimedwait : sigsuspend w/timeout.
48 */ 48 */
49 49
50#include <sys/cdefs.h> 50#include <sys/cdefs.h>
51__KERNEL_RCSID(0, "$NetBSD: linux_signal.c,v 1.79.6.1 2020/01/21 18:12:54 martin Exp $"); 51__KERNEL_RCSID(0, "$NetBSD: linux_signal.c,v 1.79.6.2 2023/06/21 21:04:02 martin Exp $");
52 52
53#define COMPAT_LINUX 1 53#define COMPAT_LINUX 1
54 54
55#include <sys/param.h> 55#include <sys/param.h>
56#include <sys/systm.h> 56#include <sys/systm.h>
57#include <sys/namei.h> 57#include <sys/namei.h>
58#include <sys/proc.h> 58#include <sys/proc.h>
59#include <sys/filedesc.h> 59#include <sys/filedesc.h>
60#include <sys/ioctl.h> 60#include <sys/ioctl.h>
61#include <sys/mount.h> 61#include <sys/mount.h>
62#include <sys/kernel.h> 62#include <sys/kernel.h>
63#include <sys/signal.h> 63#include <sys/signal.h>
64#include <sys/signalvar.h> 64#include <sys/signalvar.h>
@@ -264,54 +264,62 @@ linux_to_native_sigflags(const unsigned  @@ -264,54 +264,62 @@ linux_to_native_sigflags(const unsigned
264 if ((lsf & ~LINUX_SA_ALLBITS) != 0) { 264 if ((lsf & ~LINUX_SA_ALLBITS) != 0) {
265 DPRINTF(("linux_old_to_native_sigflags: " 265 DPRINTF(("linux_old_to_native_sigflags: "
266 "%lx extra bits ignored\n", lsf)); 266 "%lx extra bits ignored\n", lsf));
267 } 267 }
268 return bsf; 268 return bsf;
269} 269}
270 270
271/* 271/*
272 * Convert between Linux and BSD sigaction structures. 272 * Convert between Linux and BSD sigaction structures.
273 */ 273 */
274void 274void
275linux_old_to_native_sigaction(struct sigaction *bsa, const struct linux_old_sigaction *lsa) 275linux_old_to_native_sigaction(struct sigaction *bsa, const struct linux_old_sigaction *lsa)
276{ 276{
 277
 278 memset(bsa, 0, sizeof(*bsa));
277 bsa->sa_handler = lsa->linux_sa_handler; 279 bsa->sa_handler = lsa->linux_sa_handler;
278 linux_old_to_native_sigset(&bsa->sa_mask, &lsa->linux_sa_mask); 280 linux_old_to_native_sigset(&bsa->sa_mask, &lsa->linux_sa_mask);
279 bsa->sa_flags = linux_to_native_sigflags(lsa->linux_sa_flags); 281 bsa->sa_flags = linux_to_native_sigflags(lsa->linux_sa_flags);
280} 282}
281 283
282void 284void
283native_to_linux_old_sigaction(struct linux_old_sigaction *lsa, const struct sigaction *bsa) 285native_to_linux_old_sigaction(struct linux_old_sigaction *lsa, const struct sigaction *bsa)
284{ 286{
 287
 288 memset(lsa, 0, sizeof(*lsa));
285 lsa->linux_sa_handler = bsa->sa_handler; 289 lsa->linux_sa_handler = bsa->sa_handler;
286 native_to_linux_old_sigset(&lsa->linux_sa_mask, &bsa->sa_mask); 290 native_to_linux_old_sigset(&lsa->linux_sa_mask, &bsa->sa_mask);
287 lsa->linux_sa_flags = native_to_linux_sigflags(bsa->sa_flags); 291 lsa->linux_sa_flags = native_to_linux_sigflags(bsa->sa_flags);
288#ifndef __alpha__ 292#ifndef __alpha__
289 lsa->linux_sa_restorer = NULL; 293 lsa->linux_sa_restorer = NULL;
290#endif 294#endif
291} 295}
292 296
293/* ...and the new sigaction conversion funcs. */ 297/* ...and the new sigaction conversion funcs. */
294void 298void
295linux_to_native_sigaction(struct sigaction *bsa, const struct linux_sigaction *lsa) 299linux_to_native_sigaction(struct sigaction *bsa, const struct linux_sigaction *lsa)
296{ 300{
 301
 302 memset(bsa, 0, sizeof(*bsa));
297 bsa->sa_handler = lsa->linux_sa_handler; 303 bsa->sa_handler = lsa->linux_sa_handler;
298 linux_to_native_sigset(&bsa->sa_mask, &lsa->linux_sa_mask); 304 linux_to_native_sigset(&bsa->sa_mask, &lsa->linux_sa_mask);
299 bsa->sa_flags = linux_to_native_sigflags(lsa->linux_sa_flags); 305 bsa->sa_flags = linux_to_native_sigflags(lsa->linux_sa_flags);
300} 306}
301 307
302void 308void
303native_to_linux_sigaction(struct linux_sigaction *lsa, const struct sigaction *bsa) 309native_to_linux_sigaction(struct linux_sigaction *lsa, const struct sigaction *bsa)
304{ 310{
 311
 312 memset(lsa, 0, sizeof(*lsa));
305 lsa->linux_sa_handler = bsa->sa_handler; 313 lsa->linux_sa_handler = bsa->sa_handler;
306 native_to_linux_sigset(&lsa->linux_sa_mask, &bsa->sa_mask); 314 native_to_linux_sigset(&lsa->linux_sa_mask, &bsa->sa_mask);
307 lsa->linux_sa_flags = native_to_linux_sigflags(bsa->sa_flags); 315 lsa->linux_sa_flags = native_to_linux_sigflags(bsa->sa_flags);
308#ifndef __alpha__ 316#ifndef __alpha__
309 lsa->linux_sa_restorer = NULL; 317 lsa->linux_sa_restorer = NULL;
310#endif 318#endif
311} 319}
312 320
313/* ----------------------------------------------------------------------- */ 321/* ----------------------------------------------------------------------- */
314 322
315/* 323/*
316 * The Linux sigaction() system call. Do the usual conversions, 324 * The Linux sigaction() system call. Do the usual conversions,
317 * and just call sigaction(). Some flags and values are silently 325 * and just call sigaction(). Some flags and values are silently

cvs diff -r1.138.6.6 -r1.138.6.7 src/sys/compat/linux/common/linux_socket.c (expand / switch to unified diff)

--- src/sys/compat/linux/common/linux_socket.c 2020/07/17 15:28:08 1.138.6.6
+++ src/sys/compat/linux/common/linux_socket.c 2023/06/21 21:04:02 1.138.6.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_socket.c,v 1.138.6.6 2020/07/17 15:28:08 martin Exp $ */ 1/* $NetBSD: linux_socket.c,v 1.138.6.7 2023/06/21 21:04:02 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Frank van der Linden and Eric Haszlakiewicz. 8 * by Frank van der Linden and Eric Haszlakiewicz.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -25,27 +25,27 @@ @@ -25,27 +25,27 @@
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32/* 32/*
33 * Functions in multiarch: 33 * Functions in multiarch:
34 * linux_sys_socketcall : linux_socketcall.c 34 * linux_sys_socketcall : linux_socketcall.c
35 */ 35 */
36 36
37#include <sys/cdefs.h> 37#include <sys/cdefs.h>
38__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.138.6.6 2020/07/17 15:28:08 martin Exp $"); 38__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.138.6.7 2023/06/21 21:04:02 martin Exp $");
39 39
40#if defined(_KERNEL_OPT) 40#if defined(_KERNEL_OPT)
41#include "opt_inet.h" 41#include "opt_inet.h"
42#endif /* defined(_KERNEL_OPT) */ 42#endif /* defined(_KERNEL_OPT) */
43 43
44#include <sys/param.h> 44#include <sys/param.h>
45#include <sys/kernel.h> 45#include <sys/kernel.h>
46#include <sys/systm.h> 46#include <sys/systm.h>
47#include <sys/buf.h> 47#include <sys/buf.h>
48#include <sys/ioctl.h> 48#include <sys/ioctl.h>
49#include <sys/tty.h> 49#include <sys/tty.h>
50#include <sys/file.h> 50#include <sys/file.h>
51#include <sys/filedesc.h> 51#include <sys/filedesc.h>
@@ -445,38 +445,40 @@ linux_sys_sendto(struct lwp *l, const st @@ -445,38 +445,40 @@ linux_sys_sendto(struct lwp *l, const st
445 445
446 msg.msg_iov = &aiov; 446 msg.msg_iov = &aiov;
447 msg.msg_iovlen = 1; 447 msg.msg_iovlen = 1;
448 aiov.iov_base = __UNCONST(SCARG(uap, msg)); 448 aiov.iov_base = __UNCONST(SCARG(uap, msg));
449 aiov.iov_len = SCARG(uap, len); 449 aiov.iov_len = SCARG(uap, len);
450 450
451 return do_sys_sendmsg(l, SCARG(uap, s), &msg, bflags, 451 return do_sys_sendmsg(l, SCARG(uap, s), &msg, bflags,
452 NULL, 0, retval); 452 NULL, 0, retval);
453} 453}
454 454
455static void 455static void
456linux_to_bsd_msghdr(const struct linux_msghdr *lmsg, struct msghdr *bmsg) 456linux_to_bsd_msghdr(const struct linux_msghdr *lmsg, struct msghdr *bmsg)
457{ 457{
 458 memset(bmsg, 0, sizeof(*bmsg));
458 bmsg->msg_name = lmsg->msg_name; 459 bmsg->msg_name = lmsg->msg_name;
459 bmsg->msg_namelen = lmsg->msg_namelen; 460 bmsg->msg_namelen = lmsg->msg_namelen;
460 bmsg->msg_iov = lmsg->msg_iov; 461 bmsg->msg_iov = lmsg->msg_iov;
461 bmsg->msg_iovlen = lmsg->msg_iovlen; 462 bmsg->msg_iovlen = lmsg->msg_iovlen;
462 bmsg->msg_control = lmsg->msg_control; 463 bmsg->msg_control = lmsg->msg_control;
463 bmsg->msg_controllen = lmsg->msg_controllen; 464 bmsg->msg_controllen = lmsg->msg_controllen;
464 bmsg->msg_flags = lmsg->msg_flags; 465 bmsg->msg_flags = lmsg->msg_flags;
465} 466}
466 467
467static void 468static void
468bsd_to_linux_msghdr(const struct msghdr *bmsg, struct linux_msghdr *lmsg) 469bsd_to_linux_msghdr(const struct msghdr *bmsg, struct linux_msghdr *lmsg)
469{ 470{
 471 memset(lmsg, 0, sizeof(*lmsg));
470 lmsg->msg_name = bmsg->msg_name; 472 lmsg->msg_name = bmsg->msg_name;
471 lmsg->msg_namelen = bmsg->msg_namelen; 473 lmsg->msg_namelen = bmsg->msg_namelen;
472 lmsg->msg_iov = bmsg->msg_iov; 474 lmsg->msg_iov = bmsg->msg_iov;
473 lmsg->msg_iovlen = bmsg->msg_iovlen; 475 lmsg->msg_iovlen = bmsg->msg_iovlen;
474 lmsg->msg_control = bmsg->msg_control; 476 lmsg->msg_control = bmsg->msg_control;
475 lmsg->msg_controllen = bmsg->msg_controllen; 477 lmsg->msg_controllen = bmsg->msg_controllen;
476 lmsg->msg_flags = bmsg->msg_flags; 478 lmsg->msg_flags = bmsg->msg_flags;
477} 479}
478 480
479int 481int
480linux_sys_sendmsg(struct lwp *l, const struct linux_sys_sendmsg_args *uap, register_t *retval) 482linux_sys_sendmsg(struct lwp *l, const struct linux_sys_sendmsg_args *uap, register_t *retval)
481{ 483{
482 /* { 484 /* {
@@ -705,26 +707,27 @@ linux_copyout_msg_control(struct lwp *l, @@ -705,26 +707,27 @@ linux_copyout_msg_control(struct lwp *l,
705 707
706 q = (char *)mp->msg_control; 708 q = (char *)mp->msg_control;
707 q_end = q + mp->msg_controllen; 709 q_end = q + mp->msg_controllen;
708 710
709 for (m = control; m != NULL; ) { 711 for (m = control; m != NULL; ) {
710 cmsg = mtod(m, struct cmsghdr *); 712 cmsg = mtod(m, struct cmsghdr *);
711 713
712 /* 714 /*
713 * Fixup cmsg. We handle two things: 715 * Fixup cmsg. We handle two things:
714 * 0. different sizeof cmsg_len. 716 * 0. different sizeof cmsg_len.
715 * 1. different values for level/type on some archs 717 * 1. different values for level/type on some archs
716 * 2. different alignment of CMSG_DATA on some archs 718 * 2. different alignment of CMSG_DATA on some archs
717 */ 719 */
 720 memset(&linux_cmsg, 0, sizeof(linux_cmsg));
718 linux_cmsg.cmsg_len = cmsg->cmsg_len - LINUX_CMSG_ALIGN_DELTA; 721 linux_cmsg.cmsg_len = cmsg->cmsg_len - LINUX_CMSG_ALIGN_DELTA;
719 linux_cmsg.cmsg_level = cmsg->cmsg_level; 722 linux_cmsg.cmsg_level = cmsg->cmsg_level;
720 linux_cmsg.cmsg_type = cmsg->cmsg_type; 723 linux_cmsg.cmsg_type = cmsg->cmsg_type;
721 724
722 dlen = q_end - q; 725 dlen = q_end - q;
723 if (linux_cmsg.cmsg_len > dlen) { 726 if (linux_cmsg.cmsg_len > dlen) {
724 /* Not enough room for the parameter */ 727 /* Not enough room for the parameter */
725 dlen -= sizeof linux_cmsg; 728 dlen -= sizeof linux_cmsg;
726 if (dlen <= 0) 729 if (dlen <= 0)
727 /* Discard if header wont fit */ 730 /* Discard if header wont fit */
728 break; 731 break;
729 mp->msg_flags |= MSG_CTRUNC; 732 mp->msg_flags |= MSG_CTRUNC;
730 if (linux_cmsg.cmsg_level == SOL_SOCKET 733 if (linux_cmsg.cmsg_level == SOL_SOCKET

cvs diff -r1.37.22.1 -r1.37.22.2 src/sys/compat/linux/common/linux_time.c (expand / switch to unified diff)

--- src/sys/compat/linux/common/linux_time.c 2017/08/08 15:59:04 1.37.22.1
+++ src/sys/compat/linux/common/linux_time.c 2023/06/21 21:04:02 1.37.22.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux_time.c,v 1.37.22.1 2017/08/08 15:59:04 martin Exp $ */ 1/* $NetBSD: linux_time.c,v 1.37.22.2 2023/06/21 21:04:02 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2001 The NetBSD Foundation, Inc. 4 * Copyright (c) 2001 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Emmanuel Dreyfus. 8 * by Emmanuel Dreyfus.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.37.22.1 2017/08/08 15:59:04 martin Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.37.22.2 2023/06/21 21:04:02 martin Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/ucred.h> 36#include <sys/ucred.h>
37#include <sys/kauth.h> 37#include <sys/kauth.h>
38#include <sys/mount.h> 38#include <sys/mount.h>
39#include <sys/signal.h> 39#include <sys/signal.h>
40#include <sys/stdint.h> 40#include <sys/stdint.h>
41#include <sys/time.h> 41#include <sys/time.h>
42#include <sys/systm.h> 42#include <sys/systm.h>
43#include <sys/sched.h> 43#include <sys/sched.h>
44#include <sys/syscallargs.h> 44#include <sys/syscallargs.h>
45#include <sys/lwp.h> 45#include <sys/lwp.h>
46#include <sys/proc.h> 46#include <sys/proc.h>
@@ -107,33 +107,35 @@ linux_sys_settimeofday(struct lwp *l, co @@ -107,33 +107,35 @@ linux_sys_settimeofday(struct lwp *l, co
107 KAUTH_GENERIC_ISSUSER, NULL) != 0) 107 KAUTH_GENERIC_ISSUSER, NULL) != 0)
108 return (EPERM); 108 return (EPERM);
109 error = copyin(SCARG(uap, tzp), &linux_sys_tz, sizeof(linux_sys_tz)); 109 error = copyin(SCARG(uap, tzp), &linux_sys_tz, sizeof(linux_sys_tz));
110 if (error) 110 if (error)
111 return (error); 111 return (error);
112 } 112 }
113 113
114 return (0); 114 return (0);
115} 115}
116 116
117void 117void
118native_to_linux_timespec(struct linux_timespec *ltp, struct timespec *ntp) 118native_to_linux_timespec(struct linux_timespec *ltp, struct timespec *ntp)
119{ 119{
 120 memset(ltp, 0, sizeof(*ltp));
120 ltp->tv_sec = ntp->tv_sec; 121 ltp->tv_sec = ntp->tv_sec;
121 ltp->tv_nsec = ntp->tv_nsec; 122 ltp->tv_nsec = ntp->tv_nsec;
122} 123}
123 124
124void 125void
125linux_to_native_timespec(struct timespec *ntp, struct linux_timespec *ltp) 126linux_to_native_timespec(struct timespec *ntp, struct linux_timespec *ltp)
126{ 127{
 128 memset(ntp, 0, sizeof(*ntp));
127 ntp->tv_sec = ltp->tv_sec; 129 ntp->tv_sec = ltp->tv_sec;
128 ntp->tv_nsec = ltp->tv_nsec; 130 ntp->tv_nsec = ltp->tv_nsec;
129} 131}
130 132
131int 133int
132linux_sys_nanosleep(struct lwp *l, const struct linux_sys_nanosleep_args *uap, 134linux_sys_nanosleep(struct lwp *l, const struct linux_sys_nanosleep_args *uap,
133 register_t *retval) 135 register_t *retval)
134{ 136{
135 /* { 137 /* {
136 syscallarg(struct linux_timespec *) rqtp; 138 syscallarg(struct linux_timespec *) rqtp;
137 syscallarg(struct linux_timespec *) rmtp; 139 syscallarg(struct linux_timespec *) rmtp;
138 } */ 140 } */
139 struct timespec rqts, rmts; 141 struct timespec rqts, rmts;

cvs diff -r1.38.6.2 -r1.38.6.3 src/sys/compat/linux32/arch/amd64/linux32_machdep.c (expand / switch to unified diff)

--- src/sys/compat/linux32/arch/amd64/linux32_machdep.c 2019/04/05 07:48:05 1.38.6.2
+++ src/sys/compat/linux32/arch/amd64/linux32_machdep.c 2023/06/21 21:04:03 1.38.6.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux32_machdep.c,v 1.38.6.2 2019/04/05 07:48:05 martin Exp $ */ 1/* $NetBSD: linux32_machdep.c,v 1.38.6.3 2023/06/21 21:04:03 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved. 4 * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software 14 * 3. All advertising materials mentioning features or use of this software
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * THIS SOFTWARE IS PROVIDED BY THE THE AUTHOR AND CONTRIBUTORS ``AS IS''  21 * THIS SOFTWARE IS PROVIDED BY THE THE AUTHOR AND CONTRIBUTORS ``AS IS''
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,  22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS  24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE. 31 * POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: linux32_machdep.c,v 1.38.6.2 2019/04/05 07:48:05 martin Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: linux32_machdep.c,v 1.38.6.3 2023/06/21 21:04:03 martin Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/proc.h> 37#include <sys/proc.h>
38#include <sys/exec.h> 38#include <sys/exec.h>
39 39
40#include <machine/vmparam.h> 40#include <machine/vmparam.h>
41#include <machine/cpufunc.h> 41#include <machine/cpufunc.h>
42#include <machine/netbsd32_machdep.h> 42#include <machine/netbsd32_machdep.h>
43 43
44#include <x86/fpu.h> 44#include <x86/fpu.h>
45 45
46#include <compat/netbsd32/netbsd32.h> 46#include <compat/netbsd32/netbsd32.h>
47#include <compat/netbsd32/netbsd32_syscallargs.h> 47#include <compat/netbsd32/netbsd32_syscallargs.h>
@@ -112,26 +112,28 @@ linux32_old_sendsig(const ksiginfo_t *ks @@ -112,26 +112,28 @@ linux32_old_sendsig(const ksiginfo_t *ks
112 112
113 113
114 /* Allocate space for the signal handler context. */ 114 /* Allocate space for the signal handler context. */
115 if (onstack) 115 if (onstack)
116 fp = (struct linux32_sigframe *)((char *)sas->ss_sp + 116 fp = (struct linux32_sigframe *)((char *)sas->ss_sp +
117 sas->ss_size); 117 sas->ss_size);
118 else 118 else
119 fp = (struct linux32_sigframe *)tf->tf_rsp; 119 fp = (struct linux32_sigframe *)tf->tf_rsp;
120 fp--; 120 fp--;
121 121
122 DPRINTF(("old: onstack = %d, fp = %p sig = %d rip = 0x%lx\n", 122 DPRINTF(("old: onstack = %d, fp = %p sig = %d rip = 0x%lx\n",
123 onstack, fp, sig, tf->tf_rip)); 123 onstack, fp, sig, tf->tf_rip));
124 124
 125 memset(&frame, 0, sizeof(frame));
 126
125 /* Build stack frame for signal trampoline. */ 127 /* Build stack frame for signal trampoline. */
126 NETBSD32PTR32(frame.sf_handler, catcher); 128 NETBSD32PTR32(frame.sf_handler, catcher);
127 frame.sf_sig = native_to_linux32_signo[sig]; 129 frame.sf_sig = native_to_linux32_signo[sig];
128 130
129 linux32_save_sigcontext(l, tf, mask, &frame.sf_sc); 131 linux32_save_sigcontext(l, tf, mask, &frame.sf_sc);
130 132
131 sendsig_reset(l, sig); 133 sendsig_reset(l, sig);
132 mutex_exit(p->p_lock); 134 mutex_exit(p->p_lock);
133 error = copyout(&frame, fp, sizeof(frame)); 135 error = copyout(&frame, fp, sizeof(frame));
134 mutex_enter(p->p_lock); 136 mutex_enter(p->p_lock);
135 137
136 if (error != 0) { 138 if (error != 0) {
137 /* 139 /*

cvs diff -r1.19 -r1.19.8.1 src/sys/compat/linux32/common/linux32_exec_elf32.c (expand / switch to unified diff)

--- src/sys/compat/linux32/common/linux32_exec_elf32.c 2016/08/06 15:13:13 1.19
+++ src/sys/compat/linux32/common/linux32_exec_elf32.c 2023/06/21 21:04:02 1.19.8.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux32_exec_elf32.c,v 1.19 2016/08/06 15:13:13 maxv Exp $ */ 1/* $NetBSD: linux32_exec_elf32.c,v 1.19.8.1 2023/06/21 21:04:02 martin Exp $ */
2 2
3/*-  3/*-
4 * Copyright (c) 1995, 1998, 2000, 2001,2006 The NetBSD Foundation, Inc. 4 * Copyright (c) 1995, 1998, 2000, 2001,2006 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 *  6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Christos Zoulas, Frank van der Linden, Eric Haszlakiewicz and 8 * by Christos Zoulas, Frank van der Linden, Eric Haszlakiewicz and
9 * Emmanuel Dreyfus. 9 * Emmanuel Dreyfus.
10 *  10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE. 30 * POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: linux32_exec_elf32.c,v 1.19 2016/08/06 15:13:13 maxv Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: linux32_exec_elf32.c,v 1.19.8.1 2023/06/21 21:04:02 martin Exp $");
35 35
36#define ELFSIZE 32 36#define ELFSIZE 32
37 37
38#include <sys/param.h> 38#include <sys/param.h>
39#include <sys/systm.h> 39#include <sys/systm.h>
40#include <sys/proc.h> 40#include <sys/proc.h>
41#include <sys/vnode.h> 41#include <sys/vnode.h>
42#include <sys/exec.h> 42#include <sys/exec.h>
43#include <sys/exec_elf.h> 43#include <sys/exec_elf.h>
44#include <sys/kauth.h> 44#include <sys/kauth.h>
45#include <sys/kernel.h> 45#include <sys/kernel.h>
46#include <sys/resourcevar.h> 46#include <sys/resourcevar.h>
47#include <sys/signal.h> 47#include <sys/signal.h>
@@ -217,26 +217,28 @@ linux32_elf32_copyargs(struct lwp *l, st @@ -217,26 +217,28 @@ linux32_elf32_copyargs(struct lwp *l, st
217 a++; 217 a++;
218 218
219 randbytes[0] = cprng_strong32(); 219 randbytes[0] = cprng_strong32();
220 randbytes[1] = cprng_strong32(); 220 randbytes[1] = cprng_strong32();
221 randbytes[2] = cprng_strong32(); 221 randbytes[2] = cprng_strong32();
222 randbytes[3] = cprng_strong32(); 222 randbytes[3] = cprng_strong32();
223 223
224 len = sizeof(randbytes); 224 len = sizeof(randbytes);
225 if ((error = copyout(randbytes, *stackp, len)) != 0) 225 if ((error = copyout(randbytes, *stackp, len)) != 0)
226 return error; 226 return error;
227 *stackp += len; 227 *stackp += len;
228 228
229#if 0 229#if 0
 230 memset(&esd, 0, sizeof(esd));
 231
230 memcpy(esd.kernel_vsyscall, linux32_kernel_vsyscall, 232 memcpy(esd.kernel_vsyscall, linux32_kernel_vsyscall,
231 sizeof(linux32_kernel_vsyscall)); 233 sizeof(linux32_kernel_vsyscall));
232 234
233 memcpy(&esd.elfhdr, eh, sizeof(*eh)); 235 memcpy(&esd.elfhdr, eh, sizeof(*eh));
234 236
235 strcpy(esd.hw_platform, LINUX32_PLATFORM); 237 strcpy(esd.hw_platform, LINUX32_PLATFORM);
236  238
237 /* 239 /*
238 * Copy out the ELF auxiliary table and hw platform name 240 * Copy out the ELF auxiliary table and hw platform name
239 */ 241 */
240 if ((error = copyout(&esd, esdp, sizeof(esd))) != 0) 242 if ((error = copyout(&esd, esdp, sizeof(esd))) != 0)
241 return error; 243 return error;
242 *stackp += sizeof(esd); 244 *stackp += sizeof(esd);

cvs diff -r1.11 -r1.11.30.1 src/sys/compat/linux32/common/linux32_resource.c (expand / switch to unified diff)

--- src/sys/compat/linux32/common/linux32_resource.c 2012/09/22 22:34:03 1.11
+++ src/sys/compat/linux32/common/linux32_resource.c 2023/06/21 21:04:02 1.11.30.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux32_resource.c,v 1.11 2012/09/22 22:34:03 joerg Exp $ */ 1/* $NetBSD: linux32_resource.c,v 1.11.30.1 2023/06/21 21:04:02 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved. 4 * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software 14 * 3. All advertising materials mentioning features or use of this software
@@ -23,27 +23,27 @@ @@ -23,27 +23,27 @@
23 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS  24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE. 31 * POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35 35
36__KERNEL_RCSID(0, "$NetBSD: linux32_resource.c,v 1.11 2012/09/22 22:34:03 joerg Exp $"); 36__KERNEL_RCSID(0, "$NetBSD: linux32_resource.c,v 1.11.30.1 2023/06/21 21:04:02 martin Exp $");
37 37
38#include <sys/types.h> 38#include <sys/types.h>
39#include <sys/param.h> 39#include <sys/param.h>
40#include <sys/fstypes.h> 40#include <sys/fstypes.h>
41#include <sys/signal.h> 41#include <sys/signal.h>
42#include <sys/dirent.h> 42#include <sys/dirent.h>
43#include <sys/kernel.h> 43#include <sys/kernel.h>
44#include <sys/fcntl.h> 44#include <sys/fcntl.h>
45#include <sys/select.h> 45#include <sys/select.h>
46#include <sys/proc.h> 46#include <sys/proc.h>
47#include <sys/resourcevar.h> 47#include <sys/resourcevar.h>
48#include <sys/ucred.h> 48#include <sys/ucred.h>
49#include <sys/swap.h> 49#include <sys/swap.h>
@@ -77,26 +77,27 @@ int @@ -77,26 +77,27 @@ int
77linux32_sys_getrlimit(struct lwp *l, const struct linux32_sys_getrlimit_args *uap, register_t *retval) 77linux32_sys_getrlimit(struct lwp *l, const struct linux32_sys_getrlimit_args *uap, register_t *retval)
78{ 78{
79 /* { 79 /* {
80 syscallarg(int) which; 80 syscallarg(int) which;
81 syscallarg(netbsd32_orlimitp_t) rlp; 81 syscallarg(netbsd32_orlimitp_t) rlp;
82 } */ 82 } */
83 struct orlimit orl; 83 struct orlimit orl;
84 int which; 84 int which;
85 85
86 which = linux_to_bsd_limit(SCARG(uap, which)); 86 which = linux_to_bsd_limit(SCARG(uap, which));
87 if (which < 0) 87 if (which < 0)
88 return -which; 88 return -which;
89 89
 90 memset(&orl, 0, sizeof(orl));
90 bsd_to_linux_rlimit(&orl, &l->l_proc->p_rlimit[which]); 91 bsd_to_linux_rlimit(&orl, &l->l_proc->p_rlimit[which]);
91 92
92 return copyout(&orl, SCARG_P32(uap, rlp), sizeof(orl)); 93 return copyout(&orl, SCARG_P32(uap, rlp), sizeof(orl));
93} 94}
94 95
95int 96int
96linux32_sys_setrlimit(struct lwp *l, const struct linux32_sys_setrlimit_args *uap, register_t *retval) 97linux32_sys_setrlimit(struct lwp *l, const struct linux32_sys_setrlimit_args *uap, register_t *retval)
97{ 98{
98 /* { 99 /* {
99 syscallarg(int) which; 100 syscallarg(int) which;
100 syscallarg(netbsd32_orlimitp_t) rlp; 101 syscallarg(netbsd32_orlimitp_t) rlp;
101 } */ 102 } */
102 struct rlimit rl; 103 struct rlimit rl;

cvs diff -r1.18.10.1 -r1.18.10.2 src/sys/compat/linux32/common/linux32_signal.c (expand / switch to unified diff)

--- src/sys/compat/linux32/common/linux32_signal.c 2020/01/21 18:12:54 1.18.10.1
+++ src/sys/compat/linux32/common/linux32_signal.c 2023/06/21 21:04:02 1.18.10.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux32_signal.c,v 1.18.10.1 2020/01/21 18:12:54 martin Exp $ */ 1/* $NetBSD: linux32_signal.c,v 1.18.10.2 2023/06/21 21:04:02 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved. 4 * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software 14 * 3. All advertising materials mentioning features or use of this software
@@ -22,27 +22,27 @@ @@ -22,27 +22,27 @@
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,  22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS  24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE. 31 * POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35__KERNEL_RCSID(0, "$NetBSD: linux32_signal.c,v 1.18.10.1 2020/01/21 18:12:54 martin Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: linux32_signal.c,v 1.18.10.2 2023/06/21 21:04:02 martin Exp $");
36 36
37#include <sys/param.h> 37#include <sys/param.h>
38#include <sys/ucred.h> 38#include <sys/ucred.h>
39#include <sys/signalvar.h> 39#include <sys/signalvar.h>
40#include <sys/lwp.h> 40#include <sys/lwp.h>
41#include <sys/time.h> 41#include <sys/time.h>
42#include <sys/proc.h> 42#include <sys/proc.h>
43#include <sys/wait.h> 43#include <sys/wait.h>
44 44
45#include <compat/netbsd32/netbsd32.h> 45#include <compat/netbsd32/netbsd32.h>
46 46
47#include <compat/linux/common/linux_types.h> 47#include <compat/linux/common/linux_types.h>
48#include <compat/linux/common/linux_signal.h> 48#include <compat/linux/common/linux_signal.h>
@@ -205,34 +205,36 @@ linux32_to_native_sigflags(const unsigne @@ -205,34 +205,36 @@ linux32_to_native_sigflags(const unsigne
205 bsf |= SA_SIGINFO; 205 bsf |= SA_SIGINFO;
206 if ((lsf & ~LINUX32_SA_ALLBITS) != 0) { 206 if ((lsf & ~LINUX32_SA_ALLBITS) != 0) {
207#ifdef DEBUG_LINUX 207#ifdef DEBUG_LINUX
208 printf("linux32_old_to_native_sigflags: " 208 printf("linux32_old_to_native_sigflags: "
209 "%lx extra bits ignored\n", lsf); 209 "%lx extra bits ignored\n", lsf);
210#endif 210#endif
211 } 211 }
212 return bsf; 212 return bsf;
213}  213}
214 214
215void 215void
216linux32_to_native_sigaction(struct sigaction *bsa, const struct linux32_sigaction *lsa) 216linux32_to_native_sigaction(struct sigaction *bsa, const struct linux32_sigaction *lsa)
217{ 217{
 218 memset(bsa, 0, sizeof(*bsa));
218 bsa->sa_handler = NETBSD32PTR64(lsa->linux_sa_handler); 219 bsa->sa_handler = NETBSD32PTR64(lsa->linux_sa_handler);
219 linux32_to_native_sigset(&bsa->sa_mask, &lsa->linux_sa_mask); 220 linux32_to_native_sigset(&bsa->sa_mask, &lsa->linux_sa_mask);
220 bsa->sa_flags = linux32_to_native_sigflags(lsa->linux_sa_flags); 221 bsa->sa_flags = linux32_to_native_sigflags(lsa->linux_sa_flags);
221} 222}
222 223
223void 224void
224native_to_linux32_sigaction(struct linux32_sigaction *lsa, const struct sigaction *bsa) 225native_to_linux32_sigaction(struct linux32_sigaction *lsa, const struct sigaction *bsa)
225{ 226{
 227 memset(lsa, 0, sizeof(*lsa));
226 NETBSD32PTR32(lsa->linux_sa_handler, bsa->sa_handler); 228 NETBSD32PTR32(lsa->linux_sa_handler, bsa->sa_handler);
227 native_to_linux32_sigset(&lsa->linux_sa_mask, &bsa->sa_mask); 229 native_to_linux32_sigset(&lsa->linux_sa_mask, &bsa->sa_mask);
228 lsa->linux_sa_flags = native_to_linux32_sigflags(bsa->sa_flags); 230 lsa->linux_sa_flags = native_to_linux32_sigflags(bsa->sa_flags);
229 NETBSD32PTR32(lsa->linux_sa_restorer, NULL); 231 NETBSD32PTR32(lsa->linux_sa_restorer, NULL);
230} 232}
231 233
232void 234void
233native_to_linux32_sigaltstack(struct linux32_sigaltstack *lss, const struct sigaltstack *bss) 235native_to_linux32_sigaltstack(struct linux32_sigaltstack *lss, const struct sigaltstack *bss)
234{ 236{
235 memset(lss, 0, sizeof(*lss)); 237 memset(lss, 0, sizeof(*lss));
236 NETBSD32PTR32(lss->ss_sp, bss->ss_sp); 238 NETBSD32PTR32(lss->ss_sp, bss->ss_sp);
237 lss->ss_size = bss->ss_size; 239 lss->ss_size = bss->ss_size;
238 if (bss->ss_flags & SS_ONSTACK) 240 if (bss->ss_flags & SS_ONSTACK)

cvs diff -r1.37 -r1.37.30.1 src/sys/compat/linux32/common/linux32_time.c (expand / switch to unified diff)

--- src/sys/compat/linux32/common/linux32_time.c 2012/10/02 01:44:28 1.37
+++ src/sys/compat/linux32/common/linux32_time.c 2023/06/21 21:04:02 1.37.30.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: linux32_time.c,v 1.37 2012/10/02 01:44:28 christos Exp $ */ 1/* $NetBSD: linux32_time.c,v 1.37.30.1 2023/06/21 21:04:02 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved. 4 * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software 14 * 3. All advertising materials mentioning features or use of this software
@@ -23,27 +23,27 @@ @@ -23,27 +23,27 @@
23 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS  24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE. 31 * POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35 35
36__KERNEL_RCSID(0, "$NetBSD: linux32_time.c,v 1.37 2012/10/02 01:44:28 christos Exp $"); 36__KERNEL_RCSID(0, "$NetBSD: linux32_time.c,v 1.37.30.1 2023/06/21 21:04:02 martin Exp $");
37 37
38#include <sys/types.h> 38#include <sys/types.h>
39#include <sys/param.h> 39#include <sys/param.h>
40#include <sys/fstypes.h> 40#include <sys/fstypes.h>
41#include <sys/signal.h> 41#include <sys/signal.h>
42#include <sys/dirent.h> 42#include <sys/dirent.h>
43#include <sys/kauth.h> 43#include <sys/kauth.h>
44#include <sys/kernel.h> 44#include <sys/kernel.h>
45#include <sys/fcntl.h> 45#include <sys/fcntl.h>
46#include <sys/namei.h> 46#include <sys/namei.h>
47#include <sys/select.h> 47#include <sys/select.h>
48#include <sys/proc.h> 48#include <sys/proc.h>
49#include <sys/resourcevar.h> 49#include <sys/resourcevar.h>
@@ -156,26 +156,28 @@ int @@ -156,26 +156,28 @@ int
156linux32_sys_times(struct lwp *l, const struct linux32_sys_times_args *uap, register_t *retval) 156linux32_sys_times(struct lwp *l, const struct linux32_sys_times_args *uap, register_t *retval)
157{ 157{
158 /* { 158 /* {
159 syscallarg(linux32_tmsp_t) tms; 159 syscallarg(linux32_tmsp_t) tms;
160 } */ 160 } */
161 struct proc *p = l->l_proc; 161 struct proc *p = l->l_proc;
162 struct timeval t; 162 struct timeval t;
163 int error; 163 int error;
164 164
165 if (SCARG_P32(uap, tms)) { 165 if (SCARG_P32(uap, tms)) {
166 struct linux32_tms ltms32; 166 struct linux32_tms ltms32;
167 struct rusage ru; 167 struct rusage ru;
168 168
 169 memset(&ltms32, 0, sizeof(ltms32));
 170
169 mutex_enter(p->p_lock); 171 mutex_enter(p->p_lock);
170 calcru(p, &ru.ru_utime, &ru.ru_stime, NULL, NULL); 172 calcru(p, &ru.ru_utime, &ru.ru_stime, NULL, NULL);
171 ltms32.ltms32_utime = CONVTCK(ru.ru_utime); 173 ltms32.ltms32_utime = CONVTCK(ru.ru_utime);
172 ltms32.ltms32_stime = CONVTCK(ru.ru_stime); 174 ltms32.ltms32_stime = CONVTCK(ru.ru_stime);
173 ltms32.ltms32_cutime = CONVTCK(p->p_stats->p_cru.ru_utime); 175 ltms32.ltms32_cutime = CONVTCK(p->p_stats->p_cru.ru_utime);
174 ltms32.ltms32_cstime = CONVTCK(p->p_stats->p_cru.ru_stime); 176 ltms32.ltms32_cstime = CONVTCK(p->p_stats->p_cru.ru_stime);
175 mutex_exit(p->p_lock); 177 mutex_exit(p->p_lock);
176 178
177 error = copyout(&ltms32, SCARG_P32(uap, tms), sizeof(ltms32)); 179 error = copyout(&ltms32, SCARG_P32(uap, tms), sizeof(ltms32));
178 if (error) 180 if (error)
179 return error; 181 return error;
180 } 182 }
181 183
@@ -227,33 +229,37 @@ linux32_sys_utime(struct lwp *l, const s @@ -227,33 +229,37 @@ linux32_sys_utime(struct lwp *l, const s
227 tv[1].tv_usec = 0; 229 tv[1].tv_usec = 0;
228 tvp = tv; 230 tvp = tv;
229 } else { 231 } else {
230 tvp = NULL; 232 tvp = NULL;
231 } 233 }
232  234
233 return do_sys_utimes(l, NULL, SCARG_P32(uap, path), FOLLOW, 235 return do_sys_utimes(l, NULL, SCARG_P32(uap, path), FOLLOW,
234 tvp, UIO_SYSSPACE); 236 tvp, UIO_SYSSPACE);
235} 237}
236 238
237void 239void
238native_to_linux32_timespec(struct linux32_timespec *ltp, struct timespec *ntp) 240native_to_linux32_timespec(struct linux32_timespec *ltp, struct timespec *ntp)
239{ 241{
 242
 243 memset(ltp, 0, sizeof(*ltp));
240 ltp->tv_sec = ntp->tv_sec; 244 ltp->tv_sec = ntp->tv_sec;
241 ltp->tv_nsec = ntp->tv_nsec; 245 ltp->tv_nsec = ntp->tv_nsec;
242} 246}
243 247
244void 248void
245linux32_to_native_timespec(struct timespec *ntp, struct linux32_timespec *ltp) 249linux32_to_native_timespec(struct timespec *ntp, struct linux32_timespec *ltp)
246{ 250{
 251
 252 memset(ntp, 0, sizeof(*ntp));
247 ntp->tv_sec = ltp->tv_sec; 253 ntp->tv_sec = ltp->tv_sec;
248 ntp->tv_nsec = ltp->tv_nsec; 254 ntp->tv_nsec = ltp->tv_nsec;
249} 255}
250 256
251int 257int
252linux32_sys_nanosleep(struct lwp *l, 258linux32_sys_nanosleep(struct lwp *l,
253 const struct linux32_sys_nanosleep_args *uap, register_t *retval) 259 const struct linux32_sys_nanosleep_args *uap, register_t *retval)
254{ 260{
255 /* { 261 /* {
256 syscallarg(linux32_timespecp_t) rqtp; 262 syscallarg(linux32_timespecp_t) rqtp;
257 syscallarg(linux32_timespecp_t) rmtp; 263 syscallarg(linux32_timespecp_t) rmtp;
258 } */ 264 } */
259 struct timespec rqts, rmts; 265 struct timespec rqts, rmts;

cvs diff -r1.33 -r1.33.30.1 src/sys/compat/netbsd32/netbsd32_compat_12.c (expand / switch to unified diff)

--- src/sys/compat/netbsd32/netbsd32_compat_12.c 2012/12/10 02:21:58 1.33
+++ src/sys/compat/netbsd32/netbsd32_compat_12.c 2023/06/21 21:04:01 1.33.30.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: netbsd32_compat_12.c,v 1.33 2012/12/10 02:21:58 chs Exp $ */ 1/* $NetBSD: netbsd32_compat_12.c,v 1.33.30.1 2023/06/21 21:04:01 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2001 Matthew R. Green 4 * Copyright (c) 1998, 2001 Matthew R. Green
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_12.c,v 1.33 2012/12/10 02:21:58 chs Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_12.c,v 1.33.30.1 2023/06/21 21:04:01 martin Exp $");
31 31
32#if defined(_KERNEL_OPT) 32#if defined(_KERNEL_OPT)
33#include "opt_compat_netbsd.h" 33#include "opt_compat_netbsd.h"
34#endif 34#endif
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/filedesc.h> 38#include <sys/filedesc.h>
39#include <sys/mount.h> 39#include <sys/mount.h>
40#include <sys/mman.h> 40#include <sys/mman.h>
41#include <sys/namei.h> 41#include <sys/namei.h>
42#include <sys/proc.h> 42#include <sys/proc.h>
43#include <sys/stat.h> 43#include <sys/stat.h>
@@ -49,26 +49,27 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_com @@ -49,26 +49,27 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_com
49#include <compat/sys/stat.h> 49#include <compat/sys/stat.h>
50 50
51#include <compat/netbsd32/netbsd32.h> 51#include <compat/netbsd32/netbsd32.h>
52#include <compat/netbsd32/netbsd32_syscallargs.h> 52#include <compat/netbsd32/netbsd32_syscallargs.h>
53 53
54static void netbsd32_stat12_to_netbsd32(struct stat12 *, 54static void netbsd32_stat12_to_netbsd32(struct stat12 *,
55 struct netbsd32_stat12 *); 55 struct netbsd32_stat12 *);
56 56
57/* for use with {,fl}stat() */ 57/* for use with {,fl}stat() */
58static void 58static void
59netbsd32_stat12_to_netbsd32(struct stat12 *sp12, struct netbsd32_stat12 *sp32) 59netbsd32_stat12_to_netbsd32(struct stat12 *sp12, struct netbsd32_stat12 *sp32)
60{ 60{
61 61
 62 memset(sp32, 0, sizeof(*sp32));
62 sp32->st_dev = sp12->st_dev; 63 sp32->st_dev = sp12->st_dev;
63 sp32->st_ino = sp12->st_ino; 64 sp32->st_ino = sp12->st_ino;
64 sp32->st_mode = sp12->st_mode; 65 sp32->st_mode = sp12->st_mode;
65 sp32->st_nlink = sp12->st_nlink; 66 sp32->st_nlink = sp12->st_nlink;
66 sp32->st_uid = sp12->st_uid; 67 sp32->st_uid = sp12->st_uid;
67 sp32->st_gid = sp12->st_gid; 68 sp32->st_gid = sp12->st_gid;
68 sp32->st_rdev = sp12->st_rdev; 69 sp32->st_rdev = sp12->st_rdev;
69 if (sp12->st_size < (quad_t)1 << 32) 70 if (sp12->st_size < (quad_t)1 << 32)
70 sp32->st_size = sp12->st_size; 71 sp32->st_size = sp12->st_size;
71 else 72 else
72 sp32->st_size = -2; 73 sp32->st_size = -2;
73 sp32->st_atimespec.tv_sec = sp12->st_atimespec.tv_sec; 74 sp32->st_atimespec.tv_sec = sp12->st_atimespec.tv_sec;
74 sp32->st_atimespec.tv_nsec = sp12->st_atimespec.tv_nsec; 75 sp32->st_atimespec.tv_nsec = sp12->st_atimespec.tv_nsec;

cvs diff -r1.36.4.1 -r1.36.4.2 src/sys/compat/netbsd32/netbsd32_compat_20.c (expand / switch to unified diff)

--- src/sys/compat/netbsd32/netbsd32_compat_20.c 2020/01/21 18:12:54 1.36.4.1
+++ src/sys/compat/netbsd32/netbsd32_compat_20.c 2023/06/21 21:04:01 1.36.4.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: netbsd32_compat_20.c,v 1.36.4.1 2020/01/21 18:12:54 martin Exp $ */ 1/* $NetBSD: netbsd32_compat_20.c,v 1.36.4.2 2023/06/21 21:04:01 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2001 Matthew R. Green 4 * Copyright (c) 1998, 2001 Matthew R. Green
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,52 +17,54 @@ @@ -17,52 +17,54 @@
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_20.c,v 1.36.4.1 2020/01/21 18:12:54 martin Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_20.c,v 1.36.4.2 2023/06/21 21:04:01 martin Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/systm.h> 33#include <sys/systm.h>
34#include <sys/mount.h> 34#include <sys/mount.h>
35#include <sys/stat.h> 35#include <sys/stat.h>
36#include <sys/time.h> 36#include <sys/time.h>
37#include <sys/ktrace.h> 37#include <sys/ktrace.h>
38#include <sys/vnode.h> 38#include <sys/vnode.h>
39#include <sys/file.h> 39#include <sys/file.h>
40#include <sys/filedesc.h> 40#include <sys/filedesc.h>
41#include <sys/namei.h> 41#include <sys/namei.h>
42#include <sys/syscallargs.h> 42#include <sys/syscallargs.h>
43#include <sys/proc.h> 43#include <sys/proc.h>
44#include <sys/dirent.h> 44#include <sys/dirent.h>
45 45
46#include <compat/netbsd32/netbsd32.h> 46#include <compat/netbsd32/netbsd32.h>
47#include <compat/netbsd32/netbsd32_syscallargs.h> 47#include <compat/netbsd32/netbsd32_syscallargs.h>
48#include <compat/netbsd32/netbsd32_conv.h> 48#include <compat/netbsd32/netbsd32_conv.h>
49 49
50static inline void compat_20_netbsd32_from_statvfs(struct statvfs *, 50static inline void compat_20_netbsd32_from_statvfs(struct statvfs *,
51 struct netbsd32_statfs *); 51 struct netbsd32_statfs *);
52 52
53static inline void 53static inline void
54compat_20_netbsd32_from_statvfs(struct statvfs *sbp, struct netbsd32_statfs *sb32p) 54compat_20_netbsd32_from_statvfs(struct statvfs *sbp, struct netbsd32_statfs *sb32p)
55{ 55{
 56
 57 memset(sb32p, 0, sizeof(*sb32p));
56 sb32p->f_type = 0; /* XXX Put an actual value? */ 58 sb32p->f_type = 0; /* XXX Put an actual value? */
57 sb32p->f_flags = sbp->f_flag; 59 sb32p->f_flags = sbp->f_flag;
58 sb32p->f_bsize = (netbsd32_long)sbp->f_bsize; 60 sb32p->f_bsize = (netbsd32_long)sbp->f_bsize;
59 sb32p->f_iosize = (netbsd32_long)sbp->f_iosize; 61 sb32p->f_iosize = (netbsd32_long)sbp->f_iosize;
60 sb32p->f_blocks = (netbsd32_long)sbp->f_blocks; 62 sb32p->f_blocks = (netbsd32_long)sbp->f_blocks;
61 sb32p->f_bfree = (netbsd32_long)sbp->f_bfree; 63 sb32p->f_bfree = (netbsd32_long)sbp->f_bfree;
62 sb32p->f_bavail = (netbsd32_long)sbp->f_bavail; 64 sb32p->f_bavail = (netbsd32_long)sbp->f_bavail;
63 sb32p->f_files = (netbsd32_long)sbp->f_files; 65 sb32p->f_files = (netbsd32_long)sbp->f_files;
64 sb32p->f_ffree = (netbsd32_long)sbp->f_ffree; 66 sb32p->f_ffree = (netbsd32_long)sbp->f_ffree;
65 sb32p->f_fsid = sbp->f_fsidx; 67 sb32p->f_fsid = sbp->f_fsidx;
66 sb32p->f_owner = sbp->f_owner; 68 sb32p->f_owner = sbp->f_owner;
67 sb32p->f_spare[0] = 0; 69 sb32p->f_spare[0] = 0;
68 sb32p->f_spare[1] = 0; 70 sb32p->f_spare[1] = 0;

cvs diff -r1.54.8.1 -r1.54.8.2 src/sys/compat/netbsd32/netbsd32_compat_43.c (expand / switch to unified diff)

--- src/sys/compat/netbsd32/netbsd32_compat_43.c 2020/01/21 18:12:54 1.54.8.1
+++ src/sys/compat/netbsd32/netbsd32_compat_43.c 2023/06/21 21:04:01 1.54.8.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: netbsd32_compat_43.c,v 1.54.8.1 2020/01/21 18:12:54 martin Exp $ */ 1/* $NetBSD: netbsd32_compat_43.c,v 1.54.8.2 2023/06/21 21:04:01 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2001 Matthew R. Green 4 * Copyright (c) 1998, 2001 Matthew R. Green
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.54.8.1 2020/01/21 18:12:54 martin Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.54.8.2 2023/06/21 21:04:01 martin Exp $");
31 31
32#if defined(_KERNEL_OPT) 32#if defined(_KERNEL_OPT)
33#include "opt_compat_43.h" 33#include "opt_compat_43.h"
34#endif 34#endif
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/fcntl.h> 38#include <sys/fcntl.h>
39#include <sys/filedesc.h> 39#include <sys/filedesc.h>
40#include <sys/mbuf.h> 40#include <sys/mbuf.h>
41#include <sys/mount.h> 41#include <sys/mount.h>
42#include <sys/namei.h> 42#include <sys/namei.h>
43#include <sys/socket.h> 43#include <sys/socket.h>
@@ -634,26 +634,27 @@ compat_43_netbsd32_osigvec(struct lwp *l @@ -634,26 +634,27 @@ compat_43_netbsd32_osigvec(struct lwp *l
634 nsa.sa_handler = NETBSD32PTR64(sv32.sv_handler); 634 nsa.sa_handler = NETBSD32PTR64(sv32.sv_handler);
635 nsa.sa_mask.__bits[0] = sv32.sv_mask; 635 nsa.sa_mask.__bits[0] = sv32.sv_mask;
636 nsa.sa_mask.__bits[1] = 0; 636 nsa.sa_mask.__bits[1] = 0;
637 nsa.sa_mask.__bits[2] = 0; 637 nsa.sa_mask.__bits[2] = 0;
638 nsa.sa_mask.__bits[3] = 0; 638 nsa.sa_mask.__bits[3] = 0;
639 nsa.sa_flags = sv32.sv_flags ^ SA_RESTART; 639 nsa.sa_flags = sv32.sv_flags ^ SA_RESTART;
640 error = sigaction1(l, SCARG(uap, signum), &nsa, &osa, NULL, 0); 640 error = sigaction1(l, SCARG(uap, signum), &nsa, &osa, NULL, 0);
641 } else 641 } else
642 error = sigaction1(l, SCARG(uap, signum), NULL, &osa, NULL, 0); 642 error = sigaction1(l, SCARG(uap, signum), NULL, &osa, NULL, 0);
643 if (error) 643 if (error)
644 return error; 644 return error;
645 645
646 if (SCARG_P32(uap, osv)) { 646 if (SCARG_P32(uap, osv)) {
 647 memset(&sv32, 0, sizeof(sv32));
647 NETBSD32PTR32(sv32.sv_handler, osa.sa_handler); 648 NETBSD32PTR32(sv32.sv_handler, osa.sa_handler);
648 sv32.sv_mask = osa.sa_mask.__bits[0]; 649 sv32.sv_mask = osa.sa_mask.__bits[0];
649 sv32.sv_flags = osa.sa_flags ^ SA_RESTART; 650 sv32.sv_flags = osa.sa_flags ^ SA_RESTART;
650 error = copyout(&sv32, SCARG_P32(uap, osv), sizeof(sv32)); 651 error = copyout(&sv32, SCARG_P32(uap, osv), sizeof(sv32));
651 } 652 }
652 653
653 return error; 654 return error;
654} 655}
655 656
656int 657int
657compat_43_netbsd32_sigblock(struct lwp *l, const struct compat_43_netbsd32_sigblock_args *uap, register_t *retval) 658compat_43_netbsd32_sigblock(struct lwp *l, const struct compat_43_netbsd32_sigblock_args *uap, register_t *retval)
658{ 659{
659 /* { 660 /* {
@@ -692,20 +693,21 @@ compat_43_netbsd32_osigstack(struct lwp  @@ -692,20 +693,21 @@ compat_43_netbsd32_osigstack(struct lwp
692 error = copyin(SCARG_P32(uap, nss), &ss32, sizeof(ss32)); 693 error = copyin(SCARG_P32(uap, nss), &ss32, sizeof(ss32));
693 if (error) 694 if (error)
694 return error; 695 return error;
695 nsa.ss_sp = NETBSD32PTR64(ss32.ss_sp); 696 nsa.ss_sp = NETBSD32PTR64(ss32.ss_sp);
696 nsa.ss_size = SIGSTKSZ; /* Use the recommended size */ 697 nsa.ss_size = SIGSTKSZ; /* Use the recommended size */
697 nsa.ss_flags = ss32.ss_onstack ? SS_ONSTACK : 0; 698 nsa.ss_flags = ss32.ss_onstack ? SS_ONSTACK : 0;
698 error = sigaltstack1(l, &nsa, &osa); 699 error = sigaltstack1(l, &nsa, &osa);
699 } else 700 } else
700 error = sigaltstack1(l, NULL, &osa); 701 error = sigaltstack1(l, NULL, &osa);
701 if (error) 702 if (error)
702 return error; 703 return error;
703 704
704 if (SCARG_P32(uap, oss)) { 705 if (SCARG_P32(uap, oss)) {
 706 memset(&ss32, 0, sizeof(ss32));
705 NETBSD32PTR32(ss32.ss_sp, osa.ss_sp); 707 NETBSD32PTR32(ss32.ss_sp, osa.ss_sp);
706 ss32.ss_onstack = (osa.ss_flags & SS_ONSTACK) != 0; 708 ss32.ss_onstack = (osa.ss_flags & SS_ONSTACK) != 0;
707 error = copyout(&ss32, SCARG_P32(uap, oss), sizeof(ss32)); 709 error = copyout(&ss32, SCARG_P32(uap, oss), sizeof(ss32));
708 } 710 }
709 711
710 return error; 712 return error;
711} 713}

cvs diff -r1.32.10.1 -r1.32.10.2 src/sys/compat/netbsd32/netbsd32_compat_50.c (expand / switch to unified diff)

--- src/sys/compat/netbsd32/netbsd32_compat_50.c 2020/01/21 18:12:54 1.32.10.1
+++ src/sys/compat/netbsd32/netbsd32_compat_50.c 2023/06/21 21:04:01 1.32.10.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: netbsd32_compat_50.c,v 1.32.10.1 2020/01/21 18:12:54 martin Exp $ */ 1/* $NetBSD: netbsd32_compat_50.c,v 1.32.10.2 2023/06/21 21:04:01 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Christos Zoulas. 8 * by Christos Zoulas.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -26,27 +26,27 @@ @@ -26,27 +26,27 @@
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE. 36 * POSSIBILITY OF SUCH DAMAGE.
37 */ 37 */
38#include <sys/cdefs.h> 38#include <sys/cdefs.h>
39__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.32.10.1 2020/01/21 18:12:54 martin Exp $"); 39__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.32.10.2 2023/06/21 21:04:01 martin Exp $");
40 40
41#if defined(_KERNEL_OPT) 41#if defined(_KERNEL_OPT)
42#include "opt_compat_netbsd.h" 42#include "opt_compat_netbsd.h"
43#endif 43#endif
44 44
45#include <sys/param.h> 45#include <sys/param.h>
46#include <sys/systm.h> 46#include <sys/systm.h>
47#include <sys/mount.h> 47#include <sys/mount.h>
48#include <sys/socket.h> 48#include <sys/socket.h>
49#include <sys/socketvar.h> 49#include <sys/socketvar.h>
50#include <sys/stat.h> 50#include <sys/stat.h>
51#include <sys/time.h> 51#include <sys/time.h>
52#include <sys/ktrace.h> 52#include <sys/ktrace.h>
@@ -153,26 +153,27 @@ compat_50_netbsd32_gettimeofday(struct l @@ -153,26 +153,27 @@ compat_50_netbsd32_gettimeofday(struct l
153 153
154 if (SCARG_P32(uap, tp)) { 154 if (SCARG_P32(uap, tp)) {
155 microtime(&atv); 155 microtime(&atv);
156 netbsd32_from_timeval50(&atv, &tv32); 156 netbsd32_from_timeval50(&atv, &tv32);
157 error = copyout(&tv32, SCARG_P32(uap, tp), sizeof(tv32)); 157 error = copyout(&tv32, SCARG_P32(uap, tp), sizeof(tv32));
158 if (error) 158 if (error)
159 return error; 159 return error;
160 } 160 }
161 if (SCARG_P32(uap, tzp)) { 161 if (SCARG_P32(uap, tzp)) {
162 /* 162 /*
163 * NetBSD has no kernel notion of time zone, so we just 163 * NetBSD has no kernel notion of time zone, so we just
164 * fake up a timezone struct and return it if demanded. 164 * fake up a timezone struct and return it if demanded.
165 */ 165 */
 166 memset(&tzfake, 0, sizeof(tzfake));
166 tzfake.tz_minuteswest = 0; 167 tzfake.tz_minuteswest = 0;
167 tzfake.tz_dsttime = 0; 168 tzfake.tz_dsttime = 0;
168 error = copyout(&tzfake, SCARG_P32(uap, tzp), sizeof(tzfake)); 169 error = copyout(&tzfake, SCARG_P32(uap, tzp), sizeof(tzfake));
169 } 170 }
170 return error; 171 return error;
171} 172}
172 173
173int 174int
174compat_50_netbsd32_settimeofday(struct lwp *l, 175compat_50_netbsd32_settimeofday(struct lwp *l,
175 const struct compat_50_netbsd32_settimeofday_args *uap, register_t *retval) 176 const struct compat_50_netbsd32_settimeofday_args *uap, register_t *retval)
176{ 177{
177 /* { 178 /* {
178 syscallarg(const netbsd32_timeval50p_t) tv; 179 syscallarg(const netbsd32_timeval50p_t) tv;
@@ -234,26 +235,28 @@ compat_50_netbsd32_adjtime(struct lwp *l @@ -234,26 +235,28 @@ compat_50_netbsd32_adjtime(struct lwp *l
234 } */ 235 } */
235 struct netbsd32_timeval50 atv; 236 struct netbsd32_timeval50 atv;
236 int error; 237 int error;
237 238
238 extern int time_adjusted; /* in kern_ntptime.c */ 239 extern int time_adjusted; /* in kern_ntptime.c */
239 extern int64_t time_adjtime; /* in kern_ntptime.c */ 240 extern int64_t time_adjtime; /* in kern_ntptime.c */
240 241
241 if ((error = kauth_authorize_system(l->l_cred, 242 if ((error = kauth_authorize_system(l->l_cred,
242 KAUTH_SYSTEM_TIME, KAUTH_REQ_SYSTEM_TIME_ADJTIME, NULL, NULL, 243 KAUTH_SYSTEM_TIME, KAUTH_REQ_SYSTEM_TIME_ADJTIME, NULL, NULL,
243 NULL)) != 0) 244 NULL)) != 0)
244 return (error); 245 return (error);
245 246
246 if (SCARG_P32(uap, olddelta)) { 247 if (SCARG_P32(uap, olddelta)) {
 248 memset(&atv, 0, sizeof(atv));
 249
247 mutex_spin_enter(&timecounter_lock); 250 mutex_spin_enter(&timecounter_lock);
248 atv.tv_sec = time_adjtime / 1000000; 251 atv.tv_sec = time_adjtime / 1000000;
249 atv.tv_usec = time_adjtime % 1000000; 252 atv.tv_usec = time_adjtime % 1000000;
250 if (atv.tv_usec < 0) { 253 if (atv.tv_usec < 0) {
251 atv.tv_usec += 1000000; 254 atv.tv_usec += 1000000;
252 atv.tv_sec--; 255 atv.tv_sec--;
253 } 256 }
254 mutex_spin_exit(&timecounter_lock); 257 mutex_spin_exit(&timecounter_lock);
255 258
256 error = copyout(&atv, SCARG_P32(uap, olddelta), sizeof(atv)); 259 error = copyout(&atv, SCARG_P32(uap, olddelta), sizeof(atv));
257 if (error) 260 if (error)
258 return (error); 261 return (error);
259 } 262 }
@@ -380,48 +383,51 @@ compat_50_netbsd32_timer_settime(struct  @@ -380,48 +383,51 @@ compat_50_netbsd32_timer_settime(struct
380 if ((error = copyin(SCARG_P32(uap, value), &its32, sizeof(its32))) != 0) 383 if ((error = copyin(SCARG_P32(uap, value), &its32, sizeof(its32))) != 0)
381 return (error); 384 return (error);
382 netbsd32_to_timespec50(&its32.it_interval, &value.it_interval); 385 netbsd32_to_timespec50(&its32.it_interval, &value.it_interval);
383 netbsd32_to_timespec50(&its32.it_value, &value.it_value); 386 netbsd32_to_timespec50(&its32.it_value, &value.it_value);
384 387
385 if (SCARG_P32(uap, ovalue)) 388 if (SCARG_P32(uap, ovalue))
386 ovp = &ovalue; 389 ovp = &ovalue;
387 390
388 if ((error = dotimer_settime(SCARG(uap, timerid), &value, ovp, 391 if ((error = dotimer_settime(SCARG(uap, timerid), &value, ovp,
389 SCARG(uap, flags), l->l_proc)) != 0) 392 SCARG(uap, flags), l->l_proc)) != 0)
390 return error; 393 return error;
391 394
392 if (ovp) { 395 if (ovp) {
 396 memset(&its32, 0, sizeof(its32));
393 netbsd32_from_timespec50(&ovp->it_interval, &its32.it_interval); 397 netbsd32_from_timespec50(&ovp->it_interval, &its32.it_interval);
394 netbsd32_from_timespec50(&ovp->it_value, &its32.it_value); 398 netbsd32_from_timespec50(&ovp->it_value, &its32.it_value);
395 return copyout(&its32, SCARG_P32(uap, ovalue), sizeof(its32)); 399 return copyout(&its32, SCARG_P32(uap, ovalue), sizeof(its32));
396 } 400 }
397 return 0; 401 return 0;
398} 402}
399 403
400int 404int
401compat_50_netbsd32_timer_gettime(struct lwp *l, const struct compat_50_netbsd32_timer_gettime_args *uap, register_t *retval) 405compat_50_netbsd32_timer_gettime(struct lwp *l, const struct compat_50_netbsd32_timer_gettime_args *uap, register_t *retval)
402{ 406{
403 /* { 407 /* {
404 syscallarg(netbsd32_timer_t) timerid; 408 syscallarg(netbsd32_timer_t) timerid;
405 syscallarg(netbsd32_itimerspec50p_t) value; 409 syscallarg(netbsd32_itimerspec50p_t) value;
406 } */ 410 } */
407 int error; 411 int error;
408 struct itimerspec its; 412 struct itimerspec its;
409 struct netbsd32_itimerspec50 its32; 413 struct netbsd32_itimerspec50 its32;
410 414
411 if ((error = dotimer_gettime(SCARG(uap, timerid), l->l_proc, 415 if ((error = dotimer_gettime(SCARG(uap, timerid), l->l_proc,
412 &its)) != 0) 416 &its)) != 0)
413 return error; 417 return error;
414 418
 419 memset(&its32, 0, sizeof(its32));
 420
415 netbsd32_from_timespec50(&its.it_interval, &its32.it_interval); 421 netbsd32_from_timespec50(&its.it_interval, &its32.it_interval);
416 netbsd32_from_timespec50(&its.it_value, &its32.it_value); 422 netbsd32_from_timespec50(&its.it_value, &its32.it_value);
417 423
418 return copyout(&its32, SCARG_P32(uap, value), sizeof(its32)); 424 return copyout(&its32, SCARG_P32(uap, value), sizeof(its32));
419} 425}
420 426
421int 427int
422compat_50_netbsd32_nanosleep(struct lwp *l, 428compat_50_netbsd32_nanosleep(struct lwp *l,
423 const struct compat_50_netbsd32_nanosleep_args *uap, register_t *retval) 429 const struct compat_50_netbsd32_nanosleep_args *uap, register_t *retval)
424{ 430{
425 /* { 431 /* {
426 syscallarg(const netbsd32_timespec50p_t) rqtp; 432 syscallarg(const netbsd32_timespec50p_t) rqtp;
427 syscallarg(netbsd32_timespecp_t) rmtp; 433 syscallarg(netbsd32_timespecp_t) rmtp;

cvs diff -r1.31.8.4 -r1.31.8.5 src/sys/compat/netbsd32/netbsd32_conv.h (expand / switch to unified diff)

--- src/sys/compat/netbsd32/netbsd32_conv.h 2023/06/21 20:38:35 1.31.8.4
+++ src/sys/compat/netbsd32/netbsd32_conv.h 2023/06/21 21:04:01 1.31.8.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: netbsd32_conv.h,v 1.31.8.4 2023/06/21 20:38:35 martin Exp $ */ 1/* $NetBSD: netbsd32_conv.h,v 1.31.8.5 2023/06/21 21:04:01 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2001 Matthew R. Green 4 * Copyright (c) 1998, 2001 Matthew R. Green
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -53,188 +53,203 @@ @@ -53,188 +53,203 @@
53 53
54#include <compat/sys/dirent.h> 54#include <compat/sys/dirent.h>
55 55
56#include <prop/plistref.h> 56#include <prop/plistref.h>
57 57
58#include <compat/netbsd32/netbsd32.h> 58#include <compat/netbsd32/netbsd32.h>
59 59
60/* converters for structures that we need */ 60/* converters for structures that we need */
61static __inline void 61static __inline void
62netbsd32_from_timeval50(const struct timeval *tv, 62netbsd32_from_timeval50(const struct timeval *tv,
63 struct netbsd32_timeval50 *tv32) 63 struct netbsd32_timeval50 *tv32)
64{ 64{
65 65
 66 memset(tv32, 0, sizeof(*tv32));
66 tv32->tv_sec = (netbsd32_time50_t)tv->tv_sec; 67 tv32->tv_sec = (netbsd32_time50_t)tv->tv_sec;
67 tv32->tv_usec = (netbsd32_long)tv->tv_usec; 68 tv32->tv_usec = (netbsd32_long)tv->tv_usec;
68} 69}
69 70
70static __inline void 71static __inline void
71netbsd32_from_timeval(const struct timeval *tv, 72netbsd32_from_timeval(const struct timeval *tv,
72 struct netbsd32_timeval *tv32) 73 struct netbsd32_timeval *tv32)
73{ 74{
74 75
 76 memset(tv32, 0, sizeof(*tv32));
75 tv32->tv_sec = (netbsd32_time_t)tv->tv_sec; 77 tv32->tv_sec = (netbsd32_time_t)tv->tv_sec;
76 tv32->tv_usec = tv->tv_usec; 78 tv32->tv_usec = tv->tv_usec;
77} 79}
78 80
79static __inline void 81static __inline void
80netbsd32_to_timeval50(const struct netbsd32_timeval50 *tv32, 82netbsd32_to_timeval50(const struct netbsd32_timeval50 *tv32,
81 struct timeval *tv) 83 struct timeval *tv)
82{ 84{
83 85
 86 memset(tv, 0, sizeof(*tv));
84 tv->tv_sec = (time_t)tv32->tv_sec; 87 tv->tv_sec = (time_t)tv32->tv_sec;
85 tv->tv_usec = tv32->tv_usec; 88 tv->tv_usec = tv32->tv_usec;
86} 89}
87 90
88static __inline void 91static __inline void
89netbsd32_to_timeval(const struct netbsd32_timeval *tv32, 92netbsd32_to_timeval(const struct netbsd32_timeval *tv32,
90 struct timeval *tv) 93 struct timeval *tv)
91{ 94{
92 95
 96 memset(tv, 0, sizeof(*tv));
93 tv->tv_sec = (time_t)tv32->tv_sec; 97 tv->tv_sec = (time_t)tv32->tv_sec;
94 tv->tv_usec = tv32->tv_usec; 98 tv->tv_usec = tv32->tv_usec;
95} 99}
96 100
97static __inline void 101static __inline void
98netbsd32_from_itimerval50(const struct itimerval *itv, 102netbsd32_from_itimerval50(const struct itimerval *itv,
99 struct netbsd32_itimerval50 *itv32) 103 struct netbsd32_itimerval50 *itv32)
100{ 104{
101 105
 106 memset(itv32, 0, sizeof(*itv32));
102 netbsd32_from_timeval50(&itv->it_interval, 107 netbsd32_from_timeval50(&itv->it_interval,
103 &itv32->it_interval); 108 &itv32->it_interval);
104 netbsd32_from_timeval50(&itv->it_value, 109 netbsd32_from_timeval50(&itv->it_value,
105 &itv32->it_value); 110 &itv32->it_value);
106} 111}
107 112
108static __inline void 113static __inline void
109netbsd32_from_itimerval(const struct itimerval *itv, 114netbsd32_from_itimerval(const struct itimerval *itv,
110 struct netbsd32_itimerval *itv32) 115 struct netbsd32_itimerval *itv32)
111{ 116{
112 117
 118 memset(itv32, 0, sizeof(*itv32));
113 netbsd32_from_timeval(&itv->it_interval, 119 netbsd32_from_timeval(&itv->it_interval,
114 &itv32->it_interval); 120 &itv32->it_interval);
115 netbsd32_from_timeval(&itv->it_value, 121 netbsd32_from_timeval(&itv->it_value,
116 &itv32->it_value); 122 &itv32->it_value);
117} 123}
118 124
119static __inline void 125static __inline void
120netbsd32_to_itimerval50(const struct netbsd32_itimerval50 *itv32, 126netbsd32_to_itimerval50(const struct netbsd32_itimerval50 *itv32,
121 struct itimerval *itv) 127 struct itimerval *itv)
122{ 128{
123 129
 130 memset(itv, 0, sizeof(*itv));
124 netbsd32_to_timeval50(&itv32->it_interval, &itv->it_interval); 131 netbsd32_to_timeval50(&itv32->it_interval, &itv->it_interval);
125 netbsd32_to_timeval50(&itv32->it_value, &itv->it_value); 132 netbsd32_to_timeval50(&itv32->it_value, &itv->it_value);
126} 133}
127 134
128static __inline void 135static __inline void
129netbsd32_to_itimerval(const struct netbsd32_itimerval *itv32, 136netbsd32_to_itimerval(const struct netbsd32_itimerval *itv32,
130 struct itimerval *itv) 137 struct itimerval *itv)
131{ 138{
132 139
 140 memset(itv, 0, sizeof(*itv));
133 netbsd32_to_timeval(&itv32->it_interval, &itv->it_interval); 141 netbsd32_to_timeval(&itv32->it_interval, &itv->it_interval);
134 netbsd32_to_timeval(&itv32->it_value, &itv->it_value); 142 netbsd32_to_timeval(&itv32->it_value, &itv->it_value);
135} 143}
136 144
137static __inline void 145static __inline void
138netbsd32_to_timespec50(const struct netbsd32_timespec50 *s32p, 146netbsd32_to_timespec50(const struct netbsd32_timespec50 *s32p,
139 struct timespec *p) 147 struct timespec *p)
140{ 148{
141 149
 150 memset(p, 0, sizeof(*p));
142 p->tv_sec = (time_t)s32p->tv_sec; 151 p->tv_sec = (time_t)s32p->tv_sec;
143 p->tv_nsec = (long)s32p->tv_nsec; 152 p->tv_nsec = (long)s32p->tv_nsec;
144} 153}
145 154
146static __inline void 155static __inline void
147netbsd32_to_timespec(const struct netbsd32_timespec *s32p, 156netbsd32_to_timespec(const struct netbsd32_timespec *s32p,
148 struct timespec *p) 157 struct timespec *p)
149{ 158{
150 159
 160 memset(p, 0, sizeof(*p));
151 p->tv_sec = (time_t)s32p->tv_sec; 161 p->tv_sec = (time_t)s32p->tv_sec;
152 p->tv_nsec = (long)s32p->tv_nsec; 162 p->tv_nsec = (long)s32p->tv_nsec;
153} 163}
154 164
155static __inline void 165static __inline void
156netbsd32_from_timespec50(const struct timespec *p, 166netbsd32_from_timespec50(const struct timespec *p,
157 struct netbsd32_timespec50 *s32p) 167 struct netbsd32_timespec50 *s32p)
158{ 168{
159 169
 170 memset(s32p, 0, sizeof(*s32p));
160 s32p->tv_sec = (netbsd32_time50_t)p->tv_sec; 171 s32p->tv_sec = (netbsd32_time50_t)p->tv_sec;
161 s32p->tv_nsec = (netbsd32_long)p->tv_nsec; 172 s32p->tv_nsec = (netbsd32_long)p->tv_nsec;
162} 173}
163 174
164static __inline void 175static __inline void
165netbsd32_from_timespec(const struct timespec *p, 176netbsd32_from_timespec(const struct timespec *p,
166 struct netbsd32_timespec *s32p) 177 struct netbsd32_timespec *s32p)
167{ 178{
168 179
 180 memset(s32p, 0, sizeof(*s32p));
169 s32p->tv_sec = (netbsd32_time_t)p->tv_sec; 181 s32p->tv_sec = (netbsd32_time_t)p->tv_sec;
170 s32p->tv_nsec = (netbsd32_long)p->tv_nsec; 182 s32p->tv_nsec = (netbsd32_long)p->tv_nsec;
171} 183}
172 184
173static __inline void 185static __inline void
174netbsd32_from_rusage(const struct rusage *rup, 186netbsd32_from_rusage(const struct rusage *rup,
175 struct netbsd32_rusage *ru32p) 187 struct netbsd32_rusage *ru32p)
176{ 188{
177 189
 190 memset(ru32p, 0, sizeof(*ru32p));
178 netbsd32_from_timeval(&rup->ru_utime, &ru32p->ru_utime); 191 netbsd32_from_timeval(&rup->ru_utime, &ru32p->ru_utime);
179 netbsd32_from_timeval(&rup->ru_stime, &ru32p->ru_stime); 192 netbsd32_from_timeval(&rup->ru_stime, &ru32p->ru_stime);
180#define C(var) ru32p->var = (netbsd32_long)rup->var 193#define C(var) ru32p->var = (netbsd32_long)rup->var
181 C(ru_maxrss); 194 C(ru_maxrss);
182 C(ru_ixrss); 195 C(ru_ixrss);
183 C(ru_idrss); 196 C(ru_idrss);
184 C(ru_isrss); 197 C(ru_isrss);
185 C(ru_minflt); 198 C(ru_minflt);
186 C(ru_majflt); 199 C(ru_majflt);
187 C(ru_nswap); 200 C(ru_nswap);
188 C(ru_inblock); 201 C(ru_inblock);
189 C(ru_oublock); 202 C(ru_oublock);
190 C(ru_msgsnd); 203 C(ru_msgsnd);
191 C(ru_msgrcv); 204 C(ru_msgrcv);
192 C(ru_nsignals); 205 C(ru_nsignals);
193 C(ru_nvcsw); 206 C(ru_nvcsw);
194 C(ru_nivcsw); 207 C(ru_nivcsw);
195#undef C 208#undef C
196} 209}
197 210
198static __inline void 211static __inline void
199netbsd32_to_rusage(const struct netbsd32_rusage *ru32p, 212netbsd32_to_rusage(const struct netbsd32_rusage *ru32p,
200 struct rusage *rup) 213 struct rusage *rup)
201{ 214{
202 215
 216 memset(rup, 0, sizeof(*rup));
203 netbsd32_to_timeval(&ru32p->ru_utime, &rup->ru_utime); 217 netbsd32_to_timeval(&ru32p->ru_utime, &rup->ru_utime);
204 netbsd32_to_timeval(&ru32p->ru_stime, &rup->ru_stime); 218 netbsd32_to_timeval(&ru32p->ru_stime, &rup->ru_stime);
205#define C(var) rup->var = (long)ru32p->var 219#define C(var) rup->var = (long)ru32p->var
206 C(ru_maxrss); 220 C(ru_maxrss);
207 C(ru_ixrss); 221 C(ru_ixrss);
208 C(ru_idrss); 222 C(ru_idrss);
209 C(ru_isrss); 223 C(ru_isrss);
210 C(ru_minflt); 224 C(ru_minflt);
211 C(ru_majflt); 225 C(ru_majflt);
212 C(ru_nswap); 226 C(ru_nswap);
213 C(ru_inblock); 227 C(ru_inblock);
214 C(ru_oublock); 228 C(ru_oublock);
215 C(ru_msgsnd); 229 C(ru_msgsnd);
216 C(ru_msgrcv); 230 C(ru_msgrcv);
217 C(ru_nsignals); 231 C(ru_nsignals);
218 C(ru_nvcsw); 232 C(ru_nvcsw);
219 C(ru_nivcsw); 233 C(ru_nivcsw);
220#undef C 234#undef C
221} 235}
222 236
223static __inline void 237static __inline void
224netbsd32_from_rusage50(const struct rusage *rup, 238netbsd32_from_rusage50(const struct rusage *rup,
225 struct netbsd32_rusage50 *ru32p) 239 struct netbsd32_rusage50 *ru32p)
226{ 240{
227 241
 242 memset(ru32p, 0, sizeof(*ru32p));
228 netbsd32_from_timeval50(&rup->ru_utime, &ru32p->ru_utime); 243 netbsd32_from_timeval50(&rup->ru_utime, &ru32p->ru_utime);
229 netbsd32_from_timeval50(&rup->ru_stime, &ru32p->ru_stime); 244 netbsd32_from_timeval50(&rup->ru_stime, &ru32p->ru_stime);
230#define C(var) ru32p->var = (netbsd32_long)rup->var 245#define C(var) ru32p->var = (netbsd32_long)rup->var
231 C(ru_maxrss); 246 C(ru_maxrss);
232 C(ru_ixrss); 247 C(ru_ixrss);
233 C(ru_idrss); 248 C(ru_idrss);
234 C(ru_isrss); 249 C(ru_isrss);
235 C(ru_minflt); 250 C(ru_minflt);
236 C(ru_majflt); 251 C(ru_majflt);
237 C(ru_nswap); 252 C(ru_nswap);
238 C(ru_inblock); 253 C(ru_inblock);
239 C(ru_oublock); 254 C(ru_oublock);
240 C(ru_msgsnd); 255 C(ru_msgsnd);
@@ -249,26 +264,27 @@ static __inline int @@ -249,26 +264,27 @@ static __inline int
249netbsd32_to_iovecin(const struct netbsd32_iovec *iov32p, struct iovec *iovp, 264netbsd32_to_iovecin(const struct netbsd32_iovec *iov32p, struct iovec *iovp,
250 int len) 265 int len)
251{ 266{
252 int i, error=0; 267 int i, error=0;
253 u_int32_t iov_base; 268 u_int32_t iov_base;
254 u_int32_t iov_len, total_iov_len; 269 u_int32_t iov_len, total_iov_len;
255 270
256 /* 271 /*
257 * We could allocate an iov32p, do a copyin, and translate 272 * We could allocate an iov32p, do a copyin, and translate
258 * each field and then free it all up, or we could copyin 273 * each field and then free it all up, or we could copyin
259 * each field separately. I'm doing the latter to reduce 274 * each field separately. I'm doing the latter to reduce
260 * the number of MALLOC()s. 275 * the number of MALLOC()s.
261 */ 276 */
 277 memset(iovp, 0, sizeof(*iovp));
262 total_iov_len = 0; 278 total_iov_len = 0;
263 for (i = 0; i < len; i++, iovp++, iov32p++) { 279 for (i = 0; i < len; i++, iovp++, iov32p++) {
264 if ((error = copyin(&iov32p->iov_base, &iov_base, sizeof(iov_base)))) 280 if ((error = copyin(&iov32p->iov_base, &iov_base, sizeof(iov_base))))
265 return (error); 281 return (error);
266 if ((error = copyin(&iov32p->iov_len, &iov_len, sizeof(iov_len)))) 282 if ((error = copyin(&iov32p->iov_len, &iov_len, sizeof(iov_len))))
267 return (error); 283 return (error);
268 iovp->iov_base = (void *)(u_long)iov_base; 284 iovp->iov_base = (void *)(u_long)iov_base;
269 iovp->iov_len = (size_t)iov_len; 285 iovp->iov_len = (size_t)iov_len;
270 286
271 /* 287 /*
272 * System calls return ssize_t because -1 is returned 288 * System calls return ssize_t because -1 is returned
273 * on error. Therefore we must restrict the length to 289 * on error. Therefore we must restrict the length to
274 * SSIZE_MAX (NETBSD32_SSIZE_MAX with compat32) to 290 * SSIZE_MAX (NETBSD32_SSIZE_MAX with compat32) to
@@ -279,50 +295,54 @@ netbsd32_to_iovecin(const struct netbsd3 @@ -279,50 +295,54 @@ netbsd32_to_iovecin(const struct netbsd3
279 total_iov_len > NETBSD32_SSIZE_MAX) { 295 total_iov_len > NETBSD32_SSIZE_MAX) {
280 return EINVAL; 296 return EINVAL;
281 break; 297 break;
282 } 298 }
283 } 299 }
284 return error; 300 return error;
285} 301}
286 302
287/* msg_iov must be done separately */ 303/* msg_iov must be done separately */
288static __inline void 304static __inline void
289netbsd32_to_msghdr(const struct netbsd32_msghdr *mhp32, struct msghdr *mhp) 305netbsd32_to_msghdr(const struct netbsd32_msghdr *mhp32, struct msghdr *mhp)
290{ 306{
291 307
 308 memset(mhp, 0, sizeof(*mhp));
292 mhp->msg_name = NETBSD32PTR64(mhp32->msg_name); 309 mhp->msg_name = NETBSD32PTR64(mhp32->msg_name);
293 mhp->msg_namelen = mhp32->msg_namelen; 310 mhp->msg_namelen = mhp32->msg_namelen;
294 mhp->msg_iovlen = (size_t)mhp32->msg_iovlen; 311 mhp->msg_iovlen = (size_t)mhp32->msg_iovlen;
295 mhp->msg_control = NETBSD32PTR64(mhp32->msg_control); 312 mhp->msg_control = NETBSD32PTR64(mhp32->msg_control);
296 mhp->msg_controllen = mhp32->msg_controllen; 313 mhp->msg_controllen = mhp32->msg_controllen;
297 mhp->msg_flags = mhp32->msg_flags; 314 mhp->msg_flags = mhp32->msg_flags;
298} 315}
299 316
300/* msg_iov must be done separately */ 317/* msg_iov must be done separately */
301static __inline void 318static __inline void
302netbsd32_from_msghdr(struct netbsd32_msghdr *mhp32, const struct msghdr *mhp) 319netbsd32_from_msghdr(struct netbsd32_msghdr *mhp32, const struct msghdr *mhp)
303{ 320{
304 321
 322 memset(mhp32, 0, sizeof(*mhp32));
305 NETBSD32PTR32(mhp32->msg_name, mhp->msg_name); 323 NETBSD32PTR32(mhp32->msg_name, mhp->msg_name);
306 mhp32->msg_namelen = mhp->msg_namelen; 324 mhp32->msg_namelen = mhp->msg_namelen;
307 mhp32->msg_iovlen = mhp->msg_iovlen; 325 mhp32->msg_iovlen = mhp->msg_iovlen;
308 NETBSD32PTR32(mhp32->msg_control, mhp->msg_control); 326 NETBSD32PTR32(mhp32->msg_control, mhp->msg_control);
309 mhp32->msg_controllen = mhp->msg_controllen; 327 mhp32->msg_controllen = mhp->msg_controllen;
310 mhp32->msg_flags = mhp->msg_flags; 328 mhp32->msg_flags = mhp->msg_flags;
311} 329}
312 330
313static __inline void 331static __inline void
314netbsd32_from_statvfs(const struct statvfs *sbp, struct netbsd32_statvfs *sb32p) 332netbsd32_from_statvfs(const struct statvfs *sbp, struct netbsd32_statvfs *sb32p)
315{ 333{
 334
 335 memset(sb32p, 0, sizeof(*sb32p));
316 sb32p->f_flag = sbp->f_flag; 336 sb32p->f_flag = sbp->f_flag;
317 sb32p->f_bsize = (netbsd32_u_long)sbp->f_bsize; 337 sb32p->f_bsize = (netbsd32_u_long)sbp->f_bsize;
318 sb32p->f_frsize = (netbsd32_u_long)sbp->f_frsize; 338 sb32p->f_frsize = (netbsd32_u_long)sbp->f_frsize;
319 sb32p->f_iosize = (netbsd32_u_long)sbp->f_iosize; 339 sb32p->f_iosize = (netbsd32_u_long)sbp->f_iosize;
320 sb32p->f_blocks = sbp->f_blocks; 340 sb32p->f_blocks = sbp->f_blocks;
321 sb32p->f_bfree = sbp->f_bfree; 341 sb32p->f_bfree = sbp->f_bfree;
322 sb32p->f_bavail = sbp->f_bavail; 342 sb32p->f_bavail = sbp->f_bavail;
323 sb32p->f_bresvd = sbp->f_bresvd; 343 sb32p->f_bresvd = sbp->f_bresvd;
324 sb32p->f_files = sbp->f_files; 344 sb32p->f_files = sbp->f_files;
325 sb32p->f_ffree = sbp->f_ffree; 345 sb32p->f_ffree = sbp->f_ffree;
326 sb32p->f_favail = sbp->f_favail; 346 sb32p->f_favail = sbp->f_favail;
327 sb32p->f_fresvd = sbp->f_fresvd; 347 sb32p->f_fresvd = sbp->f_fresvd;
328 sb32p->f_syncreads = sbp->f_syncreads; 348 sb32p->f_syncreads = sbp->f_syncreads;
@@ -344,123 +364,128 @@ netbsd32_from_statvfs(const struct statv @@ -344,123 +364,128 @@ netbsd32_from_statvfs(const struct statv
344 sizeof(sb32p->f_mntfromname)); 364 sizeof(sb32p->f_mntfromname));
345#else 365#else
346 /* If we want to be careful */ 366 /* If we want to be careful */
347 memcpy(sb32p->f_fstypename, sbp->f_fstypename, sizeof(sb32p->f_fstypename)); 367 memcpy(sb32p->f_fstypename, sbp->f_fstypename, sizeof(sb32p->f_fstypename));
348 memcpy(sb32p->f_mntonname, sbp->f_mntonname, sizeof(sb32p->f_mntonname)); 368 memcpy(sb32p->f_mntonname, sbp->f_mntonname, sizeof(sb32p->f_mntonname));
349 memcpy(sb32p->f_mntfromname, sbp->f_mntfromname, sizeof(sb32p->f_mntfromname)); 369 memcpy(sb32p->f_mntfromname, sbp->f_mntfromname, sizeof(sb32p->f_mntfromname));
350#endif 370#endif
351} 371}
352 372
353static __inline void 373static __inline void
354netbsd32_from_timex(const struct timex *txp, struct netbsd32_timex *tx32p) 374netbsd32_from_timex(const struct timex *txp, struct netbsd32_timex *tx32p)
355{ 375{
356 376
 377 memset(tx32p, 0, sizeof(*tx32p));
357 tx32p->modes = txp->modes; 378 tx32p->modes = txp->modes;
358 tx32p->offset = (netbsd32_long)txp->offset; 379 tx32p->offset = (netbsd32_long)txp->offset;
359 tx32p->freq = (netbsd32_long)txp->freq; 380 tx32p->freq = (netbsd32_long)txp->freq;
360 tx32p->maxerror = (netbsd32_long)txp->maxerror; 381 tx32p->maxerror = (netbsd32_long)txp->maxerror;
361 tx32p->esterror = (netbsd32_long)txp->esterror; 382 tx32p->esterror = (netbsd32_long)txp->esterror;
362 tx32p->status = txp->status; 383 tx32p->status = txp->status;
363 tx32p->constant = (netbsd32_long)txp->constant; 384 tx32p->constant = (netbsd32_long)txp->constant;
364 tx32p->precision = (netbsd32_long)txp->precision; 385 tx32p->precision = (netbsd32_long)txp->precision;
365 tx32p->tolerance = (netbsd32_long)txp->tolerance; 386 tx32p->tolerance = (netbsd32_long)txp->tolerance;
366 tx32p->ppsfreq = (netbsd32_long)txp->ppsfreq; 387 tx32p->ppsfreq = (netbsd32_long)txp->ppsfreq;
367 tx32p->jitter = (netbsd32_long)txp->jitter; 388 tx32p->jitter = (netbsd32_long)txp->jitter;
368 tx32p->shift = txp->shift; 389 tx32p->shift = txp->shift;
369 tx32p->stabil = (netbsd32_long)txp->stabil; 390 tx32p->stabil = (netbsd32_long)txp->stabil;
370 tx32p->jitcnt = (netbsd32_long)txp->jitcnt; 391 tx32p->jitcnt = (netbsd32_long)txp->jitcnt;
371 tx32p->calcnt = (netbsd32_long)txp->calcnt; 392 tx32p->calcnt = (netbsd32_long)txp->calcnt;
372 tx32p->errcnt = (netbsd32_long)txp->errcnt; 393 tx32p->errcnt = (netbsd32_long)txp->errcnt;
373 tx32p->stbcnt = (netbsd32_long)txp->stbcnt; 394 tx32p->stbcnt = (netbsd32_long)txp->stbcnt;
374} 395}
375 396
376static __inline void 397static __inline void
377netbsd32_to_timex(const struct netbsd32_timex *tx32p, struct timex *txp) 398netbsd32_to_timex(const struct netbsd32_timex *tx32p, struct timex *txp)
378{ 399{
379 400
 401 memset(txp, 0, sizeof(*txp));
380 txp->modes = tx32p->modes; 402 txp->modes = tx32p->modes;
381 txp->offset = (long)tx32p->offset; 403 txp->offset = (long)tx32p->offset;
382 txp->freq = (long)tx32p->freq; 404 txp->freq = (long)tx32p->freq;
383 txp->maxerror = (long)tx32p->maxerror; 405 txp->maxerror = (long)tx32p->maxerror;
384 txp->esterror = (long)tx32p->esterror; 406 txp->esterror = (long)tx32p->esterror;
385 txp->status = tx32p->status; 407 txp->status = tx32p->status;
386 txp->constant = (long)tx32p->constant; 408 txp->constant = (long)tx32p->constant;
387 txp->precision = (long)tx32p->precision; 409 txp->precision = (long)tx32p->precision;
388 txp->tolerance = (long)tx32p->tolerance; 410 txp->tolerance = (long)tx32p->tolerance;
389 txp->ppsfreq = (long)tx32p->ppsfreq; 411 txp->ppsfreq = (long)tx32p->ppsfreq;
390 txp->jitter = (long)tx32p->jitter; 412 txp->jitter = (long)tx32p->jitter;
391 txp->shift = tx32p->shift; 413 txp->shift = tx32p->shift;
392 txp->stabil = (long)tx32p->stabil; 414 txp->stabil = (long)tx32p->stabil;
393 txp->jitcnt = (long)tx32p->jitcnt; 415 txp->jitcnt = (long)tx32p->jitcnt;
394 txp->calcnt = (long)tx32p->calcnt; 416 txp->calcnt = (long)tx32p->calcnt;
395 txp->errcnt = (long)tx32p->errcnt; 417 txp->errcnt = (long)tx32p->errcnt;
396 txp->stbcnt = (long)tx32p->stbcnt; 418 txp->stbcnt = (long)tx32p->stbcnt;
397} 419}
398 420
399static __inline void 421static __inline void
400netbsd32_from___stat13(const struct stat *sbp, struct netbsd32_stat13 *sb32p) 422netbsd32_from___stat13(const struct stat *sbp, struct netbsd32_stat13 *sb32p)
401{ 423{
 424
402 memset(sb32p, 0, sizeof *sb32p); 425 memset(sb32p, 0, sizeof *sb32p);
403 sb32p->st_dev = (uint32_t)sbp->st_dev; 426 sb32p->st_dev = (uint32_t)sbp->st_dev;
404 sb32p->st_ino = sbp->st_ino; 427 sb32p->st_ino = sbp->st_ino;
405 sb32p->st_mode = sbp->st_mode; 428 sb32p->st_mode = sbp->st_mode;
406 sb32p->st_nlink = sbp->st_nlink; 429 sb32p->st_nlink = sbp->st_nlink;
407 sb32p->st_uid = sbp->st_uid; 430 sb32p->st_uid = sbp->st_uid;
408 sb32p->st_gid = sbp->st_gid; 431 sb32p->st_gid = sbp->st_gid;
409 sb32p->st_rdev = (uint32_t)sbp->st_rdev; 432 sb32p->st_rdev = (uint32_t)sbp->st_rdev;
410 sb32p->st_size = sbp->st_size; 433 sb32p->st_size = sbp->st_size;
411 sb32p->st_atimespec.tv_sec = (int32_t)sbp->st_atimespec.tv_sec; 434 sb32p->st_atimespec.tv_sec = (int32_t)sbp->st_atimespec.tv_sec;
412 sb32p->st_atimespec.tv_nsec = (netbsd32_long)sbp->st_atimespec.tv_nsec; 435 sb32p->st_atimespec.tv_nsec = (netbsd32_long)sbp->st_atimespec.tv_nsec;
413 sb32p->st_mtimespec.tv_sec = (int32_t)sbp->st_mtimespec.tv_sec; 436 sb32p->st_mtimespec.tv_sec = (int32_t)sbp->st_mtimespec.tv_sec;
414 sb32p->st_mtimespec.tv_nsec = (netbsd32_long)sbp->st_mtimespec.tv_nsec; 437 sb32p->st_mtimespec.tv_nsec = (netbsd32_long)sbp->st_mtimespec.tv_nsec;
415 sb32p->st_ctimespec.tv_sec = (int32_t)sbp->st_ctimespec.tv_sec; 438 sb32p->st_ctimespec.tv_sec = (int32_t)sbp->st_ctimespec.tv_sec;
416 sb32p->st_ctimespec.tv_nsec = (netbsd32_long)sbp->st_ctimespec.tv_nsec; 439 sb32p->st_ctimespec.tv_nsec = (netbsd32_long)sbp->st_ctimespec.tv_nsec;
417 sb32p->st_blksize = sbp->st_blksize; 440 sb32p->st_blksize = sbp->st_blksize;
418 sb32p->st_blocks = sbp->st_blocks; 441 sb32p->st_blocks = sbp->st_blocks;
419 sb32p->st_flags = sbp->st_flags; 442 sb32p->st_flags = sbp->st_flags;
420 sb32p->st_gen = sbp->st_gen; 443 sb32p->st_gen = sbp->st_gen;
421 sb32p->st_birthtimespec.tv_sec = (int32_t)sbp->st_birthtimespec.tv_sec; 444 sb32p->st_birthtimespec.tv_sec = (int32_t)sbp->st_birthtimespec.tv_sec;
422 sb32p->st_birthtimespec.tv_nsec = (netbsd32_long)sbp->st_birthtimespec.tv_nsec; 445 sb32p->st_birthtimespec.tv_nsec = (netbsd32_long)sbp->st_birthtimespec.tv_nsec;
423} 446}
424 447
425static __inline void 448static __inline void
426netbsd32_from___stat50(const struct stat *sbp, struct netbsd32_stat50 *sb32p) 449netbsd32_from___stat50(const struct stat *sbp, struct netbsd32_stat50 *sb32p)
427{ 450{
 451
428 memset(sb32p, 0, sizeof *sb32p); 452 memset(sb32p, 0, sizeof *sb32p);
429 sb32p->st_dev = (uint32_t)sbp->st_dev; 453 sb32p->st_dev = (uint32_t)sbp->st_dev;
430 sb32p->st_ino = sbp->st_ino; 454 sb32p->st_ino = sbp->st_ino;
431 sb32p->st_mode = sbp->st_mode; 455 sb32p->st_mode = sbp->st_mode;
432 sb32p->st_nlink = sbp->st_nlink; 456 sb32p->st_nlink = sbp->st_nlink;
433 sb32p->st_uid = sbp->st_uid; 457 sb32p->st_uid = sbp->st_uid;
434 sb32p->st_gid = sbp->st_gid; 458 sb32p->st_gid = sbp->st_gid;
435 sb32p->st_rdev = (uint32_t)sbp->st_rdev; 459 sb32p->st_rdev = (uint32_t)sbp->st_rdev;
436 sb32p->st_size = sbp->st_size; 460 sb32p->st_size = sbp->st_size;
437 sb32p->st_atimespec.tv_sec = (int32_t)sbp->st_atimespec.tv_sec; 461 sb32p->st_atimespec.tv_sec = (int32_t)sbp->st_atimespec.tv_sec;
438 sb32p->st_atimespec.tv_nsec = (netbsd32_long)sbp->st_atimespec.tv_nsec; 462 sb32p->st_atimespec.tv_nsec = (netbsd32_long)sbp->st_atimespec.tv_nsec;
439 sb32p->st_mtimespec.tv_sec = (int32_t)sbp->st_mtimespec.tv_sec; 463 sb32p->st_mtimespec.tv_sec = (int32_t)sbp->st_mtimespec.tv_sec;
440 sb32p->st_mtimespec.tv_nsec = (netbsd32_long)sbp->st_mtimespec.tv_nsec; 464 sb32p->st_mtimespec.tv_nsec = (netbsd32_long)sbp->st_mtimespec.tv_nsec;
441 sb32p->st_ctimespec.tv_sec = (int32_t)sbp->st_ctimespec.tv_sec; 465 sb32p->st_ctimespec.tv_sec = (int32_t)sbp->st_ctimespec.tv_sec;
442 sb32p->st_ctimespec.tv_nsec = (netbsd32_long)sbp->st_ctimespec.tv_nsec; 466 sb32p->st_ctimespec.tv_nsec = (netbsd32_long)sbp->st_ctimespec.tv_nsec;
443 sb32p->st_birthtimespec.tv_sec = (int32_t)sbp->st_birthtimespec.tv_sec; 467 sb32p->st_birthtimespec.tv_sec = (int32_t)sbp->st_birthtimespec.tv_sec;
444 sb32p->st_birthtimespec.tv_nsec = (netbsd32_long)sbp->st_birthtimespec.tv_nsec; 468 sb32p->st_birthtimespec.tv_nsec = (netbsd32_long)sbp->st_birthtimespec.tv_nsec;
445 sb32p->st_blksize = sbp->st_blksize; 469 sb32p->st_blksize = sbp->st_blksize;
446 sb32p->st_blocks = sbp->st_blocks; 470 sb32p->st_blocks = sbp->st_blocks;
447 sb32p->st_flags = sbp->st_flags; 471 sb32p->st_flags = sbp->st_flags;
448 sb32p->st_gen = sbp->st_gen; 472 sb32p->st_gen = sbp->st_gen;
449} 473}
450 474
451static __inline void 475static __inline void
452netbsd32_from_stat(const struct stat *sbp, struct netbsd32_stat *sb32p) 476netbsd32_from_stat(const struct stat *sbp, struct netbsd32_stat *sb32p)
453{ 477{
 478
454 memset(sb32p, 0, sizeof *sb32p); 479 memset(sb32p, 0, sizeof *sb32p);
455 sb32p->st_dev = sbp->st_dev; 480 sb32p->st_dev = sbp->st_dev;
456 sb32p->st_ino = sbp->st_ino; 481 sb32p->st_ino = sbp->st_ino;
457 sb32p->st_mode = sbp->st_mode; 482 sb32p->st_mode = sbp->st_mode;
458 sb32p->st_nlink = sbp->st_nlink; 483 sb32p->st_nlink = sbp->st_nlink;
459 sb32p->st_uid = sbp->st_uid; 484 sb32p->st_uid = sbp->st_uid;
460 sb32p->st_gid = sbp->st_gid; 485 sb32p->st_gid = sbp->st_gid;
461 sb32p->st_rdev = sbp->st_rdev; 486 sb32p->st_rdev = sbp->st_rdev;
462 sb32p->st_size = sbp->st_size; 487 sb32p->st_size = sbp->st_size;
463 sb32p->st_atimespec.tv_sec = (netbsd32_time_t)sbp->st_atimespec.tv_sec; 488 sb32p->st_atimespec.tv_sec = (netbsd32_time_t)sbp->st_atimespec.tv_sec;
464 sb32p->st_atimespec.tv_nsec = (netbsd32_long)sbp->st_atimespec.tv_nsec; 489 sb32p->st_atimespec.tv_nsec = (netbsd32_long)sbp->st_atimespec.tv_nsec;
465 sb32p->st_mtimespec.tv_sec = (netbsd32_time_t)sbp->st_mtimespec.tv_sec; 490 sb32p->st_mtimespec.tv_sec = (netbsd32_time_t)sbp->st_mtimespec.tv_sec;
466 sb32p->st_mtimespec.tv_nsec = (netbsd32_long)sbp->st_mtimespec.tv_nsec; 491 sb32p->st_mtimespec.tv_nsec = (netbsd32_long)sbp->st_mtimespec.tv_nsec;
@@ -469,26 +494,27 @@ netbsd32_from_stat(const struct stat *sb @@ -469,26 +494,27 @@ netbsd32_from_stat(const struct stat *sb
469 sb32p->st_birthtimespec.tv_sec = (netbsd32_time_t)sbp->st_birthtimespec.tv_sec; 494 sb32p->st_birthtimespec.tv_sec = (netbsd32_time_t)sbp->st_birthtimespec.tv_sec;
470 sb32p->st_birthtimespec.tv_nsec = (netbsd32_long)sbp->st_birthtimespec.tv_nsec; 495 sb32p->st_birthtimespec.tv_nsec = (netbsd32_long)sbp->st_birthtimespec.tv_nsec;
471 sb32p->st_blksize = sbp->st_blksize; 496 sb32p->st_blksize = sbp->st_blksize;
472 sb32p->st_blocks = sbp->st_blocks; 497 sb32p->st_blocks = sbp->st_blocks;
473 sb32p->st_flags = sbp->st_flags; 498 sb32p->st_flags = sbp->st_flags;
474 sb32p->st_gen = sbp->st_gen; 499 sb32p->st_gen = sbp->st_gen;
475} 500}
476 501
477static __inline void 502static __inline void
478netbsd32_to_ipc_perm(const struct netbsd32_ipc_perm *ip32p, 503netbsd32_to_ipc_perm(const struct netbsd32_ipc_perm *ip32p,
479 struct ipc_perm *ipp) 504 struct ipc_perm *ipp)
480{ 505{
481 506
 507 memset(ipp, 0, sizeof(*ipp));
482 ipp->cuid = ip32p->cuid; 508 ipp->cuid = ip32p->cuid;
483 ipp->cgid = ip32p->cgid; 509 ipp->cgid = ip32p->cgid;
484 ipp->uid = ip32p->uid; 510 ipp->uid = ip32p->uid;
485 ipp->gid = ip32p->gid; 511 ipp->gid = ip32p->gid;
486 ipp->mode = ip32p->mode; 512 ipp->mode = ip32p->mode;
487 ipp->_seq = ip32p->_seq; 513 ipp->_seq = ip32p->_seq;
488 ipp->_key = (key_t)ip32p->_key; 514 ipp->_key = (key_t)ip32p->_key;
489} 515}
490 516
491static __inline void 517static __inline void
492netbsd32_from_ipc_perm(const struct ipc_perm *ipp, 518netbsd32_from_ipc_perm(const struct ipc_perm *ipp,
493 struct netbsd32_ipc_perm *ip32p) 519 struct netbsd32_ipc_perm *ip32p)
494{ 520{
@@ -497,64 +523,67 @@ netbsd32_from_ipc_perm(const struct ipc_ @@ -497,64 +523,67 @@ netbsd32_from_ipc_perm(const struct ipc_
497 ip32p->cuid = ipp->cuid; 523 ip32p->cuid = ipp->cuid;
498 ip32p->cgid = ipp->cgid; 524 ip32p->cgid = ipp->cgid;
499 ip32p->uid = ipp->uid; 525 ip32p->uid = ipp->uid;
500 ip32p->gid = ipp->gid; 526 ip32p->gid = ipp->gid;
501 ip32p->mode = ipp->mode; 527 ip32p->mode = ipp->mode;
502 ip32p->_seq = ipp->_seq; 528 ip32p->_seq = ipp->_seq;
503 ip32p->_key = (netbsd32_key_t)ipp->_key; 529 ip32p->_key = (netbsd32_key_t)ipp->_key;
504} 530}
505 531
506static __inline void 532static __inline void
507netbsd32_to_msg(const struct netbsd32_msg *m32p, struct msg *mp) 533netbsd32_to_msg(const struct netbsd32_msg *m32p, struct msg *mp)
508{ 534{
509 535
 536 memset(mp, 0, sizeof(*mp));
510 mp->msg_next = NETBSD32PTR64(m32p->msg_next); 537 mp->msg_next = NETBSD32PTR64(m32p->msg_next);
511 mp->msg_type = (long)m32p->msg_type; 538 mp->msg_type = (long)m32p->msg_type;
512 mp->msg_ts = m32p->msg_ts; 539 mp->msg_ts = m32p->msg_ts;
513 mp->msg_spot = m32p->msg_spot; 540 mp->msg_spot = m32p->msg_spot;
514} 541}
515 542
516static __inline void 543static __inline void
517netbsd32_from_msg(const struct msg *mp, struct netbsd32_msg *m32p) 544netbsd32_from_msg(const struct msg *mp, struct netbsd32_msg *m32p)
518{ 545{
519 546
520 memset(m32p, 0, sizeof *m32p); 547 memset(m32p, 0, sizeof *m32p);
521 NETBSD32PTR32(m32p->msg_next, mp->msg_next); 548 NETBSD32PTR32(m32p->msg_next, mp->msg_next);
522 m32p->msg_type = (netbsd32_long)mp->msg_type; 549 m32p->msg_type = (netbsd32_long)mp->msg_type;
523 m32p->msg_ts = mp->msg_ts; 550 m32p->msg_ts = mp->msg_ts;
524 m32p->msg_spot = mp->msg_spot; 551 m32p->msg_spot = mp->msg_spot;
525} 552}
526 553
527static __inline void 554static __inline void
528netbsd32_to_msqid_ds50(const struct netbsd32_msqid_ds50 *ds32p, 555netbsd32_to_msqid_ds50(const struct netbsd32_msqid_ds50 *ds32p,
529 struct msqid_ds *dsp) 556 struct msqid_ds *dsp)
530{ 557{
531 558
 559 memset(dsp, 0, sizeof(*dsp));
532 netbsd32_to_ipc_perm(&ds32p->msg_perm, &dsp->msg_perm); 560 netbsd32_to_ipc_perm(&ds32p->msg_perm, &dsp->msg_perm);
533 dsp->_msg_cbytes = (u_long)ds32p->_msg_cbytes; 561 dsp->_msg_cbytes = (u_long)ds32p->_msg_cbytes;
534 dsp->msg_qnum = (u_long)ds32p->msg_qnum; 562 dsp->msg_qnum = (u_long)ds32p->msg_qnum;
535 dsp->msg_qbytes = (u_long)ds32p->msg_qbytes; 563 dsp->msg_qbytes = (u_long)ds32p->msg_qbytes;
536 dsp->msg_lspid = ds32p->msg_lspid; 564 dsp->msg_lspid = ds32p->msg_lspid;
537 dsp->msg_lrpid = ds32p->msg_lrpid; 565 dsp->msg_lrpid = ds32p->msg_lrpid;
538 dsp->msg_rtime = (time_t)ds32p->msg_rtime; 566 dsp->msg_rtime = (time_t)ds32p->msg_rtime;
539 dsp->msg_stime = (time_t)ds32p->msg_stime; 567 dsp->msg_stime = (time_t)ds32p->msg_stime;
540 dsp->msg_ctime = (time_t)ds32p->msg_ctime; 568 dsp->msg_ctime = (time_t)ds32p->msg_ctime;
541} 569}
542 570
543static __inline void 571static __inline void
544netbsd32_to_msqid_ds(const struct netbsd32_msqid_ds *ds32p, 572netbsd32_to_msqid_ds(const struct netbsd32_msqid_ds *ds32p,
545 struct msqid_ds *dsp) 573 struct msqid_ds *dsp)
546{ 574{
547 575
 576 memset(dsp, 0, sizeof(*dsp));
548 netbsd32_to_ipc_perm(&ds32p->msg_perm, &dsp->msg_perm); 577 netbsd32_to_ipc_perm(&ds32p->msg_perm, &dsp->msg_perm);
549 dsp->_msg_cbytes = (u_long)ds32p->_msg_cbytes; 578 dsp->_msg_cbytes = (u_long)ds32p->_msg_cbytes;
550 dsp->msg_qnum = (u_long)ds32p->msg_qnum; 579 dsp->msg_qnum = (u_long)ds32p->msg_qnum;
551 dsp->msg_qbytes = (u_long)ds32p->msg_qbytes; 580 dsp->msg_qbytes = (u_long)ds32p->msg_qbytes;
552 dsp->msg_lspid = ds32p->msg_lspid; 581 dsp->msg_lspid = ds32p->msg_lspid;
553 dsp->msg_lrpid = ds32p->msg_lrpid; 582 dsp->msg_lrpid = ds32p->msg_lrpid;
554 dsp->msg_rtime = (time_t)ds32p->msg_rtime; 583 dsp->msg_rtime = (time_t)ds32p->msg_rtime;
555 dsp->msg_stime = (time_t)ds32p->msg_stime; 584 dsp->msg_stime = (time_t)ds32p->msg_stime;
556 dsp->msg_ctime = (time_t)ds32p->msg_ctime; 585 dsp->msg_ctime = (time_t)ds32p->msg_ctime;
557} 586}
558 587
559static __inline void 588static __inline void
560netbsd32_from_msqid_ds50(const struct msqid_ds *dsp, 589netbsd32_from_msqid_ds50(const struct msqid_ds *dsp,
@@ -585,41 +614,43 @@ netbsd32_from_msqid_ds(const struct msqi @@ -585,41 +614,43 @@ netbsd32_from_msqid_ds(const struct msqi
585 ds32p->msg_qbytes = (netbsd32_u_long)dsp->msg_qbytes; 614 ds32p->msg_qbytes = (netbsd32_u_long)dsp->msg_qbytes;
586 ds32p->msg_lspid = dsp->msg_lspid; 615 ds32p->msg_lspid = dsp->msg_lspid;
587 ds32p->msg_lrpid = dsp->msg_lrpid; 616 ds32p->msg_lrpid = dsp->msg_lrpid;
588 ds32p->msg_rtime = dsp->msg_rtime; 617 ds32p->msg_rtime = dsp->msg_rtime;
589 ds32p->msg_stime = dsp->msg_stime; 618 ds32p->msg_stime = dsp->msg_stime;
590 ds32p->msg_ctime = dsp->msg_ctime; 619 ds32p->msg_ctime = dsp->msg_ctime;
591} 620}
592 621
593static __inline void 622static __inline void
594netbsd32_to_shmid_ds50(const struct netbsd32_shmid_ds50 *ds32p, 623netbsd32_to_shmid_ds50(const struct netbsd32_shmid_ds50 *ds32p,
595 struct shmid_ds *dsp) 624 struct shmid_ds *dsp)
596{ 625{
597 626
 627 memset(dsp, 0, sizeof(*dsp));
598 netbsd32_to_ipc_perm(&ds32p->shm_perm, &dsp->shm_perm); 628 netbsd32_to_ipc_perm(&ds32p->shm_perm, &dsp->shm_perm);
599 dsp->shm_segsz = ds32p->shm_segsz; 629 dsp->shm_segsz = ds32p->shm_segsz;
600 dsp->shm_lpid = ds32p->shm_lpid; 630 dsp->shm_lpid = ds32p->shm_lpid;
601 dsp->shm_cpid = ds32p->shm_cpid; 631 dsp->shm_cpid = ds32p->shm_cpid;
602 dsp->shm_nattch = ds32p->shm_nattch; 632 dsp->shm_nattch = ds32p->shm_nattch;
603 dsp->shm_atime = (time_t)ds32p->shm_atime; 633 dsp->shm_atime = (time_t)ds32p->shm_atime;
604 dsp->shm_dtime = (time_t)ds32p->shm_dtime; 634 dsp->shm_dtime = (time_t)ds32p->shm_dtime;
605 dsp->shm_ctime = (time_t)ds32p->shm_ctime; 635 dsp->shm_ctime = (time_t)ds32p->shm_ctime;
606} 636}
607 637
608static __inline void 638static __inline void
609netbsd32_to_shmid_ds(const struct netbsd32_shmid_ds *ds32p, 639netbsd32_to_shmid_ds(const struct netbsd32_shmid_ds *ds32p,
610 struct shmid_ds *dsp) 640 struct shmid_ds *dsp)
611{ 641{
612 642
 643 memset(dsp, 0, sizeof(*dsp));
613 netbsd32_to_ipc_perm(&ds32p->shm_perm, &dsp->shm_perm); 644 netbsd32_to_ipc_perm(&ds32p->shm_perm, &dsp->shm_perm);
614 dsp->shm_segsz = ds32p->shm_segsz; 645 dsp->shm_segsz = ds32p->shm_segsz;
615 dsp->shm_lpid = ds32p->shm_lpid; 646 dsp->shm_lpid = ds32p->shm_lpid;
616 dsp->shm_cpid = ds32p->shm_cpid; 647 dsp->shm_cpid = ds32p->shm_cpid;
617 dsp->shm_nattch = ds32p->shm_nattch; 648 dsp->shm_nattch = ds32p->shm_nattch;
618 dsp->shm_atime = (long)ds32p->shm_atime; 649 dsp->shm_atime = (long)ds32p->shm_atime;
619 dsp->shm_dtime = (time_t)ds32p->shm_dtime; 650 dsp->shm_dtime = (time_t)ds32p->shm_dtime;
620 dsp->shm_ctime = (time_t)ds32p->shm_ctime; 651 dsp->shm_ctime = (time_t)ds32p->shm_ctime;
621} 652}
622 653
623static __inline void 654static __inline void
624netbsd32_from_shmid_ds50(const struct shmid_ds *dsp, 655netbsd32_from_shmid_ds50(const struct shmid_ds *dsp,
625 struct netbsd32_shmid_ds50 *ds32p) 656 struct netbsd32_shmid_ds50 *ds32p)
@@ -647,37 +678,39 @@ netbsd32_from_shmid_ds(const struct shmi @@ -647,37 +678,39 @@ netbsd32_from_shmid_ds(const struct shmi
647 ds32p->shm_lpid = dsp->shm_lpid; 678 ds32p->shm_lpid = dsp->shm_lpid;
648 ds32p->shm_cpid = dsp->shm_cpid; 679 ds32p->shm_cpid = dsp->shm_cpid;
649 ds32p->shm_nattch = dsp->shm_nattch; 680 ds32p->shm_nattch = dsp->shm_nattch;
650 ds32p->shm_atime = (netbsd32_long)dsp->shm_atime; 681 ds32p->shm_atime = (netbsd32_long)dsp->shm_atime;
651 ds32p->shm_dtime = (netbsd32_long)dsp->shm_dtime; 682 ds32p->shm_dtime = (netbsd32_long)dsp->shm_dtime;
652 ds32p->shm_ctime = (netbsd32_long)dsp->shm_ctime; 683 ds32p->shm_ctime = (netbsd32_long)dsp->shm_ctime;
653} 684}
654 685
655static __inline void 686static __inline void
656netbsd32_to_semid_ds50(const struct netbsd32_semid_ds50 *s32dsp, 687netbsd32_to_semid_ds50(const struct netbsd32_semid_ds50 *s32dsp,
657 struct semid_ds *dsp) 688 struct semid_ds *dsp)
658{ 689{
659 690
 691 memset(dsp, 0, sizeof(*dsp));
660 netbsd32_to_ipc_perm(&s32dsp->sem_perm, &dsp->sem_perm); 692 netbsd32_to_ipc_perm(&s32dsp->sem_perm, &dsp->sem_perm);
661 dsp->sem_nsems = (time_t)s32dsp->sem_nsems; 693 dsp->sem_nsems = (time_t)s32dsp->sem_nsems;
662 dsp->sem_otime = (time_t)s32dsp->sem_otime; 694 dsp->sem_otime = (time_t)s32dsp->sem_otime;
663 dsp->sem_ctime = (time_t)s32dsp->sem_ctime; 695 dsp->sem_ctime = (time_t)s32dsp->sem_ctime;
664} 696}
665 697
666static __inline void 698static __inline void
667netbsd32_to_semid_ds(const struct netbsd32_semid_ds *s32dsp, 699netbsd32_to_semid_ds(const struct netbsd32_semid_ds *s32dsp,
668 struct semid_ds *dsp) 700 struct semid_ds *dsp)
669{ 701{
670 702
 703 memset(dsp, 0, sizeof(*dsp));
671 netbsd32_to_ipc_perm(&s32dsp->sem_perm, &dsp->sem_perm); 704 netbsd32_to_ipc_perm(&s32dsp->sem_perm, &dsp->sem_perm);
672 dsp->sem_nsems = s32dsp->sem_nsems; 705 dsp->sem_nsems = s32dsp->sem_nsems;
673 dsp->sem_otime = s32dsp->sem_otime; 706 dsp->sem_otime = s32dsp->sem_otime;
674 dsp->sem_ctime = s32dsp->sem_ctime; 707 dsp->sem_ctime = s32dsp->sem_ctime;
675} 708}
676 709
677static __inline void 710static __inline void
678netbsd32_from_semid_ds50(const struct semid_ds *dsp, 711netbsd32_from_semid_ds50(const struct semid_ds *dsp,
679 struct netbsd32_semid_ds50 *s32dsp) 712 struct netbsd32_semid_ds50 *s32dsp)
680{ 713{
681 714
682 memset(s32dsp, 0, sizeof *s32dsp); 715 memset(s32dsp, 0, sizeof *s32dsp);
683 netbsd32_from_ipc_perm(&dsp->sem_perm, &s32dsp->sem_perm); 716 netbsd32_from_ipc_perm(&dsp->sem_perm, &s32dsp->sem_perm);
@@ -693,57 +726,64 @@ netbsd32_from_semid_ds(const struct semi @@ -693,57 +726,64 @@ netbsd32_from_semid_ds(const struct semi
693 726
694 memset(s32dsp, 0, sizeof *s32dsp); 727 memset(s32dsp, 0, sizeof *s32dsp);
695 netbsd32_from_ipc_perm(&dsp->sem_perm, &s32dsp->sem_perm); 728 netbsd32_from_ipc_perm(&dsp->sem_perm, &s32dsp->sem_perm);
696 s32dsp->sem_nsems = dsp->sem_nsems; 729 s32dsp->sem_nsems = dsp->sem_nsems;
697 s32dsp->sem_otime = dsp->sem_otime; 730 s32dsp->sem_otime = dsp->sem_otime;
698 s32dsp->sem_ctime = dsp->sem_ctime; 731 s32dsp->sem_ctime = dsp->sem_ctime;
699} 732}
700 733
701static __inline void 734static __inline void
702netbsd32_from_loadavg(struct netbsd32_loadavg *av32, 735netbsd32_from_loadavg(struct netbsd32_loadavg *av32,
703 const struct loadavg *av) 736 const struct loadavg *av)
704{ 737{
705 738
 739 memset(av32, 0, sizeof(*av32));
706 av32->ldavg[0] = av->ldavg[0]; 740 av32->ldavg[0] = av->ldavg[0];
707 av32->ldavg[1] = av->ldavg[1]; 741 av32->ldavg[1] = av->ldavg[1];
708 av32->ldavg[2] = av->ldavg[2]; 742 av32->ldavg[2] = av->ldavg[2];
709 av32->fscale = (netbsd32_long)av->fscale; 743 av32->fscale = (netbsd32_long)av->fscale;
710} 744}
711 745
712static __inline void 746static __inline void
713netbsd32_to_kevent(struct netbsd32_kevent *ke32, struct kevent *ke) 747netbsd32_to_kevent(struct netbsd32_kevent *ke32, struct kevent *ke)
714{ 748{
 749
 750 memset(ke, 0, sizeof(*ke));
715 ke->ident = ke32->ident; 751 ke->ident = ke32->ident;
716 ke->filter = ke32->filter; 752 ke->filter = ke32->filter;
717 ke->flags = ke32->flags; 753 ke->flags = ke32->flags;
718 ke->fflags = ke32->fflags; 754 ke->fflags = ke32->fflags;
719 ke->data = ke32->data; 755 ke->data = ke32->data;
720 ke->udata = ke32->udata; 756 ke->udata = ke32->udata;
721} 757}
722 758
723static __inline void 759static __inline void
724netbsd32_from_kevent(struct kevent *ke, struct netbsd32_kevent *ke32) 760netbsd32_from_kevent(struct kevent *ke, struct netbsd32_kevent *ke32)
725{ 761{
 762
 763 memset(ke32, 0, sizeof(*ke32));
726 ke32->ident = ke->ident; 764 ke32->ident = ke->ident;
727 ke32->filter = ke->filter; 765 ke32->filter = ke->filter;
728 ke32->flags = ke->flags; 766 ke32->flags = ke->flags;
729 ke32->fflags = ke->fflags; 767 ke32->fflags = ke->fflags;
730 ke32->data = ke->data; 768 ke32->data = ke->data;
731 ke32->udata = ke->udata; 769 ke32->udata = ke->udata;
732} 770}
733 771
734static __inline void 772static __inline void
735netbsd32_to_sigevent(const struct netbsd32_sigevent *ev32, struct sigevent *ev) 773netbsd32_to_sigevent(const struct netbsd32_sigevent *ev32, struct sigevent *ev)
736{ 774{
 775
 776 memset(ev, 0, sizeof(*ev));
737 ev->sigev_notify = ev32->sigev_notify; 777 ev->sigev_notify = ev32->sigev_notify;
738 ev->sigev_signo = ev32->sigev_signo; 778 ev->sigev_signo = ev32->sigev_signo;
739 /* 779 /*
740 * XXX sival_ptr, sigev_notify_function and 780 * XXX sival_ptr, sigev_notify_function and
741 * sigev_notify_attributes are currently unused 781 * sigev_notify_attributes are currently unused
742 */ 782 */
743 ev->sigev_value.sival_int = ev32->sigev_value.sival_int; 783 ev->sigev_value.sival_int = ev32->sigev_value.sival_int;
744 ev->sigev_notify_function = NETBSD32PTR64(ev32->sigev_notify_function); 784 ev->sigev_notify_function = NETBSD32PTR64(ev32->sigev_notify_function);
745 ev->sigev_notify_attributes = NETBSD32PTR64(ev32->sigev_notify_attributes); 785 ev->sigev_notify_attributes = NETBSD32PTR64(ev32->sigev_notify_attributes);
746} 786}
747 787
748static __inline int 788static __inline int
749netbsd32_to_dirent12(char *buf, int nbytes) 789netbsd32_to_dirent12(char *buf, int nbytes)
@@ -786,40 +826,45 @@ netbsd32_copyin_plistref(netbsd32_pointe @@ -786,40 +826,45 @@ netbsd32_copyin_plistref(netbsd32_pointe
786 sizeof(struct netbsd32_plistref)); 826 sizeof(struct netbsd32_plistref));
787 if (error) 827 if (error)
788 return error; 828 return error;
789 p->pref_plist = NETBSD32PTR64(n32plist.pref_plist); 829 p->pref_plist = NETBSD32PTR64(n32plist.pref_plist);
790 p->pref_len = n32plist.pref_len; 830 p->pref_len = n32plist.pref_len;
791 return 0; 831 return 0;
792} 832}
793 833
794static inline int 834static inline int
795netbsd32_copyout_plistref(netbsd32_pointer_t n32p, struct plistref *p) 835netbsd32_copyout_plistref(netbsd32_pointer_t n32p, struct plistref *p)
796{ 836{
797 struct netbsd32_plistref n32plist; 837 struct netbsd32_plistref n32plist;
798 838
 839 memset(&n32plist, 0, sizeof(n32plist));
799 NETBSD32PTR32(n32plist.pref_plist, p->pref_plist); 840 NETBSD32PTR32(n32plist.pref_plist, p->pref_plist);
800 n32plist.pref_len = p->pref_len; 841 n32plist.pref_len = p->pref_len;
801 return copyout(&n32plist, NETBSD32PTR64(n32p), 842 return copyout(&n32plist, NETBSD32PTR64(n32p),
802 sizeof(struct netbsd32_plistref)); 843 sizeof(struct netbsd32_plistref));
803} 844}
804 845
805static __inline void 846static __inline void
806netbsd32_to_mq_attr(const struct netbsd32_mq_attr *a32, 847netbsd32_to_mq_attr(const struct netbsd32_mq_attr *a32,
807 struct mq_attr *attr) 848 struct mq_attr *attr)
808{ 849{
 850
 851 memset(attr, 0, sizeof(*attr));
809 attr->mq_flags = a32->mq_flags; 852 attr->mq_flags = a32->mq_flags;
810 attr->mq_maxmsg = a32->mq_maxmsg; 853 attr->mq_maxmsg = a32->mq_maxmsg;
811 attr->mq_msgsize = a32->mq_msgsize; 854 attr->mq_msgsize = a32->mq_msgsize;
812 attr->mq_curmsgs = a32->mq_curmsgs; 855 attr->mq_curmsgs = a32->mq_curmsgs;
813} 856}
814 857
815static __inline void 858static __inline void
816netbsd32_from_mq_attr(const struct mq_attr *attr, 859netbsd32_from_mq_attr(const struct mq_attr *attr,
817 struct netbsd32_mq_attr *a32) 860 struct netbsd32_mq_attr *a32)
818{ 861{
 862
 863 memset(a32, 0, sizeof(*a32));
819 a32->mq_flags = attr->mq_flags; 864 a32->mq_flags = attr->mq_flags;
820 a32->mq_maxmsg = attr->mq_maxmsg; 865 a32->mq_maxmsg = attr->mq_maxmsg;
821 a32->mq_msgsize = attr->mq_msgsize; 866 a32->mq_msgsize = attr->mq_msgsize;
822 a32->mq_curmsgs = attr->mq_curmsgs; 867 a32->mq_curmsgs = attr->mq_curmsgs;
823} 868}
824 869
825#endif /* _COMPAT_NETBSD32_NETBSD32_CONV_H_ */ 870#endif /* _COMPAT_NETBSD32_NETBSD32_CONV_H_ */

cvs diff -r1.5 -r1.5.8.1 src/sys/compat/netbsd32/netbsd32_nfssvc.c (expand / switch to unified diff)

--- src/sys/compat/netbsd32/netbsd32_nfssvc.c 2016/10/15 06:50:13 1.5
+++ src/sys/compat/netbsd32/netbsd32_nfssvc.c 2023/06/21 21:04:01 1.5.8.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: netbsd32_nfssvc.c,v 1.5 2016/10/15 06:50:13 skrll Exp $ */ 1/* $NetBSD: netbsd32_nfssvc.c,v 1.5.8.1 2023/06/21 21:04:01 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2015 Matthew R. Green 4 * Copyright (c) 2015 Matthew R. Green
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -19,27 +19,27 @@ @@ -19,27 +19,27 @@
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE. 28 * SUCH DAMAGE.
29 */ 29 */
30 30
31#include <sys/cdefs.h> 31#include <sys/cdefs.h>
32__KERNEL_RCSID(0, "$NetBSD: netbsd32_nfssvc.c,v 1.5 2016/10/15 06:50:13 skrll Exp $"); 32__KERNEL_RCSID(0, "$NetBSD: netbsd32_nfssvc.c,v 1.5.8.1 2023/06/21 21:04:01 martin Exp $");
33 33
34#if defined(_KERNEL_OPT) 34#if defined(_KERNEL_OPT)
35#include "opt_nfs.h" 35#include "opt_nfs.h"
36#include "opt_nfsserver.h" 36#include "opt_nfsserver.h"
37#include "opt_compat_netbsd.h" 37#include "opt_compat_netbsd.h"
38#endif 38#endif
39 39
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/vnode.h> 41#include <sys/vnode.h>
42#include <sys/filedesc.h> 42#include <sys/filedesc.h>
43#include <sys/module.h> 43#include <sys/module.h>
44#include <sys/syscallvar.h> 44#include <sys/syscallvar.h>
45 45
@@ -113,26 +113,27 @@ nfssvc32_nsd_in(struct nfsd_srvargs *nsd @@ -113,26 +113,27 @@ nfssvc32_nsd_in(struct nfsd_srvargs *nsd
113 nsd->nsd_ttl = args32.nsd_ttl; 113 nsd->nsd_ttl = args32.nsd_ttl;
114 nsd->nsd_key[0] = args32.nsd_key[0]; 114 nsd->nsd_key[0] = args32.nsd_key[0];
115 nsd->nsd_key[1] = args32.nsd_key[1]; 115 nsd->nsd_key[1] = args32.nsd_key[1];
116 } 116 }
117 117
118 return error; 118 return error;
119} 119}
120 120
121static int 121static int
122nfssvc32_nsd_out(void *argp, const struct nfsd_srvargs *nsd) 122nfssvc32_nsd_out(void *argp, const struct nfsd_srvargs *nsd)
123{ 123{
124 struct netbsd32_nfsd_srvargs args32; 124 struct netbsd32_nfsd_srvargs args32;
125 125
 126 memset(&args32, 0, sizeof(args32));
126 NETBSD32PTR32(args32.nsd_nfsd, nsd->nsd_nfsd); 127 NETBSD32PTR32(args32.nsd_nfsd, nsd->nsd_nfsd);
127 args32.nsd_uid = nsd->nsd_uid; 128 args32.nsd_uid = nsd->nsd_uid;
128 args32.nsd_haddr = nsd->nsd_haddr; 129 args32.nsd_haddr = nsd->nsd_haddr;
129 args32.nsd_cr = nsd->nsd_cr; 130 args32.nsd_cr = nsd->nsd_cr;
130 args32.nsd_authlen = nsd->nsd_authlen; 131 args32.nsd_authlen = nsd->nsd_authlen;
131 NETBSD32PTR32(args32.nsd_authstr, nsd->nsd_authstr); 132 NETBSD32PTR32(args32.nsd_authstr, nsd->nsd_authstr);
132 args32.nsd_verflen = nsd->nsd_verflen; 133 args32.nsd_verflen = nsd->nsd_verflen;
133 args32.nsd_uid = nsd->nsd_uid; 134 args32.nsd_uid = nsd->nsd_uid;
134 netbsd32_from_timeval(&nsd->nsd_timestamp, &args32.nsd_timestamp); 135 netbsd32_from_timeval(&nsd->nsd_timestamp, &args32.nsd_timestamp);
135 args32.nsd_ttl = nsd->nsd_ttl; 136 args32.nsd_ttl = nsd->nsd_ttl;
136 args32.nsd_key[0] = nsd->nsd_key[0]; 137 args32.nsd_key[0] = nsd->nsd_key[0];
137 args32.nsd_key[1] = nsd->nsd_key[1]; 138 args32.nsd_key[1] = nsd->nsd_key[1];
138 139

cvs diff -r1.4.6.1 -r1.4.6.2 src/sys/compat/netbsd32/netbsd32_ptrace.c (expand / switch to unified diff)

--- src/sys/compat/netbsd32/netbsd32_ptrace.c 2018/04/12 13:42:49 1.4.6.1
+++ src/sys/compat/netbsd32/netbsd32_ptrace.c 2023/06/21 21:04:01 1.4.6.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: netbsd32_ptrace.c,v 1.4.6.1 2018/04/12 13:42:49 martin Exp $ */ 1/* $NetBSD: netbsd32_ptrace.c,v 1.4.6.2 2023/06/21 21:04:01 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2016 The NetBSD Foundation, Inc. 4 * Copyright (c) 2016 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Nick Hudson 8 * by Nick Hudson
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: netbsd32_ptrace.c,v 1.4.6.1 2018/04/12 13:42:49 martin Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: netbsd32_ptrace.c,v 1.4.6.2 2023/06/21 21:04:01 martin Exp $");
34 34
35#if defined(_KERNEL_OPT) 35#if defined(_KERNEL_OPT)
36#include "opt_ptrace.h" 36#include "opt_ptrace.h"
37#include "opt_compat_netbsd.h" 37#include "opt_compat_netbsd.h"
38#endif 38#endif
39 39
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/module.h> 41#include <sys/module.h>
42#include <sys/ptrace.h> 42#include <sys/ptrace.h>
43#include <sys/syscallvar.h> 43#include <sys/syscallvar.h>
44 44
45#include <compat/netbsd32/netbsd32.h> 45#include <compat/netbsd32/netbsd32.h>
46#include <compat/netbsd32/netbsd32_syscall.h> 46#include <compat/netbsd32/netbsd32_syscall.h>
@@ -71,26 +71,27 @@ netbsd32_copyin_piod(struct ptrace_io_de @@ -71,26 +71,27 @@ netbsd32_copyin_piod(struct ptrace_io_de
71 piod->piod_len = (size_t)piod32.piod_len; 71 piod->piod_len = (size_t)piod32.piod_len;
72 72
73 return 0; 73 return 0;
74} 74}
75 75
76static int 76static int
77netbsd32_copyout_piod(const struct ptrace_io_desc *piod, void *addr, size_t len) 77netbsd32_copyout_piod(const struct ptrace_io_desc *piod, void *addr, size_t len)
78{ 78{
79 struct netbsd32_ptrace_io_desc piod32; 79 struct netbsd32_ptrace_io_desc piod32;
80 80
81 if (len != 0 && sizeof(piod32) != len) 81 if (len != 0 && sizeof(piod32) != len)
82 return EINVAL; 82 return EINVAL;
83 83
 84 memset(&piod32, 0, sizeof(piod32));
84 piod32.piod_op = piod->piod_op; 85 piod32.piod_op = piod->piod_op;
85 NETBSD32PTR32(piod32.piod_offs, piod->piod_offs); 86 NETBSD32PTR32(piod32.piod_offs, piod->piod_offs);
86 NETBSD32PTR32(piod32.piod_addr, piod->piod_addr); 87 NETBSD32PTR32(piod32.piod_addr, piod->piod_addr);
87 piod32.piod_len = (netbsd32_size_t)piod->piod_len; 88 piod32.piod_len = (netbsd32_size_t)piod->piod_len;
88 return copyout(&piod32, addr, sizeof(piod32)); 89 return copyout(&piod32, addr, sizeof(piod32));
89} 90}
90 91
91static int 92static int
92netbsd32_copyin_siginfo(struct ptrace_siginfo *psi, const void *addr, size_t len) 93netbsd32_copyin_siginfo(struct ptrace_siginfo *psi, const void *addr, size_t len)
93{ 94{
94 struct netbsd32_ptrace_siginfo psi32; 95 struct netbsd32_ptrace_siginfo psi32;
95 96
96 if (sizeof(psi32) != len) 97 if (sizeof(psi32) != len)
@@ -102,26 +103,27 @@ netbsd32_copyin_siginfo(struct ptrace_si @@ -102,26 +103,27 @@ netbsd32_copyin_siginfo(struct ptrace_si
102 psi->psi_lwpid = psi32.psi_lwpid; 103 psi->psi_lwpid = psi32.psi_lwpid;
103 netbsd32_si32_to_si(&psi->psi_siginfo, &psi32.psi_siginfo); 104 netbsd32_si32_to_si(&psi->psi_siginfo, &psi32.psi_siginfo);
104 return 0; 105 return 0;
105} 106}
106 107
107static int 108static int
108netbsd32_copyout_siginfo(const struct ptrace_siginfo *psi, void *addr, size_t len) 109netbsd32_copyout_siginfo(const struct ptrace_siginfo *psi, void *addr, size_t len)
109{ 110{
110 struct netbsd32_ptrace_siginfo psi32; 111 struct netbsd32_ptrace_siginfo psi32;
111 112
112 if (sizeof(psi32) != len) 113 if (sizeof(psi32) != len)
113 return EINVAL; 114 return EINVAL;
114 115
 116 memset(&psi32, 0, sizeof(psi32));
115 psi32.psi_lwpid = psi->psi_lwpid; 117 psi32.psi_lwpid = psi->psi_lwpid;
116 netbsd32_si_to_si32(&psi32.psi_siginfo, &psi->psi_siginfo); 118 netbsd32_si_to_si32(&psi32.psi_siginfo, &psi->psi_siginfo);
117 return copyout(&psi32, addr, sizeof(psi32)); 119 return copyout(&psi32, addr, sizeof(psi32));
118} 120}
119 121
120static int 122static int
121netbsd32_doregs(struct lwp *curl /*tracer*/, 123netbsd32_doregs(struct lwp *curl /*tracer*/,
122 struct lwp *l /*traced*/, 124 struct lwp *l /*traced*/,
123 struct uio *uio) 125 struct uio *uio)
124{ 126{
125#if defined(PT_GETREGS) || defined(PT_SETREGS) 127#if defined(PT_GETREGS) || defined(PT_SETREGS)
126 process_reg32 r32; 128 process_reg32 r32;
127 int error; 129 int error;

cvs diff -r1.43.8.1 -r1.43.8.2 src/sys/compat/netbsd32/netbsd32_signal.c (expand / switch to unified diff)

--- src/sys/compat/netbsd32/netbsd32_signal.c 2018/04/12 13:42:49 1.43.8.1
+++ src/sys/compat/netbsd32/netbsd32_signal.c 2023/06/21 21:04:01 1.43.8.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: netbsd32_signal.c,v 1.43.8.1 2018/04/12 13:42:49 martin Exp $ */ 1/* $NetBSD: netbsd32_signal.c,v 1.43.8.2 2023/06/21 21:04:01 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2001 Matthew R. Green 4 * Copyright (c) 1998, 2001 Matthew R. Green
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: netbsd32_signal.c,v 1.43.8.1 2018/04/12 13:42:49 martin Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: netbsd32_signal.c,v 1.43.8.2 2023/06/21 21:04:01 martin Exp $");
31 31
32#if defined(_KERNEL_OPT)  32#if defined(_KERNEL_OPT)
33#include "opt_ktrace.h" 33#include "opt_ktrace.h"
34#endif 34#endif
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/mount.h> 38#include <sys/mount.h>
39#include <sys/stat.h> 39#include <sys/stat.h>
40#include <sys/time.h> 40#include <sys/time.h>
41#include <sys/signalvar.h> 41#include <sys/signalvar.h>
42#include <sys/ktrace.h> 42#include <sys/ktrace.h>
43#include <sys/proc.h> 43#include <sys/proc.h>
@@ -76,26 +76,27 @@ netbsd32_sigaction(struct lwp *l, const  @@ -76,26 +76,27 @@ netbsd32_sigaction(struct lwp *l, const
76 memset(&nsa.sa_mask, 0, sizeof(nsa.sa_mask)); 76 memset(&nsa.sa_mask, 0, sizeof(nsa.sa_mask));
77 nsa.sa_mask.__bits[0] = sa32.netbsd32_sa_mask; 77 nsa.sa_mask.__bits[0] = sa32.netbsd32_sa_mask;
78 nsa.sa_flags = sa32.netbsd32_sa_flags; 78 nsa.sa_flags = sa32.netbsd32_sa_flags;
79 } 79 }
80 error = sigaction1(l, SCARG(uap, signum), 80 error = sigaction1(l, SCARG(uap, signum),
81 SCARG_P32(uap, nsa) ? &nsa : 0, 81 SCARG_P32(uap, nsa) ? &nsa : 0,
82 SCARG_P32(uap, osa) ? &osa : 0, 82 SCARG_P32(uap, osa) ? &osa : 0,
83 NULL, 0); 83 NULL, 0);
84 84
85 if (error) 85 if (error)
86 return (error); 86 return (error);
87 87
88 if (SCARG_P32(uap, osa)) { 88 if (SCARG_P32(uap, osa)) {
 89 memset(&sa32, 0, sizeof(sa32));
89 NETBSD32PTR32(sa32.netbsd32_sa_handler, osa.sa_handler); 90 NETBSD32PTR32(sa32.netbsd32_sa_handler, osa.sa_handler);
90 sa32.netbsd32_sa_mask = osa.sa_mask.__bits[0]; 91 sa32.netbsd32_sa_mask = osa.sa_mask.__bits[0];
91 sa32.netbsd32_sa_flags = osa.sa_flags; 92 sa32.netbsd32_sa_flags = osa.sa_flags;
92 sa32p = SCARG_P32(uap, osa); 93 sa32p = SCARG_P32(uap, osa);
93 if (copyout(&sa32, sa32p, sizeof(sa32))) 94 if (copyout(&sa32, sa32p, sizeof(sa32)))
94 return EFAULT; 95 return EFAULT;
95 } 96 }
96 97
97 return (0); 98 return (0);
98} 99}
99 100
100int 101int
101netbsd32___sigaltstack14(struct lwp *l, const struct netbsd32___sigaltstack14_args *uap, register_t *retval) 102netbsd32___sigaltstack14(struct lwp *l, const struct netbsd32___sigaltstack14_args *uap, register_t *retval)
@@ -125,26 +126,27 @@ netbsd32___sigaction14(struct lwp *l, co @@ -125,26 +126,27 @@ netbsd32___sigaction14(struct lwp *l, co
125 if (error) 126 if (error)
126 return (error); 127 return (error);
127 nsa.sa_handler = NETBSD32PTR64(sa32.netbsd32_sa_handler); 128 nsa.sa_handler = NETBSD32PTR64(sa32.netbsd32_sa_handler);
128 nsa.sa_mask = sa32.netbsd32_sa_mask; 129 nsa.sa_mask = sa32.netbsd32_sa_mask;
129 nsa.sa_flags = sa32.netbsd32_sa_flags; 130 nsa.sa_flags = sa32.netbsd32_sa_flags;
130 } 131 }
131 error = sigaction1(l, SCARG(uap, signum), 132 error = sigaction1(l, SCARG(uap, signum),
132 SCARG_P32(uap, nsa) ? &nsa : 0, 133 SCARG_P32(uap, nsa) ? &nsa : 0,
133 SCARG_P32(uap, osa) ? &osa : 0, 134 SCARG_P32(uap, osa) ? &osa : 0,
134 NULL, 0); 135 NULL, 0);
135 if (error) 136 if (error)
136 return (error); 137 return (error);
137 if (SCARG_P32(uap, osa)) { 138 if (SCARG_P32(uap, osa)) {
 139 memset(&sa32, 0, sizeof(sa32));
138 NETBSD32PTR32(sa32.netbsd32_sa_handler, osa.sa_handler); 140 NETBSD32PTR32(sa32.netbsd32_sa_handler, osa.sa_handler);
139 sa32.netbsd32_sa_mask = osa.sa_mask; 141 sa32.netbsd32_sa_mask = osa.sa_mask;
140 sa32.netbsd32_sa_flags = osa.sa_flags; 142 sa32.netbsd32_sa_flags = osa.sa_flags;
141 error = copyout(&sa32, SCARG_P32(uap, osa), sizeof(sa32)); 143 error = copyout(&sa32, SCARG_P32(uap, osa), sizeof(sa32));
142 if (error) 144 if (error)
143 return (error); 145 return (error);
144 } 146 }
145 return (0); 147 return (0);
146} 148}
147 149
148/* ARGSUSED */ 150/* ARGSUSED */
149int 151int
150netbsd32___sigaction_sigtramp(struct lwp *l, const struct netbsd32___sigaction_sigtramp_args *uap, register_t *retval) 152netbsd32___sigaction_sigtramp(struct lwp *l, const struct netbsd32___sigaction_sigtramp_args *uap, register_t *retval)
@@ -165,26 +167,27 @@ netbsd32___sigaction_sigtramp(struct lwp @@ -165,26 +167,27 @@ netbsd32___sigaction_sigtramp(struct lwp
165 if (error) 167 if (error)
166 return (error); 168 return (error);
167 nsa.sa_handler = NETBSD32PTR64(sa32.netbsd32_sa_handler); 169 nsa.sa_handler = NETBSD32PTR64(sa32.netbsd32_sa_handler);
168 nsa.sa_mask = sa32.netbsd32_sa_mask; 170 nsa.sa_mask = sa32.netbsd32_sa_mask;
169 nsa.sa_flags = sa32.netbsd32_sa_flags; 171 nsa.sa_flags = sa32.netbsd32_sa_flags;
170 } 172 }
171 error = sigaction1(l, SCARG(uap, signum), 173 error = sigaction1(l, SCARG(uap, signum),
172 SCARG_P32(uap, nsa) ? &nsa : 0, 174 SCARG_P32(uap, nsa) ? &nsa : 0,
173 SCARG_P32(uap, osa) ? &osa : 0, 175 SCARG_P32(uap, osa) ? &osa : 0,
174 SCARG_P32(uap, tramp), SCARG(uap, vers)); 176 SCARG_P32(uap, tramp), SCARG(uap, vers));
175 if (error) 177 if (error)
176 return (error); 178 return (error);
177 if (SCARG_P32(uap, osa)) { 179 if (SCARG_P32(uap, osa)) {
 180 memset(&sa32, 0, sizeof(sa32));
178 NETBSD32PTR32(sa32.netbsd32_sa_handler, osa.sa_handler); 181 NETBSD32PTR32(sa32.netbsd32_sa_handler, osa.sa_handler);
179 sa32.netbsd32_sa_mask = osa.sa_mask; 182 sa32.netbsd32_sa_mask = osa.sa_mask;
180 sa32.netbsd32_sa_flags = osa.sa_flags; 183 sa32.netbsd32_sa_flags = osa.sa_flags;
181 error = copyout(&sa32, SCARG_P32(uap, osa), sizeof(sa32)); 184 error = copyout(&sa32, SCARG_P32(uap, osa), sizeof(sa32));
182 if (error) 185 if (error)
183 return (error); 186 return (error);
184 } 187 }
185 return (0); 188 return (0);
186} 189}
187 190
188void 191void
189netbsd32_ksi32_to_ksi(struct _ksiginfo *si, const struct __ksiginfo32 *si32) 192netbsd32_ksi32_to_ksi(struct _ksiginfo *si, const struct __ksiginfo32 *si32)
190{ 193{

cvs diff -r1.49 -r1.49.6.1 src/sys/compat/netbsd32/netbsd32_time.c (expand / switch to unified diff)

--- src/sys/compat/netbsd32/netbsd32_time.c 2017/02/26 10:26:19 1.49
+++ src/sys/compat/netbsd32/netbsd32_time.c 2023/06/21 21:04:01 1.49.6.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: netbsd32_time.c,v 1.49 2017/02/26 10:26:19 njoly Exp $ */ 1/* $NetBSD: netbsd32_time.c,v 1.49.6.1 2023/06/21 21:04:01 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2001 Matthew R. Green 4 * Copyright (c) 1998, 2001 Matthew R. Green
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: netbsd32_time.c,v 1.49 2017/02/26 10:26:19 njoly Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: netbsd32_time.c,v 1.49.6.1 2023/06/21 21:04:01 martin Exp $");
31 31
32#if defined(_KERNEL_OPT) 32#if defined(_KERNEL_OPT)
33#include "opt_ntp.h" 33#include "opt_ntp.h"
34#include "opt_compat_netbsd.h" 34#include "opt_compat_netbsd.h"
35#endif 35#endif
36 36
37#include <sys/param.h> 37#include <sys/param.h>
38#include <sys/systm.h> 38#include <sys/systm.h>
39#include <sys/mount.h> 39#include <sys/mount.h>
40#include <sys/time.h> 40#include <sys/time.h>
41#include <sys/timex.h> 41#include <sys/timex.h>
42#include <sys/timevar.h> 42#include <sys/timevar.h>
43#include <sys/proc.h> 43#include <sys/proc.h>
@@ -247,26 +247,27 @@ netbsd32___gettimeofday50(struct lwp *l, @@ -247,26 +247,27 @@ netbsd32___gettimeofday50(struct lwp *l,
247 247
248 if (SCARG_P32(uap, tp)) { 248 if (SCARG_P32(uap, tp)) {
249 microtime(&atv); 249 microtime(&atv);
250 netbsd32_from_timeval(&atv, &tv32); 250 netbsd32_from_timeval(&atv, &tv32);
251 error = copyout(&tv32, SCARG_P32(uap, tp), sizeof(tv32)); 251 error = copyout(&tv32, SCARG_P32(uap, tp), sizeof(tv32));
252 if (error) 252 if (error)
253 return (error); 253 return (error);
254 } 254 }
255 if (SCARG_P32(uap, tzp)) { 255 if (SCARG_P32(uap, tzp)) {
256 /* 256 /*
257 * NetBSD has no kernel notion of time zone, so we just 257 * NetBSD has no kernel notion of time zone, so we just
258 * fake up a timezone struct and return it if demanded. 258 * fake up a timezone struct and return it if demanded.
259 */ 259 */
 260 memset(&tzfake, 0, sizeof(tzfake));
260 tzfake.tz_minuteswest = 0; 261 tzfake.tz_minuteswest = 0;
261 tzfake.tz_dsttime = 0; 262 tzfake.tz_dsttime = 0;
262 error = copyout(&tzfake, SCARG_P32(uap, tzp), sizeof(tzfake)); 263 error = copyout(&tzfake, SCARG_P32(uap, tzp), sizeof(tzfake));
263 } 264 }
264 return (error); 265 return (error);
265} 266}
266 267
267int 268int
268netbsd32___settimeofday50(struct lwp *l, const struct netbsd32___settimeofday50_args *uap, register_t *retval) 269netbsd32___settimeofday50(struct lwp *l, const struct netbsd32___settimeofday50_args *uap, register_t *retval)
269{ 270{
270 /* { 271 /* {
271 syscallarg(const netbsd32_timevalp_t) tv; 272 syscallarg(const netbsd32_timevalp_t) tv;
272 syscallarg(const netbsd32_timezonep_t) tzp; 273 syscallarg(const netbsd32_timezonep_t) tzp;
@@ -307,26 +308,27 @@ netbsd32___adjtime50(struct lwp *l, cons @@ -307,26 +308,27 @@ netbsd32___adjtime50(struct lwp *l, cons
307 } */ 308 } */
308 struct netbsd32_timeval atv; 309 struct netbsd32_timeval atv;
309 int error; 310 int error;
310 311
311 extern int time_adjusted; /* in kern_ntptime.c */ 312 extern int time_adjusted; /* in kern_ntptime.c */
312 extern int64_t time_adjtime; /* in kern_ntptime.c */ 313 extern int64_t time_adjtime; /* in kern_ntptime.c */
313 314
314 if ((error = kauth_authorize_system(l->l_cred, 315 if ((error = kauth_authorize_system(l->l_cred,
315 KAUTH_SYSTEM_TIME, KAUTH_REQ_SYSTEM_TIME_ADJTIME, NULL, NULL, 316 KAUTH_SYSTEM_TIME, KAUTH_REQ_SYSTEM_TIME_ADJTIME, NULL, NULL,
316 NULL)) != 0) 317 NULL)) != 0)
317 return (error); 318 return (error);
318 319
319 if (SCARG_P32(uap, olddelta)) { 320 if (SCARG_P32(uap, olddelta)) {
 321 memset(&atv, 0, sizeof(atv));
320 atv.tv_sec = time_adjtime / 1000000; 322 atv.tv_sec = time_adjtime / 1000000;
321 atv.tv_usec = time_adjtime % 1000000; 323 atv.tv_usec = time_adjtime % 1000000;
322 if (atv.tv_usec < 0) { 324 if (atv.tv_usec < 0) {
323 atv.tv_usec += 1000000; 325 atv.tv_usec += 1000000;
324 atv.tv_sec--; 326 atv.tv_sec--;
325 } 327 }
326 error = copyout(&atv, SCARG_P32(uap, olddelta), sizeof(atv)); 328 error = copyout(&atv, SCARG_P32(uap, olddelta), sizeof(atv));
327 if (error) 329 if (error)
328 return (error); 330 return (error);
329 } 331 }
330 332
331 if (SCARG_P32(uap, delta)) { 333 if (SCARG_P32(uap, delta)) {
332 error = copyin(SCARG_P32(uap, delta), &atv, sizeof(atv)); 334 error = copyin(SCARG_P32(uap, delta), &atv, sizeof(atv));
@@ -518,48 +520,50 @@ netbsd32___timer_settime50(struct lwp *l @@ -518,48 +520,50 @@ netbsd32___timer_settime50(struct lwp *l
518 if ((error = copyin(SCARG_P32(uap, value), &its32, sizeof(its32))) != 0) 520 if ((error = copyin(SCARG_P32(uap, value), &its32, sizeof(its32))) != 0)
519 return (error); 521 return (error);
520 netbsd32_to_timespec(&its32.it_interval, &value.it_interval); 522 netbsd32_to_timespec(&its32.it_interval, &value.it_interval);
521 netbsd32_to_timespec(&its32.it_value, &value.it_value); 523 netbsd32_to_timespec(&its32.it_value, &value.it_value);
522 524
523 if (SCARG_P32(uap, ovalue)) 525 if (SCARG_P32(uap, ovalue))
524 ovp = &ovalue; 526 ovp = &ovalue;
525 527
526 if ((error = dotimer_settime(SCARG(uap, timerid), &value, ovp, 528 if ((error = dotimer_settime(SCARG(uap, timerid), &value, ovp,
527 SCARG(uap, flags), l->l_proc)) != 0) 529 SCARG(uap, flags), l->l_proc)) != 0)
528 return error; 530 return error;
529 531
530 if (ovp) { 532 if (ovp) {
 533 memset(&its32, 0, sizeof(its32));
531 netbsd32_from_timespec(&ovp->it_interval, &its32.it_interval); 534 netbsd32_from_timespec(&ovp->it_interval, &its32.it_interval);
532 netbsd32_from_timespec(&ovp->it_value, &its32.it_value); 535 netbsd32_from_timespec(&ovp->it_value, &its32.it_value);
533 return copyout(&its32, SCARG_P32(uap, ovalue), sizeof(its32)); 536 return copyout(&its32, SCARG_P32(uap, ovalue), sizeof(its32));
534 } 537 }
535 return 0; 538 return 0;
536} 539}
537 540
538int 541int
539netbsd32___timer_gettime50(struct lwp *l, const struct netbsd32___timer_gettime50_args *uap, register_t *retval) 542netbsd32___timer_gettime50(struct lwp *l, const struct netbsd32___timer_gettime50_args *uap, register_t *retval)
540{ 543{
541 /* { 544 /* {
542 syscallarg(netbsd32_timer_t) timerid; 545 syscallarg(netbsd32_timer_t) timerid;
543 syscallarg(netbsd32_itimerspecp_t) value; 546 syscallarg(netbsd32_itimerspecp_t) value;
544 } */ 547 } */
545 int error; 548 int error;
546 struct itimerspec its; 549 struct itimerspec its;
547 struct netbsd32_itimerspec its32; 550 struct netbsd32_itimerspec its32;
548 551
549 if ((error = dotimer_gettime(SCARG(uap, timerid), l->l_proc, 552 if ((error = dotimer_gettime(SCARG(uap, timerid), l->l_proc,
550 &its)) != 0) 553 &its)) != 0)
551 return error; 554 return error;
552 555
 556 memset(&its32, 0, sizeof(its32));
553 netbsd32_from_timespec(&its.it_interval, &its32.it_interval); 557 netbsd32_from_timespec(&its.it_interval, &its32.it_interval);
554 netbsd32_from_timespec(&its.it_value, &its32.it_value); 558 netbsd32_from_timespec(&its.it_value, &its32.it_value);
555 559
556 return copyout(&its32, SCARG_P32(uap, value), sizeof(its32)); 560 return copyout(&its32, SCARG_P32(uap, value), sizeof(its32));
557} 561}
558 562
559int 563int
560netbsd32_timer_getoverrun(struct lwp *l, const struct netbsd32_timer_getoverrun_args *uap, register_t *retval) 564netbsd32_timer_getoverrun(struct lwp *l, const struct netbsd32_timer_getoverrun_args *uap, register_t *retval)
561{ 565{
562 /* { 566 /* {
563 syscallarg(netbsd32_timer_t) timerid; 567 syscallarg(netbsd32_timer_t) timerid;
564 } */ 568 } */
565 struct sys_timer_getoverrun_args ua; 569 struct sys_timer_getoverrun_args ua;

cvs diff -r1.23 -r1.23.8.1 src/sys/compat/netbsd32/netbsd32_wait.c (expand / switch to unified diff)

--- src/sys/compat/netbsd32/netbsd32_wait.c 2016/09/23 14:09:39 1.23
+++ src/sys/compat/netbsd32/netbsd32_wait.c 2023/06/21 21:04:01 1.23.8.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: netbsd32_wait.c,v 1.23 2016/09/23 14:09:39 skrll Exp $ */ 1/* $NetBSD: netbsd32_wait.c,v 1.23.8.1 2023/06/21 21:04:01 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2001 Matthew R. Green 4 * Copyright (c) 1998, 2001 Matthew R. Green
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: netbsd32_wait.c,v 1.23 2016/09/23 14:09:39 skrll Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: netbsd32_wait.c,v 1.23.8.1 2023/06/21 21:04:01 martin Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/systm.h> 33#include <sys/systm.h>
34#include <sys/mount.h> 34#include <sys/mount.h>
35#include <sys/time.h> 35#include <sys/time.h>
36#include <sys/wait.h> 36#include <sys/wait.h>
37#include <sys/ptrace.h> 37#include <sys/ptrace.h>
38#include <sys/resourcevar.h> 38#include <sys/resourcevar.h>
39#include <sys/vnode.h> 39#include <sys/vnode.h>
40#include <sys/pool.h> 40#include <sys/pool.h>
41#include <sys/proc.h> 41#include <sys/proc.h>
42#include <sys/dirent.h> 42#include <sys/dirent.h>
43 43
@@ -122,26 +122,27 @@ netbsd32_wait6(struct lwp *l, const stru @@ -122,26 +122,27 @@ netbsd32_wait6(struct lwp *l, const stru
122 * FreeBSD does for wait6(), so a tossup... Go with FreeBSD for now. 122 * FreeBSD does for wait6(), so a tossup... Go with FreeBSD for now.
123 */ 123 */
124 if (pid == 0) 124 if (pid == 0)
125 return error; 125 return error;
126#endif 126#endif
127 127
128 128
129 if (error == 0 && SCARG_P32(uap, status)) 129 if (error == 0 && SCARG_P32(uap, status))
130 error = copyout(&status, SCARG_P32(uap, status), 130 error = copyout(&status, SCARG_P32(uap, status),
131 sizeof(status)); 131 sizeof(status));
132 if (wrup != NULL && error == 0) { 132 if (wrup != NULL && error == 0) {
133 struct netbsd32_wrusage wru32; 133 struct netbsd32_wrusage wru32;
134 134
 135 memset(&wru32, 0, sizeof(wru32));
135 netbsd32_from_rusage(&wrup->wru_self, &wru32.wru_self); 136 netbsd32_from_rusage(&wrup->wru_self, &wru32.wru_self);
136 netbsd32_from_rusage(&wrup->wru_children, &wru32.wru_children); 137 netbsd32_from_rusage(&wrup->wru_children, &wru32.wru_children);
137 error = copyout(&wru32, SCARG_P32(uap, wru), sizeof(wru32)); 138 error = copyout(&wru32, SCARG_P32(uap, wru), sizeof(wru32));
138 } 139 }
139 if (sip != NULL && error == 0) { 140 if (sip != NULL && error == 0) {
140 siginfo32_t si32; 141 siginfo32_t si32;
141 142
142 netbsd32_si_to_si32(&si32, sip); 143 netbsd32_si_to_si32(&si32, sip);
143 error = copyout(&si32, SCARG_P32(uap, info), sizeof(si32)); 144 error = copyout(&si32, SCARG_P32(uap, info), sizeof(si32));
144 } 145 }
145 146
146 return error; 147 return error;
147} 148}

cvs diff -r1.70.6.3 -r1.70.6.4 src/sys/compat/ossaudio/ossaudio.c (expand / switch to unified diff)

--- src/sys/compat/ossaudio/ossaudio.c 2020/04/22 18:15:12 1.70.6.3
+++ src/sys/compat/ossaudio/ossaudio.c 2023/06/21 21:04:02 1.70.6.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ossaudio.c,v 1.70.6.3 2020/04/22 18:15:12 martin Exp $ */ 1/* $NetBSD: ossaudio.c,v 1.70.6.4 2023/06/21 21:04:02 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.70.6.3 2020/04/22 18:15:12 martin Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.70.6.4 2023/06/21 21:04:02 martin Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/proc.h> 33#include <sys/proc.h>
34#include <sys/systm.h> 34#include <sys/systm.h>
35#include <sys/file.h> 35#include <sys/file.h>
36#include <sys/vnode.h> 36#include <sys/vnode.h>
37#include <sys/filedesc.h> 37#include <sys/filedesc.h>
38#include <sys/ioctl.h> 38#include <sys/ioctl.h>
39#include <sys/mount.h> 39#include <sys/mount.h>
40#include <sys/kernel.h> 40#include <sys/kernel.h>
41#include <sys/audioio.h> 41#include <sys/audioio.h>
42#include <sys/midiio.h> 42#include <sys/midiio.h>
43#include <sys/kauth.h> 43#include <sys/kauth.h>
@@ -608,48 +608,50 @@ oss_ioctl_audio(struct lwp *l, const str @@ -608,48 +608,50 @@ oss_ioctl_audio(struct lwp *l, const str
608 DPRINTF(("%s: SNDCTL_DSP_GETFMTS = %x = %d\n", 608 DPRINTF(("%s: SNDCTL_DSP_GETFMTS = %x = %d\n",
609 __func__, idat, error)); 609 __func__, idat, error));
610 goto out; 610 goto out;
611 } 611 }
612 break; 612 break;
613 case OSS_SNDCTL_DSP_GETOSPACE: 613 case OSS_SNDCTL_DSP_GETOSPACE:
614 error = ioctlf(fp, AUDIO_GETBUFINFO, &tmpinfo); 614 error = ioctlf(fp, AUDIO_GETBUFINFO, &tmpinfo);
615 if (error) { 615 if (error) {
616 DPRINTF(("%s: AUDIO_GETBUFINFO %d\n", 616 DPRINTF(("%s: AUDIO_GETBUFINFO %d\n",
617 __func__, error)); 617 __func__, error));
618 goto out; 618 goto out;
619 } 619 }
620 setblocksize(fp, &tmpinfo); 620 setblocksize(fp, &tmpinfo);
 621 memset(&bufinfo, 0, sizeof(bufinfo));
621 bufinfo.fragsize = tmpinfo.blocksize; 622 bufinfo.fragsize = tmpinfo.blocksize;
622 bufinfo.fragments = tmpinfo.hiwat - 623 bufinfo.fragments = tmpinfo.hiwat -
623 (tmpinfo.play.seek + tmpinfo.blocksize - 1) / 624 (tmpinfo.play.seek + tmpinfo.blocksize - 1) /
624 tmpinfo.blocksize; 625 tmpinfo.blocksize;
625 bufinfo.fragstotal = tmpinfo.hiwat; 626 bufinfo.fragstotal = tmpinfo.hiwat;
626 bufinfo.bytes = 627 bufinfo.bytes =
627 tmpinfo.hiwat * tmpinfo.blocksize - tmpinfo.play.seek; 628 tmpinfo.hiwat * tmpinfo.blocksize - tmpinfo.play.seek;
628 error = copyout(&bufinfo, SCARG(uap, data), sizeof bufinfo); 629 error = copyout(&bufinfo, SCARG(uap, data), sizeof bufinfo);
629 if (error) { 630 if (error) {
630 DPRINTF(("%s: SNDCTL_DSP_GETOSPACE = %d\n", 631 DPRINTF(("%s: SNDCTL_DSP_GETOSPACE = %d\n",
631 __func__, error)); 632 __func__, error));
632 goto out; 633 goto out;
633 } 634 }
634 break; 635 break;
635 case OSS_SNDCTL_DSP_GETISPACE: 636 case OSS_SNDCTL_DSP_GETISPACE:
636 error = ioctlf(fp, AUDIO_GETBUFINFO, &tmpinfo); 637 error = ioctlf(fp, AUDIO_GETBUFINFO, &tmpinfo);
637 if (error) { 638 if (error) {
638 DPRINTF(("%s: AUDIO_GETBUFINFO %d\n", 639 DPRINTF(("%s: AUDIO_GETBUFINFO %d\n",
639 __func__, error)); 640 __func__, error));
640 goto out; 641 goto out;
641 } 642 }
642 setblocksize(fp, &tmpinfo); 643 setblocksize(fp, &tmpinfo);
 644 memset(&bufinfo, 0, sizeof(bufinfo));
643 bufinfo.fragsize = tmpinfo.blocksize; 645 bufinfo.fragsize = tmpinfo.blocksize;
644 bufinfo.fragments = tmpinfo.record.seek / tmpinfo.blocksize; 646 bufinfo.fragments = tmpinfo.record.seek / tmpinfo.blocksize;
645 bufinfo.fragstotal = tmpinfo.hiwat; 647 bufinfo.fragstotal = tmpinfo.hiwat;
646 bufinfo.bytes = bufinfo.fragments * tmpinfo.blocksize; 648 bufinfo.bytes = bufinfo.fragments * tmpinfo.blocksize;
647 error = copyout(&bufinfo, SCARG(uap, data), sizeof bufinfo); 649 error = copyout(&bufinfo, SCARG(uap, data), sizeof bufinfo);
648 if (error) { 650 if (error) {
649 DPRINTF(("%s: SNDCTL_DSP_GETISPACE %d %d %d %d = %d\n", 651 DPRINTF(("%s: SNDCTL_DSP_GETISPACE %d %d %d %d = %d\n",
650 __func__, bufinfo.fragsize, bufinfo.fragments, 652 __func__, bufinfo.fragsize, bufinfo.fragments,
651 bufinfo.fragstotal, bufinfo.bytes, error)); 653 bufinfo.fragstotal, bufinfo.bytes, error));
652 goto out; 654 goto out;
653 } 655 }
654 break; 656 break;
655 case OSS_SNDCTL_DSP_NONBLOCK: 657 case OSS_SNDCTL_DSP_NONBLOCK:
@@ -738,43 +740,45 @@ oss_ioctl_audio(struct lwp *l, const str @@ -738,43 +740,45 @@ oss_ioctl_audio(struct lwp *l, const str
738 DPRINTF(("%s: SNDCTL_DSP_{GET,SET}RIGGER %x = %d\n", 740 DPRINTF(("%s: SNDCTL_DSP_{GET,SET}RIGGER %x = %d\n",
739 __func__, idat, error)); 741 __func__, idat, error));
740 goto out; 742 goto out;
741 } 743 }
742 break; 744 break;
743#endif 745#endif
744 case OSS_SNDCTL_DSP_GETIPTR: 746 case OSS_SNDCTL_DSP_GETIPTR:
745 error = ioctlf(fp, AUDIO_GETIOFFS, &tmpoffs); 747 error = ioctlf(fp, AUDIO_GETIOFFS, &tmpoffs);
746 if (error) { 748 if (error) {
747 DPRINTF(("%s: AUDIO_GETIOFFS %d\n", 749 DPRINTF(("%s: AUDIO_GETIOFFS %d\n",
748 __func__, error)); 750 __func__, error));
749 goto out; 751 goto out;
750 } 752 }
 753 memset(&cntinfo, 0, sizeof(cntinfo));
751 cntinfo.bytes = tmpoffs.samples; 754 cntinfo.bytes = tmpoffs.samples;
752 cntinfo.blocks = tmpoffs.deltablks; 755 cntinfo.blocks = tmpoffs.deltablks;
753 cntinfo.ptr = tmpoffs.offset; 756 cntinfo.ptr = tmpoffs.offset;
754 error = copyout(&cntinfo, SCARG(uap, data), sizeof cntinfo); 757 error = copyout(&cntinfo, SCARG(uap, data), sizeof cntinfo);
755 if (error) { 758 if (error) {
756 DPRINTF(("%s: SNDCTL_DSP_GETIPTR %d\n", 759 DPRINTF(("%s: SNDCTL_DSP_GETIPTR %d\n",
757 __func__, error)); 760 __func__, error));
758 goto out; 761 goto out;
759 } 762 }
760 break; 763 break;
761 case OSS_SNDCTL_DSP_GETOPTR: 764 case OSS_SNDCTL_DSP_GETOPTR:
762 error = ioctlf(fp, AUDIO_GETOOFFS, &tmpoffs); 765 error = ioctlf(fp, AUDIO_GETOOFFS, &tmpoffs);
763 if (error) { 766 if (error) {
764 DPRINTF(("%s: AUDIO_GETOOFFS %d\n", 767 DPRINTF(("%s: AUDIO_GETOOFFS %d\n",
765 __func__, error)); 768 __func__, error));
766 goto out; 769 goto out;
767 } 770 }
 771 memset(&cntinfo, 0, sizeof(cntinfo));
768 cntinfo.bytes = tmpoffs.samples; 772 cntinfo.bytes = tmpoffs.samples;
769 cntinfo.blocks = tmpoffs.deltablks; 773 cntinfo.blocks = tmpoffs.deltablks;
770 cntinfo.ptr = tmpoffs.offset; 774 cntinfo.ptr = tmpoffs.offset;
771 error = copyout(&cntinfo, SCARG(uap, data), sizeof cntinfo); 775 error = copyout(&cntinfo, SCARG(uap, data), sizeof cntinfo);
772 if (error) { 776 if (error) {
773 DPRINTF(("%s: SNDCTL_DSP_GETOPTR %d\n", 777 DPRINTF(("%s: SNDCTL_DSP_GETOPTR %d\n",
774 __func__, error)); 778 __func__, error));
775 goto out; 779 goto out;
776 } 780 }
777 break; 781 break;
778 case OSS_SNDCTL_DSP_SETDUPLEX: 782 case OSS_SNDCTL_DSP_SETDUPLEX:
779 idat = 1; 783 idat = 1;
780 error = ioctlf(fp, AUDIO_SETFD, &idat); 784 error = ioctlf(fp, AUDIO_SETFD, &idat);

cvs diff -r1.68 -r1.68.8.1 src/sys/compat/sunos/sunos_ioctl.c (expand / switch to unified diff)

--- src/sys/compat/sunos/sunos_ioctl.c 2016/10/08 15:48:07 1.68
+++ src/sys/compat/sunos/sunos_ioctl.c 2023/06/21 21:04:01 1.68.8.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sunos_ioctl.c,v 1.68 2016/10/08 15:48:07 maxv Exp $ */ 1/* $NetBSD: sunos_ioctl.c,v 1.68.8.1 2023/06/21 21:04:01 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1993 Markus Wild. 4 * Copyright (c) 1993 Markus Wild.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. The name of the author may not be used to endorse or promote products 12 * 2. The name of the author may not be used to endorse or promote products
13 * derived from this software without specific prior written permission 13 * derived from this software without specific prior written permission
14 * 14 *
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 * 25 *
26 * loosely from: Header: sunos_ioctl.c,v 1.7 93/05/28 04:40:43 torek Exp 26 * loosely from: Header: sunos_ioctl.c,v 1.7 93/05/28 04:40:43 torek Exp
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: sunos_ioctl.c,v 1.68 2016/10/08 15:48:07 maxv Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: sunos_ioctl.c,v 1.68.8.1 2023/06/21 21:04:01 martin Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/proc.h> 33#include <sys/proc.h>
34#include <sys/systm.h> 34#include <sys/systm.h>
35#include <sys/file.h> 35#include <sys/file.h>
36#include <sys/filedesc.h> 36#include <sys/filedesc.h>
37#include <sys/ioctl.h> 37#include <sys/ioctl.h>
38#include <sys/termios.h> 38#include <sys/termios.h>
39#include <sys/tty.h> 39#include <sys/tty.h>
40#include <sys/socket.h> 40#include <sys/socket.h>
41#include <sys/audioio.h> 41#include <sys/audioio.h>
42#include <sys/vnode.h> 42#include <sys/vnode.h>
43#include <sys/mount.h> 43#include <sys/mount.h>
@@ -117,26 +117,28 @@ static void stio2stios(struct sunos_term @@ -117,26 +117,28 @@ static void stio2stios(struct sunos_term
117 * Code may vary with different architectures of course. 117 * Code may vary with different architectures of course.
118 * 118 *
119 * I don't know what optimizer you used, but seeing divu's and 119 * I don't know what optimizer you used, but seeing divu's and
120 * bfextu's in the m68k assembly output did not encourage me... 120 * bfextu's in the m68k assembly output did not encourage me...
121 * as well, gcc on the sparc definitely generates much better 121 * as well, gcc on the sparc definitely generates much better
122 * code with `?:'. 122 * code with `?:'.
123 */ 123 */
124 124
125static void 125static void
126stios2btios(struct sunos_termios *st, struct termios *bt) 126stios2btios(struct sunos_termios *st, struct termios *bt)
127{ 127{
128 u_long l, r; 128 u_long l, r;
129 129
 130 memset(bt, 0, sizeof(*bt));
 131
130 l = st->c_iflag; 132 l = st->c_iflag;
131 r = ((l & 0x00000001) ? IGNBRK : 0); 133 r = ((l & 0x00000001) ? IGNBRK : 0);
132 r |= ((l & 0x00000002) ? BRKINT : 0); 134 r |= ((l & 0x00000002) ? BRKINT : 0);
133 r |= ((l & 0x00000004) ? IGNPAR : 0); 135 r |= ((l & 0x00000004) ? IGNPAR : 0);
134 r |= ((l & 0x00000008) ? PARMRK : 0); 136 r |= ((l & 0x00000008) ? PARMRK : 0);
135 r |= ((l & 0x00000010) ? INPCK : 0); 137 r |= ((l & 0x00000010) ? INPCK : 0);
136 r |= ((l & 0x00000020) ? ISTRIP : 0); 138 r |= ((l & 0x00000020) ? ISTRIP : 0);
137 r |= ((l & 0x00000040) ? INLCR : 0); 139 r |= ((l & 0x00000040) ? INLCR : 0);
138 r |= ((l & 0x00000080) ? IGNCR : 0); 140 r |= ((l & 0x00000080) ? IGNCR : 0);
139 r |= ((l & 0x00000100) ? ICRNL : 0); 141 r |= ((l & 0x00000100) ? ICRNL : 0);
140 /* ((l & 0x00000200) ? IUCLC : 0) */ 142 /* ((l & 0x00000200) ? IUCLC : 0) */
141 r |= ((l & 0x00000400) ? IXON : 0); 143 r |= ((l & 0x00000400) ? IXON : 0);
142 r |= ((l & 0x00000800) ? IXANY : 0); 144 r |= ((l & 0x00000800) ? IXANY : 0);
@@ -238,26 +240,28 @@ stios2btios(struct sunos_termios *st, st @@ -238,26 +240,28 @@ stios2btios(struct sunos_termios *st, st
238 240
239 /* if `raw mode', create native VMIN/VTIME from SunOS VEOF/VEOL */ 241 /* if `raw mode', create native VMIN/VTIME from SunOS VEOF/VEOL */
240 bt->c_cc[VMIN] = (bt->c_lflag & ICANON) ? 1 : bt->c_cc[VEOF]; 242 bt->c_cc[VMIN] = (bt->c_lflag & ICANON) ? 1 : bt->c_cc[VEOF];
241 bt->c_cc[VTIME] = (bt->c_lflag & ICANON) ? 1 : bt->c_cc[VEOL]; 243 bt->c_cc[VTIME] = (bt->c_lflag & ICANON) ? 1 : bt->c_cc[VEOL];
242} 244}
243 245
244 246
245static void 247static void
246btios2stios(struct termios *bt, struct sunos_termios *st) 248btios2stios(struct termios *bt, struct sunos_termios *st)
247{ 249{
248 u_long l, r; 250 u_long l, r;
249 int s; 251 int s;
250 252
 253 memset(st, 0, sizeof(*st));
 254
251 l = bt->c_iflag; 255 l = bt->c_iflag;
252 r = ((l & IGNBRK) ? 0x00000001 : 0); 256 r = ((l & IGNBRK) ? 0x00000001 : 0);
253 r |= ((l & BRKINT) ? 0x00000002 : 0); 257 r |= ((l & BRKINT) ? 0x00000002 : 0);
254 r |= ((l & IGNPAR) ? 0x00000004 : 0); 258 r |= ((l & IGNPAR) ? 0x00000004 : 0);
255 r |= ((l & PARMRK) ? 0x00000008 : 0); 259 r |= ((l & PARMRK) ? 0x00000008 : 0);
256 r |= ((l & INPCK) ? 0x00000010 : 0); 260 r |= ((l & INPCK) ? 0x00000010 : 0);
257 r |= ((l & ISTRIP) ? 0x00000020 : 0); 261 r |= ((l & ISTRIP) ? 0x00000020 : 0);
258 r |= ((l & INLCR) ? 0x00000040 : 0); 262 r |= ((l & INLCR) ? 0x00000040 : 0);
259 r |= ((l & IGNCR) ? 0x00000080 : 0); 263 r |= ((l & IGNCR) ? 0x00000080 : 0);
260 r |= ((l & ICRNL) ? 0x00000100 : 0); 264 r |= ((l & ICRNL) ? 0x00000100 : 0);
261 /* ((l & IUCLC) ? 0x00000200 : 0) */ 265 /* ((l & IUCLC) ? 0x00000200 : 0) */
262 r |= ((l & IXON) ? 0x00000400 : 0); 266 r |= ((l & IXON) ? 0x00000400 : 0);
263 r |= ((l & IXANY) ? 0x00000800 : 0); 267 r |= ((l & IXANY) ? 0x00000800 : 0);
@@ -362,37 +366,41 @@ btios2stios(struct termios *bt, struct s @@ -362,37 +366,41 @@ btios2stios(struct termios *bt, struct s
362 366
363 if (!(bt->c_lflag & ICANON)) { 367 if (!(bt->c_lflag & ICANON)) {
364 /* SunOS stores VMIN/VTIME in VEOF/VEOL (if ICANON is off) */ 368 /* SunOS stores VMIN/VTIME in VEOF/VEOL (if ICANON is off) */
365 st->c_cc[4] = bt->c_cc[VMIN]; 369 st->c_cc[4] = bt->c_cc[VMIN];
366 st->c_cc[5] = bt->c_cc[VTIME]; 370 st->c_cc[5] = bt->c_cc[VTIME];
367 } 371 }
368 372
369 st->c_line = 0; 373 st->c_line = 0;
370} 374}
371 375
372static void 376static void
373stios2stio(struct sunos_termios *ts, struct sunos_termio *t) 377stios2stio(struct sunos_termios *ts, struct sunos_termio *t)
374{ 378{
 379
 380 memset(t, 0, sizeof(*t));
375 t->c_iflag = ts->c_iflag; 381 t->c_iflag = ts->c_iflag;
376 t->c_oflag = ts->c_oflag; 382 t->c_oflag = ts->c_oflag;
377 t->c_cflag = ts->c_cflag; 383 t->c_cflag = ts->c_cflag;
378 t->c_lflag = ts->c_lflag; 384 t->c_lflag = ts->c_lflag;
379 t->c_line = ts->c_line; 385 t->c_line = ts->c_line;
380 memcpy(t->c_cc, ts->c_cc, 8); 386 memcpy(t->c_cc, ts->c_cc, 8);
381} 387}
382 388
383static void 389static void
384stio2stios(struct sunos_termio *t, struct sunos_termios *ts) 390stio2stios(struct sunos_termio *t, struct sunos_termios *ts)
385{ 391{
 392
 393 memset(ts, 0, sizeof(*ts));
386 ts->c_iflag = t->c_iflag; 394 ts->c_iflag = t->c_iflag;
387 ts->c_oflag = t->c_oflag; 395 ts->c_oflag = t->c_oflag;
388 ts->c_cflag = t->c_cflag; 396 ts->c_cflag = t->c_cflag;
389 ts->c_lflag = t->c_lflag; 397 ts->c_lflag = t->c_lflag;
390 ts->c_line = t->c_line; 398 ts->c_line = t->c_line;
391 memcpy(ts->c_cc, t->c_cc, 8); /* don't touch the upper fields! */ 399 memcpy(ts->c_cc, t->c_cc, 8); /* don't touch the upper fields! */
392} 400}
393 401
394int 402int
395sunos_sys_ioctl(struct lwp *l, const struct sunos_sys_ioctl_args *uap, register_t *retval) 403sunos_sys_ioctl(struct lwp *l, const struct sunos_sys_ioctl_args *uap, register_t *retval)
396{ 404{
397 /* { 405 /* {
398 int fd; 406 int fd;
@@ -474,26 +482,27 @@ sunos_sys_ioctl(struct lwp *l, const str @@ -474,26 +482,27 @@ sunos_sys_ioctl(struct lwp *l, const str
474 ws.ws_col = ss.ts_col; 482 ws.ws_col = ss.ts_col;
475 483
476 error = (*ctl)(fp, TIOCSWINSZ, &ws); 484 error = (*ctl)(fp, TIOCSWINSZ, &ws);
477 break; 485 break;
478 } 486 }
479 case _IOW('t', 38, struct sunos_ttysize): 487 case _IOW('t', 38, struct sunos_ttysize):
480 { 488 {
481 struct winsize ws; 489 struct winsize ws;
482 struct sunos_ttysize ss; 490 struct sunos_ttysize ss;
483 491
484 if ((error = (*ctl)(fp, TIOCGWINSZ, &ws)) != 0) 492 if ((error = (*ctl)(fp, TIOCGWINSZ, &ws)) != 0)
485 break; 493 break;
486 494
 495 memset(&ss, 0, sizeof(ss));
487 ss.ts_row = ws.ws_row; 496 ss.ts_row = ws.ws_row;
488 ss.ts_col = ws.ws_col; 497 ss.ts_col = ws.ws_col;
489 498
490 error = copyout((void *)&ss, SCARG(uap, data), sizeof (ss)); 499 error = copyout((void *)&ss, SCARG(uap, data), sizeof (ss));
491 break; 500 break;
492 } 501 }
493 case _IOR('t', 119, int): /* TIOCGPGRP */ 502 case _IOR('t', 119, int): /* TIOCGPGRP */
494 { 503 {
495 int pgrp; 504 int pgrp;
496 505
497 error = (*ctl)(fp, TIOCGPGRP, &pgrp); 506 error = (*ctl)(fp, TIOCGPGRP, &pgrp);
498 if (error == 0 && pgrp == 0) 507 if (error == 0 && pgrp == 0)
499 error = EIO; 508 error = EIO;
@@ -714,26 +723,27 @@ sunos_sys_ioctl(struct lwp *l, const str @@ -714,26 +723,27 @@ sunos_sys_ioctl(struct lwp *l, const str
714/* 723/*
715 * Audio ioctl translations. 724 * Audio ioctl translations.
716 */ 725 */
717 case _IOR('A', 1, struct sunos_audio_info): /* AUDIO_GETINFO */ 726 case _IOR('A', 1, struct sunos_audio_info): /* AUDIO_GETINFO */
718 sunos_au_getinfo: 727 sunos_au_getinfo:
719 { 728 {
720 struct audio_info aui; 729 struct audio_info aui;
721 struct sunos_audio_info sunos_aui; 730 struct sunos_audio_info sunos_aui;
722 731
723 error = (*ctl)(fp, AUDIO_GETINFO, &aui); 732 error = (*ctl)(fp, AUDIO_GETINFO, &aui);
724 if (error) 733 if (error)
725 break; 734 break;
726 735
 736 memset(&sunos_aui, 0, sizeof(sunos_aui));
727 sunos_aui.play = *(struct sunos_audio_prinfo *)&aui.play; 737 sunos_aui.play = *(struct sunos_audio_prinfo *)&aui.play;
728 sunos_aui.record = *(struct sunos_audio_prinfo *)&aui.record; 738 sunos_aui.record = *(struct sunos_audio_prinfo *)&aui.record;
729 739
730 /* `avail_ports' is `seek' in BSD */ 740 /* `avail_ports' is `seek' in BSD */
731 sunos_aui.play.avail_ports = AUDIO_SPEAKER | AUDIO_HEADPHONE; 741 sunos_aui.play.avail_ports = AUDIO_SPEAKER | AUDIO_HEADPHONE;
732 sunos_aui.record.avail_ports = AUDIO_SPEAKER | AUDIO_HEADPHONE; 742 sunos_aui.record.avail_ports = AUDIO_SPEAKER | AUDIO_HEADPHONE;
733 743
734 sunos_aui.play.waiting = 0; 744 sunos_aui.play.waiting = 0;
735 sunos_aui.record.waiting = 0; 745 sunos_aui.record.waiting = 0;
736 sunos_aui.play.eof = 0; 746 sunos_aui.play.eof = 0;
737 sunos_aui.record.eof = 0; 747 sunos_aui.record.eof = 0;
738 sunos_aui.monitor_gain = 0; /* aui.__spare; XXX */ 748 sunos_aui.monitor_gain = 0; /* aui.__spare; XXX */
739 /*XXXsunos_aui.output_muted = 0;*/ 749 /*XXXsunos_aui.output_muted = 0;*/
@@ -924,52 +934,58 @@ struct sunos_flock { @@ -924,52 +934,58 @@ struct sunos_flock {
924 short l_xxx; 934 short l_xxx;
925}; 935};
926 936
927static void bsd_to_sunos_flock(struct flock *, struct sunos_flock *); 937static void bsd_to_sunos_flock(struct flock *, struct sunos_flock *);
928static void sunos_to_bsd_flock(struct sunos_flock *, struct flock *); 938static void sunos_to_bsd_flock(struct sunos_flock *, struct flock *);
929 939
930#define SUNOS_F_RDLCK 1 940#define SUNOS_F_RDLCK 1
931#define SUNOS_F_WRLCK 2 941#define SUNOS_F_WRLCK 2
932#define SUNOS_F_UNLCK 3 942#define SUNOS_F_UNLCK 3
933 943
934static void 944static void
935bsd_to_sunos_flock(struct flock *iflp, struct sunos_flock *oflp) 945bsd_to_sunos_flock(struct flock *iflp, struct sunos_flock *oflp)
936{ 946{
 947
 948 memset(oflp, 0, sizeof(*oflp));
 949
937 switch (iflp->l_type) { 950 switch (iflp->l_type) {
938 case F_RDLCK: 951 case F_RDLCK:
939 oflp->l_type = SUNOS_F_RDLCK; 952 oflp->l_type = SUNOS_F_RDLCK;
940 break; 953 break;
941 case F_WRLCK: 954 case F_WRLCK:
942 oflp->l_type = SUNOS_F_WRLCK; 955 oflp->l_type = SUNOS_F_WRLCK;
943 break; 956 break;
944 case F_UNLCK: 957 case F_UNLCK:
945 oflp->l_type = SUNOS_F_UNLCK; 958 oflp->l_type = SUNOS_F_UNLCK;
946 break; 959 break;
947 default: 960 default:
948 oflp->l_type = -1; 961 oflp->l_type = -1;
949 break; 962 break;
950 } 963 }
951 964
952 oflp->l_whence = (short) iflp->l_whence; 965 oflp->l_whence = (short) iflp->l_whence;
953 oflp->l_start = (long) iflp->l_start; 966 oflp->l_start = (long) iflp->l_start;
954 oflp->l_len = (long) iflp->l_len; 967 oflp->l_len = (long) iflp->l_len;
955 oflp->l_pid = (short) iflp->l_pid; 968 oflp->l_pid = (short) iflp->l_pid;
956 oflp->l_xxx = 0; 969 oflp->l_xxx = 0;
957} 970}
958 971
959 972
960static void 973static void
961sunos_to_bsd_flock(struct sunos_flock *iflp, struct flock *oflp) 974sunos_to_bsd_flock(struct sunos_flock *iflp, struct flock *oflp)
962{ 975{
 976
 977 memset(oflp, 0, sizeof(*oflp));
 978
963 switch (iflp->l_type) { 979 switch (iflp->l_type) {
964 case SUNOS_F_RDLCK: 980 case SUNOS_F_RDLCK:
965 oflp->l_type = F_RDLCK; 981 oflp->l_type = F_RDLCK;
966 break; 982 break;
967 case SUNOS_F_WRLCK: 983 case SUNOS_F_WRLCK:
968 oflp->l_type = F_WRLCK; 984 oflp->l_type = F_WRLCK;
969 break; 985 break;
970 case SUNOS_F_UNLCK: 986 case SUNOS_F_UNLCK:
971 oflp->l_type = F_UNLCK; 987 oflp->l_type = F_UNLCK;
972 break; 988 break;
973 default: 989 default:
974 oflp->l_type = -1; 990 oflp->l_type = -1;
975 break; 991 break;

cvs diff -r1.170.10.1 -r1.170.10.2 src/sys/compat/sunos/sunos_misc.c (expand / switch to unified diff)

--- src/sys/compat/sunos/sunos_misc.c 2017/08/09 05:12:18 1.170.10.1
+++ src/sys/compat/sunos/sunos_misc.c 2023/06/21 21:04:01 1.170.10.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sunos_misc.c,v 1.170.10.1 2017/08/09 05:12:18 snj Exp $ */ 1/* $NetBSD: sunos_misc.c,v 1.170.10.2 2023/06/21 21:04:01 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1992, 1993 4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This software was developed by the Computer Systems Engineering group 7 * This software was developed by the Computer Systems Engineering group
8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
9 * contributed to Berkeley. 9 * contributed to Berkeley.
10 * 10 *
11 * All advertising materials mentioning features or use of this software 11 * All advertising materials mentioning features or use of this software
12 * must display the following acknowledgement: 12 * must display the following acknowledgement:
13 * This product includes software developed by the University of 13 * This product includes software developed by the University of
14 * California, Lawrence Berkeley Laboratory. 14 * California, Lawrence Berkeley Laboratory.
@@ -40,27 +40,27 @@ @@ -40,27 +40,27 @@
40 * @(#)sunos_misc.c 8.1 (Berkeley) 6/18/93 40 * @(#)sunos_misc.c 8.1 (Berkeley) 6/18/93
41 * 41 *
42 * Header: sunos_misc.c,v 1.16 93/04/07 02:46:27 torek Exp 42 * Header: sunos_misc.c,v 1.16 93/04/07 02:46:27 torek Exp
43 */ 43 */
44 44
45/* 45/*
46 * SunOS compatibility module. 46 * SunOS compatibility module.
47 * 47 *
48 * SunOS system calls that are implemented differently in BSD are 48 * SunOS system calls that are implemented differently in BSD are
49 * handled here. 49 * handled here.
50 */ 50 */
51 51
52#include <sys/cdefs.h> 52#include <sys/cdefs.h>
53__KERNEL_RCSID(0, "$NetBSD: sunos_misc.c,v 1.170.10.1 2017/08/09 05:12:18 snj Exp $"); 53__KERNEL_RCSID(0, "$NetBSD: sunos_misc.c,v 1.170.10.2 2023/06/21 21:04:01 martin Exp $");
54 54
55#include <sys/param.h> 55#include <sys/param.h>
56#include <sys/systm.h> 56#include <sys/systm.h>
57#include <sys/namei.h> 57#include <sys/namei.h>
58#include <sys/proc.h> 58#include <sys/proc.h>
59#include <sys/dirent.h> 59#include <sys/dirent.h>
60#include <sys/file.h> 60#include <sys/file.h>
61#include <sys/stat.h> 61#include <sys/stat.h>
62#include <sys/filedesc.h> 62#include <sys/filedesc.h>
63#include <sys/ioctl.h> 63#include <sys/ioctl.h>
64#include <sys/kernel.h> 64#include <sys/kernel.h>
65#include <sys/reboot.h> 65#include <sys/reboot.h>
66#include <sys/malloc.h> 66#include <sys/malloc.h>
@@ -295,33 +295,35 @@ sunos_sys_mount(struct lwp *l, const str @@ -295,33 +295,35 @@ sunos_sys_mount(struct lwp *l, const str
295int 295int
296async_daemon(struct lwp *l, const void *v, register_t *retval) 296async_daemon(struct lwp *l, const void *v, register_t *retval)
297{ 297{
298 298
299 return kpause("fakeniod", false, 0, NULL); 299 return kpause("fakeniod", false, 0, NULL);
300} 300}
301 301
302void native_to_sunos_sigset(const sigset_t *, int *); 302void native_to_sunos_sigset(const sigset_t *, int *);
303void sunos_to_native_sigset(const int, sigset_t *); 303void sunos_to_native_sigset(const int, sigset_t *);
304 304
305inline void 305inline void
306native_to_sunos_sigset(const sigset_t *ss, int *mask) 306native_to_sunos_sigset(const sigset_t *ss, int *mask)
307{ 307{
 308
308 *mask = ss->__bits[0]; 309 *mask = ss->__bits[0];
309} 310}
310 311
311inline void 312inline void
312sunos_to_native_sigset(const int mask, sigset_t *ss) 313sunos_to_native_sigset(const int mask, sigset_t *ss)
313{ 314{
314 315
 316 memset(ss, 0, sizeof(*ss));
315 ss->__bits[0] = mask; 317 ss->__bits[0] = mask;
316 ss->__bits[1] = 0; 318 ss->__bits[1] = 0;
317 ss->__bits[2] = 0; 319 ss->__bits[2] = 0;
318 ss->__bits[3] = 0; 320 ss->__bits[3] = 0;
319} 321}
320 322
321int 323int
322sunos_sys_sigpending(struct lwp *l, const struct sunos_sys_sigpending_args *uap, register_t *retval) 324sunos_sys_sigpending(struct lwp *l, const struct sunos_sys_sigpending_args *uap, register_t *retval)
323{ 325{
324 sigset_t ss; 326 sigset_t ss;
325 int mask; 327 int mask;
326 328
327 sigpending1(l, &ss); 329 sigpending1(l, &ss);
@@ -421,26 +423,27 @@ again: @@ -421,26 +423,27 @@ again:
421 if ((*cookie >> 32) != 0) { 423 if ((*cookie >> 32) != 0) {
422 compat_offseterr(vp, "sunos_getdents"); 424 compat_offseterr(vp, "sunos_getdents");
423 error = EINVAL; 425 error = EINVAL;
424 goto out; 426 goto out;
425 } 427 }
426 if (bdp->d_fileno == 0) { 428 if (bdp->d_fileno == 0) {
427 inp += reclen; /* it is a hole; squish it out */ 429 inp += reclen; /* it is a hole; squish it out */
428 if (cookie) 430 if (cookie)
429 off = *cookie++; 431 off = *cookie++;
430 else 432 else
431 off += reclen; 433 off += reclen;
432 continue; 434 continue;
433 } 435 }
 436 memset(&idb, 0, sizeof(idb));
434 sunos_reclen = SUNOS_RECLEN(&idb, bdp->d_namlen); 437 sunos_reclen = SUNOS_RECLEN(&idb, bdp->d_namlen);
435 if (reclen > len || resid < sunos_reclen) { 438 if (reclen > len || resid < sunos_reclen) {
436 /* entry too big for buffer, so just stop */ 439 /* entry too big for buffer, so just stop */
437 outp++; 440 outp++;
438 break; 441 break;
439 } 442 }
440 if (cookie) 443 if (cookie)
441 off = *cookie++; /* each entry points to next */ 444 off = *cookie++; /* each entry points to next */
442 else 445 else
443 off += reclen; 446 off += reclen;
444 /* 447 /*
445 * Massage in place to make a Sun-shaped dirent (otherwise 448 * Massage in place to make a Sun-shaped dirent (otherwise
446 * we have to worry about touching user memory outside of 449 * we have to worry about touching user memory outside of

cvs diff -r1.34 -r1.34.10.1 src/sys/compat/sunos32/sunos32_ioctl.c (expand / switch to unified diff)

--- src/sys/compat/sunos32/sunos32_ioctl.c 2015/12/11 08:10:43 1.34
+++ src/sys/compat/sunos32/sunos32_ioctl.c 2023/06/21 21:04:03 1.34.10.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sunos32_ioctl.c,v 1.34 2015/12/11 08:10:43 mlelstv Exp $ */ 1/* $NetBSD: sunos32_ioctl.c,v 1.34.10.1 2023/06/21 21:04:03 martin Exp $ */
2/* from: NetBSD: sunos_ioctl.c,v 1.35 2001/02/03 22:20:02 mrg Exp */ 2/* from: NetBSD: sunos_ioctl.c,v 1.35 2001/02/03 22:20:02 mrg Exp */
3 3
4/* 4/*
5 * Copyright (c) 2001 Matthew R. Green 5 * Copyright (c) 2001 Matthew R. Green
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -44,27 +44,27 @@ @@ -44,27 +44,27 @@
44 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 44 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
45 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 45 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
46 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
47 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 47 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
48 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 48 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
49 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 49 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
50 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 50 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
51 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 51 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52 * 52 *
53 * loosely from: Header: sunos_ioctl.c,v 1.7 93/05/28 04:40:43 torek Exp 53 * loosely from: Header: sunos_ioctl.c,v 1.7 93/05/28 04:40:43 torek Exp
54 */ 54 */
55 55
56#include <sys/cdefs.h> 56#include <sys/cdefs.h>
57__KERNEL_RCSID(0, "$NetBSD: sunos32_ioctl.c,v 1.34 2015/12/11 08:10:43 mlelstv Exp $"); 57__KERNEL_RCSID(0, "$NetBSD: sunos32_ioctl.c,v 1.34.10.1 2023/06/21 21:04:03 martin Exp $");
58 58
59#if defined(_KERNEL_OPT) 59#if defined(_KERNEL_OPT)
60#include "opt_compat_netbsd32.h" 60#include "opt_compat_netbsd32.h"
61#include "opt_execfmt.h" 61#include "opt_execfmt.h"
62#endif 62#endif
63 63
64#include <sys/param.h> 64#include <sys/param.h>
65#include <sys/proc.h> 65#include <sys/proc.h>
66#include <sys/systm.h> 66#include <sys/systm.h>
67#include <sys/file.h> 67#include <sys/file.h>
68#include <sys/filedesc.h> 68#include <sys/filedesc.h>
69#include <sys/ioctl.h> 69#include <sys/ioctl.h>
70#include <sys/termios.h> 70#include <sys/termios.h>
@@ -153,26 +153,28 @@ static void stio2stios(struct sunos_term @@ -153,26 +153,28 @@ static void stio2stios(struct sunos_term
153 * Code may vary with different architectures of course. 153 * Code may vary with different architectures of course.
154 * 154 *
155 * I don't know what optimizer you used, but seeing divu's and 155 * I don't know what optimizer you used, but seeing divu's and
156 * bfextu's in the m68k assembly output did not encourage me... 156 * bfextu's in the m68k assembly output did not encourage me...
157 * as well, gcc on the sparc definitely generates much better 157 * as well, gcc on the sparc definitely generates much better
158 * code with `?:'. 158 * code with `?:'.
159 */ 159 */
160 160
161static void 161static void
162stios2btios(struct sunos_termios *st, struct termios *bt) 162stios2btios(struct sunos_termios *st, struct termios *bt)
163{ 163{
164 netbsd32_u_long l, r; 164 netbsd32_u_long l, r;
165 165
 166 memset(bt, 0, sizeof(*bt));
 167
166 l = st->c_iflag; 168 l = st->c_iflag;
167 r = ((l & 0x00000001) ? IGNBRK : 0); 169 r = ((l & 0x00000001) ? IGNBRK : 0);
168 r |= ((l & 0x00000002) ? BRKINT : 0); 170 r |= ((l & 0x00000002) ? BRKINT : 0);
169 r |= ((l & 0x00000004) ? IGNPAR : 0); 171 r |= ((l & 0x00000004) ? IGNPAR : 0);
170 r |= ((l & 0x00000008) ? PARMRK : 0); 172 r |= ((l & 0x00000008) ? PARMRK : 0);
171 r |= ((l & 0x00000010) ? INPCK : 0); 173 r |= ((l & 0x00000010) ? INPCK : 0);
172 r |= ((l & 0x00000020) ? ISTRIP : 0); 174 r |= ((l & 0x00000020) ? ISTRIP : 0);
173 r |= ((l & 0x00000040) ? INLCR : 0); 175 r |= ((l & 0x00000040) ? INLCR : 0);
174 r |= ((l & 0x00000080) ? IGNCR : 0); 176 r |= ((l & 0x00000080) ? IGNCR : 0);
175 r |= ((l & 0x00000100) ? ICRNL : 0); 177 r |= ((l & 0x00000100) ? ICRNL : 0);
176 /* ((l & 0x00000200) ? IUCLC : 0) */ 178 /* ((l & 0x00000200) ? IUCLC : 0) */
177 r |= ((l & 0x00000400) ? IXON : 0); 179 r |= ((l & 0x00000400) ? IXON : 0);
178 r |= ((l & 0x00000800) ? IXANY : 0); 180 r |= ((l & 0x00000800) ? IXANY : 0);
@@ -274,26 +276,28 @@ stios2btios(struct sunos_termios *st, st @@ -274,26 +276,28 @@ stios2btios(struct sunos_termios *st, st
274 276
275 /* if `raw mode', create native VMIN/VTIME from SunOS VEOF/VEOL */ 277 /* if `raw mode', create native VMIN/VTIME from SunOS VEOF/VEOL */
276 bt->c_cc[VMIN] = (bt->c_lflag & ICANON) ? 1 : bt->c_cc[VEOF]; 278 bt->c_cc[VMIN] = (bt->c_lflag & ICANON) ? 1 : bt->c_cc[VEOF];
277 bt->c_cc[VTIME] = (bt->c_lflag & ICANON) ? 1 : bt->c_cc[VEOL]; 279 bt->c_cc[VTIME] = (bt->c_lflag & ICANON) ? 1 : bt->c_cc[VEOL];
278} 280}
279 281
280 282
281static void 283static void
282btios2stios(struct termios *bt, struct sunos_termios *st) 284btios2stios(struct termios *bt, struct sunos_termios *st)
283{ 285{
284 netbsd32_u_long l, r; 286 netbsd32_u_long l, r;
285 int s; 287 int s;
286 288
 289 memset(st, 0, sizeof(*st));
 290
287 l = bt->c_iflag; 291 l = bt->c_iflag;
288 r = ((l & IGNBRK) ? 0x00000001 : 0); 292 r = ((l & IGNBRK) ? 0x00000001 : 0);
289 r |= ((l & BRKINT) ? 0x00000002 : 0); 293 r |= ((l & BRKINT) ? 0x00000002 : 0);
290 r |= ((l & IGNPAR) ? 0x00000004 : 0); 294 r |= ((l & IGNPAR) ? 0x00000004 : 0);
291 r |= ((l & PARMRK) ? 0x00000008 : 0); 295 r |= ((l & PARMRK) ? 0x00000008 : 0);
292 r |= ((l & INPCK) ? 0x00000010 : 0); 296 r |= ((l & INPCK) ? 0x00000010 : 0);
293 r |= ((l & ISTRIP) ? 0x00000020 : 0); 297 r |= ((l & ISTRIP) ? 0x00000020 : 0);
294 r |= ((l & INLCR) ? 0x00000040 : 0); 298 r |= ((l & INLCR) ? 0x00000040 : 0);
295 r |= ((l & IGNCR) ? 0x00000080 : 0); 299 r |= ((l & IGNCR) ? 0x00000080 : 0);
296 r |= ((l & ICRNL) ? 0x00000100 : 0); 300 r |= ((l & ICRNL) ? 0x00000100 : 0);
297 /* ((l & IUCLC) ? 0x00000200 : 0) */ 301 /* ((l & IUCLC) ? 0x00000200 : 0) */
298 r |= ((l & IXON) ? 0x00000400 : 0); 302 r |= ((l & IXON) ? 0x00000400 : 0);
299 r |= ((l & IXANY) ? 0x00000800 : 0); 303 r |= ((l & IXANY) ? 0x00000800 : 0);
@@ -398,37 +402,41 @@ btios2stios(struct termios *bt, struct s @@ -398,37 +402,41 @@ btios2stios(struct termios *bt, struct s
398 402
399 if (!(bt->c_lflag & ICANON)) { 403 if (!(bt->c_lflag & ICANON)) {
400 /* SunOS stores VMIN/VTIME in VEOF/VEOL (if ICANON is off) */ 404 /* SunOS stores VMIN/VTIME in VEOF/VEOL (if ICANON is off) */
401 st->c_cc[4] = bt->c_cc[VMIN]; 405 st->c_cc[4] = bt->c_cc[VMIN];
402 st->c_cc[5] = bt->c_cc[VTIME]; 406 st->c_cc[5] = bt->c_cc[VTIME];
403 } 407 }
404 408
405 st->c_line = 0; 409 st->c_line = 0;
406} 410}
407 411
408static void 412static void
409stios2stio(struct sunos_termios *ts, struct sunos_termio *t) 413stios2stio(struct sunos_termios *ts, struct sunos_termio *t)
410{ 414{
 415
 416 memset(t, 0, sizeof(*t));
411 t->c_iflag = ts->c_iflag; 417 t->c_iflag = ts->c_iflag;
412 t->c_oflag = ts->c_oflag; 418 t->c_oflag = ts->c_oflag;
413 t->c_cflag = ts->c_cflag; 419 t->c_cflag = ts->c_cflag;
414 t->c_lflag = ts->c_lflag; 420 t->c_lflag = ts->c_lflag;
415 t->c_line = ts->c_line; 421 t->c_line = ts->c_line;
416 memcpy(t->c_cc, ts->c_cc, 8); 422 memcpy(t->c_cc, ts->c_cc, 8);
417} 423}
418 424
419static void 425static void
420stio2stios(struct sunos_termio *t, struct sunos_termios *ts) 426stio2stios(struct sunos_termio *t, struct sunos_termios *ts)
421{ 427{
 428
 429 memset(ts, 0, sizeof(*ts));
422 ts->c_iflag = t->c_iflag; 430 ts->c_iflag = t->c_iflag;
423 ts->c_oflag = t->c_oflag; 431 ts->c_oflag = t->c_oflag;
424 ts->c_cflag = t->c_cflag; 432 ts->c_cflag = t->c_cflag;
425 ts->c_lflag = t->c_lflag; 433 ts->c_lflag = t->c_lflag;
426 ts->c_line = t->c_line; 434 ts->c_line = t->c_line;
427 memcpy(ts->c_cc, t->c_cc, 8); /* don't touch the upper fields! */ 435 memcpy(ts->c_cc, t->c_cc, 8); /* don't touch the upper fields! */
428} 436}
429 437
430 438
431static int 439static int
432sunos32_do_ioctl(int fd, int cmd, void *arg, struct lwp *l) 440sunos32_do_ioctl(int fd, int cmd, void *arg, struct lwp *l)
433{ 441{
434 file_t *fp; 442 file_t *fp;
@@ -518,26 +526,27 @@ sunos32_sys_ioctl(struct lwp *l, const s @@ -518,26 +526,27 @@ sunos32_sys_ioctl(struct lwp *l, const s
518 ws.ws_row = ss.ts_row; 526 ws.ws_row = ss.ts_row;
519 ws.ws_col = ss.ts_col; 527 ws.ws_col = ss.ts_col;
520 528
521 return (sunos32_do_ioctl(SCARG(&bsd_ua, fd), TIOCSWINSZ, &ws, l)); 529 return (sunos32_do_ioctl(SCARG(&bsd_ua, fd), TIOCSWINSZ, &ws, l));
522 } 530 }
523 case _IOW('t', 38, struct sunos_ttysize): 531 case _IOW('t', 38, struct sunos_ttysize):
524 { 532 {
525 struct winsize ws; 533 struct winsize ws;
526 struct sunos_ttysize ss; 534 struct sunos_ttysize ss;
527 535
528 if ((error = sunos32_do_ioctl(SCARG(&bsd_ua, fd), TIOCGWINSZ, &ws, l)) != 0) 536 if ((error = sunos32_do_ioctl(SCARG(&bsd_ua, fd), TIOCGWINSZ, &ws, l)) != 0)
529 return (error); 537 return (error);
530 538
 539 memset(&ss, 0, sizeof(ss));
531 ss.ts_row = ws.ws_row; 540 ss.ts_row = ws.ws_row;
532 ss.ts_col = ws.ws_col; 541 ss.ts_col = ws.ws_col;
533 542
534 return copyout(&ss, SCARG_P32(uap, data), sizeof (ss)); 543 return copyout(&ss, SCARG_P32(uap, data), sizeof (ss));
535 } 544 }
536 case _IOW('t', 130, int): /* TIOCSETPGRP: posix variant */ 545 case _IOW('t', 130, int): /* TIOCSETPGRP: posix variant */
537 SCARG(&bsd_ua, com) = TIOCSPGRP; 546 SCARG(&bsd_ua, com) = TIOCSPGRP;
538 break; 547 break;
539 case _IOR('t', 131, int): /* TIOCGETPGRP: posix variant */ 548 case _IOR('t', 131, int): /* TIOCGETPGRP: posix variant */
540 { 549 {
541 /* 550 /*
542 * sigh, must do error translation on pty devices 551 * sigh, must do error translation on pty devices
543 * (see also kern/tty_pty.c) 552 * (see also kern/tty_pty.c)
@@ -746,26 +755,28 @@ sunos32_sys_ioctl(struct lwp *l, const s @@ -746,26 +755,28 @@ sunos32_sys_ioctl(struct lwp *l, const s
746/* 755/*
747 * Audio ioctl translations. 756 * Audio ioctl translations.
748 */ 757 */
749 case _IOR('A', 1, struct sunos_audio_info): /* AUDIO_GETINFO */ 758 case _IOR('A', 1, struct sunos_audio_info): /* AUDIO_GETINFO */
750 sunos_au_getinfo: 759 sunos_au_getinfo:
751 { 760 {
752 struct audio_info aui; 761 struct audio_info aui;
753 struct sunos_audio_info sunos_aui; 762 struct sunos_audio_info sunos_aui;
754 763
755 error = sunos32_do_ioctl(SCARG(&bsd_ua, fd), AUDIO_GETINFO, &aui, l); 764 error = sunos32_do_ioctl(SCARG(&bsd_ua, fd), AUDIO_GETINFO, &aui, l);
756 if (error) 765 if (error)
757 return error; 766 return error;
758 767
 768 memset(&sunos_aui, 0, sizeof(sunos_aui));
 769
759 sunos_aui.play = *(struct sunos_audio_prinfo *)&aui.play; 770 sunos_aui.play = *(struct sunos_audio_prinfo *)&aui.play;
760 sunos_aui.record = *(struct sunos_audio_prinfo *)&aui.record; 771 sunos_aui.record = *(struct sunos_audio_prinfo *)&aui.record;
761 772
762 /* `avail_ports' is `seek' in BSD */ 773 /* `avail_ports' is `seek' in BSD */
763 sunos_aui.play.avail_ports = AUDIO_SPEAKER | AUDIO_HEADPHONE; 774 sunos_aui.play.avail_ports = AUDIO_SPEAKER | AUDIO_HEADPHONE;
764 sunos_aui.record.avail_ports = AUDIO_SPEAKER | AUDIO_HEADPHONE; 775 sunos_aui.record.avail_ports = AUDIO_SPEAKER | AUDIO_HEADPHONE;
765 776
766 sunos_aui.play.waiting = 0; 777 sunos_aui.play.waiting = 0;
767 sunos_aui.record.waiting = 0; 778 sunos_aui.record.waiting = 0;
768 sunos_aui.play.eof = 0; 779 sunos_aui.play.eof = 0;
769 sunos_aui.record.eof = 0; 780 sunos_aui.record.eof = 0;
770 sunos_aui.monitor_gain = 0; /* aui.__spare; XXX */ 781 sunos_aui.monitor_gain = 0; /* aui.__spare; XXX */
771 /*XXXsunos_aui.output_muted = 0;*/ 782 /*XXXsunos_aui.output_muted = 0;*/
@@ -940,52 +951,58 @@ struct sunos_flock { @@ -940,52 +951,58 @@ struct sunos_flock {
940 short l_xxx; 951 short l_xxx;
941}; 952};
942 953
943static void bsd_to_sunos_flock(struct flock *, struct sunos_flock *); 954static void bsd_to_sunos_flock(struct flock *, struct sunos_flock *);
944static void sunos_to_bsd_flock(struct sunos_flock *, struct flock *); 955static void sunos_to_bsd_flock(struct sunos_flock *, struct flock *);
945 956
946#define SUNOS_F_RDLCK 1 957#define SUNOS_F_RDLCK 1
947#define SUNOS_F_WRLCK 2 958#define SUNOS_F_WRLCK 2
948#define SUNOS_F_UNLCK 3 959#define SUNOS_F_UNLCK 3
949 960
950static void 961static void
951bsd_to_sunos_flock(struct flock *iflp, struct sunos_flock *oflp) 962bsd_to_sunos_flock(struct flock *iflp, struct sunos_flock *oflp)
952{ 963{
 964
 965 memset(oflp, 0, sizeof(*oflp));
 966
953 switch (iflp->l_type) { 967 switch (iflp->l_type) {
954 case F_RDLCK: 968 case F_RDLCK:
955 oflp->l_type = SUNOS_F_RDLCK; 969 oflp->l_type = SUNOS_F_RDLCK;
956 break; 970 break;
957 case F_WRLCK: 971 case F_WRLCK:
958 oflp->l_type = SUNOS_F_WRLCK; 972 oflp->l_type = SUNOS_F_WRLCK;
959 break; 973 break;
960 case F_UNLCK: 974 case F_UNLCK:
961 oflp->l_type = SUNOS_F_UNLCK; 975 oflp->l_type = SUNOS_F_UNLCK;
962 break; 976 break;
963 default: 977 default:
964 oflp->l_type = -1; 978 oflp->l_type = -1;
965 break; 979 break;
966 } 980 }
967 981
968 oflp->l_whence = (short) iflp->l_whence; 982 oflp->l_whence = (short) iflp->l_whence;
969 oflp->l_start = (netbsd32_long) iflp->l_start; 983 oflp->l_start = (netbsd32_long) iflp->l_start;
970 oflp->l_len = (netbsd32_long) iflp->l_len; 984 oflp->l_len = (netbsd32_long) iflp->l_len;
971 oflp->l_pid = (short) iflp->l_pid; 985 oflp->l_pid = (short) iflp->l_pid;
972 oflp->l_xxx = 0; 986 oflp->l_xxx = 0;
973} 987}
974 988
975 989
976static void 990static void
977sunos_to_bsd_flock(struct sunos_flock *iflp, struct flock *oflp) 991sunos_to_bsd_flock(struct sunos_flock *iflp, struct flock *oflp)
978{ 992{
 993
 994 memset(oflp, 0, sizeof(*oflp));
 995
979 switch (iflp->l_type) { 996 switch (iflp->l_type) {
980 case SUNOS_F_RDLCK: 997 case SUNOS_F_RDLCK:
981 oflp->l_type = F_RDLCK; 998 oflp->l_type = F_RDLCK;
982 break; 999 break;
983 case SUNOS_F_WRLCK: 1000 case SUNOS_F_WRLCK:
984 oflp->l_type = F_WRLCK; 1001 oflp->l_type = F_WRLCK;
985 break; 1002 break;
986 case SUNOS_F_UNLCK: 1003 case SUNOS_F_UNLCK:
987 oflp->l_type = F_UNLCK; 1004 oflp->l_type = F_UNLCK;
988 break; 1005 break;
989 default: 1006 default:
990 oflp->l_type = -1; 1007 oflp->l_type = -1;
991 break; 1008 break;

cvs diff -r1.77.10.1 -r1.77.10.2 src/sys/compat/sunos32/sunos32_misc.c (expand / switch to unified diff)

--- src/sys/compat/sunos32/sunos32_misc.c 2017/08/09 05:12:18 1.77.10.1
+++ src/sys/compat/sunos32/sunos32_misc.c 2023/06/21 21:04:03 1.77.10.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sunos32_misc.c,v 1.77.10.1 2017/08/09 05:12:18 snj Exp $ */ 1/* $NetBSD: sunos32_misc.c,v 1.77.10.2 2023/06/21 21:04:03 martin Exp $ */
2/* from :NetBSD: sunos_misc.c,v 1.107 2000/12/01 19:25:10 jdolecek Exp */ 2/* from :NetBSD: sunos_misc.c,v 1.107 2000/12/01 19:25:10 jdolecek Exp */
3 3
4/* 4/*
5 * Copyright (c) 2001 Matthew R. Green 5 * Copyright (c) 2001 Matthew R. Green
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -67,27 +67,27 @@ @@ -67,27 +67,27 @@
67 * @(#)sunos_misc.c 8.1 (Berkeley) 6/18/93 67 * @(#)sunos_misc.c 8.1 (Berkeley) 6/18/93
68 * 68 *
69 * Header: sunos_misc.c,v 1.16 93/04/07 02:46:27 torek Exp 69 * Header: sunos_misc.c,v 1.16 93/04/07 02:46:27 torek Exp
70 */ 70 */
71 71
72/* 72/*
73 * SunOS compatibility module, 64-bit kernel version 73 * SunOS compatibility module, 64-bit kernel version
74 * 74 *
75 * SunOS system calls that are implemented differently in BSD are 75 * SunOS system calls that are implemented differently in BSD are
76 * handled here. 76 * handled here.
77 */ 77 */
78 78
79#include <sys/cdefs.h> 79#include <sys/cdefs.h>
80__KERNEL_RCSID(0, "$NetBSD: sunos32_misc.c,v 1.77.10.1 2017/08/09 05:12:18 snj Exp $"); 80__KERNEL_RCSID(0, "$NetBSD: sunos32_misc.c,v 1.77.10.2 2023/06/21 21:04:03 martin Exp $");
81 81
82#define COMPAT_SUNOS 1 82#define COMPAT_SUNOS 1
83 83
84#if defined(_KERNEL_OPT) 84#if defined(_KERNEL_OPT)
85#include "opt_compat_43.h" 85#include "opt_compat_43.h"
86#include "opt_compat_netbsd.h" 86#include "opt_compat_netbsd.h"
87#endif 87#endif
88 88
89#include <sys/param.h> 89#include <sys/param.h>
90#include <sys/systm.h> 90#include <sys/systm.h>
91#include <sys/namei.h> 91#include <sys/namei.h>
92#include <sys/proc.h> 92#include <sys/proc.h>
93#include <sys/dirent.h> 93#include <sys/dirent.h>
@@ -151,26 +151,27 @@ sunos32_sigvec_to_sigaction(const struct @@ -151,26 +151,27 @@ sunos32_sigvec_to_sigaction(const struct
151 151
152 sa->sa_handler = NETBSD32PTR64(sv->sv_handler); 152 sa->sa_handler = NETBSD32PTR64(sv->sv_handler);
153 compat_43_sigmask_to_sigset(&sv->sv_mask, &sa->sa_mask); 153 compat_43_sigmask_to_sigset(&sv->sv_mask, &sa->sa_mask);
154 sa->sa_flags = sv->sv_flags ^ SA_RESTART; 154 sa->sa_flags = sv->sv_flags ^ SA_RESTART;
155} 155}
156 156
157static void 157static void
158sunos32_sigvec_from_sigaction( 158sunos32_sigvec_from_sigaction(
159 struct netbsd32_sigvec *sv, 159 struct netbsd32_sigvec *sv,
160 const struct sigaction *sa) 160 const struct sigaction *sa)
161{ 161{
162/*XXX*/ extern void compat_43_sigset_to_sigmask(const sigset_t *, int *); 162/*XXX*/ extern void compat_43_sigset_to_sigmask(const sigset_t *, int *);
163 163
 164 memset(sv, 0, sizeof(*sv));
164 NETBSD32PTR32(sv->sv_handler, sa->sa_handler); 165 NETBSD32PTR32(sv->sv_handler, sa->sa_handler);
165 compat_43_sigset_to_sigmask(&sa->sa_mask, &sv->sv_mask); 166 compat_43_sigset_to_sigmask(&sa->sa_mask, &sv->sv_mask);
166 sv->sv_flags = sa->sa_flags ^ SA_RESTART; 167 sv->sv_flags = sa->sa_flags ^ SA_RESTART;
167} 168}
168 169
169int 170int
170sunos32_sys_stime(struct lwp *l, const struct sunos32_sys_stime_args *uap, register_t *retval) 171sunos32_sys_stime(struct lwp *l, const struct sunos32_sys_stime_args *uap, register_t *retval)
171{ 172{
172 /* { 173 /* {
173 syscallarg(sunos32_time_tp) tp; 174 syscallarg(sunos32_time_tp) tp;
174 } */ 175 } */
175 struct netbsd32_timeval ntv; 176 struct netbsd32_timeval ntv;
176 struct timeval tv; 177 struct timeval tv;
@@ -531,33 +532,35 @@ sunos32_sys_mount(struct lwp *l, const s @@ -531,33 +532,35 @@ sunos32_sys_mount(struct lwp *l, const s
531 strcpy(fsname, "ffs"); 532 strcpy(fsname, "ffs");
532 533
533 return do_sys_mount(l, fsname, UIO_SYSSPACE, 534 return do_sys_mount(l, fsname, UIO_SYSSPACE,
534 SCARG_P32(uap, path), nflags, SCARG_P32(uap, data), UIO_USERSPACE, 535 SCARG_P32(uap, path), nflags, SCARG_P32(uap, data), UIO_USERSPACE,
535 0, &dummy); 536 0, &dummy);
536} 537}
537 538
538void native_to_sunos_sigset(const sigset_t *, int *); 539void native_to_sunos_sigset(const sigset_t *, int *);
539void sunos_to_native_sigset(const int, sigset_t *); 540void sunos_to_native_sigset(const int, sigset_t *);
540 541
541inline void 542inline void
542native_to_sunos_sigset(const sigset_t *ss, int *mask) 543native_to_sunos_sigset(const sigset_t *ss, int *mask)
543{ 544{
 545
544 *mask = ss->__bits[0]; 546 *mask = ss->__bits[0];
545} 547}
546 548
547inline void 549inline void
548sunos_to_native_sigset(const int mask, sigset_t *ss) 550sunos_to_native_sigset(const int mask, sigset_t *ss)
549{ 551{
550 552
 553 memset(ss, 0, sizeof(*ss));
551 ss->__bits[0] = mask; 554 ss->__bits[0] = mask;
552 ss->__bits[1] = 0; 555 ss->__bits[1] = 0;
553 ss->__bits[2] = 0; 556 ss->__bits[2] = 0;
554 ss->__bits[3] = 0; 557 ss->__bits[3] = 0;
555} 558}
556 559
557int 560int
558sunos32_sys_sigpending(struct lwp *l, const struct sunos32_sys_sigpending_args *uap, register_t *retval) 561sunos32_sys_sigpending(struct lwp *l, const struct sunos32_sys_sigpending_args *uap, register_t *retval)
559{ 562{
560 /* { 563 /* {
561 syscallarg(netbsd32_intp) mask; 564 syscallarg(netbsd32_intp) mask;
562 } */ 565 } */
563 sigset_t ss; 566 sigset_t ss;
@@ -666,26 +669,27 @@ again: @@ -666,26 +669,27 @@ again:
666 if (cookie && (*cookie >> 32) != 0) { 669 if (cookie && (*cookie >> 32) != 0) {
667 compat_offseterr(vp, "sunos_getdents"); 670 compat_offseterr(vp, "sunos_getdents");
668 error = EINVAL; 671 error = EINVAL;
669 goto out; 672 goto out;
670 } 673 }
671 if (bdp->d_fileno == 0) { 674 if (bdp->d_fileno == 0) {
672 inp += reclen; /* it is a hole; squish it out */ 675 inp += reclen; /* it is a hole; squish it out */
673 if (cookie) 676 if (cookie)
674 off = *cookie++; 677 off = *cookie++;
675 else 678 else
676 off += reclen; 679 off += reclen;
677 continue; 680 continue;
678 } 681 }
 682 memset(&idb, 0, sizeof(idb));
679 sunos_reclen = SUNOS32_RECLEN(&idb, bdp->d_namlen); 683 sunos_reclen = SUNOS32_RECLEN(&idb, bdp->d_namlen);
680 if (reclen > len || resid < sunos_reclen) { 684 if (reclen > len || resid < sunos_reclen) {
681 /* entry too big for buffer, so just stop */ 685 /* entry too big for buffer, so just stop */
682 outp++; 686 outp++;
683 break; 687 break;
684 } 688 }
685 if (cookie) 689 if (cookie)
686 off = *cookie++; /* each entry points to next */ 690 off = *cookie++; /* each entry points to next */
687 else 691 else
688 off += reclen; 692 off += reclen;
689 /* 693 /*
690 * Massage in place to make a Sun-shaped dirent (otherwise 694 * Massage in place to make a Sun-shaped dirent (otherwise
691 * we have to worry about touching user memory outside of 695 * we have to worry about touching user memory outside of

cvs diff -r1.1.58.1 -r1.1.58.2 src/sys/compat/sys/time_types.h (expand / switch to unified diff)

--- src/sys/compat/sys/time_types.h 2019/01/03 09:00:01 1.1.58.1
+++ src/sys/compat/sys/time_types.h 2023/06/21 21:04:02 1.1.58.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: time_types.h,v 1.1.58.1 2019/01/03 09:00:01 martin Exp $ */ 1/* $NetBSD: time_types.h,v 1.1.58.2 2023/06/21 21:04:02 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1982, 1986, 1993 4 * Copyright (c) 1982, 1986, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -62,70 +62,80 @@ struct timespec50 { @@ -62,70 +62,80 @@ struct timespec50 {
62 int32_t tv_sec; /* seconds */ 62 int32_t tv_sec; /* seconds */
63 long tv_nsec; /* and nanoseconds */ 63 long tv_nsec; /* and nanoseconds */
64}; 64};
65 65
66/* 66/*
67 * Structure defined by POSIX.1b to be like a itimerval, but with 67 * Structure defined by POSIX.1b to be like a itimerval, but with
68 * timespecs. Used in the timer_*() system calls. 68 * timespecs. Used in the timer_*() system calls.
69 */ 69 */
70struct itimerspec50 { 70struct itimerspec50 {
71 struct timespec50 it_interval; 71 struct timespec50 it_interval;
72 struct timespec50 it_value; 72 struct timespec50 it_value;
73}; 73};
74 74
75static __inline void timeval50_to_timeval(const struct timeval50 *ts50, 75static __inline void
76 struct timeval *ts) 76timeval50_to_timeval(const struct timeval50 *ts50, struct timeval *ts)
77{ 77{
 78 memset(ts, 0, sizeof(*ts));
78 ts->tv_sec = ts50->tv_sec; 79 ts->tv_sec = ts50->tv_sec;
79 ts->tv_usec = (suseconds_t)ts50->tv_usec; 80 ts->tv_usec = (suseconds_t)ts50->tv_usec;
80} 81}
81 82
82static __inline void timeval_to_timeval50(const struct timeval *ts, 83static __inline void
83 struct timeval50 *ts50) 84timeval_to_timeval50(const struct timeval *ts, struct timeval50 *ts50)
84{ 85{
 86 memset(ts50, 0, sizeof(*ts50));
85 ts50->tv_sec = (long)ts->tv_sec; 87 ts50->tv_sec = (long)ts->tv_sec;
86 ts50->tv_usec = ts->tv_usec; 88 ts50->tv_usec = ts->tv_usec;
87} 89}
88 90
89static __inline void timespec50_to_timespec(const struct timespec50 *ts50, 91static __inline void
90 struct timespec *ts) 92timespec50_to_timespec(const struct timespec50 *ts50, struct timespec *ts)
91{ 93{
 94 memset(ts, 0, sizeof(*ts));
92 ts->tv_sec = ts50->tv_sec; 95 ts->tv_sec = ts50->tv_sec;
93 ts->tv_nsec = ts50->tv_nsec; 96 ts->tv_nsec = ts50->tv_nsec;
94} 97}
95 98
96static __inline void timespec_to_timespec50(const struct timespec *ts, 99static __inline void
97 struct timespec50 *ts50) 100timespec_to_timespec50(const struct timespec *ts, struct timespec50 *ts50)
98{ 101{
 102 memset(ts50, 0, sizeof(*ts50));
99 ts50->tv_sec = (int32_t)ts->tv_sec; 103 ts50->tv_sec = (int32_t)ts->tv_sec;
100 ts50->tv_nsec = ts->tv_nsec; 104 ts50->tv_nsec = ts->tv_nsec;
101} 105}
102 106
103static __inline void itimerval50_to_itimerval(const struct itimerval50 *ts50, 107static __inline void
104 struct itimerval *ts) 108itimerval50_to_itimerval(const struct itimerval50 *ts50, struct itimerval *ts)
105{ 109{
 110 memset(ts, 0, sizeof(*ts));
106 timeval50_to_timeval(&ts50->it_interval, &ts->it_interval); 111 timeval50_to_timeval(&ts50->it_interval, &ts->it_interval);
107 timeval50_to_timeval(&ts50->it_value, &ts->it_value); 112 timeval50_to_timeval(&ts50->it_value, &ts->it_value);
108} 113}
109 114
110static __inline void itimerval_to_itimerval50(const struct itimerval *ts, 115static __inline void
111 struct itimerval50 *ts50) 116itimerval_to_itimerval50(const struct itimerval *ts, struct itimerval50 *ts50)
112{ 117{
 118 memset(ts50, 0, sizeof(*ts50));
113 timeval_to_timeval50(&ts->it_interval, &ts50->it_interval); 119 timeval_to_timeval50(&ts->it_interval, &ts50->it_interval);
114 timeval_to_timeval50(&ts->it_value, &ts50->it_value); 120 timeval_to_timeval50(&ts->it_value, &ts50->it_value);
115} 121}
116 122
117static __inline void itimerspec50_to_itimerspec(const struct itimerspec50 *ts50, 123static __inline void
 124itimerspec50_to_itimerspec(const struct itimerspec50 *ts50,
118 struct itimerspec *ts) 125 struct itimerspec *ts)
119{ 126{
 127 memset(ts, 0, sizeof(*ts));
120 timespec50_to_timespec(&ts50->it_interval, &ts->it_interval); 128 timespec50_to_timespec(&ts50->it_interval, &ts->it_interval);
121 timespec50_to_timespec(&ts50->it_value, &ts->it_value); 129 timespec50_to_timespec(&ts50->it_value, &ts->it_value);
122} 130}
123 131
124static __inline void itimerspec_to_itimerspec50(const struct itimerspec *ts, 132static __inline void
 133itimerspec_to_itimerspec50(const struct itimerspec *ts,
125 struct itimerspec50 *ts50) 134 struct itimerspec50 *ts50)
126{ 135{
 136 memset(ts50, 0, sizeof(*ts50));
127 timespec_to_timespec50(&ts->it_interval, &ts50->it_interval); 137 timespec_to_timespec50(&ts->it_interval, &ts50->it_interval);
128 timespec_to_timespec50(&ts->it_value, &ts50->it_value); 138 timespec_to_timespec50(&ts->it_value, &ts50->it_value);
129} 139}
130 140
131#endif /* _COMPAT_SYS_TIME_TYPES_H_ */ 141#endif /* _COMPAT_SYS_TIME_TYPES_H_ */

cvs diff -r1.37 -r1.37.8.1 src/sys/compat/ultrix/ultrix_ioctl.c (expand / switch to unified diff)

--- src/sys/compat/ultrix/ultrix_ioctl.c 2016/10/08 15:48:07 1.37
+++ src/sys/compat/ultrix/ultrix_ioctl.c 2023/06/21 21:04:01 1.37.8.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ultrix_ioctl.c,v 1.37 2016/10/08 15:48:07 maxv Exp $ */ 1/* $NetBSD: ultrix_ioctl.c,v 1.37.8.1 2023/06/21 21:04:01 martin Exp $ */
2/* from : NetBSD: sunos_ioctl.c,v 1.21 1995/10/07 06:27:31 mycroft Exp */ 2/* from : NetBSD: sunos_ioctl.c,v 1.21 1995/10/07 06:27:31 mycroft Exp */
3 3
4/* 4/*
5 * Copyright (c) 1993 Markus Wild. 5 * Copyright (c) 1993 Markus Wild.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. The name of the author may not be used to endorse or promote products 13 * 2. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission 14 * derived from this software without specific prior written permission
@@ -18,27 +18,27 @@ @@ -18,27 +18,27 @@
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 * 26 *
27 * loosely from: Header: sunos_ioctl.c,v 1.7 93/05/28 04:40:43 torek Exp 27 * loosely from: Header: sunos_ioctl.c,v 1.7 93/05/28 04:40:43 torek Exp
28 */ 28 */
29 29
30#include <sys/cdefs.h> 30#include <sys/cdefs.h>
31__KERNEL_RCSID(0, "$NetBSD: ultrix_ioctl.c,v 1.37 2016/10/08 15:48:07 maxv Exp $"); 31__KERNEL_RCSID(0, "$NetBSD: ultrix_ioctl.c,v 1.37.8.1 2023/06/21 21:04:01 martin Exp $");
32 32
33#if defined(_KERNEL_OPT) 33#if defined(_KERNEL_OPT)
34#include "opt_compat_ultrix.h" 34#include "opt_compat_ultrix.h"
35#include "opt_compat_sunos.h" 35#include "opt_compat_sunos.h"
36#endif 36#endif
37 37
38#include <sys/param.h> 38#include <sys/param.h>
39#include <sys/proc.h> 39#include <sys/proc.h>
40#include <sys/systm.h> 40#include <sys/systm.h>
41#include <sys/file.h> 41#include <sys/file.h>
42#include <sys/filedesc.h> 42#include <sys/filedesc.h>
43#include <sys/ioctl.h> 43#include <sys/ioctl.h>
44#include <sys/termios.h> 44#include <sys/termios.h>
@@ -135,26 +135,28 @@ static void stio2stios(struct emul_termi @@ -135,26 +135,28 @@ static void stio2stios(struct emul_termi
135 * 135 *
136 * I don't know what optimizer you used, but seeing divu's and 136 * I don't know what optimizer you used, but seeing divu's and
137 * bfextu's in the m68k assembly output did not encourage me... 137 * bfextu's in the m68k assembly output did not encourage me...
138 * as well, gcc on the sparc definately generates much better 138 * as well, gcc on the sparc definately generates much better
139 * code with ?:. 139 * code with ?:.
140 */ 140 */
141 141
142 142
143static void 143static void
144stios2btios(struct emul_termios *st, struct termios *bt) 144stios2btios(struct emul_termios *st, struct termios *bt)
145{ 145{
146 uint32_t l, r; 146 uint32_t l, r;
147 147
 148 memset(bt, 0, sizeof(*bt));
 149
148 l = st->c_iflag; 150 l = st->c_iflag;
149 r = ((l & 0x00000001) ? IGNBRK : 0); 151 r = ((l & 0x00000001) ? IGNBRK : 0);
150 r |= ((l & 0x00000002) ? BRKINT : 0); 152 r |= ((l & 0x00000002) ? BRKINT : 0);
151 r |= ((l & 0x00000004) ? IGNPAR : 0); 153 r |= ((l & 0x00000004) ? IGNPAR : 0);
152 r |= ((l & 0x00000008) ? PARMRK : 0); 154 r |= ((l & 0x00000008) ? PARMRK : 0);
153 r |= ((l & 0x00000010) ? INPCK : 0); 155 r |= ((l & 0x00000010) ? INPCK : 0);
154 r |= ((l & 0x00000020) ? ISTRIP : 0); 156 r |= ((l & 0x00000020) ? ISTRIP : 0);
155 r |= ((l & 0x00000040) ? INLCR : 0); 157 r |= ((l & 0x00000040) ? INLCR : 0);
156 r |= ((l & 0x00000080) ? IGNCR : 0); 158 r |= ((l & 0x00000080) ? IGNCR : 0);
157 r |= ((l & 0x00000100) ? ICRNL : 0); 159 r |= ((l & 0x00000100) ? ICRNL : 0);
158 /* ((l & 0x00000200) ? IUCLC : 0) */ 160 /* ((l & 0x00000200) ? IUCLC : 0) */
159 r |= ((l & 0x00000400) ? IXON : 0); 161 r |= ((l & 0x00000400) ? IXON : 0);
160 r |= ((l & 0x00000800) ? IXANY : 0); 162 r |= ((l & 0x00000800) ? IXANY : 0);
@@ -266,26 +268,28 @@ stios2btios(struct emul_termios *st, str @@ -266,26 +268,28 @@ stios2btios(struct emul_termios *st, str
266#endif 268#endif
267 269
268} 270}
269 271
270/* 272/*
271 * Convert bsd termios to "sunos" emulated termios 273 * Convert bsd termios to "sunos" emulated termios
272 */ 274 */
273static void 275static void
274btios2stios(struct termios *bt, struct emul_termios *st) 276btios2stios(struct termios *bt, struct emul_termios *st)
275{ 277{
276 uint32_t l, r; 278 uint32_t l, r;
277 int speed; 279 int speed;
278 280
 281 memset(st, 0, sizeof(*st));
 282
279 l = bt->c_iflag; 283 l = bt->c_iflag;
280 r = ((l & IGNBRK) ? 0x00000001 : 0); 284 r = ((l & IGNBRK) ? 0x00000001 : 0);
281 r |= ((l & BRKINT) ? 0x00000002 : 0); 285 r |= ((l & BRKINT) ? 0x00000002 : 0);
282 r |= ((l & IGNPAR) ? 0x00000004 : 0); 286 r |= ((l & IGNPAR) ? 0x00000004 : 0);
283 r |= ((l & PARMRK) ? 0x00000008 : 0); 287 r |= ((l & PARMRK) ? 0x00000008 : 0);
284 r |= ((l & INPCK) ? 0x00000010 : 0); 288 r |= ((l & INPCK) ? 0x00000010 : 0);
285 r |= ((l & ISTRIP) ? 0x00000020 : 0); 289 r |= ((l & ISTRIP) ? 0x00000020 : 0);
286 r |= ((l & INLCR) ? 0x00000040 : 0); 290 r |= ((l & INLCR) ? 0x00000040 : 0);
287 r |= ((l & IGNCR) ? 0x00000080 : 0); 291 r |= ((l & IGNCR) ? 0x00000080 : 0);
288 r |= ((l & ICRNL) ? 0x00000100 : 0); 292 r |= ((l & ICRNL) ? 0x00000100 : 0);
289 /* ((l & IUCLC) ? 0x00000200 : 0) */ 293 /* ((l & IUCLC) ? 0x00000200 : 0) */
290 r |= ((l & IXON) ? 0x00000400 : 0); 294 r |= ((l & IXON) ? 0x00000400 : 0);
291 r |= ((l & IXANY) ? 0x00000800 : 0); 295 r |= ((l & IXANY) ? 0x00000800 : 0);
@@ -409,40 +413,44 @@ btios2stios(struct termios *bt, struct e @@ -409,40 +413,44 @@ btios2stios(struct termios *bt, struct e
409#else 413#else
410 st->c_line = 2; /* 4.3bsd "new" line discipline, Ultrix default. */ 414 st->c_line = 2; /* 4.3bsd "new" line discipline, Ultrix default. */
411#endif 415#endif
412} 416}
413 417
414#define TERMIO_NCC 10 /* ultrix termio NCC is 10 */ 418#define TERMIO_NCC 10 /* ultrix termio NCC is 10 */
415 419
416/* 420/*
417 * Convert emulated struct termios to termio(?) 421 * Convert emulated struct termios to termio(?)
418 */ 422 */
419static void 423static void
420stios2stio(struct emul_termios *ts, struct emul_termio *t) 424stios2stio(struct emul_termios *ts, struct emul_termio *t)
421{ 425{
 426
 427 memset(t, 0, sizeof(*t));
422 t->c_iflag = ts->c_iflag; 428 t->c_iflag = ts->c_iflag;
423 t->c_oflag = ts->c_oflag; 429 t->c_oflag = ts->c_oflag;
424 t->c_cflag = ts->c_cflag; 430 t->c_cflag = ts->c_cflag;
425 t->c_lflag = ts->c_lflag; 431 t->c_lflag = ts->c_lflag;
426 t->c_line = ts->c_line; 432 t->c_line = ts->c_line;
427 memcpy(t->c_cc, ts->c_cc, TERMIO_NCC); 433 memcpy(t->c_cc, ts->c_cc, TERMIO_NCC);
428} 434}
429 435
430/* 436/*
431 * Convert the other way 437 * Convert the other way
432 */ 438 */
433static void 439static void
434stio2stios(struct emul_termio *t, struct emul_termios *ts) 440stio2stios(struct emul_termio *t, struct emul_termios *ts)
435{ 441{
 442
 443 memset(ts, 0, sizeof(*t));
436 ts->c_iflag = t->c_iflag; 444 ts->c_iflag = t->c_iflag;
437 ts->c_oflag = t->c_oflag; 445 ts->c_oflag = t->c_oflag;
438 ts->c_cflag = t->c_cflag; 446 ts->c_cflag = t->c_cflag;
439 ts->c_lflag = t->c_lflag; 447 ts->c_lflag = t->c_lflag;
440 ts->c_line = t->c_line; 448 ts->c_line = t->c_line;
441 memcpy(ts->c_cc, t->c_cc, TERMIO_NCC); /* don't touch the upper fields! */ 449 memcpy(ts->c_cc, t->c_cc, TERMIO_NCC); /* don't touch the upper fields! */
442} 450}
443 451
444static int 452static int
445ultrix_do_ioctl(int fd, int cmd, void *arg, struct lwp *l) 453ultrix_do_ioctl(int fd, int cmd, void *arg, struct lwp *l)
446{ 454{
447 file_t *fp; 455 file_t *fp;
448 int error; 456 int error;
@@ -518,26 +526,27 @@ ultrix_sys_ioctl(struct lwp *l, const st @@ -518,26 +526,27 @@ ultrix_sys_ioctl(struct lwp *l, const st
518 ws.ws_row = ss.ts_row; 526 ws.ws_row = ss.ts_row;
519 ws.ws_col = ss.ts_col; 527 ws.ws_col = ss.ts_col;
520 528
521 return ultrix_do_ioctl(SCARG(&ap, fd), TIOCSWINSZ, &ws, l); 529 return ultrix_do_ioctl(SCARG(&ap, fd), TIOCSWINSZ, &ws, l);
522 } 530 }
523 case _IOW('t', 38, struct sunos_ttysize): 531 case _IOW('t', 38, struct sunos_ttysize):
524 { 532 {
525 struct winsize ws; 533 struct winsize ws;
526 struct sunos_ttysize ss; 534 struct sunos_ttysize ss;
527 535
528 if ((error = ultrix_do_ioctl(SCARG(&ap, fd), TIOCGWINSZ, &ws, l)) != 0) 536 if ((error = ultrix_do_ioctl(SCARG(&ap, fd), TIOCGWINSZ, &ws, l)) != 0)
529 return error; 537 return error;
530 538
 539 memset(&ss, 0, sizeof(ss));
531 ss.ts_row = ws.ws_row; 540 ss.ts_row = ws.ws_row;
532 ss.ts_col = ws.ws_col; 541 ss.ts_col = ws.ws_col;
533 542
534 return copyout (&ss, SCARG(&ap, data), sizeof (ss)); 543 return copyout (&ss, SCARG(&ap, data), sizeof (ss));
535 } 544 }
536 case _IOW('t', 118, int): 545 case _IOW('t', 118, int):
537 SCARG(&ap, com) = TIOCSPGRP; 546 SCARG(&ap, com) = TIOCSPGRP;
538 break; 547 break;
539 case _IOR('t', 119, int): 548 case _IOR('t', 119, int):
540 SCARG(&ap, com) = TIOCGPGRP; 549 SCARG(&ap, com) = TIOCGPGRP;
541 break; 550 break;
542 551
543 /* Emulate termio or termios tcget() */ 552 /* Emulate termio or termios tcget() */

cvs diff -r1.122 -r1.122.32.1 src/sys/compat/ultrix/ultrix_misc.c (expand / switch to unified diff)

--- src/sys/compat/ultrix/ultrix_misc.c 2012/02/19 21:06:45 1.122
+++ src/sys/compat/ultrix/ultrix_misc.c 2023/06/21 21:04:01 1.122.32.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ultrix_misc.c,v 1.122 2012/02/19 21:06:45 rmind Exp $ */ 1/* $NetBSD: ultrix_misc.c,v 1.122.32.1 2023/06/21 21:04:01 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1995, 1997 Jonathan Stone (hereinafter referred to as the author) 4 * Copyright (c) 1995, 1997 Jonathan Stone (hereinafter referred to as the author)
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -66,27 +66,27 @@ @@ -66,27 +66,27 @@
66 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 66 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
67 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 67 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
68 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 68 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
69 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 69 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
70 * SUCH DAMAGE. 70 * SUCH DAMAGE.
71 * 71 *
72 * 72 *
73 * @(#)sun_misc.c 8.1 (Berkeley) 6/18/93 73 * @(#)sun_misc.c 8.1 (Berkeley) 6/18/93
74 * 74 *
75 * from: Header: sun_misc.c,v 1.16 93/04/07 02:46:27 torek Exp 75 * from: Header: sun_misc.c,v 1.16 93/04/07 02:46:27 torek Exp
76 */ 76 */
77 77
78#include <sys/cdefs.h> 78#include <sys/cdefs.h>
79__KERNEL_RCSID(0, "$NetBSD: ultrix_misc.c,v 1.122 2012/02/19 21:06:45 rmind Exp $"); 79__KERNEL_RCSID(0, "$NetBSD: ultrix_misc.c,v 1.122.32.1 2023/06/21 21:04:01 martin Exp $");
80 80
81#if defined(_KERNEL_OPT) 81#if defined(_KERNEL_OPT)
82#include "opt_sysv.h" 82#include "opt_sysv.h"
83#endif 83#endif
84 84
85#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ 85#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
86 86
87/* 87/*
88 * Ultrix compatibility module. 88 * Ultrix compatibility module.
89 * 89 *
90 * Ultrix system calls that are implemented differently in BSD are 90 * Ultrix system calls that are implemented differently in BSD are
91 * handled here. 91 * handled here.
92 */ 92 */
@@ -618,26 +618,27 @@ ultrix_sys_sigvec(struct lwp *l, const s @@ -618,26 +618,27 @@ ultrix_sys_sigvec(struct lwp *l, const s
618 nsa.sa_flags |= SA_RESTART; 618 nsa.sa_flags |= SA_RESTART;
619#else /* optimized - assuming ULTRIX_SV_OLDSIG=>!ULTRIX_SV_INTERRUPT */ 619#else /* optimized - assuming ULTRIX_SV_OLDSIG=>!ULTRIX_SV_INTERRUPT */
620 nsa.sa_flags = nsv.sv_flags & ~ULTRIX_SV_OLDSIG; 620 nsa.sa_flags = nsv.sv_flags & ~ULTRIX_SV_OLDSIG;
621 nsa.sa_flags ^= SA_RESTART; 621 nsa.sa_flags ^= SA_RESTART;
622#endif 622#endif
623 native_sigset13_to_sigset(&nsv.sv_mask, &nsa.sa_mask); 623 native_sigset13_to_sigset(&nsv.sv_mask, &nsa.sa_mask);
624 } 624 }
625 error = sigaction1(l, SCARG(uap, signum), 625 error = sigaction1(l, SCARG(uap, signum),
626 SCARG(uap, nsv) ? &nsa : 0, SCARG(uap, osv) ? &osa : 0, 626 SCARG(uap, nsv) ? &nsa : 0, SCARG(uap, osv) ? &osa : 0,
627 NULL, 0); 627 NULL, 0);
628 if (error) 628 if (error)
629 return error; 629 return error;
630 if (SCARG(uap, osv)) { 630 if (SCARG(uap, osv)) {
 631 memset(&osv, 0, sizeof(osv));
631 osv.sv_handler = osa.sa_handler; 632 osv.sv_handler = osa.sa_handler;
632 osv.sv_flags = osa.sa_flags ^ SA_RESTART; 633 osv.sv_flags = osa.sa_flags ^ SA_RESTART;
633 osv.sv_flags &= (ULTRIX_SV_ONSTACK | ULTRIX_SV_INTERRUPT); 634 osv.sv_flags &= (ULTRIX_SV_ONSTACK | ULTRIX_SV_INTERRUPT);
634 native_sigset_to_sigset13(&osa.sa_mask, &osv.sv_mask); 635 native_sigset_to_sigset13(&osa.sa_mask, &osv.sv_mask);
635 error = copyout(&osv, SCARG(uap, osv), sizeof(osv)); 636 error = copyout(&osv, SCARG(uap, osv), sizeof(osv));
636 if (error) 637 if (error)
637 return error; 638 return error;
638 } 639 }
639 return 0; 640 return 0;
640} 641}
641 642
642int 643int
643ultrix_sys_shmsys(struct lwp *l, const struct ultrix_sys_shmsys_args *uap, register_t *retval) 644ultrix_sys_shmsys(struct lwp *l, const struct ultrix_sys_shmsys_args *uap, register_t *retval)
@@ -677,52 +678,56 @@ ultrix_sys_shmsys(struct lwp *l, const s @@ -677,52 +678,56 @@ ultrix_sys_shmsys(struct lwp *l, const s
677 678
678 default: 679 default:
679 return EINVAL; 680 return EINVAL;
680 } 681 }
681#else 682#else
682 return EOPNOTSUPP; 683 return EOPNOTSUPP;
683#endif /* SYSVSHM */ 684#endif /* SYSVSHM */
684} 685}
685 686
686static int 687static int
687ultrix_to_bsd_flock(struct ultrix_flock *ufl, struct flock *fl) 688ultrix_to_bsd_flock(struct ultrix_flock *ufl, struct flock *fl)
688{ 689{
689 690
 691 memset(fl, 0, sizeof(*fl));
 692
690 fl->l_start = ufl->l_start; 693 fl->l_start = ufl->l_start;
691 fl->l_len = ufl->l_len; 694 fl->l_len = ufl->l_len;
692 fl->l_pid = ufl->l_pid; 695 fl->l_pid = ufl->l_pid;
693 fl->l_whence = ufl->l_whence; 696 fl->l_whence = ufl->l_whence;
694 697
695 switch (ufl->l_type) { 698 switch (ufl->l_type) {
696 case ULTRIX_F_RDLCK: 699 case ULTRIX_F_RDLCK:
697 fl->l_type = F_RDLCK; 700 fl->l_type = F_RDLCK;
698 break; 701 break;
699 case ULTRIX_F_WRLCK: 702 case ULTRIX_F_WRLCK:
700 fl->l_type = F_WRLCK; 703 fl->l_type = F_WRLCK;
701 break; 704 break;
702 case ULTRIX_F_UNLCK: 705 case ULTRIX_F_UNLCK:
703 fl->l_type = F_UNLCK; 706 fl->l_type = F_UNLCK;
704 break; 707 break;
705 default: 708 default:
706 return EINVAL; 709 return EINVAL;
707 } 710 }
708 711
709 return 0; 712 return 0;
710} 713}
711 714
712static void 715static void
713bsd_to_ultrix_flock(struct flock *fl, struct ultrix_flock *ufl) 716bsd_to_ultrix_flock(struct flock *fl, struct ultrix_flock *ufl)
714{ 717{
715 718
 719 memset(ufl, 0, sizeof(*ufl));
 720
716 ufl->l_start = fl->l_start; 721 ufl->l_start = fl->l_start;
717 ufl->l_len = fl->l_len; 722 ufl->l_len = fl->l_len;
718 ufl->l_pid = fl->l_pid; 723 ufl->l_pid = fl->l_pid;
719 ufl->l_whence = fl->l_whence; 724 ufl->l_whence = fl->l_whence;
720 725
721 switch (fl->l_type) { 726 switch (fl->l_type) {
722 case F_RDLCK: 727 case F_RDLCK:
723 ufl->l_type = ULTRIX_F_RDLCK; 728 ufl->l_type = ULTRIX_F_RDLCK;
724 break; 729 break;
725 case F_WRLCK: 730 case F_WRLCK:
726 ufl->l_type = ULTRIX_F_WRLCK; 731 ufl->l_type = ULTRIX_F_WRLCK;
727 break; 732 break;
728 case F_UNLCK: 733 case F_UNLCK: