CVS commit: src/sys/compat/common

2021-08-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 15 07:57:46 UTC 2021

Modified Files:
src/sys/compat/common: vfs_syscalls_30.c vfs_syscalls_43.c
vfs_syscalls_50.c

Log Message:
- memset struct stat to avoid kernel memory disclosure of padded fields
  (thanks Trend Micro for the report)
- use do_fhstat
- consistency in argument order of compat functions


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/compat/common/vfs_syscalls_30.c
cvs rdiff -u -r1.66 -r1.67 src/sys/compat/common/vfs_syscalls_43.c
cvs rdiff -u -r1.25 -r1.26 src/sys/compat/common/vfs_syscalls_50.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/vfs_syscalls_30.c
diff -u src/sys/compat/common/vfs_syscalls_30.c:1.41 src/sys/compat/common/vfs_syscalls_30.c:1.42
--- src/sys/compat/common/vfs_syscalls_30.c:1.41	Fri Jan 31 04:01:23 2020
+++ src/sys/compat/common/vfs_syscalls_30.c	Sun Aug 15 03:57:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_30.c,v 1.41 2020/01/31 09:01:23 maxv Exp $	*/
+/*	$NetBSD: vfs_syscalls_30.c,v 1.42 2021/08/15 07:57:46 christos Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.41 2020/01/31 09:01:23 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.42 2021/08/15 07:57:46 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -63,8 +63,6 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls
 #include 
 #include 
 
-static void cvtstat(struct stat13 *, const struct stat *);
-
 static const struct syscall_package vfs_syscalls_30_syscalls[] = {
 	{ SYS_compat_30___fhstat30, 0, (sy_call_t *)compat_30_sys___fhstat30 },
 	{ SYS_compat_30___fstat13, 0, (sy_call_t *)compat_30_sys___fstat13 },
@@ -85,6 +83,8 @@ static void
 cvtstat(struct stat13 *ost, const struct stat *st)
 {
 
+	/* Handle any padding. */
+	memset(ost, 0, sizeof(*ost));
 	ost->st_dev = st->st_dev;
 	ost->st_ino = (uint32_t)st->st_ino;
 	ost->st_mode = st->st_mode;
@@ -123,8 +123,7 @@ compat_30_sys___stat13(struct lwp *l,
 	if (error)
 		return error;
 	cvtstat(, );
-	error = copyout(, SCARG(uap, ub), sizeof (osb));
-	return error;
+	return copyout(, SCARG(uap, ub), sizeof(osb));
 }
 
 
@@ -148,8 +147,7 @@ compat_30_sys___lstat13(struct lwp *l,
 	if (error)
 		return error;
 	cvtstat(, );
-	error = copyout(, SCARG(uap, ub), sizeof (osb));
-	return error;
+	return copyout(, SCARG(uap, ub), sizeof(osb));
 }
 
 /* ARGSUSED */
@@ -164,34 +162,12 @@ compat_30_sys_fhstat(struct lwp *l,
 	struct stat sb;
 	struct stat13 osb;
 	int error;
-	struct compat_30_fhandle fh;
-	struct mount *mp;
-	struct vnode *vp;
-
-	/*
-	 * Must be super user
-	 */
-	if ((error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_FILEHANDLE,
-	0, NULL, NULL, NULL)))
-		return (error);
 
-	if ((error = copyin(SCARG(uap, fhp), , sizeof(fh))) != 0)
-		return (error);
-
-	if ((mp = vfs_getvfs(_fsid)) == NULL)
-		return (ESTALE);
-	if (mp->mnt_op->vfs_fhtovp == NULL)
-		return EOPNOTSUPP;
-	error = VFS_FHTOVP(mp, (struct fid*)_fid, LK_EXCLUSIVE, );
-	if (error != 0)
-		return (error);
-	error = vn_stat(vp, );
-	vput(vp);
+	error = do_fhstat(l, SCARG(uap, fhp), sizeof(*SCARG(uap, fhp)), );
 	if (error)
-		return (error);
+		return error;
 	cvtstat(, );
-	error = copyout(, SCARG(uap, sb), sizeof(osb));
-	return (error);
+	return copyout(, SCARG(uap, sb), sizeof(osb));
 }
 
 /*
@@ -214,8 +190,7 @@ compat_30_sys___fstat13(struct lwp *l,
 	if (error)
 		return error;
 	cvtstat(, );
-	error = copyout(, SCARG(uap, sb), sizeof (osb));
-	return error;
+	return copyout(, SCARG(uap, sb), sizeof(osb));
 }
 
 /*
@@ -292,7 +267,7 @@ again:
 		bdp = (struct dirent *)inp;
 		reclen = bdp->d_reclen;
 		if (reclen & _DIRENT_ALIGN(bdp))
-			panic("netbsd30_getdents: bad reclen %d", reclen);
+			panic("%s: bad reclen %d", __func__, reclen);
 		if (cookie)
 			off = *cookie++; /* each entry points to the next */
 		else
@@ -396,9 +371,8 @@ compat_30_sys_getfh(struct lwp *l, const
 		error = EINVAL;
 	}
 	if (error)
-		return (error);
-	error = copyout(, SCARG(uap, fhp), sizeof(struct compat_30_fhandle));
-	return (error);
+		return error;
+	return copyout(, SCARG(uap, fhp), sizeof(fh));
 }
 
 /*
@@ -437,8 +411,7 @@ compat_30_sys___fhstat30(struct lwp *l,
 	if (error)
 		return error;
 	cvtstat(, );
-	error = copyout(, SCARG(uap_30, sb), sizeof (osb));
-	return error;
+	return copyout(, SCARG(uap_30, sb), sizeof(osb));
 }
 
 /* ARGSUSED */

Index: src/sys/compat/common/vfs_syscalls_43.c
diff -u src/sys/compat/common/vfs_syscalls_43.c:1.66 src/sys/compat/common/vfs_syscalls_43.c:1.67
--- src/sys/compat/common/vfs_syscalls_43.c:1.66	Wed Jun 24 06:28:16 2020
+++ src/sys/compat/common/vfs_syscalls_43.c	Sun Aug 15 03:57:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_43.c,v 1.66 

CVS commit: src/sys/compat/common

2021-05-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue May 25 16:50:49 UTC 2021

Modified Files:
src/sys/compat/common: Makefile

Log Message:
PR port-xen/53130 was fixed and closed some time ago, so now we can
belatedly re-enable inclusion of the compat_60 x86 microcode code in
the loadable module.  (It was already being included in the built-in
version of the module.)


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/compat/common/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/Makefile
diff -u src/sys/compat/common/Makefile:1.65 src/sys/compat/common/Makefile:1.66
--- src/sys/compat/common/Makefile:1.65	Sun Jan 27 02:08:39 2019
+++ src/sys/compat/common/Makefile	Tue May 25 16:50:49 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.65 2019/01/27 02:08:39 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.66 2021/05/25 16:50:49 pgoyette Exp $
 
 LIB=		compat
 NOPIC=		# defined
@@ -27,11 +27,9 @@ lib${LIB}.o:: ${OBJS:O} __buildstdlib
 
 lib${LIB}.po:: ${POBJS:O} __buildproflib
 
-.if NOTYET
 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
 CPPFLAGS+=	-DCPU_UCODE
 .endif
-.endif
 
 showsources: ${SRCS}
 	@echo ${.ALLSRC}



CVS commit: src/sys/compat/common

2020-12-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 22:10:56 UTC 2020

Modified Files:
src/sys/compat/common: bio_30.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/common/bio_30.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/bio_30.c
diff -u src/sys/compat/common/bio_30.c:1.4 src/sys/compat/common/bio_30.c:1.5
--- src/sys/compat/common/bio_30.c:1.4	Thu Dec 12 02:15:42 2019
+++ src/sys/compat/common/bio_30.c	Sat Dec 19 22:10:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bio_30.c,v 1.4 2019/12/12 02:15:42 pgoyette Exp $ */
+/*	$NetBSD: bio_30.c,v 1.5 2020/12/19 22:10:56 thorpej Exp $ */
 /*	$OpenBSD: bio.c,v 1.9 2007/03/20 02:35:55 marco Exp $	*/
 
 /*
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bio_30.c,v 1.4 2019/12/12 02:15:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bio_30.c,v 1.5 2020/12/19 22:10:56 thorpej Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -37,7 +37,7 @@ __KERNEL_RCSID(0, "$NetBSD: bio_30.c,v 1
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -58,33 +58,31 @@ compat_30_bio(void *cookie, u_long cmd, 
 
 	switch (cmd) {
 	case OBIOCDISK: {
-		struct bioc_disk *bd =
-		malloc(sizeof(*bd), M_DEVBUF, M_WAITOK|M_ZERO);
+		struct bioc_disk *bd = kmem_zalloc(sizeof(*bd), KM_SLEEP);
 
 		(void)memcpy(bd, addr, sizeof(struct obioc_disk));
 		error = (*delegate)(cookie, BIOCDISK, bd);
 		if (error) {
-			free(bd, M_DEVBUF);
+			kmem_free(bd, sizeof(*bd));
 			return error;
 		}
 
 		(void)memcpy(addr, bd, sizeof(struct obioc_disk));
-		free(bd, M_DEVBUF);
+		kmem_free(bd, sizeof(*bd));
 		return 0;
 	}
 	case OBIOCVOL: {
-		struct bioc_vol *bv =
-		malloc(sizeof(*bv), M_DEVBUF, M_WAITOK|M_ZERO);
+		struct bioc_vol *bv = kmem_zalloc(sizeof(*bv), KM_SLEEP);
 
 		(void)memcpy(bv, addr, sizeof(struct obioc_vol));
 		error = (*delegate)(cookie, BIOCVOL, bv);
 		if (error) {
-			free(bv, M_DEVBUF);
+			kmem_free(bv, sizeof(*bv));
 			return error;
 		}
 
 		(void)memcpy(addr, bv, sizeof(struct obioc_vol));
-		free(bv, M_DEVBUF);
+		kmem_free(bv, sizeof(*bv));
 		return 0;
 	}
 	default:



CVS commit: src/sys/compat/common

2020-10-09 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Fri Oct  9 10:41:53 UTC 2020

Modified Files:
src/sys/compat/common: tty_43.c

Log Message:
tty_43: Check a bitset from userspace is valid before shifting it

Passing a negative value to these legacy compat ioctls results in
left shift on a negative value which is undefined behaviour and results
in the tty (at least, possibly other things) locking up.

The argument to the ioctl should always be > 0. Return EINVAL otherwise.

While here, adjustments to code style to match current guidelines.

Found by UBSan.

Reported-by: syzbot+39cd551a05298b222...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/compat/common/tty_43.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/tty_43.c
diff -u src/sys/compat/common/tty_43.c:1.37 src/sys/compat/common/tty_43.c:1.38
--- src/sys/compat/common/tty_43.c:1.37	Sat Aug  8 19:04:58 2020
+++ src/sys/compat/common/tty_43.c	Fri Oct  9 10:41:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty_43.c,v 1.37 2020/08/08 19:04:58 christos Exp $	*/
+/*	$NetBSD: tty_43.c,v 1.38 2020/10/09 10:41:53 nia Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tty_43.c,v 1.37 2020/08/08 19:04:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_43.c,v 1.38 2020/10/09 10:41:53 nia Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -220,20 +220,24 @@ compat_43_ttioctl(struct tty *tp, u_long
 	case TIOCLBIC:
 	case TIOCLSET: {
 		struct termios term;
-		int flags;
+		int argbits, flags;
+
+		argbits = *(int *)data;
+		if (argbits < 0)
+			return EINVAL;
 
 		mutex_spin_enter(_lock);
 		term = tp->t_termios;
 		flags = ttcompatgetflags(tp);
 		switch (com) {
 		case TIOCLSET:
-			tp->t_flags = (flags&0x) | (*(int *)data<<16);
+			tp->t_flags = (flags & 0x) | (argbits << 16);
 			break;
 		case TIOCLBIS:
-			tp->t_flags = flags | (*(int *)data<<16);
+			tp->t_flags = flags | (argbits << 16);
 			break;
 		case TIOCLBIC:
-			tp->t_flags = flags & ~(*(int *)data<<16);
+			tp->t_flags = flags & ~(argbits << 16);
 			break;
 		}
 		ttcompatsetlflags(tp, );



CVS commit: src/sys/compat/common

2020-08-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug  8 19:04:58 UTC 2020

Modified Files:
src/sys/compat/common: tty_43.c

Log Message:
Fix the OTIOCGETD emulation. Line discipline 0 is NTTYDISC.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/compat/common/tty_43.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/tty_43.c
diff -u src/sys/compat/common/tty_43.c:1.36 src/sys/compat/common/tty_43.c:1.37
--- src/sys/compat/common/tty_43.c:1.36	Sat May 23 19:42:41 2020
+++ src/sys/compat/common/tty_43.c	Sat Aug  8 15:04:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty_43.c,v 1.36 2020/05/23 23:42:41 ad Exp $	*/
+/*	$NetBSD: tty_43.c,v 1.37 2020/08/08 19:04:58 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tty_43.c,v 1.36 2020/05/23 23:42:41 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_43.c,v 1.37 2020/08/08 19:04:58 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -250,8 +250,8 @@ compat_43_ttioctl(struct tty *tp, u_long
 
 	case OTIOCGETD:
 		mutex_spin_enter(_lock);
-		*(int *)data = (tp->t_linesw == NULL) ?
-		2 /* XXX old NTTYDISC */ : tp->t_linesw->l_no;
+		*(int *)data = (tp->t_linesw == NULL || tp->t_linesw->l_no == 0)
+		? 2 /* XXX old NTTYDISC */ : tp->t_linesw->l_no;
 		mutex_spin_exit(_lock);
 		break;
 



CVS commit: src/sys/compat/common

2020-06-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun 28 14:37:53 UTC 2020

Modified Files:
src/sys/compat/common: vfs_syscalls_20.c

Log Message:
Fix struct entry size (thanks kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/compat/common/vfs_syscalls_20.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/vfs_syscalls_20.c
diff -u src/sys/compat/common/vfs_syscalls_20.c:1.45 src/sys/compat/common/vfs_syscalls_20.c:1.46
--- src/sys/compat/common/vfs_syscalls_20.c:1.45	Fri Jan 17 15:08:06 2020
+++ src/sys/compat/common/vfs_syscalls_20.c	Sun Jun 28 10:37:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_20.c,v 1.45 2020/01/17 20:08:06 ad Exp $	*/
+/*	$NetBSD: vfs_syscalls_20.c,v 1.46 2020/06/28 14:37:53 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_20.c,v 1.45 2020/01/17 20:08:06 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_20.c,v 1.46 2020/06/28 14:37:53 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -153,7 +153,7 @@ compat_20_sys_getfsstat(struct lwp *l, c
 	} */
 	return do_sys_getvfsstat(l, SCARG(uap, buf), SCARG(uap, bufsize),
 	SCARG(uap, flags), statvfs_to_statfs12_copy,
-	sizeof(struct statvfs90), retval);
+	sizeof(struct statfs12), retval);
 }
 
 int



CVS commit: src/sys/compat/common

2020-06-24 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Wed Jun 24 17:47:52 UTC 2020

Modified Files:
src/sys/compat/common: tty_60.c

Log Message:
reduce stack usage in compat_60_ptmget_ioctl() - allocate struct ptmget
via kmem_alloc()


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/compat/common/tty_60.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/tty_60.c
diff -u src/sys/compat/common/tty_60.c:1.9 src/sys/compat/common/tty_60.c:1.10
--- src/sys/compat/common/tty_60.c:1.9	Thu Dec 12 02:15:42 2019
+++ src/sys/compat/common/tty_60.c	Wed Jun 24 17:47:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty_60.c,v 1.9 2019/12/12 02:15:42 pgoyette Exp $	*/
+/*	$NetBSD: tty_60.c,v 1.10 2020/06/24 17:47:52 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tty_60.c,v 1.9 2019/12/12 02:15:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_60.c,v 1.10 2020/06/24 17:47:52 jdolecek Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: tty_60.c,v 1
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -70,7 +71,7 @@ compat_60_ptmget_ioctl(dev_t dev, u_long
 {
 	int ret;
 	u_long newcmd;
-	struct ptmget pg;
+	struct ptmget *pg;
 	const struct cdevsw *cd = cdevsw_lookup(dev);
 
 	if (cd == NULL || cd->d_ioctl == NULL)
@@ -82,10 +83,16 @@ compat_60_ptmget_ioctl(dev_t dev, u_long
 	default: return ENOTTY;
 	}
 
-	ret = (cd->d_ioctl)(dev, newcmd, , flag, l);
+	pg = kmem_alloc(sizeof(*pg), KM_SLEEP);
+
+	ret = (cd->d_ioctl)(dev, newcmd, pg, flag, l);
 	if (ret != 0)
-		return ret;
-	ret = ptmget_to_ptmget60(, data);
+		goto out;
+
+	ret = ptmget_to_ptmget60(pg, data);
+
+out:
+	kmem_free(pg, sizeof(*pg));
 	return ret;
 }
 



CVS commit: src/sys/compat/common

2020-03-26 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Mar 26 13:39:29 UTC 2020

Modified Files:
src/sys/compat/common: compat_sysctl_09_43.c

Log Message:
When using SYSCTL_SETUP there is no guarantee of the order in which
the set-up functions will be called, so it is perfectly acceptable
for a compat code's routine to be called ahead of the code in other
parts of the kernel.

So make sure that the 2nd level sysctl node ``vfs.generic'' exists
before trying to add the 3rd level entries.

XXX Rather than creating the 2nd level node in two places, we could
XXX add the shared ``vfs.generic'' node to sysctl_init_base.c but
XXX this is left for another day.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/compat/common/compat_sysctl_09_43.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_sysctl_09_43.c
diff -u src/sys/compat/common/compat_sysctl_09_43.c:1.5 src/sys/compat/common/compat_sysctl_09_43.c:1.6
--- src/sys/compat/common/compat_sysctl_09_43.c:1.5	Thu Feb 27 17:42:33 2020
+++ src/sys/compat/common/compat_sysctl_09_43.c	Thu Mar 26 13:39:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_sysctl_09_43.c,v 1.5 2020/02/27 17:42:33 pgoyette Exp $	*/
+/*	$NetBSD: compat_sysctl_09_43.c,v 1.6 2020/03/26 13:39:29 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_sysctl_09_43.c,v 1.5 2020/02/27 17:42:33 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_sysctl_09_43.c,v 1.6 2020/03/26 13:39:29 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -106,6 +106,17 @@ SYSCTL_SETUP(compat_sysctl_vfs, "Top-lev
 	int error;
 
 	error = sysctl_createv(clog, 0, NULL, NULL,
+			CTLFLAG_PERMANENT, 
+			CTLTYPE_NODE, "generic",
+			SYSCTL_DESCR("Non-specific vfs related information"),
+			NULL, 0, NULL, 0,
+			CTL_VFS, VFS_GENERIC, CTL_EOL);
+	if (error == EEXIST)
+		error = 0;
+	if (error != 0)
+		return;
+
+	error = sysctl_createv(clog, 0, NULL, NULL,
 		   CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
 		   CTLTYPE_INT, "maxtypenum",
 		   SYSCTL_DESCR("Highest valid filesystem type number"),



CVS commit: src/sys/compat/common

2020-03-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Mar  9 00:42:36 UTC 2020

Modified Files:
src/sys/compat/common: compat_50_quota.c

Log Message:
The compat_50_quota code needs quota support from ufs.  Add dependency.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/common/compat_50_quota.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_50_quota.c
diff -u src/sys/compat/common/compat_50_quota.c:1.2 src/sys/compat/common/compat_50_quota.c:1.3
--- src/sys/compat/common/compat_50_quota.c:1.2	Wed Jan 22 23:41:29 2020
+++ src/sys/compat/common/compat_50_quota.c	Mon Mar  9 00:42:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_50_quota.c,v 1.2 2020/01/22 23:41:29 pgoyette Exp $ */
+/*	$NetBSD: compat_50_quota.c,v 1.3 2020/03/09 00:42:36 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_50_quota.c,v 1.2 2020/01/22 23:41:29 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_50_quota.c,v 1.3 2020/03/09 00:42:36 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -164,7 +164,7 @@ compat_50_sys_quotactl(struct lwp *l, co
 	return error;
 }
 
-MODULE(MODULE_CLASS_EXEC, compat_50_quota, "compat_50");
+MODULE(MODULE_CLASS_EXEC, compat_50_quota, "compat_50,ufs");
 
 static int
 compat_50_quota_modcmd(modcmd_t cmd, void *arg)



CVS commit: src/sys/compat/common

2020-02-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Feb 27 18:19:16 UTC 2020

Modified Files:
src/sys/compat/common: vfs_syscalls_43.c

Log Message:
Include all of the vfs syscalls in the syscall_package, not just oquota.

Should fix PR kern/55025

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/compat/common/vfs_syscalls_43.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/vfs_syscalls_43.c
diff -u src/sys/compat/common/vfs_syscalls_43.c:1.64 src/sys/compat/common/vfs_syscalls_43.c:1.65
--- src/sys/compat/common/vfs_syscalls_43.c:1.64	Sun Jan 27 02:08:39 2019
+++ src/sys/compat/common/vfs_syscalls_43.c	Thu Feb 27 18:19:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_43.c,v 1.64 2019/01/27 02:08:39 pgoyette Exp $	*/
+/*	$NetBSD: vfs_syscalls_43.c,v 1.65 2020/02/27 18:19:16 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.64 2019/01/27 02:08:39 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.65 2020/02/27 18:19:16 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -79,7 +79,16 @@ static void cvttimespec(struct timespec 
 static void cvtstat(struct stat *, struct stat43 *);
 
 static struct syscall_package vfs_syscalls_43_syscalls[] = {
-	{ SYS_compat_43_oquota, 0, (sy_call_t *)compat_43_sys_quota },
+	{ SYS_compat_43_oquota, 0, (sy_call_t *)compat_43_sys_quota },
+	{ SYS_compat_43_stat43, 0, (sy_call_t *)compat_43_sys_stat },
+	{ SYS_compat_43_lstat43,0, (sy_call_t *)compat_43_sys_lstat },
+	{ SYS_compat_43_fstat43,0, (sy_call_t *)compat_43_sys_fstat },
+	{ SYS_compat_43_otruncate,  0, (sy_call_t *)compat_43_sys_ftruncate },
+	{ SYS_compat_43_oftruncate, 0, (sy_call_t *)compat_43_sys_ftruncate },
+	{ SYS_compat_43_olseek, 0, (sy_call_t *)compat_43_sys_lseek },
+	{ SYS_compat_43_ocreat, 0, (sy_call_t *)compat_43_sys_creat },
+	{ SYS_compat_43_ogetdirentries, 0,
+	(sy_call_t *)compat_43_sys_getdirentries },
 	{ 0, 0, NULL }
 };
 



CVS commit: src/sys/compat/common

2020-02-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Feb 27 17:42:33 UTC 2020

Modified Files:
src/sys/compat/common: compat_sysctl_09_43.c

Log Message:
Ooppss - SYSCTL_SETUP() functions return void.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/common/compat_sysctl_09_43.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_sysctl_09_43.c
diff -u src/sys/compat/common/compat_sysctl_09_43.c:1.4 src/sys/compat/common/compat_sysctl_09_43.c:1.5
--- src/sys/compat/common/compat_sysctl_09_43.c:1.4	Thu Feb 27 16:41:59 2020
+++ src/sys/compat/common/compat_sysctl_09_43.c	Thu Feb 27 17:42:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_sysctl_09_43.c,v 1.4 2020/02/27 16:41:59 pgoyette Exp $	*/
+/*	$NetBSD: compat_sysctl_09_43.c,v 1.5 2020/02/27 17:42:33 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_sysctl_09_43.c,v 1.4 2020/02/27 16:41:59 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_sysctl_09_43.c,v 1.5 2020/02/27 17:42:33 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -114,7 +114,7 @@ SYSCTL_SETUP(compat_sysctl_vfs, "Top-lev
 	if (error == EEXIST)
 		error = 0;
 	if (error != 0)
-		return error;
+		return;
 
 	error = sysctl_createv(clog, 0, NULL, NULL,
 		   CTLFLAG_PERMANENT,
@@ -123,8 +123,6 @@ SYSCTL_SETUP(compat_sysctl_vfs, "Top-lev
 		   sysctl_vfs_generic_conf, 0, NULL,
 		   sizeof(struct vfsconf),
 		   CTL_VFS, VFS_GENERIC, VFS_CONF, CTL_EOL);
-
-	return error;
 }
 #endif
 



CVS commit: src/sys/compat/common

2020-02-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Feb 27 16:41:59 UTC 2020

Modified Files:
src/sys/compat/common: compat_sysctl_09_43.c kern_time_50.c

Log Message:
Remove explicit calls to the sysctl setup routines, since this is now
handled by the module infrastructure.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/compat/common/compat_sysctl_09_43.c
cvs rdiff -u -r1.34 -r1.35 src/sys/compat/common/kern_time_50.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_sysctl_09_43.c
diff -u src/sys/compat/common/compat_sysctl_09_43.c:1.3 src/sys/compat/common/compat_sysctl_09_43.c:1.4
--- src/sys/compat/common/compat_sysctl_09_43.c:1.3	Fri Dec  6 08:35:21 2019
+++ src/sys/compat/common/compat_sysctl_09_43.c	Thu Feb 27 16:41:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_sysctl_09_43.c,v 1.3 2019/12/06 08:35:21 maxv Exp $	*/
+/*	$NetBSD: compat_sysctl_09_43.c,v 1.4 2020/02/27 16:41:59 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_sysctl_09_43.c,v 1.3 2019/12/06 08:35:21 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_sysctl_09_43.c,v 1.4 2020/02/27 16:41:59 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -101,8 +101,7 @@ sysctl_vfs_generic_conf(SYSCTLFN_ARGS)
 /*
  * Top level filesystem related information gathering.
  */
-static int
-compat_sysctl_vfs(struct sysctllog **clog)
+SYSCTL_SETUP(compat_sysctl_vfs, "Top-level filesystem info")
 {
 	int error;
 
@@ -129,20 +128,17 @@ compat_sysctl_vfs(struct sysctllog **clo
 }
 #endif
 
-static struct sysctllog *compat_09_43_clog = NULL;
-
 int
 compat_sysctl_09_43_init(void)
 {
 
-	return compat_sysctl_vfs(_09_43_clog);
+	return 0;
 }
 
 int
 compat_sysctl_09_43_fini(void)
 {
 
-	sysctl_teardown(_09_43_clog);
 	return 0;
 }
 

Index: src/sys/compat/common/kern_time_50.c
diff -u src/sys/compat/common/kern_time_50.c:1.34 src/sys/compat/common/kern_time_50.c:1.35
--- src/sys/compat/common/kern_time_50.c:1.34	Thu Jan  2 15:42:26 2020
+++ src/sys/compat/common/kern_time_50.c	Thu Feb 27 16:41:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time_50.c,v 1.34 2020/01/02 15:42:26 thorpej Exp $	*/
+/*	$NetBSD: kern_time_50.c,v 1.35 2020/02/27 16:41:59 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.34 2020/01/02 15:42:26 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.35 2020/02/27 16:41:59 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -73,8 +73,6 @@ __KERNEL_RCSID(0, "$NetBSD: kern_time_50
 
 struct timeval50 boottime50; 
 
-static struct sysctllog *kern_time_50_clog = NULL;
-
 static const struct syscall_package kern_time_50_syscalls[] = {
 	{ SYS_compat_50_clock_gettime, 0,
 	(sy_call_t *)compat_50_sys_clock_gettime },  
@@ -580,8 +578,7 @@ compat_50_sys___ntp_gettime30(struct lwp
 	return 0;
 }
 
-static void
-compat_sysctl_time(struct sysctllog **clog)
+SYSCTL_SETUP(compat_sysctl_time, "Old system boottime")
 {
 	struct timeval tv;
 
@@ -601,11 +598,7 @@ kern_time_50_init(void)
 {   
 	int error;
 
-	compat_sysctl_time(_time_50_clog);
-
 	error = syscall_establish(NULL, kern_time_50_syscalls);
-	if (error != 0)
-		sysctl_teardown(_time_50_clog);
 
 	return error;
 }   
@@ -616,8 +609,6 @@ kern_time_50_fini(void)
 	int error;
 
 	error = syscall_disestablish(NULL, kern_time_50_syscalls);
-	if (error == 0)
-		sysctl_teardown(_time_50_clog);
 
 	return error;
 } 



CVS commit: src/sys/compat/common

2020-02-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Feb 23 15:57:09 UTC 2020

Modified Files:
src/sys/compat/common: kern_xxx_12.c

Log Message:
Don't bother with kernel_lock for kern_reboot().


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/compat/common/kern_xxx_12.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/kern_xxx_12.c
diff -u src/sys/compat/common/kern_xxx_12.c:1.17 src/sys/compat/common/kern_xxx_12.c:1.18
--- src/sys/compat/common/kern_xxx_12.c:1.17	Wed Jan  1 22:57:17 2020
+++ src/sys/compat/common/kern_xxx_12.c	Sun Feb 23 15:57:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_xxx_12.c,v 1.17 2020/01/01 22:57:17 thorpej Exp $	*/
+/*	$NetBSD: kern_xxx_12.c,v 1.18 2020/02/23 15:57:09 ad Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_xxx_12.c,v 1.17 2020/01/01 22:57:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_xxx_12.c,v 1.18 2020/02/23 15:57:09 ad Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -68,9 +68,7 @@ compat_12_sys_reboot(struct lwp *l,
 	if ((error = kauth_authorize_system(l->l_cred,
 	KAUTH_SYSTEM_REBOOT, 0, NULL, NULL, NULL)) != 0)
 		return (error);
-	KERNEL_LOCK(1, NULL);
 	kern_reboot(SCARG(uap, opt), NULL);
-	KERNEL_UNLOCK_ONE(NULL);
 	return (0);
 }
 



CVS commit: src/sys/compat/common

2020-02-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Feb 22 09:42:20 UTC 2020

Modified Files:
src/sys/compat/common: uipc_syscalls_40.c

Log Message:
pass the address of the field, instead of relying on it being the first
field of the structure, no functional change


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/compat/common/uipc_syscalls_40.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/uipc_syscalls_40.c
diff -u src/sys/compat/common/uipc_syscalls_40.c:1.21 src/sys/compat/common/uipc_syscalls_40.c:1.22
--- src/sys/compat/common/uipc_syscalls_40.c:1.21	Thu Dec 12 02:15:42 2019
+++ src/sys/compat/common/uipc_syscalls_40.c	Sat Feb 22 09:42:20 2020
@@ -1,9 +1,9 @@
-/*	$NetBSD: uipc_syscalls_40.c,v 1.21 2019/12/12 02:15:42 pgoyette Exp $	*/
+/*	$NetBSD: uipc_syscalls_40.c,v 1.22 2020/02/22 09:42:20 maxv Exp $	*/
 
 /* written by Pavel Cahyna, 2006. Public domain. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.21 2019/12/12 02:15:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.22 2020/02/22 09:42:20 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -119,7 +119,7 @@ compat_ifconf(u_long cmd, void *data)
 			} else {
 space -= sa->sa_len - sizeof(*sa);
 if (space >= sz) {
-	error = copyout(, ifrp,
+	error = copyout(_name, ifrp,
 	sizeof(ifr.ifr_name));
 	if (error == 0) {
 		error = copyout(sa,



CVS commit: src/sys/compat/common

2020-01-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jan 30 14:07:40 UTC 2020

Modified Files:
src/sys/compat/common: kern_info_43.c

Log Message:
- make sure size is not used uninitialized
- limit size range
- fix type botch for "size"
from maxv@


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/compat/common/kern_info_43.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/kern_info_43.c
diff -u src/sys/compat/common/kern_info_43.c:1.38 src/sys/compat/common/kern_info_43.c:1.39
--- src/sys/compat/common/kern_info_43.c:1.38	Thu Jan  2 10:42:26 2020
+++ src/sys/compat/common/kern_info_43.c	Thu Jan 30 09:07:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_info_43.c,v 1.38 2020/01/02 15:42:26 thorpej Exp $	*/
+/*	$NetBSD: kern_info_43.c,v 1.39 2020/01/30 14:07:40 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1991, 1993
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_info_43.c,v 1.38 2020/01/02 15:42:26 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_info_43.c,v 1.39 2020/01/30 14:07:40 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -172,11 +172,19 @@ compat_43_sys_getkerninfo(struct lwp *l,
 		syscallarg(int) arg;
 	} */
 	int error, name[6];
+	int isize;
 	size_t size;
 
-	if (SCARG(uap, size) && (error = copyin((void *)SCARG(uap, size),
-	(void *), sizeof(size
-		return (error);
+	if (!SCARG(uap, size))
+		return EINVAL;
+
+	if ((error = copyin(SCARG(uap, size), , sizeof(isize))) != 0)
+		return error;
+
+	if (isize < 0 || isize > 4096)
+		return EINVAL;
+
+	size = isize;
 
 	switch (SCARG(uap, op) & 0xff00) {
 



CVS commit: src/sys/compat/common

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:48:22 UTC 2020

Modified Files:
src/sys/compat/common: uipc_syscalls_50.c

Log Message:
Don't reference ifp->if_data directly; use if_export_if_data().


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/compat/common/uipc_syscalls_50.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/uipc_syscalls_50.c
diff -u src/sys/compat/common/uipc_syscalls_50.c:1.10 src/sys/compat/common/uipc_syscalls_50.c:1.11
--- src/sys/compat/common/uipc_syscalls_50.c:1.10	Sun Dec 15 16:48:26 2019
+++ src/sys/compat/common/uipc_syscalls_50.c	Wed Jan 29 05:48:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_syscalls_50.c,v 1.10 2019/12/15 16:48:26 tsutsui Exp $	*/
+/*	$NetBSD: uipc_syscalls_50.c,v 1.11 2020/01/29 05:48:22 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,6 +58,7 @@
 static int
 compat_ifdatareq(struct lwp *l, u_long cmd, void *data)
 {
+	struct if_data ifi;
 	struct oifdatareq *ifdr = data;
 	struct ifnet *ifp;
 	int error;
@@ -78,7 +79,8 @@ compat_ifdatareq(struct lwp *l, u_long c
 	/* Do work. */
 	switch (cmd) {
 	case OSIOCGIFDATA:
-		ifdatan2o(>ifdr_data, >if_data);
+		if_export_if_data(ifp, , false);
+		ifdatan2o(>ifdr_data, );
 		return 0;
 
 	case OSIOCZIFDATA:
@@ -90,13 +92,9 @@ compat_ifdatareq(struct lwp *l, u_long c
 			if (error != 0)
 return error;
 		}
-		ifdatan2o(>ifdr_data, >if_data);
-		/*
-		 * Assumes that the volatile counters that can be
-		 * zero'ed are at the end of if_data.
-		 */
-		memset(>if_data.ifi_ipackets, 0, sizeof(ifp->if_data) -
-		offsetof(struct if_data, ifi_ipackets));
+		if_export_if_data(ifp, , true);
+		ifdatan2o(>ifdr_data, );
+		/* XXX if_lastchange? */
 		return 0;
 
 	default:



CVS commit: src/sys/compat/common

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:47:12 UTC 2020

Modified Files:
src/sys/compat/common: rtsock_14.c rtsock_50.c

Log Message:
Don't reference ifp->if_data directly; use if_export_if_data().


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/compat/common/rtsock_14.c
cvs rdiff -u -r1.15 -r1.16 src/sys/compat/common/rtsock_50.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/rtsock_14.c
diff -u src/sys/compat/common/rtsock_14.c:1.9 src/sys/compat/common/rtsock_14.c:1.10
--- src/sys/compat/common/rtsock_14.c:1.9	Thu Dec 12 02:15:42 2019
+++ src/sys/compat/common/rtsock_14.c	Wed Jan 29 05:47:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock_14.c,v 1.9 2019/12/12 02:15:42 pgoyette Exp $	*/
+/*	$NetBSD: rtsock_14.c,v 1.10 2020/01/29 05:47:12 thorpej Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock_14.c,v 1.9 2019/12/12 02:15:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_14.c,v 1.10 2020/01/29 05:47:12 thorpej Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -99,6 +99,7 @@ void
 compat_14_rt_oifmsg(struct ifnet *ifp)
 {
 	struct if_msghdr14 oifm;
+	struct if_data ifi;
 	struct mbuf *m;
 	struct rt_addrinfo info;
 	struct timeval tv;
@@ -107,26 +108,27 @@ compat_14_rt_oifmsg(struct ifnet *ifp)
 		return;
 	(void)memset(, 0, sizeof(info));
 	(void)memset(, 0, sizeof(oifm));
+	if_export_if_data(ifp, , false);
 	oifm.ifm_index = ifp->if_index;
 	oifm.ifm_flags = ifp->if_flags;
-	oifm.ifm_data.ifi_type = ifp->if_data.ifi_type;
-	oifm.ifm_data.ifi_addrlen = ifp->if_data.ifi_addrlen;
-	oifm.ifm_data.ifi_hdrlen = ifp->if_data.ifi_hdrlen;
-	oifm.ifm_data.ifi_mtu = ifp->if_data.ifi_mtu;
-	oifm.ifm_data.ifi_metric = ifp->if_data.ifi_metric;
-	oifm.ifm_data.ifi_baudrate = ifp->if_data.ifi_baudrate;
-	oifm.ifm_data.ifi_ipackets = ifp->if_data.ifi_ipackets;
-	oifm.ifm_data.ifi_ierrors = ifp->if_data.ifi_ierrors;
-	oifm.ifm_data.ifi_opackets = ifp->if_data.ifi_opackets;
-	oifm.ifm_data.ifi_oerrors = ifp->if_data.ifi_oerrors;
-	oifm.ifm_data.ifi_collisions = ifp->if_data.ifi_collisions;
-	oifm.ifm_data.ifi_ibytes = ifp->if_data.ifi_ibytes;
-	oifm.ifm_data.ifi_obytes = ifp->if_data.ifi_obytes;
-	oifm.ifm_data.ifi_imcasts = ifp->if_data.ifi_imcasts;
-	oifm.ifm_data.ifi_omcasts = ifp->if_data.ifi_omcasts;
-	oifm.ifm_data.ifi_iqdrops = ifp->if_data.ifi_iqdrops;
-	oifm.ifm_data.ifi_noproto = ifp->if_data.ifi_noproto;
-	TIMESPEC_TO_TIMEVAL(, >if_data.ifi_lastchange);
+	oifm.ifm_data.ifi_type = ifi.ifi_type;
+	oifm.ifm_data.ifi_addrlen = ifi.ifi_addrlen;
+	oifm.ifm_data.ifi_hdrlen = ifi.ifi_hdrlen;
+	oifm.ifm_data.ifi_mtu = ifi.ifi_mtu;
+	oifm.ifm_data.ifi_metric = ifi.ifi_metric;
+	oifm.ifm_data.ifi_baudrate = ifi.ifi_baudrate;
+	oifm.ifm_data.ifi_ipackets = ifi.ifi_ipackets;
+	oifm.ifm_data.ifi_ierrors = ifi.ifi_ierrors;
+	oifm.ifm_data.ifi_opackets = ifi.ifi_opackets;
+	oifm.ifm_data.ifi_oerrors = ifi.ifi_oerrors;
+	oifm.ifm_data.ifi_collisions = ifi.ifi_collisions;
+	oifm.ifm_data.ifi_ibytes = ifi.ifi_ibytes;
+	oifm.ifm_data.ifi_obytes = ifi.ifi_obytes;
+	oifm.ifm_data.ifi_imcasts = ifi.ifi_imcasts;
+	oifm.ifm_data.ifi_omcasts = ifi.ifi_omcasts;
+	oifm.ifm_data.ifi_iqdrops = ifi.ifi_iqdrops;
+	oifm.ifm_data.ifi_noproto = ifi.ifi_noproto;
+	TIMESPEC_TO_TIMEVAL(, _lastchange);
 	timeval_to_timeval50(, _data.ifi_lastchange);
 	oifm.ifm_addrs = 0;
 	m = compat_50_rt_msg1(RTM_OOIFINFO, , (void *), sizeof(oifm));
@@ -140,30 +142,32 @@ compat_14_iflist(struct ifnet *ifp, stru
 struct rt_addrinfo *info, size_t len)
 {
 	struct if_msghdr14 *ifm;
+	struct if_data ifi;
 	struct timeval tv;
 	int error;
 
 	ifm = (struct if_msghdr14 *)w->w_tmem;
+	if_export_if_data(ifp, , false);
 	ifm->ifm_index = ifp->if_index;
 	ifm->ifm_flags = ifp->if_flags;
-	ifm->ifm_data.ifi_type = ifp->if_data.ifi_type;
-	ifm->ifm_data.ifi_addrlen = ifp->if_data.ifi_addrlen;
-	ifm->ifm_data.ifi_hdrlen = ifp->if_data.ifi_hdrlen;
-	ifm->ifm_data.ifi_mtu = ifp->if_data.ifi_mtu;
-	ifm->ifm_data.ifi_metric = ifp->if_data.ifi_metric;
-	ifm->ifm_data.ifi_baudrate = ifp->if_data.ifi_baudrate;
-	ifm->ifm_data.ifi_ipackets = ifp->if_data.ifi_ipackets;
-	ifm->ifm_data.ifi_ierrors = ifp->if_data.ifi_ierrors;
-	ifm->ifm_data.ifi_opackets = ifp->if_data.ifi_opackets;
-	ifm->ifm_data.ifi_oerrors = ifp->if_data.ifi_oerrors;
-	ifm->ifm_data.ifi_collisions = ifp->if_data.ifi_collisions;
-	ifm->ifm_data.ifi_ibytes = ifp->if_data.ifi_ibytes;
-	ifm->ifm_data.ifi_obytes = ifp->if_data.ifi_obytes;
-	ifm->ifm_data.ifi_imcasts = ifp->if_data.ifi_imcasts;
-	ifm->ifm_data.ifi_omcasts = ifp->if_data.ifi_omcasts;
-	ifm->ifm_data.ifi_iqdrops = ifp->if_data.ifi_iqdrops;
-	ifm->ifm_data.ifi_noproto = ifp->if_data.ifi_noproto;
-	TIMESPEC_TO_TIMEVAL(, >if_data.ifi_lastchange);
+	

CVS commit: src/sys/compat/common

2020-01-22 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Jan 22 23:41:29 UTC 2020

Modified Files:
src/sys/compat/common: compat_50_quota.c

Log Message:
Since this used to be part of the compat_50 module, make it depend on
compat_50 rather than compat_60 module.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/compat/common/compat_50_quota.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_50_quota.c
diff -u src/sys/compat/common/compat_50_quota.c:1.1 src/sys/compat/common/compat_50_quota.c:1.2
--- src/sys/compat/common/compat_50_quota.c:1.1	Tue Jan 21 02:37:16 2020
+++ src/sys/compat/common/compat_50_quota.c	Wed Jan 22 23:41:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_50_quota.c,v 1.1 2020/01/21 02:37:16 pgoyette Exp $ */
+/*	$NetBSD: compat_50_quota.c,v 1.2 2020/01/22 23:41:29 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_50_quota.c,v 1.1 2020/01/21 02:37:16 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_50_quota.c,v 1.2 2020/01/22 23:41:29 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -164,7 +164,7 @@ compat_50_sys_quotactl(struct lwp *l, co
 	return error;
 }
 
-MODULE(MODULE_CLASS_EXEC, compat_50_quota, "compat_60");
+MODULE(MODULE_CLASS_EXEC, compat_50_quota, "compat_50");
 
 static int
 compat_50_quota_modcmd(modcmd_t cmd, void *arg)



CVS commit: src/sys/compat/common

2020-01-03 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Jan  4 02:40:22 UTC 2020

Modified Files:
src/sys/compat/common: compat_90_mod.c

Log Message:
Resurrect boottime, but only in the compat_90 module (whether built-in
or separately loaded).  This will enable running of old vmstat(1) images
on newer kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/common/compat_90_mod.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_90_mod.c
diff -u src/sys/compat/common/compat_90_mod.c:1.2 src/sys/compat/common/compat_90_mod.c:1.3
--- src/sys/compat/common/compat_90_mod.c:1.2	Mon Oct 28 23:32:15 2019
+++ src/sys/compat/common/compat_90_mod.c	Sat Jan  4 02:40:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_90_mod.c,v 1.2 2019/10/28 23:32:15 christos Exp $	*/
+/*	$NetBSD: compat_90_mod.c,v 1.3 2020/01/04 02:40:22 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_90_mod.c,v 1.2 2019/10/28 23:32:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_90_mod.c,v 1.3 2020/01/04 02:40:22 pgoyette Exp $");
 
 #include 
 #include 
@@ -77,3 +77,5 @@ compat_90_modcmd(modcmd_t cmd, void *arg
 		return ENOTTY;
 	}
 }
+
+struct timespec boottime;	/* For access by older vmstat */



CVS commit: src/sys/compat/common

2020-01-01 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Jan  1 19:35:21 UTC 2020

Removed Files:
src/sys/compat/common: compat_mod.c

Log Message:
Emove vestigial remains of the monolithic compat module.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r0 src/sys/compat/common/compat_mod.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/compat/common

2019-12-28 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Dec 28 15:39:52 UTC 2019

Modified Files:
src/sys/compat/common: compat_30_mod.c

Log Message:
For the built-in COMPAT_30 module code, make sure to initialize the
uipc_syscalls_30 stuff, notably to include compat_30_socket().

PR kern/54804

XXX Pullup-9 XXX


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/common/compat_30_mod.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_30_mod.c
diff -u src/sys/compat/common/compat_30_mod.c:1.2 src/sys/compat/common/compat_30_mod.c:1.3
--- src/sys/compat/common/compat_30_mod.c:1.2	Sun Jan 27 02:08:39 2019
+++ src/sys/compat/common/compat_30_mod.c	Sat Dec 28 15:39:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_30_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $	*/
+/*	$NetBSD: compat_30_mod.c,v 1.3 2019/12/28 15:39:52 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_30_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_30_mod.c,v 1.3 2019/12/28 15:39:52 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -66,6 +66,12 @@ compat_30_init(void)
 		vfs_syscalls_30_fini();
 		return error;
 	}
+	error = uipc_syscalls_30_init();
+	if (error != 0) {
+		kern_time_30_fini();
+		vfs_syscalls_30_fini();
+		return error;
+	}
 	bio_30_init();
 	vnd_30_init();
 	usb_30_init();
@@ -82,18 +88,24 @@ compat_30_fini(void)
 	vnd_30_fini();
 	bio_30_fini();
 
-	error = kern_time_30_fini();
+	error = uipc_syscalls_30_fini();
 	if (error != 0)
 		goto err1;
 
-	error = vfs_syscalls_30_fini();
+	error = kern_time_30_fini();
 	if (error != 0)
 		goto err2;
 
+	error = vfs_syscalls_30_fini();
+	if (error != 0)
+		goto err3;
+
 	return 0;
 
- err2:
+ err3:
 	kern_time_30_init();
+ err2:
+	uipc_syscalls_30_init();
  err1:
 	bio_30_init();
 	vnd_30_init();



CVS commit: src/sys/compat/common

2019-04-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Apr 29 08:31:29 UTC 2019

Modified Files:
src/sys/compat/common: rtsock_50.c rtsock_70.c

Log Message:
Move the set-up of the net.oroute... sysctl tree to compat_50 since
the new AF_ROUTE was introduced in NetBSD-6.0


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/compat/common/rtsock_50.c
cvs rdiff -u -r1.6 -r1.7 src/sys/compat/common/rtsock_70.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/rtsock_50.c
diff -u src/sys/compat/common/rtsock_50.c:1.10 src/sys/compat/common/rtsock_50.c:1.11
--- src/sys/compat/common/rtsock_50.c:1.10	Fri Mar  1 11:06:56 2019
+++ src/sys/compat/common/rtsock_50.c	Mon Apr 29 08:31:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock_50.c,v 1.10 2019/03/01 11:06:56 pgoyette Exp $	*/
+/*	$NetBSD: rtsock_50.c,v 1.11 2019/04/29 08:31:29 pgoyette Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,v 1.10 2019/03/01 11:06:56 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,v 1.11 2019/04/29 08:31:29 pgoyette Exp $");
 
 #define	COMPAT_RTSOCK	/* Use the COMPATNAME/COMPATCALL macros and the
 			 * various other compat definitions - see
@@ -71,6 +71,8 @@ __KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,
 #include 
 #include 
 
+struct sysctllog *clog;
+
 void
 compat_50_rt_oifmsg(struct ifnet *ifp)
 {
@@ -164,12 +166,14 @@ rtsock_50_init(void)
 	compat_50_rt_ifannouncemsg);
 	MODULE_HOOK_SET(rtsock_rt_ieee80211msg_50_hook, "rts_50",
 	compat_50_rt_ieee80211msg);
+	sysctl_net_route_setup(, PF_OROUTE, "ortable");
 }
  
 void
 rtsock_50_fini(void)
 {  
 
+	sysctl_teardown();
 	MODULE_HOOK_UNSET(rtsock_iflist_50_hook); 
 	MODULE_HOOK_UNSET(rtsock_oifmsg_50_hook); 
 	MODULE_HOOK_UNSET(rtsock_rt_missmsg_50_hook); 

Index: src/sys/compat/common/rtsock_70.c
diff -u src/sys/compat/common/rtsock_70.c:1.6 src/sys/compat/common/rtsock_70.c:1.7
--- src/sys/compat/common/rtsock_70.c:1.6	Mon Apr 29 05:42:09 2019
+++ src/sys/compat/common/rtsock_70.c	Mon Apr 29 08:31:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock_70.c,v 1.6 2019/04/29 05:42:09 pgoyette Exp $	*/
+/*	$NetBSD: rtsock_70.c,v 1.7 2019/04/29 08:31:29 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock_70.c,v 1.6 2019/04/29 05:42:09 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_70.c,v 1.7 2019/04/29 08:31:29 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -46,8 +46,6 @@ __KERNEL_RCSID(0, "$NetBSD: rtsock_70.c,
 #include 
 #include 
 
-struct sysctllog *clog;
-
 void
 compat_70_rt_newaddrmsg1(int cmd, struct ifaddr *ifa)
 {
@@ -124,14 +122,12 @@ rtsock_70_init(void)
 	MODULE_HOOK_SET(rtsock_newaddr_70_hook, "rts_70",
 	compat_70_rt_newaddrmsg1);
 	MODULE_HOOK_SET(rtsock_iflist_70_hook, "rts_70", compat_70_iflist_addr);
-	sysctl_net_route_setup(, PF_OROUTE, "ortable");
 }
 
 void
 rtsock_70_fini(void)
 {
 
-	sysctl_teardown();
 	MODULE_HOOK_UNSET(rtsock_newaddr_70_hook);
 	MODULE_HOOK_UNSET(rtsock_iflist_70_hook);
 }



CVS commit: src/sys/compat/common

2019-04-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr 17 09:21:57 UTC 2019

Modified Files:
src/sys/compat/common: compat_70_mod.c compat_80_mod.c

Log Message:
 KNF. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/common/compat_70_mod.c \
src/sys/compat/common/compat_80_mod.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_70_mod.c
diff -u src/sys/compat/common/compat_70_mod.c:1.2 src/sys/compat/common/compat_70_mod.c:1.3
--- src/sys/compat/common/compat_70_mod.c:1.2	Sun Jan 27 02:08:39 2019
+++ src/sys/compat/common/compat_70_mod.c	Wed Apr 17 09:21:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_70_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $	*/
+/*	$NetBSD: compat_70_mod.c,v 1.3 2019/04/17 09:21:57 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_70_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_70_mod.c,v 1.3 2019/04/17 09:21:57 msaitoh Exp $");
 
 #include 
 #include 
@@ -54,7 +54,8 @@ __KERNEL_RCSID(0, "$NetBSD: compat_70_mo
 #include 
 #include 
 
-int compat_70_init(void)
+int
+compat_70_init(void)
 {
 
 	compat70_ocreds_valid = true;
@@ -64,7 +65,8 @@ int compat_70_init(void)
 	return 0;
 }
 
-int compat_70_fini(void)
+int
+compat_70_fini(void)
 {
 
 	uipc_usrreq_70_fini();
Index: src/sys/compat/common/compat_80_mod.c
diff -u src/sys/compat/common/compat_80_mod.c:1.2 src/sys/compat/common/compat_80_mod.c:1.3
--- src/sys/compat/common/compat_80_mod.c:1.2	Sun Jan 27 02:08:39 2019
+++ src/sys/compat/common/compat_80_mod.c	Wed Apr 17 09:21:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_80_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $	*/
+/*	$NetBSD: compat_80_mod.c,v 1.3 2019/04/17 09:21:57 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_80_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_80_mod.c,v 1.3 2019/04/17 09:21:57 msaitoh Exp $");
 
 #include 
 #include 
@@ -46,7 +46,8 @@ __KERNEL_RCSID(0, "$NetBSD: compat_80_mo
 #include 
 #include 
 
-int compat_80_init(void)
+int
+compat_80_init(void)
 {
 
 	kern_mod_80_init();
@@ -54,7 +55,8 @@ int compat_80_init(void)
 	return 0;
 }
 
-int compat_80_fini(void)
+int
+compat_80_fini(void)
 {
 
 	kern_mod_80_fini();



CVS commit: src/sys/compat/common

2019-04-14 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Apr 14 11:35:54 UTC 2019

Modified Files:
src/sys/compat/common: vnd_50.c

Log Message:
Only need to #include sys/vnode.h once


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/compat/common/vnd_50.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/vnd_50.c
diff -u src/sys/compat/common/vnd_50.c:1.3 src/sys/compat/common/vnd_50.c:1.4
--- src/sys/compat/common/vnd_50.c:1.3	Fri Mar  1 11:06:56 2019
+++ src/sys/compat/common/vnd_50.c	Sun Apr 14 11:35:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd_50.c,v 1.3 2019/03/01 11:06:56 pgoyette Exp $	*/
+/*	$NetBSD: vnd_50.c,v 1.4 2019/04/14 11:35:54 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnd_50.c,v 1.3 2019/03/01 11:06:56 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd_50.c,v 1.4 2019/04/14 11:35:54 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -87,7 +87,6 @@ __KERNEL_RCSID(0, "$NetBSD: vnd_50.c,v 1
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 



CVS commit: src/sys/compat/common

2019-01-28 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jan 29 04:01:45 UTC 2019

Modified Files:
src/sys/compat/common: if_43.c

Log Message:
The if43_20_hook function returns an errno; use it to determine whether
to allow conversion of the ioctl cmd --> ncmd

Should address issue reported by msaitoh@ on irc as well as via e-mail
from Patrick Welche and Ryo ONODERA.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/compat/common/if_43.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/if_43.c
diff -u src/sys/compat/common/if_43.c:1.16 src/sys/compat/common/if_43.c:1.17
--- src/sys/compat/common/if_43.c:1.16	Sun Jan 27 02:08:39 2019
+++ src/sys/compat/common/if_43.c	Tue Jan 29 04:01:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_43.c,v 1.16 2019/01/27 02:08:39 pgoyette Exp $	*/
+/*	$NetBSD: if_43.c,v 1.17 2019/01/29 04:01:45 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.16 2019/01/27 02:08:39 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.17 2019/01/29 04:01:45 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -212,8 +212,13 @@ compat_cvtcmd(u_long cmd)
 		case TAPGIFNAME:
 			return ncmd;
 		default:
-			MODULE_CALL_HOOK(if43_20_hook, (ncmd), enosys(), ncmd);
-			return ncmd;
+		{	int rv;
+
+			MODULE_CALL_HOOK(if43_20_hook, (ncmd), enosys(), rv);
+			if (rv == 0)
+return ncmd;
+			return cmd;
+		}
 		}
 	}
 }



CVS commit: src/sys/compat/common

2019-01-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jan 27 21:25:24 UTC 2019

Modified Files:
src/sys/compat/common: kern_mod_80.c

Log Message:
Include new header from correct directory


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/compat/common/kern_mod_80.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/kern_mod_80.c
diff -u src/sys/compat/common/kern_mod_80.c:1.3 src/sys/compat/common/kern_mod_80.c:1.4
--- src/sys/compat/common/kern_mod_80.c:1.3	Sun Jan 27 18:29:10 2019
+++ src/sys/compat/common/kern_mod_80.c	Sun Jan 27 21:25:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_mod_80.c,v 1.3 2019/01/27 18:29:10 christos Exp $	*/
+/*	$NetBSD: kern_mod_80.c,v 1.4 2019/01/27 21:25:24 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_mod_80.c,v 1.3 2019/01/27 18:29:10 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_mod_80.c,v 1.4 2019/01/27 21:25:24 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -49,7 +49,8 @@ __KERNEL_RCSID(0, "$NetBSD: kern_mod_80.
 #include 
 #include 
 #include 
-#include 
+
+#include 
 
 #include 
 



CVS commit: src/sys/compat/common

2019-01-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 27 03:00:48 UTC 2019

Modified Files:
src/sys/compat/common: ccd_60.c

Log Message:
make this compile again (enable #if 0 code)


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/compat/common/ccd_60.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/ccd_60.c
diff -u src/sys/compat/common/ccd_60.c:1.8 src/sys/compat/common/ccd_60.c:1.9
--- src/sys/compat/common/ccd_60.c:1.8	Sat Jan 26 21:08:39 2019
+++ src/sys/compat/common/ccd_60.c	Sat Jan 26 22:00:48 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ccd_60.c,v 1.8 2019/01/27 02:08:39 pgoyette Exp $	*/
+/*	$NetBSD: ccd_60.c,v 1.9 2019/01/27 03:00:48 christos Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1.8 2019/01/27 02:08:39 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1.9 2019/01/27 03:00:48 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -46,7 +46,6 @@ __KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1
  * sizeof (size_t) == sizeof (uint64_t) as CCDIOCSET will
  * be the same as CCDIOCSET_60
  */
-#if 0
 static int
 compat_60_ccdioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l,
 int (*f)(dev_t, u_long, void *, int, struct lwp *))
@@ -91,7 +90,6 @@ compat_60_ccdioctl(dev_t dev, u_long cmd
 		return ENOSYS;
 	}
 }
-#endif
 
 void
 ccd_60_init(void)



CVS commit: src/sys/compat/common

2018-10-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 30 14:35:16 UTC 2018

Modified Files:
src/sys/compat/common: kern_time_50.c

Log Message:
Zero ntptimeval50 too to prevent 4-byte kernel stack disclosure.

>From Thomas Barabosch of Fraunhofer FKIE.

XXX pullup-7, pullup-8 (along with rev. 1.60 of kern_ntptime.c)


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/compat/common/kern_time_50.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/kern_time_50.c
diff -u src/sys/compat/common/kern_time_50.c:1.31 src/sys/compat/common/kern_time_50.c:1.32
--- src/sys/compat/common/kern_time_50.c:1.31	Fri Mar 11 18:32:29 2016
+++ src/sys/compat/common/kern_time_50.c	Tue Oct 30 14:35:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time_50.c,v 1.31 2016/03/11 18:32:29 christos Exp $	*/
+/*	$NetBSD: kern_time_50.c,v 1.32 2018/10/30 14:35:16 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.31 2016/03/11 18:32:29 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.32 2018/10/30 14:35:16 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -526,6 +526,7 @@ compat_50_sys___ntp_gettime30(struct lwp
 
 	if (SCARG(uap, ntvp)) {
 		ntp_gettime();
+		memset(, 0, sizeof(ntv50));
 		timespec_to_timespec50(, );
 		ntv50.maxerror = ntv.maxerror;
 		ntv50.esterror = ntv.esterror;



CVS commit: src/sys/compat/common

2018-09-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Sep 12 02:24:25 UTC 2018

Modified Files:
src/sys/compat/common: uipc_syscalls_50.c

Log Message:
 Fix a bug that SIOC[GZ]IFDATA returned old ifreq structure.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/compat/common/uipc_syscalls_50.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/uipc_syscalls_50.c
diff -u src/sys/compat/common/uipc_syscalls_50.c:1.5 src/sys/compat/common/uipc_syscalls_50.c:1.6
--- src/sys/compat/common/uipc_syscalls_50.c:1.5	Thu Apr 26 08:11:18 2018
+++ src/sys/compat/common/uipc_syscalls_50.c	Wed Sep 12 02:24:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_syscalls_50.c,v 1.5 2018/04/26 08:11:18 roy Exp $	*/
+/*	$NetBSD: uipc_syscalls_50.c,v 1.6 2018/09/12 02:24:25 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_50.c,v 1.5 2018/04/26 08:11:18 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_50.c,v 1.6 2018/09/12 02:24:25 msaitoh Exp $");
 
 #include 
 #include 
@@ -65,23 +65,24 @@ compat_ifdatareq(struct lwp *l, u_long c
 
 	/* Validate arguments. */
 	switch (cmd) {
-	case SIOCGIFDATA:
-	case SIOCZIFDATA:
-		ifp = ifunit(ifdr->ifdr_name);
-		if (ifp == NULL)
-			return ENXIO;
+	case OSIOCGIFDATA:
+	case OSIOCZIFDATA:
 		break;
 	default:
 		return ENOSYS;
 	}
 
+	ifp = ifunit(ifdr->ifdr_name);
+	if (ifp == NULL)
+		return ENXIO;
+
 	/* Do work. */
 	switch (cmd) {
-	case SIOCGIFDATA:
+	case OSIOCGIFDATA:
 		ifdatan2o(>ifdr_data, >if_data);
 		return 0;
 
-	case SIOCZIFDATA:
+	case OSIOCZIFDATA:
 		if (l != NULL) {
 			error = kauth_authorize_network(l->l_cred,
 			KAUTH_NETWORK_INTERFACE,



CVS commit: src/sys/compat/common

2018-06-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jun  5 00:58:17 UTC 2018

Modified Files:
src/sys/compat/common: Makefile

Log Message:
use the standard rules, instead of rolling our own.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/compat/common/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/Makefile
diff -u src/sys/compat/common/Makefile:1.63 src/sys/compat/common/Makefile:1.64
--- src/sys/compat/common/Makefile:1.63	Tue Dec 19 23:46:19 2017
+++ src/sys/compat/common/Makefile	Mon Jun  4 20:58:17 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.63 2017/12/20 04:46:19 maya Exp $
+#	$NetBSD: Makefile,v 1.64 2018/06/05 00:58:17 christos Exp $
 
 LIB=		compat
 NOPIC=		# defined
@@ -23,15 +23,9 @@ libinstall::
 .undef DESTDIR
 .include 
 
-lib${LIB}.o:: ${OBJS:O}
-	@echo building standard ${LIB} library
-	@rm -f lib${LIB}.o
-	@${LD} -r -o lib${LIB}.o ${LDFLAGS} `NM=${NM} ${LORDER} ${OBJS} | ${TSORT}`
-
-lib${LIB}.po:: ${POBJS:O}
-	@echo building profiled ${LIB} library
-	@rm -f lib${LIB}.po
-	@${LD} -r -o lib${LIB}.po ${LDFLAGS} `NM=${NM} ${LORDER} ${POBJS} | ${TSORT}`
+lib${LIB}.o:: ${OBJS:O} __buildstdlib
+
+lib${LIB}.po:: ${POBJS:O} __buildproflib
 
 showsources: ${SRCS}
 	@echo ${.ALLSRC}



CVS commit: src/sys/compat/common

2018-05-10 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Thu May 10 09:33:46 UTC 2018

Modified Files:
src/sys/compat/common: rtsock_50.c

Log Message:
Added missing ifi_link_state at compat_50_rt_oifmsg() and compat_50_iflist().


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/compat/common/rtsock_50.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/rtsock_50.c
diff -u src/sys/compat/common/rtsock_50.c:1.6 src/sys/compat/common/rtsock_50.c:1.7
--- src/sys/compat/common/rtsock_50.c:1.6	Sat Dec 16 09:10:30 2017
+++ src/sys/compat/common/rtsock_50.c	Thu May 10 09:33:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock_50.c,v 1.6 2017/12/16 09:10:30 maxv Exp $	*/
+/*	$NetBSD: rtsock_50.c,v 1.7 2018/05/10 09:33:46 nonaka Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,v 1.6 2017/12/16 09:10:30 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,v 1.7 2018/05/10 09:33:46 nonaka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -95,6 +95,7 @@ compat_50_rt_oifmsg(struct ifnet *ifp)
 	oifm.ifm_data.ifi_type = ifp->if_data.ifi_type;
 	oifm.ifm_data.ifi_addrlen = ifp->if_data.ifi_addrlen;
 	oifm.ifm_data.ifi_hdrlen = ifp->if_data.ifi_hdrlen;
+	oifm.ifm_data.ifi_link_state = ifp->if_data.ifi_link_state;
 	oifm.ifm_data.ifi_mtu = ifp->if_data.ifi_mtu;
 	oifm.ifm_data.ifi_metric = ifp->if_data.ifi_metric;
 	oifm.ifm_data.ifi_baudrate = ifp->if_data.ifi_baudrate;
@@ -131,6 +132,7 @@ compat_50_iflist(struct ifnet *ifp, stru
 	ifm->ifm_data.ifi_type = ifp->if_data.ifi_type;
 	ifm->ifm_data.ifi_addrlen = ifp->if_data.ifi_addrlen;
 	ifm->ifm_data.ifi_hdrlen = ifp->if_data.ifi_hdrlen;
+	ifm->ifm_data.ifi_link_state = ifp->if_data.ifi_link_state;
 	ifm->ifm_data.ifi_mtu = ifp->if_data.ifi_mtu;
 	ifm->ifm_data.ifi_metric = ifp->if_data.ifi_metric;
 	ifm->ifm_data.ifi_baudrate = ifp->if_data.ifi_baudrate;



CVS commit: src/sys/compat/common

2018-05-04 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri May  4 08:55:25 UTC 2018

Modified Files:
src/sys/compat/common: compat_mod.c

Log Message:
Clean up a stray #ifdef _MODULE - it prevented definition of
COMPAT_SIGCONTEXT which in turn prevented building of the
SYS_compat16_sigaction_14 code.

Should address PR kern/53260

XXX Pull-up to netbsd-8


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/compat/common/compat_mod.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.28 src/sys/compat/common/compat_mod.c:1.29
--- src/sys/compat/common/compat_mod.c:1.28	Thu Apr 12 18:50:13 2018
+++ src/sys/compat/common/compat_mod.c	Fri May  4 08:55:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.28 2018/04/12 18:50:13 christos Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.29 2018/05/04 08:55:25 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.28 2018/04/12 18:50:13 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.29 2018/05/04 08:55:25 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -73,15 +73,13 @@ MODULE(MODULE_CLASS_EXEC, compat, NULL);
 
 int	ttcompat(struct tty *, u_long, void *, int, struct lwp *);
 
-#ifdef _MODULE
 #ifdef COMPAT_16
 #if !defined(__amd64__) || defined(COMPAT_NETBSD32)
 #define COMPAT_SIGCONTEXT
 extern char sigcode[], esigcode[];
 struct uvm_object *emul_netbsd_object;
-#endif
-#endif
-#endif /* _MODULE */
+#endif /* !defined(__amd64__) || defined(COMPAT_NETBSD32) */
+#endif /* COMPAT_16 */
 
 extern krwlock_t exec_lock;
 extern krwlock_t ttcompat_lock;



CVS commit: src/sys/compat/common

2018-04-26 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Apr 26 08:11:18 UTC 2018

Modified Files:
src/sys/compat/common: uipc_syscalls_50.c

Log Message:
Test for valid interface for ioctls that demand it.

Thanks to Robert Swindells for the patch.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/common/uipc_syscalls_50.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/uipc_syscalls_50.c
diff -u src/sys/compat/common/uipc_syscalls_50.c:1.4 src/sys/compat/common/uipc_syscalls_50.c:1.5
--- src/sys/compat/common/uipc_syscalls_50.c:1.4	Thu Apr 12 18:50:13 2018
+++ src/sys/compat/common/uipc_syscalls_50.c	Thu Apr 26 08:11:18 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_syscalls_50.c,v 1.4 2018/04/12 18:50:13 christos Exp $	*/
+/*	$NetBSD: uipc_syscalls_50.c,v 1.5 2018/04/26 08:11:18 roy Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_50.c,v 1.4 2018/04/12 18:50:13 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_50.c,v 1.5 2018/04/26 08:11:18 roy Exp $");
 
 #include 
 #include 
@@ -63,10 +63,19 @@ compat_ifdatareq(struct lwp *l, u_long c
 	struct ifnet *ifp;
 	int error;
 
-	ifp = ifunit(ifdr->ifdr_name);
-	if (ifp == NULL)
-		return ENXIO;
+	/* Validate arguments. */
+	switch (cmd) {
+	case SIOCGIFDATA:
+	case SIOCZIFDATA:
+		ifp = ifunit(ifdr->ifdr_name);
+		if (ifp == NULL)
+			return ENXIO;
+		break;
+	default:
+		return ENOSYS;
+	}
 
+	/* Do work. */
 	switch (cmd) {
 	case SIOCGIFDATA:
 		ifdatan2o(>ifdr_data, >if_data);
@@ -91,6 +100,7 @@ compat_ifdatareq(struct lwp *l, u_long c
 		return 0;
 
 	default:
+		/* Impossible due to above validation, but makes gcc happy. */
 		return ENOSYS;
 	}
 }



CVS commit: src/sys/compat/common

2018-04-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 12 20:37:00 UTC 2018

Modified Files:
src/sys/compat/common: Makefile.inc

Log Message:
If we are modular, allow us to use modules for compat; don't load all the
compat code in.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/compat/common/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/Makefile.inc
diff -u src/sys/compat/common/Makefile.inc:1.23 src/sys/compat/common/Makefile.inc:1.24
--- src/sys/compat/common/Makefile.inc:1.23	Sat Dec 16 03:31:36 2017
+++ src/sys/compat/common/Makefile.inc	Thu Apr 12 16:36:59 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.23 2017/12/16 08:31:36 maxv Exp $
+#	$NetBSD: Makefile.inc,v 1.24 2018/04/12 20:36:59 christos Exp $
 #
 #	Configuration variables (default values are below):
 #
@@ -17,7 +17,11 @@
 
 # Default values:
 COMPATDST?=		${.OBJDIR}/lib/compat
+.if !empty(OPT_MODULAR)
+COMPAT_AS?=		library
+.else
 COMPAT_AS?=		obj
+.endif
 COMPATDOTDIR?= ../../.
 
 COMPATDIR=		${S:S@^.@${COMPATDOTDIR}@:Q}/compat/common



CVS commit: src/sys/compat/common

2018-03-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 19 13:26:02 UTC 2018

Modified Files:
src/sys/compat/common: ccd_60.c

Log Message:
XXX stub it completely for now to make it compile


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/compat/common/ccd_60.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/ccd_60.c
diff -u src/sys/compat/common/ccd_60.c:1.6 src/sys/compat/common/ccd_60.c:1.7
--- src/sys/compat/common/ccd_60.c:1.6	Mon Mar 19 13:04:01 2018
+++ src/sys/compat/common/ccd_60.c	Mon Mar 19 13:26:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ccd_60.c,v 1.6 2018/03/19 13:04:01 christos Exp $	*/
+/*	$NetBSD: ccd_60.c,v 1.7 2018/03/19 13:26:02 martin Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1.6 2018/03/19 13:04:01 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1.7 2018/03/19 13:26:02 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1
  * sizeof (size_t) == sizeof (uint64_t) as CCDIOCSET will
  * be the same as CCDIOCSET_60
  */
+#if 0
 static int
 compat_60_ccdioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l,
 int (*f)(dev_t, u_long, void *, int, struct lwp *))
@@ -89,11 +90,11 @@ compat_60_ccdioctl(dev_t dev, u_long cmd
 		return ENOSYS;
 	}
 }
+#endif
 
 void
 ccd_60_init(void)
 {
-	(void)compat_50_ccdioctl;
 //	compat_ccd_ioctl_60 = compat_60_ccdioctl;
 }
 



CVS commit: src/sys/compat/common

2018-03-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 19 13:04:01 UTC 2018

Modified Files:
src/sys/compat/common: ccd_60.c

Log Message:
XXX: don't reference the global for now so that kernels without ccd build.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/compat/common/ccd_60.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/ccd_60.c
diff -u src/sys/compat/common/ccd_60.c:1.5 src/sys/compat/common/ccd_60.c:1.6
--- src/sys/compat/common/ccd_60.c:1.5	Sun Mar 18 20:21:50 2018
+++ src/sys/compat/common/ccd_60.c	Mon Mar 19 09:04:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ccd_60.c,v 1.5 2018/03/19 00:21:50 christos Exp $	*/
+/*	$NetBSD: ccd_60.c,v 1.6 2018/03/19 13:04:01 christos Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1.5 2018/03/19 00:21:50 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1.6 2018/03/19 13:04:01 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -93,11 +93,12 @@ compat_60_ccdioctl(dev_t dev, u_long cmd
 void
 ccd_60_init(void)
 {
-compat_ccd_ioctl_60 = compat_60_ccdioctl;
+	(void)compat_50_ccdioctl;
+//	compat_ccd_ioctl_60 = compat_60_ccdioctl;
 }
 
 void
 ccd_60_fini(void)
 {
-compat_ccd_ioctl_60 = (void *)enosys;
+//	compat_ccd_ioctl_60 = (void *)enosys;
 }



CVS commit: src/sys/compat/common

2018-03-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 19 00:21:50 UTC 2018

Modified Files:
src/sys/compat/common: ccd_60.c

Log Message:
remove another error decl.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/common/ccd_60.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/ccd_60.c
diff -u src/sys/compat/common/ccd_60.c:1.4 src/sys/compat/common/ccd_60.c:1.5
--- src/sys/compat/common/ccd_60.c:1.4	Sun Mar 18 19:26:38 2018
+++ src/sys/compat/common/ccd_60.c	Sun Mar 18 20:21:50 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ccd_60.c,v 1.4 2018/03/18 23:26:38 christos Exp $	*/
+/*	$NetBSD: ccd_60.c,v 1.5 2018/03/19 00:21:50 christos Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1.4 2018/03/18 23:26:38 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1.5 2018/03/19 00:21:50 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -77,8 +77,6 @@ compat_60_ccdioctl(dev_t dev, u_long cmd
 	}
 
 	case CCDIOCCLR_60:
-		int error;
-
 		if (data == NULL)
 			return ENOSYS;
 		/*



CVS commit: src/sys/compat/common

2018-03-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 18 23:26:39 UTC 2018

Modified Files:
src/sys/compat/common: ccd_60.c

Log Message:
remove error decl


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/compat/common/ccd_60.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/ccd_60.c
diff -u src/sys/compat/common/ccd_60.c:1.3 src/sys/compat/common/ccd_60.c:1.4
--- src/sys/compat/common/ccd_60.c:1.3	Sun Mar 18 19:22:15 2018
+++ src/sys/compat/common/ccd_60.c	Sun Mar 18 19:26:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ccd_60.c,v 1.3 2018/03/18 23:22:15 christos Exp $	*/
+/*	$NetBSD: ccd_60.c,v 1.4 2018/03/18 23:26:38 christos Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1.3 2018/03/18 23:22:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1.4 2018/03/18 23:26:38 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -52,8 +52,6 @@ compat_60_ccdioctl(dev_t dev, u_long cmd
 	switch (cmd) {
 #ifdef CCDIOCSET_60
 	case CCDIOCSET_60: {
-		int error;
-
 		if (data == NULL)
 			return 0;
 		



CVS commit: src/sys/compat/common

2018-03-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 18 23:22:15 UTC 2018

Modified Files:
src/sys/compat/common: ccd_60.c

Log Message:
- use the conditional from the header file
- fix compilation


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/common/ccd_60.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/ccd_60.c
diff -u src/sys/compat/common/ccd_60.c:1.2 src/sys/compat/common/ccd_60.c:1.3
--- src/sys/compat/common/ccd_60.c:1.2	Sun Mar 18 18:48:00 2018
+++ src/sys/compat/common/ccd_60.c	Sun Mar 18 19:22:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ccd_60.c,v 1.2 2018/03/18 22:48:00 pgoyette Exp $	*/
+/*	$NetBSD: ccd_60.c,v 1.3 2018/03/18 23:22:15 christos Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1.2 2018/03/18 22:48:00 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1.3 2018/03/18 23:22:15 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -50,7 +50,7 @@ compat_60_ccdioctl(dev_t dev, u_long cmd
 int (*f)(dev_t, u_long, void *, int, struct lwp *))
 {
 	switch (cmd) {
-#if defined(COMPAT_60) && !defined(_LP64)
+#ifdef CCDIOCSET_60
 	case CCDIOCSET_60: {
 		int error;
 
@@ -65,7 +65,7 @@ compat_60_ccdioctl(dev_t dev, u_long cmd
 		ccio.ccio_ileave = ccio60->ccio_ileave;
 		ccio.ccio_flags = ccio60->ccio_flags;
 		ccio.ccio_unit = ccio60->ccio_unit;
-		error = (*f)(dev, CCDIOCSET, , flag, l);
+		int error = (*f)(dev, CCDIOCSET, , flag, l);
 		if (!error) {
 			/* Copy data back, adjust types if necessary */
 			ccio60->ccio_disks = ccio.ccio_disks;
@@ -87,8 +87,8 @@ compat_60_ccdioctl(dev_t dev, u_long cmd
 		 * ccio_size member not used, so existing struct OK
 		 * drop through to existing non-compat version
 		 */
-		return (*f)(dev, CCDIOCLR, data, flag, l);
-#endif /* COMPAT_60 && !_LP64*/
+		return (*f)(dev, CCDIOCCLR, data, flag, l);
+#endif
 	default:
 		return ENOSYS;
 	}



CVS commit: src/sys/compat/common

2018-03-18 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Mar 18 22:48:00 UTC 2018

Modified Files:
src/sys/compat/common: ccd_60.c

Log Message:
Declare 'error' if needed


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/compat/common/ccd_60.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/ccd_60.c
diff -u src/sys/compat/common/ccd_60.c:1.1 src/sys/compat/common/ccd_60.c:1.2
--- src/sys/compat/common/ccd_60.c:1.1	Sun Mar 18 20:33:52 2018
+++ src/sys/compat/common/ccd_60.c	Sun Mar 18 22:48:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ccd_60.c,v 1.1 2018/03/18 20:33:52 christos Exp $	*/
+/*	$NetBSD: ccd_60.c,v 1.2 2018/03/18 22:48:00 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1.1 2018/03/18 20:33:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1.2 2018/03/18 22:48:00 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -52,6 +52,8 @@ compat_60_ccdioctl(dev_t dev, u_long cmd
 	switch (cmd) {
 #if defined(COMPAT_60) && !defined(_LP64)
 	case CCDIOCSET_60: {
+		int error;
+
 		if (data == NULL)
 			return 0;
 		
@@ -77,6 +79,8 @@ compat_60_ccdioctl(dev_t dev, u_long cmd
 	}
 
 	case CCDIOCCLR_60:
+		int error;
+
 		if (data == NULL)
 			return ENOSYS;
 		/*



CVS commit: src/sys/compat/common

2017-12-19 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Wed Dec 20 04:46:19 UTC 2017

Modified Files:
src/sys/compat/common: Makefile

Log Message:
Pass LDFLAGS to ld.

Without this, mips64-ld thinks we want to link our n64 objects with the
default ABI, n32.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/compat/common/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/Makefile
diff -u src/sys/compat/common/Makefile:1.62 src/sys/compat/common/Makefile:1.63
--- src/sys/compat/common/Makefile:1.62	Sat Dec 16 10:15:12 2017
+++ src/sys/compat/common/Makefile	Wed Dec 20 04:46:19 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.62 2017/12/16 10:15:12 maxv Exp $
+#	$NetBSD: Makefile,v 1.63 2017/12/20 04:46:19 maya Exp $
 
 LIB=		compat
 NOPIC=		# defined
@@ -26,12 +26,12 @@ libinstall::
 lib${LIB}.o:: ${OBJS:O}
 	@echo building standard ${LIB} library
 	@rm -f lib${LIB}.o
-	@${LD} -r -o lib${LIB}.o `NM=${NM} ${LORDER} ${OBJS} | ${TSORT}`
+	@${LD} -r -o lib${LIB}.o ${LDFLAGS} `NM=${NM} ${LORDER} ${OBJS} | ${TSORT}`
 
 lib${LIB}.po:: ${POBJS:O}
 	@echo building profiled ${LIB} library
 	@rm -f lib${LIB}.po
-	@${LD} -r -o lib${LIB}.po `NM=${NM} ${LORDER} ${POBJS} | ${TSORT}`
+	@${LD} -r -o lib${LIB}.po ${LDFLAGS} `NM=${NM} ${LORDER} ${POBJS} | ${TSORT}`
 
 showsources: ${SRCS}
 	@echo ${.ALLSRC}



CVS commit: src/sys/compat/common

2017-12-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Dec 16 09:10:30 UTC 2017

Modified Files:
src/sys/compat/common: rtsock_50.c rtsock_70.c

Log Message:
Build these functions regardless of whether COMPAT_50 or COMPAT_70 are
enabled. They must be there, because they are needed in rtsock.c even
when no compat option is enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/compat/common/rtsock_50.c
cvs rdiff -u -r1.1 -r1.2 src/sys/compat/common/rtsock_70.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/rtsock_50.c
diff -u src/sys/compat/common/rtsock_50.c:1.5 src/sys/compat/common/rtsock_50.c:1.6
--- src/sys/compat/common/rtsock_50.c:1.5	Sat Dec 16 07:59:14 2017
+++ src/sys/compat/common/rtsock_50.c	Sat Dec 16 09:10:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock_50.c,v 1.5 2017/12/16 07:59:14 mrg Exp $	*/
+/*	$NetBSD: rtsock_50.c,v 1.6 2017/12/16 09:10:30 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,13 +61,20 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,v 1.5 2017/12/16 07:59:14 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,v 1.6 2017/12/16 09:10:30 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
 #endif
 
-#if defined(COMPAT_50)
+/*
+ * COMPAT_50 and COMPAT_RTSOCK must be defined for rtsock.c regardless of
+ * the currently enabled options.
+ */
+#ifndef COMPAT_50
+#define COMPAT_50
+#endif
+
 #define	COMPAT_RTSOCK
 
 #include 
@@ -147,5 +154,3 @@ compat_50_iflist(struct ifnet *ifp, stru
 	w->w_where = (char *)w->w_where + len;
 	return 0;
 }
-
-#endif /* COMPAT_50 */

Index: src/sys/compat/common/rtsock_70.c
diff -u src/sys/compat/common/rtsock_70.c:1.1 src/sys/compat/common/rtsock_70.c:1.2
--- src/sys/compat/common/rtsock_70.c:1.1	Wed Sep 21 10:50:23 2016
+++ src/sys/compat/common/rtsock_70.c	Sat Dec 16 09:10:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock_70.c,v 1.1 2016/09/21 10:50:23 roy Exp $	*/
+/*	$NetBSD: rtsock_70.c,v 1.2 2017/12/16 09:10:30 maxv Exp $	*/
 
 /*
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock_70.c,v 1.1 2016/09/21 10:50:23 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_70.c,v 1.2 2017/12/16 09:10:30 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -43,7 +43,6 @@ __KERNEL_RCSID(0, "$NetBSD: rtsock_70.c,
 #include 
 #include 
 
-#if defined(COMPAT_70)
 void
 compat_70_rt_newaddrmsg1(int cmd, struct ifaddr *ifa)
 {
@@ -112,4 +111,3 @@ compat_70_iflist_addr(struct rt_walkarg 
 	}
 	return error;
 }
-#endif /* COMPAT_70 */



CVS commit: src/sys/compat/common

2017-12-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Dec 16 08:31:36 UTC 2017

Modified Files:
src/sys/compat/common: Makefile.inc

Log Message:
Build libcompat as an object, not as a library. We want all of its
functions compiled in, because compat modules loaded from the filesystem
may depend on them.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/compat/common/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/Makefile.inc
diff -u src/sys/compat/common/Makefile.inc:1.22 src/sys/compat/common/Makefile.inc:1.23
--- src/sys/compat/common/Makefile.inc:1.22	Tue Mar 22 08:25:23 2016
+++ src/sys/compat/common/Makefile.inc	Sat Dec 16 08:31:36 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.22 2016/03/22 08:25:23 mrg Exp $
+#	$NetBSD: Makefile.inc,v 1.23 2017/12/16 08:31:36 maxv Exp $
 #
 #	Configuration variables (default values are below):
 #
@@ -17,7 +17,7 @@
 
 # Default values:
 COMPATDST?=		${.OBJDIR}/lib/compat
-COMPAT_AS?=		library
+COMPAT_AS?=		obj
 COMPATDOTDIR?= ../../.
 
 COMPATDIR=		${S:S@^.@${COMPATDOTDIR}@:Q}/compat/common



CVS commit: src/sys/compat/common

2017-12-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Dec 16 07:59:15 UTC 2017

Modified Files:
src/sys/compat/common: rtsock_50.c

Log Message:
remove check for netbsd 1.5 without 5.0.  it doesn't happen.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/common/rtsock_50.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/rtsock_50.c
diff -u src/sys/compat/common/rtsock_50.c:1.4 src/sys/compat/common/rtsock_50.c:1.5
--- src/sys/compat/common/rtsock_50.c:1.4	Mon Aug 24 22:50:33 2015
+++ src/sys/compat/common/rtsock_50.c	Sat Dec 16 07:59:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock_50.c,v 1.4 2015/08/24 22:50:33 pooka Exp $	*/
+/*	$NetBSD: rtsock_50.c,v 1.5 2017/12/16 07:59:14 mrg Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,16 +61,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,v 1.4 2015/08/24 22:50:33 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,v 1.5 2017/12/16 07:59:14 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
 #endif
 
-#if defined(COMPAT_14) && !defined(COMPAT_50)
-#define	COMPAT_50	1	/* 1.4 needs 5.0 */
-#endif
-
 #if defined(COMPAT_50)
 #define	COMPAT_RTSOCK
 



CVS commit: src/sys/compat/common

2017-12-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec  3 15:23:30 UTC 2017

Modified Files:
src/sys/compat/common: vfs_syscalls_12.c vfs_syscalls_43.c

Log Message:
Make code look the same, in particular zero out the rest of the directory
record.
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/compat/common/vfs_syscalls_12.c
cvs rdiff -u -r1.61 -r1.62 src/sys/compat/common/vfs_syscalls_43.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/vfs_syscalls_12.c
diff -u src/sys/compat/common/vfs_syscalls_12.c:1.34 src/sys/compat/common/vfs_syscalls_12.c:1.35
--- src/sys/compat/common/vfs_syscalls_12.c:1.34	Fri Jul 28 11:34:06 2017
+++ src/sys/compat/common/vfs_syscalls_12.c	Sun Dec  3 10:23:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_12.c,v 1.34 2017/07/28 15:34:06 riastradh Exp $	*/
+/*	$NetBSD: vfs_syscalls_12.c,v 1.35 2017/12/03 15:23:30 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.34 2017/07/28 15:34:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.35 2017/12/03 15:23:30 christos Exp $");
 
 #include 
 #include 
@@ -183,6 +183,10 @@ again:
 off += reclen;
 			continue;
 		}
+		if (bdp->d_namlen >= sizeof(idb.d_name))
+			idb.d_namlen = sizeof(idb.d_name) - 1;
+		else
+			idb.d_namlen = bdp->d_namlen;
 		old_reclen = _DIRENT_RECLEN(, bdp->d_namlen);
 		if (reclen > len || resid < old_reclen) {
 			/* entry too big for buffer, so just stop */
@@ -197,9 +201,9 @@ again:
 		idb.d_fileno = (uint32_t)bdp->d_fileno;
 		idb.d_reclen = (uint16_t)old_reclen;
 		idb.d_type = (uint8_t)bdp->d_type;
-		idb.d_namlen = (uint8_t)bdp->d_namlen;
-		memcpy(idb.d_name, bdp->d_name, MIN(sizeof(idb.d_name),
-		bdp->d_namlen));
+		(void)memcpy(idb.d_name, bdp->d_name, idb.d_namlen);
+		memset(idb.d_name + idb.d_namlen, 0,
+		idb.d_reclen - _DIRENT_NAMEOFF() - idb.d_namlen);
 		if ((error = copyout(, outp, old_reclen)))
 			goto out;
 		/* advance past this real entry */

Index: src/sys/compat/common/vfs_syscalls_43.c
diff -u src/sys/compat/common/vfs_syscalls_43.c:1.61 src/sys/compat/common/vfs_syscalls_43.c:1.62
--- src/sys/compat/common/vfs_syscalls_43.c:1.61	Sat Jul 29 00:02:49 2017
+++ src/sys/compat/common/vfs_syscalls_43.c	Sun Dec  3 10:23:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_43.c,v 1.61 2017/07/29 04:02:49 riastradh Exp $	*/
+/*	$NetBSD: vfs_syscalls_43.c,v 1.62 2017/12/03 15:23:30 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.61 2017/07/29 04:02:49 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.62 2017/12/03 15:23:30 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -463,6 +463,10 @@ again:
 off += reclen;
 			continue;
 		}
+		if (bdp->d_namlen >= sizeof(idb.d_name))
+			idb.d_namlen = sizeof(idb.d_name) - 1;
+		else
+			idb.d_namlen = bdp->d_namlen;
 		old_reclen = _DIRENT_RECLEN(, bdp->d_namlen);
 		if (reclen > len || resid < old_reclen) {
 			/* entry too big for buffer, so just stop */
@@ -476,9 +480,10 @@ again:
 		 */
 		idb.d_fileno = (uint32_t)bdp->d_fileno;
 		idb.d_reclen = (uint16_t)old_reclen;
-		idb.d_namlen = (uint16_t)bdp->d_namlen;
-		memcpy(idb.d_name, bdp->d_name, MIN(sizeof(idb.d_name),
-		idb.d_namlen));
+		idb.d_fileno = (uint32_t)bdp->d_fileno;
+		(void)memcpy(idb.d_name, bdp->d_name, idb.d_namlen);
+		memset(idb.d_name + idb.d_namlen, 0,
+		idb.d_reclen - _DIRENT_NAMEOFF() - idb.d_namlen);
 		if ((error = copyout(, outp, old_reclen)))
 			goto out;
 		/* advance past this real entry */



CVS commit: src/sys/compat/common

2017-11-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 22 15:25:34 UTC 2017

Modified Files:
src/sys/compat/common: uipc_syscalls_40.c

Log Message:
#idef the label next_ifa: just like the only goto using it.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/compat/common/uipc_syscalls_40.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/uipc_syscalls_40.c
diff -u src/sys/compat/common/uipc_syscalls_40.c:1.14 src/sys/compat/common/uipc_syscalls_40.c:1.15
--- src/sys/compat/common/uipc_syscalls_40.c:1.14	Wed Nov 22 10:19:14 2017
+++ src/sys/compat/common/uipc_syscalls_40.c	Wed Nov 22 15:25:34 2017
@@ -1,9 +1,9 @@
-/*	$NetBSD: uipc_syscalls_40.c,v 1.14 2017/11/22 10:19:14 ozaki-r Exp $	*/
+/*	$NetBSD: uipc_syscalls_40.c,v 1.15 2017/11/22 15:25:34 martin Exp $	*/
 
 /* written by Pavel Cahyna, 2006. Public domain. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.14 2017/11/22 10:19:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.15 2017/11/22 15:25:34 martin Exp $");
 
 /*
  * System call interface to the socket abstraction.
@@ -124,7 +124,9 @@ compat_ifconf(u_long cmd, void *data)
 			}
 			space -= sz;
 
+#ifdef COMPAT_OSOCK
 		next_ifa:
+#endif
 			s = pserialize_read_enter();
 			ifa_release(ifa, _ifa);
 		}



CVS commit: src/sys/compat/common

2017-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 29 04:08:47 UTC 2017

Modified Files:
src/sys/compat/common: if_43.c

Log Message:
Kill needless nested extern of vec_compat_cvtcmd/ioctl.

Already declared in if_43.h.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/compat/common/if_43.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/if_43.c
diff -u src/sys/compat/common/if_43.c:1.13 src/sys/compat/common/if_43.c:1.14
--- src/sys/compat/common/if_43.c:1.13	Sat Nov  5 23:30:22 2016
+++ src/sys/compat/common/if_43.c	Sat Jul 29 04:08:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_43.c,v 1.13 2016/11/05 23:30:22 pgoyette Exp $	*/
+/*	$NetBSD: if_43.c,v 1.14 2017/07/29 04:08:47 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.13 2016/11/05 23:30:22 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.14 2017/07/29 04:08:47 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -289,9 +289,6 @@ static int (*orig_compat_ifioctl)(struct
 void
 if_43_init(void)
 {
-	extern u_long (*vec_compat_cvtcmd)(u_long);
-	extern int (*vec_compat_ifioctl)(struct socket *, u_long, u_long,
-	void *, struct lwp *);
 
 	orig_compat_cvtcmd = vec_compat_cvtcmd;
 	vec_compat_cvtcmd = compat_cvtcmd;



CVS commit: src/sys/compat/common

2017-04-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 29 13:25:27 UTC 2017

Modified Files:
src/sys/compat/common: vm_43.c

Log Message:
remove extra S


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/compat/common/vm_43.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/vm_43.c
diff -u src/sys/compat/common/vm_43.c:1.19 src/sys/compat/common/vm_43.c:1.20
--- src/sys/compat/common/vm_43.c:1.19	Fri Apr 28 21:15:40 2017
+++ src/sys/compat/common/vm_43.c	Sat Apr 29 09:25:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_43.c,v 1.19 2017/04/29 01:15:40 christos Exp $	*/
+/*	$NetBSD: vm_43.c,v 1.20 2017/04/29 13:25:27 christos Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_43.c,v 1.19 2017/04/29 01:15:40 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_43.c,v 1.20 2017/04/29 13:25:27 christos Exp $");
 
 #include 
 #include 
@@ -122,7 +122,7 @@ compat_43_sys_mmap(struct lwp *l, const 
 		 * and ld.so did not turn it on. We take care of this on amd64
 		 * in compat32.
 		 */
-		SCARGS(, prot) |= PROT_EXEC;
+		SCARG(, prot) |= PROT_EXEC;
 #endif
 	}
 	if (SCARG(uap, flags) & OMAP_FIXED)



CVS commit: src/sys/compat/common

2017-04-13 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Thu Apr 13 09:41:28 UTC 2017

Modified Files:
src/sys/compat/common: vfs_syscalls_20.c

Log Message:
Switch compat_20_sys_getfsstat() to mountlist iterator.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/compat/common/vfs_syscalls_20.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/vfs_syscalls_20.c
diff -u src/sys/compat/common/vfs_syscalls_20.c:1.39 src/sys/compat/common/vfs_syscalls_20.c:1.40
--- src/sys/compat/common/vfs_syscalls_20.c:1.39	Fri Jul 24 13:02:52 2015
+++ src/sys/compat/common/vfs_syscalls_20.c	Thu Apr 13 09:41:28 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_20.c,v 1.39 2015/07/24 13:02:52 maxv Exp $	*/
+/*	$NetBSD: vfs_syscalls_20.c,v 1.40 2017/04/13 09:41:28 hannken Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_20.c,v 1.39 2015/07/24 13:02:52 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_20.c,v 1.40 2017/04/13 09:41:28 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -203,7 +203,8 @@ compat_20_sys_getfsstat(struct lwp *l, c
 		syscallarg(int) flags;
 	} */
 	int root = 0;
-	struct mount *mp, *nmp;
+	mount_iterator_t *iter;
+	struct mount *mp;
 	struct statvfs *sbuf;
 	struct statfs12 *sfsp;
 	size_t count, maxcount;
@@ -212,30 +213,21 @@ compat_20_sys_getfsstat(struct lwp *l, c
 	sbuf = malloc(sizeof(*sbuf), M_TEMP, M_WAITOK);
 	maxcount = (size_t)SCARG(uap, bufsize) / sizeof(struct statfs12);
 	sfsp = SCARG(uap, buf);
-	mutex_enter(_lock);
 	count = 0;
-	for (mp = TAILQ_FIRST(); mp != NULL; mp = nmp) {
-		if (vfs_busy(mp, )) {
-			continue;
-		}
+	mountlist_iterator_init();
+	while ((mp = mountlist_iterator_next(iter)) != NULL) {
 		if (sfsp && count < maxcount) {
 			error = dostatvfs(mp, sbuf, l, SCARG(uap, flags), 0);
-			if (error) {
-vfs_unbusy(mp, false, );
+			if (error) 
 continue;
-			}
 			error = vfs2fs(sfsp, sbuf);
-			if (error) {
-vfs_unbusy(mp, false, NULL);
+			if (error)
 goto out;
-			}
 			sfsp++;
 			root |= strcmp(sbuf->f_mntonname, "/") == 0;
 		}
 		count++;
-		vfs_unbusy(mp, false, );
 	}
-	mutex_exit(_lock);
 	if (root == 0 && l->l_proc->p_cwdi->cwdi_rdir) {
 		/*
 		 * fake a root entry
@@ -252,6 +244,7 @@ compat_20_sys_getfsstat(struct lwp *l, c
 	else
 		*retval = count;
 out:
+	mountlist_iterator_destroy(iter);
 	free(sbuf, M_TEMP);
 	return error;
 }



CVS commit: src/sys/compat/common

2017-01-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 13 22:29:59 UTC 2017

Modified Files:
src/sys/compat/common: vfs_syscalls_12.c

Log Message:
use bdp, to avoid compiler warning.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/compat/common/vfs_syscalls_12.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/vfs_syscalls_12.c
diff -u src/sys/compat/common/vfs_syscalls_12.c:1.32 src/sys/compat/common/vfs_syscalls_12.c:1.33
--- src/sys/compat/common/vfs_syscalls_12.c:1.32	Fri Jan 13 15:58:59 2017
+++ src/sys/compat/common/vfs_syscalls_12.c	Fri Jan 13 17:29:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_12.c,v 1.32 2017/01/13 20:58:59 christos Exp $	*/
+/*	$NetBSD: vfs_syscalls_12.c,v 1.33 2017/01/13 22:29:59 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.32 2017/01/13 20:58:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.33 2017/01/13 22:29:59 christos Exp $");
 
 #include 
 #include 
@@ -197,7 +197,7 @@ again:
 		idb.d_type = (uint8_t)bdp->d_type;
 		idb.d_namlen = (uint8_t)bdp->d_namlen;
 		memcpy(idb.d_name, bdp->d_name, MIN(sizeof(idb.d_name),
-		idb.d_namlen));
+		bdp->d_namlen));
 		if ((error = copyout(, outp, old_reclen)))
 			goto out;
 		/* advance past this real entry */



CVS commit: src/sys/compat/common

2017-01-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 13 20:58:59 UTC 2017

Modified Files:
src/sys/compat/common: vfs_syscalls_12.c

Log Message:
convert strcpy to a bounded copy to avoid compiler warnings, although the
reclen test prevents overflow.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/compat/common/vfs_syscalls_12.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/vfs_syscalls_12.c
diff -u src/sys/compat/common/vfs_syscalls_12.c:1.31 src/sys/compat/common/vfs_syscalls_12.c:1.32
--- src/sys/compat/common/vfs_syscalls_12.c:1.31	Fri Sep  5 05:21:54 2014
+++ src/sys/compat/common/vfs_syscalls_12.c	Fri Jan 13 15:58:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_12.c,v 1.31 2014/09/05 09:21:54 matt Exp $	*/
+/*	$NetBSD: vfs_syscalls_12.c,v 1.32 2017/01/13 20:58:59 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.31 2014/09/05 09:21:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.32 2017/01/13 20:58:59 christos Exp $");
 
 #include 
 #include 
@@ -196,7 +196,8 @@ again:
 		idb.d_reclen = (uint16_t)old_reclen;
 		idb.d_type = (uint8_t)bdp->d_type;
 		idb.d_namlen = (uint8_t)bdp->d_namlen;
-		strcpy(idb.d_name, bdp->d_name);
+		memcpy(idb.d_name, bdp->d_name, MIN(sizeof(idb.d_name),
+		idb.d_namlen));
 		if ((error = copyout(, outp, old_reclen)))
 			goto out;
 		/* advance past this real entry */



CVS commit: src/sys/compat/common

2017-01-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 13 20:25:35 UTC 2017

Modified Files:
src/sys/compat/common: vfs_syscalls_43.c

Log Message:
convert strcpy to a bounded copy to avoid compiler warnings, although the
reclen test prevents overflow.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/compat/common/vfs_syscalls_43.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/vfs_syscalls_43.c
diff -u src/sys/compat/common/vfs_syscalls_43.c:1.58 src/sys/compat/common/vfs_syscalls_43.c:1.59
--- src/sys/compat/common/vfs_syscalls_43.c:1.58	Fri Aug 19 20:34:42 2016
+++ src/sys/compat/common/vfs_syscalls_43.c	Fri Jan 13 15:25:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_43.c,v 1.58 2016/08/20 00:34:42 mrg Exp $	*/
+/*	$NetBSD: vfs_syscalls_43.c,v 1.59 2017/01/13 20:25:35 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.58 2016/08/20 00:34:42 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.59 2017/01/13 20:25:35 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -475,7 +475,8 @@ again:
 		idb.d_fileno = (uint32_t)bdp->d_fileno;
 		idb.d_reclen = (uint16_t)old_reclen;
 		idb.d_namlen = (uint16_t)bdp->d_namlen;
-		strcpy(idb.d_name, bdp->d_name);
+		memcpy(idb.d_name, bdp->d_name, MIN(sizeof(idb.d_name),
+		idb.d_namlen));
 		if ((error = copyout(, outp, old_reclen)))
 			goto out;
 		/* advance past this real entry */



CVS commit: src/sys/compat/common

2016-11-03 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Nov  3 22:23:04 UTC 2016

Modified Files:
src/sys/compat/common: Makefile Makefile.sysio

Log Message:
Move if_43.c out of Makefile.sysio and into the main Makefile.

The former location gets included in both libcompat and the compat
module, leading to redefined symbols when the module is loaded.  By
moving it to the main Makefile, it gets included only in libcompat.

XXX This still isn't an ideal solution, but it will suffice until
XXX PR kern/51598 is addressed.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/compat/common/Makefile
cvs rdiff -u -r1.5 -r1.6 src/sys/compat/common/Makefile.sysio

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/Makefile
diff -u src/sys/compat/common/Makefile:1.58 src/sys/compat/common/Makefile:1.59
--- src/sys/compat/common/Makefile:1.58	Thu Nov  3 04:26:58 2016
+++ src/sys/compat/common/Makefile	Thu Nov  3 22:23:03 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.58 2016/11/03 04:26:58 riastradh Exp $
+#	$NetBSD: Makefile,v 1.59 2016/11/03 22:23:03 pgoyette Exp $
 
 LIB=		compat
 NOPIC=		# defined
@@ -11,6 +11,11 @@ CPPFLAGS=	${COMPATCPPFLAGS} ${SKIP_AUTOD
 # Common compatibility code, used by all emulations
 SRCS=	compat_exec.c compat_util.c
 
+# Compatability code for 4.3BSD 
+SRCS+=	if_43.c
+
+# Include compatability code common to libcompat and the compat module
+
 .include "Makefile.sysio"
 .include "Makefile.sysv"
 

Index: src/sys/compat/common/Makefile.sysio
diff -u src/sys/compat/common/Makefile.sysio:1.5 src/sys/compat/common/Makefile.sysio:1.6
--- src/sys/compat/common/Makefile.sysio:1.5	Thu Nov  3 11:32:15 2016
+++ src/sys/compat/common/Makefile.sysio	Thu Nov  3 22:23:03 2016
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile.sysio,v 1.5 2016/11/03 11:32:15 pgoyette Exp $
+#	$NetBSD: Makefile.sysio,v 1.6 2016/11/03 22:23:03 pgoyette Exp $
 
 # Sources for syscall and ioctl compatibility across the versions.
 
 # Compatibility code for 4.3BSD
 SRCS+=	kern_exit_43.c kern_info_43.c kern_resource_43.c kern_sig_43.c \
-	tty_43.c uipc_syscalls_43.c vfs_syscalls_43.c vm_43.c if_43.c
+	tty_43.c uipc_syscalls_43.c vfs_syscalls_43.c vm_43.c
 
 # Compatibility code for NetBSD 0.9
 SRCS+=	kern_info_09.c



CVS commit: src/sys/compat/common

2016-11-03 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Nov  3 11:32:15 UTC 2016

Modified Files:
src/sys/compat/common: Makefile.sysio

Log Message:
Hmmm, if we omit if_43.c from the SRCS list, then we break the i386
build for one of the XEN kernels.

Adding it back to the list.  At least the build will be successful.

XXX This is probably not the end of this saga, as we still have the
XXX redefined-symbol issue when loading the compat module on amd64.
XXX But for now, a working build for the vast majority of users
XXX (including our automated test suites) is more important than a
XXX successfully-loadable compat module.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/common/Makefile.sysio

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/Makefile.sysio
diff -u src/sys/compat/common/Makefile.sysio:1.4 src/sys/compat/common/Makefile.sysio:1.5
--- src/sys/compat/common/Makefile.sysio:1.4	Thu Nov  3 06:54:08 2016
+++ src/sys/compat/common/Makefile.sysio	Thu Nov  3 11:32:15 2016
@@ -1,19 +1,10 @@
-#	$NetBSD: Makefile.sysio,v 1.4 2016/11/03 06:54:08 pgoyette Exp $
+#	$NetBSD: Makefile.sysio,v 1.5 2016/11/03 11:32:15 pgoyette Exp $
 
 # Sources for syscall and ioctl compatibility across the versions.
 
 # Compatibility code for 4.3BSD
 SRCS+=	kern_exit_43.c kern_info_43.c kern_resource_43.c kern_sig_43.c \
-	tty_43.c uipc_syscalls_43.c vfs_syscalls_43.c vm_43.c
-
-# if_43.o gets included from libcompat automatically, due to two calls
-# to compat_cvtcmd() in if.c.  Ideally, if.c would be modified to have
-# a pointer to a no-op compat_cvtcmd() and that pointer would get
-# replaced by compat_mnodcmd(MODULE_CMD_INIT, ...) code.  But for now,
-# just don't include it in the compat module at all.
-#
-#SRCS+=	if_43.c
-#
+	tty_43.c uipc_syscalls_43.c vfs_syscalls_43.c vm_43.c if_43.c
 
 # Compatibility code for NetBSD 0.9
 SRCS+=	kern_info_09.c



CVS commit: src/sys/compat/common

2016-11-03 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Nov  3 06:54:08 UTC 2016

Modified Files:
src/sys/compat/common: Makefile.sysio

Log Message:
Really comment out if_43.c this time.  (I need sleep and/or caffeine.)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/compat/common/Makefile.sysio

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/Makefile.sysio
diff -u src/sys/compat/common/Makefile.sysio:1.3 src/sys/compat/common/Makefile.sysio:1.4
--- src/sys/compat/common/Makefile.sysio:1.3	Thu Nov  3 06:28:04 2016
+++ src/sys/compat/common/Makefile.sysio	Thu Nov  3 06:54:08 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.sysio,v 1.3 2016/11/03 06:28:04 pgoyette Exp $
+#	$NetBSD: Makefile.sysio,v 1.4 2016/11/03 06:54:08 pgoyette Exp $
 
 # Sources for syscall and ioctl compatibility across the versions.
 
@@ -11,8 +11,8 @@ SRCS+=	kern_exit_43.c kern_info_43.c ker
 # a pointer to a no-op compat_cvtcmd() and that pointer would get
 # replaced by compat_mnodcmd(MODULE_CMD_INIT, ...) code.  But for now,
 # just don't include it in the compat module at all.
-
-SRCS+=	if_43.c
+#
+#SRCS+=	if_43.c
 #
 
 # Compatibility code for NetBSD 0.9



CVS commit: src/sys/compat/common

2016-11-03 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Nov  3 06:28:04 UTC 2016

Modified Files:
src/sys/compat/common: Makefile.sysio

Log Message:
Use proper characgter to introduce comments!


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/common/Makefile.sysio

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/Makefile.sysio
diff -u src/sys/compat/common/Makefile.sysio:1.2 src/sys/compat/common/Makefile.sysio:1.3
--- src/sys/compat/common/Makefile.sysio:1.2	Thu Nov  3 06:22:29 2016
+++ src/sys/compat/common/Makefile.sysio	Thu Nov  3 06:28:04 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.sysio,v 1.2 2016/11/03 06:22:29 pgoyette Exp $
+#	$NetBSD: Makefile.sysio,v 1.3 2016/11/03 06:28:04 pgoyette Exp $
 
 # Sources for syscall and ioctl compatibility across the versions.
 
@@ -6,15 +6,14 @@
 SRCS+=	kern_exit_43.c kern_info_43.c kern_resource_43.c kern_sig_43.c \
 	tty_43.c uipc_syscalls_43.c vfs_syscalls_43.c vm_43.c
 
-/*
- * if_43.o gets included from libcompat automatically, due to two calls
- * to compat_cvtcmd() in if.c.  Ideally, if.c would be modified to have
- * a pointer to a no-op compat_cvtcmd() and that pointer would get
- * replaced by compat_mnodcmd(MODULE_CMD_INIT, ...) code.  But for now,
- * just don't include it in the compat module at all.
+# if_43.o gets included from libcompat automatically, due to two calls
+# to compat_cvtcmd() in if.c.  Ideally, if.c would be modified to have
+# a pointer to a no-op compat_cvtcmd() and that pointer would get
+# replaced by compat_mnodcmd(MODULE_CMD_INIT, ...) code.  But for now,
+# just don't include it in the compat module at all.
 
 SRCS+=	if_43.c
- */
+#
 
 # Compatibility code for NetBSD 0.9
 SRCS+=	kern_info_09.c



CVS commit: src/sys/compat/common

2016-11-03 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Nov  3 06:22:29 UTC 2016

Modified Files:
src/sys/compat/common: Makefile.sysio

Log Message:
if_43.o gets included from libcompat automatically, due to two calls
to compat_cvtcmd() in if.c.  Ideally, if.c would be modified to have
a pointer to a no-op compat_cvtcmd() and that pointer would get
replaced by compat_modcmd(MODULE_CMD_INIT, ...) code.  But for now,
just don't include it in the compat module at all.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/compat/common/Makefile.sysio

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/Makefile.sysio
diff -u src/sys/compat/common/Makefile.sysio:1.1 src/sys/compat/common/Makefile.sysio:1.2
--- src/sys/compat/common/Makefile.sysio:1.1	Thu Nov  3 04:26:58 2016
+++ src/sys/compat/common/Makefile.sysio	Thu Nov  3 06:22:29 2016
@@ -1,10 +1,20 @@
-#	$NetBSD: Makefile.sysio,v 1.1 2016/11/03 04:26:58 riastradh Exp $
+#	$NetBSD: Makefile.sysio,v 1.2 2016/11/03 06:22:29 pgoyette Exp $
 
 # Sources for syscall and ioctl compatibility across the versions.
 
 # Compatibility code for 4.3BSD
 SRCS+=	kern_exit_43.c kern_info_43.c kern_resource_43.c kern_sig_43.c \
-	tty_43.c uipc_syscalls_43.c vfs_syscalls_43.c vm_43.c if_43.c
+	tty_43.c uipc_syscalls_43.c vfs_syscalls_43.c vm_43.c
+
+/*
+ * if_43.o gets included from libcompat automatically, due to two calls
+ * to compat_cvtcmd() in if.c.  Ideally, if.c would be modified to have
+ * a pointer to a no-op compat_cvtcmd() and that pointer would get
+ * replaced by compat_mnodcmd(MODULE_CMD_INIT, ...) code.  But for now,
+ * just don't include it in the compat module at all.
+
+SRCS+=	if_43.c
+ */
 
 # Compatibility code for NetBSD 0.9
 SRCS+=	kern_info_09.c



CVS commit: src/sys/compat/common

2016-11-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Nov  3 03:37:06 UTC 2016

Modified Files:
src/sys/compat/common: kern_time_30.c rtsock_14.c

Log Message:
Sprinkle #ifdef _KERNEL_OPT.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/common/kern_time_30.c \
src/sys/compat/common/rtsock_14.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/kern_time_30.c
diff -u src/sys/compat/common/kern_time_30.c:1.4 src/sys/compat/common/kern_time_30.c:1.5
--- src/sys/compat/common/kern_time_30.c:1.4	Wed Jan 19 10:21:16 2011
+++ src/sys/compat/common/kern_time_30.c	Thu Nov  3 03:37:06 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time_30.c,v 1.4 2011/01/19 10:21:16 tsutsui Exp $	*/
+/*	$NetBSD: kern_time_30.c,v 1.5 2016/11/03 03:37:06 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,9 +36,11 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time_30.c,v 1.4 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time_30.c,v 1.5 2016/11/03 03:37:06 riastradh Exp $");
 
+#ifdef _KERNEL_OPT
 #include "opt_ntp.h"
+#endif
 
 #include 
 #include 
Index: src/sys/compat/common/rtsock_14.c
diff -u src/sys/compat/common/rtsock_14.c:1.4 src/sys/compat/common/rtsock_14.c:1.5
--- src/sys/compat/common/rtsock_14.c:1.4	Sun Jul 17 20:54:50 2011
+++ src/sys/compat/common/rtsock_14.c	Thu Nov  3 03:37:06 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock_14.c,v 1.4 2011/07/17 20:54:50 joerg Exp $	*/
+/*	$NetBSD: rtsock_14.c,v 1.5 2016/11/03 03:37:06 riastradh Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,9 +61,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock_14.c,v 1.4 2011/07/17 20:54:50 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_14.c,v 1.5 2016/11/03 03:37:06 riastradh Exp $");
 
+#ifdef _KERNEL_OPT
 #include "opt_inet.h"
+#endif
 
 #include 
 #include 



CVS commit: src/sys/compat/common

2016-08-19 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Aug 20 00:34:42 UTC 2016

Modified Files:
src/sys/compat/common: vfs_syscalls_43.c

Log Message:
fill in the tv_nsec parts of the converted timespec in cvtstat().


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/compat/common/vfs_syscalls_43.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/vfs_syscalls_43.c
diff -u src/sys/compat/common/vfs_syscalls_43.c:1.57 src/sys/compat/common/vfs_syscalls_43.c:1.58
--- src/sys/compat/common/vfs_syscalls_43.c:1.57	Fri Sep  5 09:21:54 2014
+++ src/sys/compat/common/vfs_syscalls_43.c	Sat Aug 20 00:34:42 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_43.c,v 1.57 2014/09/05 09:21:54 matt Exp $	*/
+/*	$NetBSD: vfs_syscalls_43.c,v 1.58 2016/08/20 00:34:42 mrg Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.57 2014/09/05 09:21:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.58 2016/08/20 00:34:42 mrg Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -75,15 +75,42 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls
 #include 
 #include 
 
+static void cvttimespec(struct timespec *, struct timespec50 *);
 static void cvtstat(struct stat *, struct stat43 *);
 
 /*
+ * Convert from an old to a new timespec structure.
+ */
+static void
+cvttimespec(struct timespec *ts, struct timespec50 *ots)
+{
+
+	if (ts->tv_sec > INT_MAX) {
+#if defined(DEBUG) || 1
+		static bool first = true;
+
+		if (first) {
+			first = false;
+			printf("%s[%s:%d]: time_t does not fit\n",
+			__func__, curlwp->l_proc->p_comm,
+			curlwp->l_lid);
+		}
+#endif
+		ots->tv_sec = INT_MAX;
+	} else
+		ots->tv_sec = ts->tv_sec;
+	ots->tv_nsec = ts->tv_nsec;
+}
+
+/*
  * Convert from an old to a new stat structure.
  */
 static void
 cvtstat(struct stat *st, struct stat43 *ost)
 {
 
+	/* Handle any padding. */
+	memset(ost, 0, sizeof *ost);
 	ost->st_dev = st->st_dev;
 	ost->st_ino = st->st_ino;
 	ost->st_mode = st->st_mode & 0x;
@@ -95,9 +122,9 @@ cvtstat(struct stat *st, struct stat43 *
 		ost->st_size = st->st_size;
 	else
 		ost->st_size = -2;
-	ost->st_atime = st->st_atime;
-	ost->st_mtime = st->st_mtime;
-	ost->st_ctime = st->st_ctime;
+	cvttimespec(>st_atimespec, >st_atimespec);
+	cvttimespec(>st_mtimespec, >st_mtimespec);
+	cvttimespec(>st_ctimespec, >st_ctimespec);
 	ost->st_blksize = st->st_blksize;
 	ost->st_blocks = st->st_blocks;
 	ost->st_flags = st->st_flags;



CVS commit: src/sys/compat/common

2016-07-25 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Jul 25 08:30:19 UTC 2016

Modified Files:
src/sys/compat/common: if_43.c

Log Message:
Apply if_get/if_put to compat_ifioctl


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/compat/common/if_43.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/if_43.c
diff -u src/sys/compat/common/if_43.c:1.11 src/sys/compat/common/if_43.c:1.12
--- src/sys/compat/common/if_43.c:1.11	Sat Jul 11 07:43:32 2015
+++ src/sys/compat/common/if_43.c	Mon Jul 25 08:30:19 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_43.c,v 1.11 2015/07/11 07:43:32 njoly Exp $	*/
+/*	$NetBSD: if_43.c,v 1.12 2016/07/25 08:30:19 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.11 2015/07/11 07:43:32 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.12 2016/07/25 08:30:19 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -218,11 +218,16 @@ compat_ifioctl(struct socket *so, u_long
 	struct ifreq *ifr = (struct ifreq *)data;
 	struct ifreq ifrb;
 	struct oifreq *oifr = NULL;
-	struct ifnet *ifp = ifunit(ifr->ifr_name);
+	struct ifnet *ifp;
 	struct sockaddr *sa;
+	struct psref psref;
+	int bound = curlwp_bind();
 
-	if (ifp == NULL)
+	ifp = if_get(ifr->ifr_name, );
+	if (ifp == NULL) {
+		curlwp_bindx(bound);
 		return ENXIO;
+	}
 
 	/*
 	 * If we have not been converted, make sure that we are.
@@ -257,6 +262,8 @@ compat_ifioctl(struct socket *so, u_long
 	}
 
 	error = (*so->so_proto->pr_usrreqs->pr_ioctl)(so, cmd, ifr, ifp);
+	if_put(ifp, );
+	curlwp_bindx(bound);
 
 	switch (ocmd) {
 	case OOSIOCGIFADDR:



CVS commit: src/sys/compat/common

2016-03-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 11 18:32:29 UTC 2016

Modified Files:
src/sys/compat/common: kern_time_50.c

Log Message:
PR/50947: David Binderman: sprinkle parens


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/compat/common/kern_time_50.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/kern_time_50.c
diff -u src/sys/compat/common/kern_time_50.c:1.30 src/sys/compat/common/kern_time_50.c:1.31
--- src/sys/compat/common/kern_time_50.c:1.30	Sun Dec  6 22:25:57 2015
+++ src/sys/compat/common/kern_time_50.c	Fri Mar 11 13:32:29 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time_50.c,v 1.30 2015/12/07 03:25:57 pgoyette Exp $	*/
+/*	$NetBSD: kern_time_50.c,v 1.31 2016/03/11 18:32:29 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.30 2015/12/07 03:25:57 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.31 2016/03/11 18:32:29 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -293,7 +293,7 @@ compat_50_sys_setitimer(struct lwp *l,
 		return (EINVAL);
 	itvp = SCARG(uap, itv);
 	if (itvp &&
-	(error = copyin(itvp, , sizeof(aitv50)) != 0))
+	(error = copyin(itvp, , sizeof(aitv50))) != 0)
 		return (error);
 	itimerval50_to_itimerval(, );
 	if (SCARG(uap, oitv) != NULL) {



CVS commit: src/sys/compat/common

2015-12-04 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Dec  5 01:59:51 UTC 2015

Modified Files:
src/sys/compat/common: compat_mod.c

Log Message:
The COMPAT_10 code for SYSVxxx is now part of the sysv_ipc module, so
don't install syscall function pointers from the compat module.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/compat/common/compat_mod.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.22 src/sys/compat/common/compat_mod.c:1.23
--- src/sys/compat/common/compat_mod.c:1.22	Mon May 11 10:32:13 2015
+++ src/sys/compat/common/compat_mod.c	Sat Dec  5 01:59:51 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.22 2015/05/11 10:32:13 pgoyette Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.23 2015/12/05 01:59:51 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.22 2015/05/11 10:32:13 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.23 2015/12/05 01:59:51 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -124,18 +124,6 @@ static const struct syscall_package comp
 	{ SYS_compat_09_ouname, 0, (sy_call_t *)compat_09_sys_uname },
 #endif
 
-#if defined(COMPAT_10) && !defined(_LP64)
-# if defined(SYSVMSG)
-	{ SYS_compat_10_omsgsys, 0, (sy_call_t *)compat_10_sys_msgsys },
-# endif
-# if defined(SYSVSEM)
-	{ SYS_compat_10_osemsys, 0, (sy_call_t *)compat_10_sys_semsys },
-# endif
-# if defined(SYSVSHM)
-	{ SYS_compat_10_oshmsys, 0, (sy_call_t *)compat_10_sys_shmsys },
-# endif
-#endif	/* defined(COMPAT_10) && !defined(_LP64) */
-
 #if defined(COMPAT_12)
 	{ SYS_compat_12_fstat12, 0, (sy_call_t *)compat_12_sys_fstat },
 	{ SYS_compat_12_getdirentries, 0, (sy_call_t *)compat_12_sys_getdirentries },



CVS commit: src/sys/compat/common

2015-12-02 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Dec  3 00:28:55 UTC 2015

Modified Files:
src/sys/compat/common: sysv_ipc_50.c

Log Message:
Add comment to #ifdef - it's a long way from its original #if


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/compat/common/sysv_ipc_50.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/sysv_ipc_50.c
diff -u src/sys/compat/common/sysv_ipc_50.c:1.3 src/sys/compat/common/sysv_ipc_50.c:1.4
--- src/sys/compat/common/sysv_ipc_50.c:1.3	Sun May 10 07:41:15 2015
+++ src/sys/compat/common/sysv_ipc_50.c	Thu Dec  3 00:28:55 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysv_ipc_50.c,v 1.3 2015/05/10 07:41:15 pgoyette Exp $	*/
+/*	$NetBSD: sysv_ipc_50.c,v 1.4 2015/12/03 00:28:55 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysv_ipc_50.c,v 1.3 2015/05/10 07:41:15 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_ipc_50.c,v 1.4 2015/12/03 00:28:55 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sysv.h"
@@ -215,4 +215,4 @@ sysctl_kern_sysvipc50(SYSCTLFN_ARGS)
 		free(bf, M_TEMP);
 	return error;
 }
-#endif
+#endif /* COMPAT_50 */



CVS commit: src/sys/compat/common

2015-10-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 22 15:18:25 UTC 2015

Modified Files:
src/sys/compat/common: tty_60.c

Log Message:
Handle both ioctls in both places :-)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/compat/common/tty_60.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/tty_60.c
diff -u src/sys/compat/common/tty_60.c:1.3 src/sys/compat/common/tty_60.c:1.4
--- src/sys/compat/common/tty_60.c:1.3	Fri Oct 19 15:44:06 2012
+++ src/sys/compat/common/tty_60.c	Thu Oct 22 11:18:25 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty_60.c,v 1.3 2012/10/19 19:44:06 apb Exp $	*/
+/*	$NetBSD: tty_60.c,v 1.4 2015/10/22 15:18:25 christos Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tty_60.c,v 1.3 2012/10/19 19:44:06 apb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_60.c,v 1.4 2015/10/22 15:18:25 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -97,6 +97,7 @@ compat_60_ttioctl(struct tty *tp, u_long
 {
 
 	switch (cmd) {
+	case COMPAT_60_TIOCPTMGET:
 	case COMPAT_60_TIOCPTSNAME:
 		return compat_60_ptmget_ioctl(tp->t_dev, cmd, data, flag, l);
 	default:



CVS commit: src/sys/compat/common

2015-07-11 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Sat Jul 11 07:43:32 UTC 2015

Modified Files:
src/sys/compat/common: if_43.c

Log Message:
Handle case where compat_ifioctl() is called with ocmd != cmd, as found in
compat Linux. Do not crash by ensuring that oifr is correctly set.

Fix crash reported by Robert Swindells on tech-kern@.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/compat/common/if_43.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/if_43.c
diff -u src/sys/compat/common/if_43.c:1.10 src/sys/compat/common/if_43.c:1.11
--- src/sys/compat/common/if_43.c:1.10	Tue May 12 20:42:46 2015
+++ src/sys/compat/common/if_43.c	Sat Jul 11 07:43:32 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_43.c,v 1.10 2015/05/12 20:42:46 christos Exp $	*/
+/*	$NetBSD: if_43.c,v 1.11 2015/07/11 07:43:32 njoly Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_43.c,v 1.10 2015/05/12 20:42:46 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_43.c,v 1.11 2015/07/11 07:43:32 njoly Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_compat_netbsd.h
@@ -231,11 +231,11 @@ compat_ifioctl(struct socket *so, u_long
 	 */
 	if (cmd == ocmd) {
 		cmd = compat_cvtcmd(ocmd);
-		if (cmd != ocmd) {
-			oifr = data;
-			data = ifr = ifrb;
-			ifreqo2n(oifr, ifr);
-		}
+	}
+	if (cmd != ocmd) {
+		oifr = data;
+		data = ifr = ifrb;
+		ifreqo2n(oifr, ifr);
 	}
 
 	switch (ocmd) {



CVS commit: src/sys/compat/common

2015-05-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue May 12 20:42:46 UTC 2015

Modified Files:
src/sys/compat/common: if_43.c

Log Message:
rump is compiled with COMPAT_OSOCK not COMPAT_OIFREQ and the code in if.c
is not handling this case properly. Make this work by checking again if
we need to convert struct ifreq here, and if we do, we do it ourselves.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/compat/common/if_43.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/if_43.c
diff -u src/sys/compat/common/if_43.c:1.9 src/sys/compat/common/if_43.c:1.10
--- src/sys/compat/common/if_43.c:1.9	Sun Nov  9 12:48:07 2014
+++ src/sys/compat/common/if_43.c	Tue May 12 16:42:46 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_43.c,v 1.9 2014/11/09 17:48:07 maxv Exp $	*/
+/*	$NetBSD: if_43.c,v 1.10 2015/05/12 20:42:46 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_43.c,v 1.9 2014/11/09 17:48:07 maxv Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_43.c,v 1.10 2015/05/12 20:42:46 christos Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_compat_netbsd.h
@@ -216,12 +216,28 @@ compat_ifioctl(struct socket *so, u_long
 {
 	int error;
 	struct ifreq *ifr = (struct ifreq *)data;
+	struct ifreq ifrb;
+	struct oifreq *oifr = NULL;
 	struct ifnet *ifp = ifunit(ifr-ifr_name);
 	struct sockaddr *sa;
 
 	if (ifp == NULL)
 		return ENXIO;
 
+	/*
+	 * If we have not been converted, make sure that we are.
+	 * (because the upper layer handles old socket calls, but
+	 * not oifreq calls.
+	 */
+	if (cmd == ocmd) {
+		cmd = compat_cvtcmd(ocmd);
+		if (cmd != ocmd) {
+			oifr = data;
+			data = ifr = ifrb;
+			ifreqo2n(oifr, ifr);
+		}
+	}
+
 	switch (ocmd) {
 	case OSIOCSIFADDR:
 	case OSIOCSIFDSTADDR:
@@ -238,21 +254,6 @@ compat_ifioctl(struct socket *so, u_long
 			sa-sa_len = 16;
 #endif
 		break;
-
-	case OOSIOCGIFADDR:
-		cmd = SIOCGIFADDR;
-		break;
-
-	case OOSIOCGIFDSTADDR:
-		cmd = SIOCGIFDSTADDR;
-		break;
-
-	case OOSIOCGIFBRDADDR:
-		cmd = SIOCGIFBRDADDR;
-		break;
-
-	case OOSIOCGIFNETMASK:
-		cmd = SIOCGIFNETMASK;
 	}
 
 	error = (*so-so_proto-pr_usrreqs-pr_ioctl)(so, cmd, ifr, ifp);
@@ -264,6 +265,11 @@ compat_ifioctl(struct socket *so, u_long
 	case OOSIOCGIFNETMASK:
 		*(u_int16_t *)ifr-ifr_addr = 
 		((struct sockaddr *)ifr-ifr_addr)-sa_family;
+		break;
 	}
+
+	if (cmd != ocmd)
+		ifreqn2o(oifr, ifr);
+
 	return error;
 }



CVS commit: src/sys/compat/common

2015-05-12 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed May 13 02:08:20 UTC 2015

Modified Files:
src/sys/compat/common: compat_sysv_mod.c

Log Message:
The compat_sysv module now depends on sysv_ipc module.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/common/compat_sysv_mod.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_sysv_mod.c
diff -u src/sys/compat/common/compat_sysv_mod.c:1.2 src/sys/compat/common/compat_sysv_mod.c:1.3
--- src/sys/compat/common/compat_sysv_mod.c:1.2	Mon May 11 10:32:13 2015
+++ src/sys/compat/common/compat_sysv_mod.c	Wed May 13 02:08:20 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_sysv_mod.c,v 1.2 2015/05/11 10:32:13 pgoyette Exp $	*/
+/*	$NetBSD: compat_sysv_mod.c,v 1.3 2015/05/13 02:08:20 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: compat_sysv_mod.c,v 1.2 2015/05/11 10:32:13 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: compat_sysv_mod.c,v 1.3 2015/05/13 02:08:20 pgoyette Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -48,7 +48,7 @@ __KERNEL_RCSID(0, $NetBSD: compat_sysv_
 #include sys/syscallvar.h
 #include sys/ipc.h
 
-MODULE(MODULE_CLASS_EXEC, compat_sysv, NULL);
+MODULE(MODULE_CLASS_EXEC, compat_sysv, sysv_ipc);
 
 static const struct syscall_package compat_sysv_syscalls[] = {
 #if defined(COMPAT_10)  !defined(_LP64)



CVS commit: src/sys/compat/common

2015-05-11 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon May 11 10:32:13 UTC 2015

Modified Files:
src/sys/compat/common: compat_mod.c compat_sysv_mod.c

Log Message:
Fix the #ifdef _MODULE stuff so that the syscall packages and sysctl stuff
gets handled properly even in built-in module case.

XXX
Whatever was I thinking when I put those conditionals in?  And wouldn't it
be a wonderful thing to have some atf regression tests to actually catch
errors in the compat{,_sysv} modules?   :)


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/compat/common/compat_mod.c
cvs rdiff -u -r1.1 -r1.2 src/sys/compat/common/compat_sysv_mod.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.21 src/sys/compat/common/compat_mod.c:1.22
--- src/sys/compat/common/compat_mod.c:1.21	Sun May 10 07:41:15 2015
+++ src/sys/compat/common/compat_mod.c	Mon May 11 10:32:13 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.21 2015/05/10 07:41:15 pgoyette Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.22 2015/05/11 10:32:13 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: compat_mod.c,v 1.21 2015/05/10 07:41:15 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: compat_mod.c,v 1.22 2015/05/11 10:32:13 pgoyette Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -60,17 +60,15 @@ __KERNEL_RCSID(0, $NetBSD: compat_mod.c
 #include compat/common/compat_util.h
 #include compat/common/compat_mod.h
 
-#ifdef _MODULE
 #if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_50)
 static struct sysctllog *compat_clog = NULL;
 #endif
-#endif
  
 MODULE(MODULE_CLASS_EXEC, compat, NULL);
 
-#ifdef _MODULE
 int	ttcompat(struct tty *, u_long, void *, int, struct lwp *);
 
+#ifdef _MODULE
 #ifdef COMPAT_16
 #if !defined(__amd64__) || defined(COMPAT_NETBSD32)
 #define COMPAT_SIGCONTEXT
@@ -78,6 +76,7 @@ extern char sigcode[], esigcode[];
 struct uvm_object *emul_netbsd_object;
 #endif
 #endif
+#endif /* _MODULE */
 
 extern krwlock_t exec_lock;
 extern krwlock_t ttcompat_lock;
@@ -230,12 +229,10 @@ static const struct syscall_package comp
 #endif
 	{ 0, 0, NULL },
 };
-#endif /* _MODULE */
 
 static int
 compat_modcmd(modcmd_t cmd, void *arg)
 {
-#ifdef _MODULE
 #ifdef COMPAT_16
 	proc_t *p;
 #endif
@@ -326,18 +323,8 @@ compat_modcmd(modcmd_t cmd, void *arg)
 	default:
 		return ENOTTY;
 	}
-#else /* _MODULE */
-	switch (cmd) {
-	case MODULE_CMD_INIT:
-	case MODULE_CMD_FINI:
-		return 0;
-	default:
-		return ENOTTY;
-	}
-#endif
 }
 
-#ifdef _MODULE
 void
 compat_sysctl_init(void)
 {
@@ -358,4 +345,3 @@ compat_sysctl_fini(void)
 sysctl_teardown(compat_clog);
 #endif
 }
-#endif

Index: src/sys/compat/common/compat_sysv_mod.c
diff -u src/sys/compat/common/compat_sysv_mod.c:1.1 src/sys/compat/common/compat_sysv_mod.c:1.2
--- src/sys/compat/common/compat_sysv_mod.c:1.1	Sun May 10 07:41:15 2015
+++ src/sys/compat/common/compat_sysv_mod.c	Mon May 11 10:32:13 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_sysv_mod.c,v 1.1 2015/05/10 07:41:15 pgoyette Exp $	*/
+/*	$NetBSD: compat_sysv_mod.c,v 1.2 2015/05/11 10:32:13 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: compat_sysv_mod.c,v 1.1 2015/05/10 07:41:15 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: compat_sysv_mod.c,v 1.2 2015/05/11 10:32:13 pgoyette Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -50,7 +50,6 @@ __KERNEL_RCSID(0, $NetBSD: compat_sysv_
 
 MODULE(MODULE_CLASS_EXEC, compat_sysv, NULL);
 
-#ifdef _MODULE
 static const struct syscall_package compat_sysv_syscalls[] = {
 #if defined(COMPAT_10)  !defined(_LP64)
 # if defined(SYSVMSG)
@@ -89,7 +88,6 @@ static const struct syscall_package comp
 #endif
 	{ 0, 0, NULL },
 };
-#endif
 
 int sysctl_kern_sysvipc50(SYSCTLFN_ARGS);
 
@@ -100,20 +98,16 @@ compat_sysv_modcmd(modcmd_t cmd, void *a
 
 	switch (cmd) {
 	case MODULE_CMD_INIT:
-#ifdef _MODULE
 		/* Link the system calls */
 		error = syscall_establish(NULL, compat_sysv_syscalls);
-#endif
 #ifdef COMPAT_50
 		sysvipc50_set_compat_sysctl(sysctl_kern_sysvipc50);
 #endif
 		return error;
 
 	case MODULE_CMD_FINI:
-#ifdef _MODULE
 		/* Unlink the system calls. */
 		error = syscall_disestablish(NULL, compat_sysv_syscalls);
-#endif
 #ifdef COMPAT_50
 		sysvipc50_set_compat_sysctl(NULL);
 #endif



CVS commit: src/sys/compat/common

2014-10-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Oct 20 06:56:38 UTC 2014

Modified Files:
src/sys/compat/common: vfs_syscalls_30.c

Log Message:
Memory leak, triggerable from root only.

Found by my code scanner.

ok christos@


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/compat/common/vfs_syscalls_30.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/vfs_syscalls_30.c
diff -u src/sys/compat/common/vfs_syscalls_30.c:1.34 src/sys/compat/common/vfs_syscalls_30.c:1.35
--- src/sys/compat/common/vfs_syscalls_30.c:1.34	Fri Sep  5 09:21:54 2014
+++ src/sys/compat/common/vfs_syscalls_30.c	Mon Oct 20 06:56:38 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_30.c,v 1.34 2014/09/05 09:21:54 matt Exp $	*/
+/*	$NetBSD: vfs_syscalls_30.c,v 1.35 2014/10/20 06:56:38 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_30.c,v 1.34 2014/09/05 09:21:54 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_30.c,v 1.35 2014/10/20 06:56:38 maxv Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -356,9 +356,13 @@ compat_30_sys_getfh(struct lwp *l, const
 	}
 	NDINIT(nd, LOOKUP, FOLLOW | LOCKLEAF | TRYEMULROOT, pb);
 	error = namei(nd);
-	if (error)
+	if (error) {
+		pathbuf_destroy(pb);
 		return (error);
+	}
 	vp = nd.ni_vp;
+	pathbuf_destroy(pb);
+
 	sz = sizeof(struct compat_30_fhandle);
 	error = vfs_composefh(vp, (void *)fh, sz);
 	vput(vp);



CVS commit: src/sys/compat/common

2014-10-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Oct 20 11:58:01 UTC 2014

Modified Files:
src/sys/compat/common: vfs_syscalls_30.c

Log Message:
simplify


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/compat/common/vfs_syscalls_30.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/vfs_syscalls_30.c
diff -u src/sys/compat/common/vfs_syscalls_30.c:1.35 src/sys/compat/common/vfs_syscalls_30.c:1.36
--- src/sys/compat/common/vfs_syscalls_30.c:1.35	Mon Oct 20 02:56:38 2014
+++ src/sys/compat/common/vfs_syscalls_30.c	Mon Oct 20 07:58:01 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_30.c,v 1.35 2014/10/20 06:56:38 maxv Exp $	*/
+/*	$NetBSD: vfs_syscalls_30.c,v 1.36 2014/10/20 11:58:01 christos Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_30.c,v 1.35 2014/10/20 06:56:38 maxv Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_30.c,v 1.36 2014/10/20 11:58:01 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -356,12 +356,10 @@ compat_30_sys_getfh(struct lwp *l, const
 	}
 	NDINIT(nd, LOOKUP, FOLLOW | LOCKLEAF | TRYEMULROOT, pb);
 	error = namei(nd);
-	if (error) {
-		pathbuf_destroy(pb);
-		return (error);
-	}
-	vp = nd.ni_vp;
 	pathbuf_destroy(pb);
+	if (error)
+		return error;
+	vp = nd.ni_vp;
 
 	sz = sizeof(struct compat_30_fhandle);
 	error = vfs_composefh(vp, (void *)fh, sz);



CVS commit: src/sys/compat/common

2014-03-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 24 20:08:08 UTC 2014

Modified Files:
src/sys/compat/common: kern_info_43.c

Log Message:
use cpu_getmodel() to get the model name


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/compat/common/kern_info_43.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/kern_info_43.c
diff -u src/sys/compat/common/kern_info_43.c:1.34 src/sys/compat/common/kern_info_43.c:1.35
--- src/sys/compat/common/kern_info_43.c:1.34	Sat Jan 10 21:45:46 2009
+++ src/sys/compat/common/kern_info_43.c	Mon Mar 24 16:08:08 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_info_43.c,v 1.34 2009/01/11 02:45:46 christos Exp $	*/
+/*	$NetBSD: kern_info_43.c,v 1.35 2014/03/24 20:08:08 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1991, 1993
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_info_43.c,v 1.34 2009/01/11 02:45:46 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_info_43.c,v 1.35 2014/03/24 20:08:08 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -50,6 +50,7 @@ __KERNEL_RCSID(0, $NetBSD: kern_info_43
 #include sys/unistd.h
 #include sys/resourcevar.h
 #include sys/kauth.h
+#include sys/cpu.h
 
 #include uvm/uvm_extern.h
 #include sys/sysctl.h
@@ -220,6 +221,7 @@ compat_43_sys_getkerninfo(struct lwp *l,
 			(struct bsdi_si *) SCARG(uap, where);
 			struct bsdi_si ksi;
 			struct timeval tv;
+			const char *cpu_model = cpu_getmodel();
 			char *us = (char *) usi[1];
 
 			if (usi == NULL) {



CVS commit: src/sys/compat/common

2014-01-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 28 01:29:04 UTC 2014

Modified Files:
src/sys/compat/common: vfs_syscalls_43.c

Log Message:
Fix the compat-4.3 getdirentries call (pre d_type). This is used in NetBSD-0.9.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/compat/common/vfs_syscalls_43.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/vfs_syscalls_43.c
diff -u src/sys/compat/common/vfs_syscalls_43.c:1.55 src/sys/compat/common/vfs_syscalls_43.c:1.56
--- src/sys/compat/common/vfs_syscalls_43.c:1.55	Wed Feb 20 20:39:54 2013
+++ src/sys/compat/common/vfs_syscalls_43.c	Mon Jan 27 20:29:04 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_43.c,v 1.55 2013/02/21 01:39:54 pgoyette Exp $	*/
+/*	$NetBSD: vfs_syscalls_43.c,v 1.56 2014/01/28 01:29:04 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_43.c,v 1.55 2013/02/21 01:39:54 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_43.c,v 1.56 2014/01/28 01:29:04 christos Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_compat_netbsd.h
@@ -70,6 +70,7 @@ __KERNEL_RCSID(0, $NetBSD: vfs_syscalls
 
 #include compat/sys/stat.h
 #include compat/sys/mount.h
+#include compat/sys/dirent.h
 
 #include compat/common/compat_util.h
 #include compat/common/compat_mod.h
@@ -348,112 +349,139 @@ compat_43_sys_getdirentries(struct lwp *
 		syscallarg(u_int) count;
 		syscallarg(long *) basep;
 	} */
+	struct dirent *bdp;
 	struct vnode *vp;
+	char *inp, *tbuf;		/* Current-format */
+	int len, reclen;		/* Current-format */
+	char *outp;			/* Dirent12-format */
+	int resid, old_reclen = 0;	/* Dirent12-format */
 	struct file *fp;
-	struct uio auio, kuio;
-	struct iovec aiov, kiov;
-	struct dirent *dp, *edp;
-	char *dirbuf;
-	size_t count = min(MAXBSIZE, (size_t)SCARG(uap, count));
-
-	int error, eofflag, readcnt;
+	struct uio auio;
+	struct iovec aiov;
+	struct dirent43 idb;
+	off_t off;		/* true file offset */
+	int buflen, error, eofflag, nbytes;
+	struct vattr va;
+	off_t *cookiebuf = NULL, *cookie;
+	int ncookies;
 	long loff;
-
+		 
 	/* fd_getvnode() will use the descriptor for us */
 	if ((error = fd_getvnode(SCARG(uap, fd), fp)) != 0)
 		return (error);
+
 	if ((fp-f_flag  FREAD) == 0) {
 		error = EBADF;
-		goto out;
+		goto out1;
 	}
+
 	vp = (struct vnode *)fp-f_data;
-unionread:
 	if (vp-v_type != VDIR) {
-		error = EINVAL;
-		goto out;
+		error = ENOTDIR;
+		goto out1;
 	}
-	aiov.iov_base = SCARG(uap, buf);
-	aiov.iov_len = count;
+
+	vn_lock(vp, LK_SHARED | LK_RETRY);
+	error = VOP_GETATTR(vp, va, l-l_cred);
+	VOP_UNLOCK(vp);
+	if (error)
+		goto out1;
+
+	loff = fp-f_offset;
+	nbytes = SCARG(uap, count);
+	buflen = min(MAXBSIZE, nbytes);
+	if (buflen  va.va_blocksize)
+		buflen = va.va_blocksize;
+	tbuf = malloc(buflen, M_TEMP, M_WAITOK);
+
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+	off = fp-f_offset;
+again:
+	aiov.iov_base = tbuf;
+	aiov.iov_len = buflen;
 	auio.uio_iov = aiov;
 	auio.uio_iovcnt = 1;
 	auio.uio_rw = UIO_READ;
-	auio.uio_resid = count;
-	KASSERT(l == curlwp);
-	auio.uio_vmspace = curproc-p_vmspace;
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
-	loff = auio.uio_offset = fp-f_offset;
-#	if (BYTE_ORDER != LITTLE_ENDIAN)
-		if ((vp-v_mount-mnt_iflag  IMNT_DTYPE) == 0) {
-			error = VOP_READDIR(vp, auio, fp-f_cred, eofflag,
-			(off_t **)0, (int *)0);
-			fp-f_offset = auio.uio_offset;
-		} else
-#	endif
-	{
-		kuio = auio;
-		kuio.uio_iov = kiov;
-		kiov.iov_len = count;
-		dirbuf = malloc(count, M_TEMP, M_WAITOK);
-		kiov.iov_base = dirbuf;
-		UIO_SETUP_SYSSPACE(kuio);
-		error = VOP_READDIR(vp, kuio, fp-f_cred, eofflag,
-			(off_t **)0, (int *)0);
-		fp-f_offset = kuio.uio_offset;
-		if (error == 0) {
-			readcnt = count - kuio.uio_resid;
-			edp = (struct dirent *)dirbuf[readcnt];
-			for (dp = (struct dirent *)dirbuf; dp  edp; ) {
-#if (BYTE_ORDER == LITTLE_ENDIAN)
-	/*
-	 * The expected low byte of
-	 * dp-d_namlen is our dp-d_type.
-	 * The high MBZ byte of dp-d_namlen
-	 * is our dp-d_namlen.
-	 */
-	dp-d_type = dp-d_namlen;
-	dp-d_namlen = 0;
-#else
-	/*
-	 * The dp-d_type is the high byte
-	 * of the expected dp-d_namlen,
-	 * so must be zero'ed.
-	 */
-	dp-d_type = 0;
-#endif
-if (dp-d_reclen  0) {
-	dp = (struct dirent *)
-	((char *)dp + dp-d_reclen);
-} else {
-	error = EIO;
-	break;
-}
-			}
-			if (dp = edp)
-error = uiomove(dirbuf, readcnt, auio);
-		}
-		free(dirbuf, M_TEMP);
-	}
-	VOP_UNLOCK(vp);
+	auio.uio_resid = buflen;
+	auio.uio_offset = off;
+	UIO_SETUP_SYSSPACE(auio);
+	/*
+ * First we read into the malloc'ed buffer, then
+ * we massage it into user space, one record at a time.
+ */
+	error = VOP_READDIR(vp, auio, fp-f_cred, eofflag, 

CVS commit: src/sys/compat/common

2014-01-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 24 22:11:46 UTC 2014

Modified Files:
src/sys/compat/common: vfs_syscalls_12.c

Log Message:
It is wishful thinking that vn_readdir will return dirent12 structures.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/compat/common/vfs_syscalls_12.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/vfs_syscalls_12.c
diff -u src/sys/compat/common/vfs_syscalls_12.c:1.29 src/sys/compat/common/vfs_syscalls_12.c:1.30
--- src/sys/compat/common/vfs_syscalls_12.c:1.29	Wed Jan 19 05:21:16 2011
+++ src/sys/compat/common/vfs_syscalls_12.c	Fri Jan 24 17:11:46 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_12.c,v 1.29 2011/01/19 10:21:16 tsutsui Exp $	*/
+/*	$NetBSD: vfs_syscalls_12.c,v 1.30 2014/01/24 22:11:46 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_12.c,v 1.29 2011/01/19 10:21:16 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_12.c,v 1.30 2014/01/24 22:11:46 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -56,6 +56,7 @@ __KERNEL_RCSID(0, $NetBSD: vfs_syscalls
 #include sys/syscallargs.h
 
 #include compat/sys/stat.h
+#include compat/sys/dirent.h
 
 /*
  * Convert from a new to an old stat structure.
@@ -96,28 +97,140 @@ compat_12_sys_getdirentries(struct lwp *
 		syscallarg(u_int) count;
 		syscallarg(long *) basep;
 	} */
+	struct dirent *bdp;
+	struct vnode *vp;
+	char *inp, *tbuf;		/* Current-format */
+	int len, reclen;		/* Current-format */
+	char *outp;			/* Dirent12-format */
+	int resid, old_reclen = 0;	/* Dirent12-format */
 	struct file *fp;
-	int error, done;
+	struct uio auio;
+	struct iovec aiov;
+	struct dirent12 idb;
+	off_t off;		/* true file offset */
+	int buflen, error, eofflag, nbytes;
+	struct vattr va;
+	off_t *cookiebuf = NULL, *cookie;
+	int ncookies;
 	long loff;
-
+		 
 	/* fd_getvnode() will use the descriptor for us */
 	if ((error = fd_getvnode(SCARG(uap, fd), fp)) != 0)
-		return error;
+		return (error);
+
 	if ((fp-f_flag  FREAD) == 0) {
 		error = EBADF;
-		goto out;
+		goto out1;
+	}
+
+	vp = (struct vnode *)fp-f_data;
+	if (vp-v_type != VDIR) {
+		error = ENOTDIR;
+		goto out1;
 	}
 
+	vn_lock(vp, LK_SHARED | LK_RETRY);
+	error = VOP_GETATTR(vp, va, l-l_cred);
+	VOP_UNLOCK(vp);
+	if (error)
+		goto out1;
+
 	loff = fp-f_offset;
+	nbytes = SCARG(uap, count);
+	buflen = min(MAXBSIZE, nbytes);
+	if (buflen  va.va_blocksize)
+		buflen = va.va_blocksize;
+	tbuf = malloc(buflen, M_TEMP, M_WAITOK);
+
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+	off = fp-f_offset;
+again:
+	aiov.iov_base = tbuf;
+	aiov.iov_len = buflen;
+	auio.uio_iov = aiov;
+	auio.uio_iovcnt = 1;
+	auio.uio_rw = UIO_READ;
+	auio.uio_resid = buflen;
+	auio.uio_offset = off;
+	UIO_SETUP_SYSSPACE(auio);
+	/*
+ * First we read into the malloc'ed buffer, then
+ * we massage it into user space, one record at a time.
+ */
+	error = VOP_READDIR(vp, auio, fp-f_cred, eofflag, cookiebuf,
+	ncookies);
+	if (error)
+		goto out;
+
+	inp = tbuf;
+	outp = SCARG(uap, buf);
+	resid = nbytes;
+	if ((len = buflen - auio.uio_resid) == 0)
+		goto eof;
+
+	for (cookie = cookiebuf; len  0; len -= reclen) {
+		bdp = (struct dirent *)inp;
+		reclen = bdp-d_reclen;
+		if (reclen  3)
+			panic(__func__);
+		if (bdp-d_fileno == 0) {
+			inp += reclen;	/* it is a hole; squish it out */
+			if (cookie)
+off = *cookie++;
+			else
+off += reclen;
+			continue;
+		}
+		old_reclen = _DIRENT_RECLEN(idb, bdp-d_namlen);
+		if (reclen  len || resid  old_reclen) {
+			/* entry too big for buffer, so just stop */
+			outp++;
+			break;
+		}
+		/*
+		 * Massage in place to make a Dirent12-shaped dirent (otherwise
+		 * we have to worry about touching user memory outside of
+		 * the copyout() call).
+		 */
+		idb.d_fileno = (uint32_t)bdp-d_fileno;
+		idb.d_reclen = (uint16_t)old_reclen;
+		idb.d_type = (uint8_t)bdp-d_type;
+		idb.d_namlen = (uint8_t)bdp-d_namlen;
+		strcpy(idb.d_name, bdp-d_name);
+		if ((error = copyout(idb, outp, old_reclen)))
+			goto out;
+		/* advance past this real entry */
+		inp += reclen;
+		if (cookie)
+			off = *cookie++; /* each entry points to itself */
+		else
+			off += reclen;
+		/* advance output past Dirent12-shaped entry */
+		outp += old_reclen;
+		resid -= old_reclen;
+	}
 
-	error = vn_readdir(fp, SCARG(uap, buf), UIO_USERSPACE,
-			SCARG(uap, count), done, l, 0, 0);
+	/* if we squished out the whole block, try again */
+	if (outp == SCARG(uap, buf)) {
+		if (cookiebuf)
+			free(cookiebuf, M_TEMP);
+		cookiebuf = NULL;
+		goto again;
+	}
+	fp-f_offset = off;	/* update the vnode offset */
 
-	error = copyout(loff, SCARG(uap, basep), sizeof(long));
-	*retval = done;
- out:
+eof:
+	*retval = nbytes - resid;
+out:
+	VOP_UNLOCK(vp);
+	if (cookiebuf)
+		free(cookiebuf, 

CVS commit: src/sys/compat/common

2013-12-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec 17 20:45:22 UTC 2013

Modified Files:
src/sys/compat/common: compat_util.c

Log Message:
Free pathbuf in an error path.
From Maxime Villard.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/compat/common/compat_util.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_util.c
diff -u src/sys/compat/common/compat_util.c:1.44 src/sys/compat/common/compat_util.c:1.45
--- src/sys/compat/common/compat_util.c:1.44	Fri Nov 19 06:44:35 2010
+++ src/sys/compat/common/compat_util.c	Tue Dec 17 20:45:22 2013
@@ -1,4 +1,4 @@
-/* 	$NetBSD: compat_util.c,v 1.44 2010/11/19 06:44:35 dholland Exp $	*/
+/* 	$NetBSD: compat_util.c,v 1.45 2013/12/17 20:45:22 martin Exp $	*/
 
 /*-
  * Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: compat_util.c,v 1.44 2010/11/19 06:44:35 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: compat_util.c,v 1.45 2013/12/17 20:45:22 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -139,6 +139,7 @@ emul_find_interp(struct lwp *l, struct e
 	error = namei(nd);
 	if (error != 0) {
 		epp-ep_interp = NULL;
+		pathbuf_destroy(pb);
 		return error;
 	}
 



CVS commit: src/sys/compat/common

2013-03-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 29 01:02:50 UTC 2013

Modified Files:
src/sys/compat/common: Makefile compat_mod.c kern_time_50.c
Added Files:
src/sys/compat/common: kern_time_60.c

Log Message:
compat glue for new lwp_park()


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/compat/common/Makefile
cvs rdiff -u -r1.18 -r1.19 src/sys/compat/common/compat_mod.c
cvs rdiff -u -r1.25 -r1.26 src/sys/compat/common/kern_time_50.c
cvs rdiff -u -r0 -r1.1 src/sys/compat/common/kern_time_60.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/Makefile
diff -u src/sys/compat/common/Makefile:1.50 src/sys/compat/common/Makefile:1.51
--- src/sys/compat/common/Makefile:1.50	Fri Oct 19 12:55:22 2012
+++ src/sys/compat/common/Makefile	Thu Mar 28 21:02:49 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.50 2012/10/19 16:55:22 apb Exp $
+#	$NetBSD: Makefile,v 1.51 2013/03/29 01:02:49 christos Exp $
 
 LIB=		compat
 NOPIC=		# defined
@@ -45,7 +45,7 @@ SRCS+=	kern_time_50.c kern_select_50.c r
 	vfs_syscalls_50.c  uipc_syscalls_50.c
 
 # Compatibility code for NetBSD 6.0
-SRCS+=	kern_sa_60.c tty_60.c
+SRCS+=	kern_sa_60.c tty_60.c kern_time_60.c
 
 # really, all machines where sizeof(int) != sizeof(long) (LP64)
 .if (${MACHINE_ARCH} != alpha  ${MACHINE_ARCH} != sparc64 \

Index: src/sys/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.18 src/sys/compat/common/compat_mod.c:1.19
--- src/sys/compat/common/compat_mod.c:1.18	Thu Feb 21 09:13:01 2013
+++ src/sys/compat/common/compat_mod.c	Thu Mar 28 21:02:49 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.18 2013/02/21 14:13:01 christos Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.19 2013/03/29 01:02:49 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: compat_mod.c,v 1.18 2013/02/21 14:13:01 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: compat_mod.c,v 1.19 2013/03/29 01:02:49 christos Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -243,6 +243,9 @@ static const struct syscall_package comp
 	{ SYS_compat_50_aio_suspend, 0, (sy_call_t *)compat_50_sys_aio_suspend },
 	{ SYS_compat_50_quotactl, 0, (sy_call_t *)compat_50_sys_quotactl },
 #endif
+#if defined(COMPAT_60)
+	{ SYS_compat_60__lwp_park, 0, (sy_call_t *)compat_60_sys__lwp_park },
+#endif
 	{ 0, 0, NULL },
 };
 

Index: src/sys/compat/common/kern_time_50.c
diff -u src/sys/compat/common/kern_time_50.c:1.25 src/sys/compat/common/kern_time_50.c:1.26
--- src/sys/compat/common/kern_time_50.c:1.25	Wed Feb 20 20:39:54 2013
+++ src/sys/compat/common/kern_time_50.c	Thu Mar 28 21:02:49 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time_50.c,v 1.25 2013/02/21 01:39:54 pgoyette Exp $	*/
+/*	$NetBSD: kern_time_50.c,v 1.26 2013/03/29 01:02:49 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_time_50.c,v 1.25 2013/02/21 01:39:54 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_time_50.c,v 1.26 2013/03/29 01:02:49 christos Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_aio.h
@@ -379,7 +379,7 @@ compat_50_sys__lwp_park(struct lwp *l,
 			return error;
 	}
 
-	return lwp_park(tsp, SCARG(uap, hint));
+	return lwp_park(CLOCK_REALTIME, TIMER_ABSTIME, tsp, SCARG(uap, hint));
 }
 
 int

Added files:

Index: src/sys/compat/common/kern_time_60.c
diff -u /dev/null src/sys/compat/common/kern_time_60.c:1.1
--- /dev/null	Thu Mar 28 21:02:50 2013
+++ src/sys/compat/common/kern_time_60.c	Thu Mar 28 21:02:50 2013
@@ -0,0 +1,74 @@
+/*	$NetBSD: kern_time_60.c,v 1.1 2013/03/29 01:02:50 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

CVS commit: src/sys/compat/common

2013-02-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb 21 10:22:04 UTC 2013

Modified Files:
src/sys/compat/common: compat_mod.c

Log Message:
Wrap sysctl_teardown(compat_clog) with the appropriate #if defined()s


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/compat/common/compat_mod.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.16 src/sys/compat/common/compat_mod.c:1.17
--- src/sys/compat/common/compat_mod.c:1.16	Thu Feb 21 01:39:54 2013
+++ src/sys/compat/common/compat_mod.c	Thu Feb 21 10:22:04 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.16 2013/02/21 01:39:54 pgoyette Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.17 2013/02/21 10:22:04 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: compat_mod.c,v 1.16 2013/02/21 01:39:54 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: compat_mod.c,v 1.17 2013/02/21 10:22:04 skrll Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -360,5 +360,7 @@ void
 compat_sysctl_fini(void)
 {
  
+#if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_50)
 sysctl_teardown(compat_clog);
+#endif
 }



CVS commit: src/sys/compat/common

2013-02-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 21 14:13:01 UTC 2013

Modified Files:
src/sys/compat/common: compat_mod.c

Log Message:
remove empty #if


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/compat/common/compat_mod.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.17 src/sys/compat/common/compat_mod.c:1.18
--- src/sys/compat/common/compat_mod.c:1.17	Thu Feb 21 05:22:04 2013
+++ src/sys/compat/common/compat_mod.c	Thu Feb 21 09:13:01 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.17 2013/02/21 10:22:04 skrll Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.18 2013/02/21 14:13:01 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: compat_mod.c,v 1.17 2013/02/21 10:22:04 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: compat_mod.c,v 1.18 2013/02/21 14:13:01 christos Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -246,9 +246,6 @@ static const struct syscall_package comp
 	{ 0, 0, NULL },
 };
 
-#if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_50)
-#endif
-
 static int
 compat_modcmd(modcmd_t cmd, void *arg)
 {



CVS commit: src/sys/compat/common

2013-01-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 22 01:47:21 UTC 2013

Modified Files:
src/sys/compat/common: compat_mod.c

Log Message:
Simplify the ifdef mess. No functional context.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/compat/common/compat_mod.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.14 src/sys/compat/common/compat_mod.c:1.15
--- src/sys/compat/common/compat_mod.c:1.14	Mon Aug  8 19:44:06 2011
+++ src/sys/compat/common/compat_mod.c	Mon Jan 21 20:47:20 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.14 2011/08/08 23:44:06 jakllsch Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.15 2013/01/22 01:47:20 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: compat_mod.c,v 1.14 2011/08/08 23:44:06 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: compat_mod.c,v 1.15 2013/01/22 01:47:20 christos Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -63,7 +63,8 @@ MODULE(MODULE_CLASS_MISC, compat, NULL);
 int	ttcompat(struct tty *, u_long, void *, int, struct lwp *);
 
 #ifdef COMPAT_16
-#if !(defined(__amd64__)  !defined(COMPAT_NETBSD32))
+#if !defined(__amd64__) || defined(COMPAT_NETBSD32)
+#define COMPAT_SIGCONTEXT
 extern char sigcode[], esigcode[];
 struct uvm_object *emul_netbsd_object;
 #endif
@@ -159,7 +160,7 @@ static const struct syscall_package comp
 #endif
 
 #if defined(COMPAT_16)
-#if !(defined(__amd64__)  !defined(COMPAT_NETBSD32))
+#if defined(COMPAT_SIGCONTEXT)
 	{ SYS_compat_16___sigaction14, 0, (sy_call_t *)compat_16_sys___sigaction14 },
 	{ SYS_compat_16___sigreturn14, 0, (sy_call_t *)compat_16_sys___sigreturn14 },
 #endif
@@ -258,7 +259,7 @@ compat_modcmd(modcmd_t cmd, void *arg)
 		ttcompatvec = ttcompat;
 #endif
 #ifdef COMPAT_16
-#if !(defined(__amd64__)  !defined(COMPAT_NETBSD32))
+#if defined(COMPAT_SIGCONTEXT)
 		KASSERT(emul_netbsd.e_sigobject == NULL);
 		rw_enter(exec_lock, RW_WRITER);
 		emul_netbsd.e_sigcode = sigcode;
@@ -311,7 +312,7 @@ compat_modcmd(modcmd_t cmd, void *arg)
 		}
 #endif
 #ifdef COMPAT_16
-#if !(defined(__amd64__)  !defined(COMPAT_NETBSD32))
+#if defined(COMPAT_SIGCONTEXT)
 		/*
 		 * The sigobject may persist if still in use, but
 		 * is reference counted so will die eventually.



CVS commit: src/sys/compat/common

2012-10-19 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Fri Oct 19 17:32:20 UTC 2012

Modified Files:
src/sys/compat/common: tty_60.c

Log Message:
This file getscompiled even if COMPAT_60 is not defined, so
protect most of the contents with #ifdef COMPAT_60


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/compat/common/tty_60.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/tty_60.c
diff -u src/sys/compat/common/tty_60.c:1.1 src/sys/compat/common/tty_60.c:1.2
--- src/sys/compat/common/tty_60.c:1.1	Fri Oct 19 16:55:22 2012
+++ src/sys/compat/common/tty_60.c	Fri Oct 19 17:32:20 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty_60.c,v 1.1 2012/10/19 16:55:22 apb Exp $	*/
+/*	$NetBSD: tty_60.c,v 1.2 2012/10/19 17:32:20 apb Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tty_60.c,v 1.1 2012/10/19 16:55:22 apb Exp $);
+__KERNEL_RCSID(0, $NetBSD: tty_60.c,v 1.2 2012/10/19 17:32:20 apb Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_compat_netbsd.h
@@ -45,6 +45,8 @@ __KERNEL_RCSID(0, $NetBSD: tty_60.c,v 1
 #include sys/tty.h
 #include compat/sys/ttycom.h
 
+#ifdef COMPAT_60
+
 /* convert struct ptmget to struct compat_60_ptmget */
 static int
 ptmget_to_ptmget60(struct ptmget *pg, struct compat_60_ptmget *pg60)
@@ -112,3 +114,5 @@ compat_60_ptmioctl(dev_t dev, u_long cmd
 		return EPASSTHROUGH;
 	}
 }
+
+#endif /* COMPAT_60 */



CVS commit: src/sys/compat/common

2012-10-19 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Fri Oct 19 19:44:06 UTC 2012

Modified Files:
src/sys/compat/common: tty_60.c

Log Message:
Also copy the sfd element of struct ptmget.  This somehow
got lost between testing and commit.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/common/tty_60.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/tty_60.c
diff -u src/sys/compat/common/tty_60.c:1.2 src/sys/compat/common/tty_60.c:1.3
--- src/sys/compat/common/tty_60.c:1.2	Fri Oct 19 17:32:20 2012
+++ src/sys/compat/common/tty_60.c	Fri Oct 19 19:44:06 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty_60.c,v 1.2 2012/10/19 17:32:20 apb Exp $	*/
+/*	$NetBSD: tty_60.c,v 1.3 2012/10/19 19:44:06 apb Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tty_60.c,v 1.2 2012/10/19 17:32:20 apb Exp $);
+__KERNEL_RCSID(0, $NetBSD: tty_60.c,v 1.3 2012/10/19 19:44:06 apb Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_compat_netbsd.h
@@ -53,6 +53,7 @@ ptmget_to_ptmget60(struct ptmget *pg, st
 {
 	memset(pg60, 0, sizeof(*pg60));
 	pg60-cfd = pg-cfd;
+	pg60-sfd = pg-sfd;
 	strlcpy(pg60-cn, pg-cn, sizeof(pg60-cn));
 	strlcpy(pg60-sn, pg-sn, sizeof(pg60-sn));
 	if (strlen(pg-cn) = sizeof(pg60-cn)



CVS commit: src/sys/compat/common

2012-08-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Aug  3 07:51:22 UTC 2012

Modified Files:
src/sys/compat/common: rndpseudo_50.c

Log Message:
Only do COMPAT_NETBSD32 stuff if _LP64


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/compat/common/rndpseudo_50.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/rndpseudo_50.c
diff -u src/sys/compat/common/rndpseudo_50.c:1.1 src/sys/compat/common/rndpseudo_50.c:1.2
--- src/sys/compat/common/rndpseudo_50.c:1.1	Mon Dec 19 21:53:52 2011
+++ src/sys/compat/common/rndpseudo_50.c	Fri Aug  3 07:51:21 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rndpseudo_50.c,v 1.1 2011/12/19 21:53:52 apb Exp $	*/
+/*	$NetBSD: rndpseudo_50.c,v 1.2 2012/08/03 07:51:21 matt Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rndpseudo_50.c,v 1.1 2011/12/19 21:53:52 apb Exp $);
+__KERNEL_RCSID(0, $NetBSD: rndpseudo_50.c,v 1.2 2012/08/03 07:51:21 matt Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_compat_netbsd.h
@@ -57,7 +57,7 @@ rndsource_to_rndsource50(rndsource_t *r,
 	r50-flags = r-flags;
 }
 
-#ifdef COMPAT_NETBSD32
+#if defined(COMPAT_NETBSD32)  defined(_LP64)
 /*
  * Convert from rndsource_t to rndsource50_32_t, for the results from
  * RNDGETNUM50_32 and RNDGETNAME50_32.
@@ -110,7 +110,7 @@ compat_50_rnd_ioctl(struct file *fp, u_l
 		break;
 	}
 
-#ifdef COMPAT_NETBSD32
+#if defined(COMPAT_NETBSD32)  defined(_LP64)
 	case RNDGETSRCNUM50_32:
 	{
 		rndstat_t rstbuf = {.start = 0};
@@ -154,7 +154,7 @@ compat_50_rnd_ioctl(struct file *fp, u_l
 		break;
 	}
 
-#ifdef COMPAT_NETBSD32
+#if defined(COMPAT_NETBSD32)  defined(_LP64)
 	case RNDGETSRCNAME50_32:
 	{
 		rndstat_name_t rstnmbuf = {.name[0] = 0};



CVS commit: src/sys/compat/common

2012-02-19 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Feb 19 17:40:46 UTC 2012

Modified Files:
src/sys/compat/common: Makefile
Added Files:
src/sys/compat/common: kern_sa_60.c

Log Message:
Add compat_60 stub for the SA syscall (all which just call sys_nosys).


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/compat/common/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/compat/common/kern_sa_60.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/Makefile
diff -u src/sys/compat/common/Makefile:1.48 src/sys/compat/common/Makefile:1.49
--- src/sys/compat/common/Makefile:1.48	Mon Dec 19 21:53:52 2011
+++ src/sys/compat/common/Makefile	Sun Feb 19 17:40:46 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.48 2011/12/19 21:53:52 apb Exp $
+#	$NetBSD: Makefile,v 1.49 2012/02/19 17:40:46 matt Exp $
 
 LIB=		compat
 NOPIC=		# defined
@@ -44,6 +44,9 @@ SRCS+=	kern_time_50.c kern_select_50.c r
 	sysv_ipc_50.c sysv_msg_50.c sysv_sem_50.c sysv_shm_50.c \
 	vfs_syscalls_50.c  uipc_syscalls_50.c
 
+# Compatibility code for NetBSD 6.0
+SRCS+=	kern_sa_60.c
+
 # really, all machines where sizeof(int) != sizeof(long) (LP64)
 .if (${MACHINE_ARCH} != alpha  ${MACHINE_ARCH} != sparc64 \
${MACHINE_ARCH} != x86_64)

Added files:

Index: src/sys/compat/common/kern_sa_60.c
diff -u /dev/null src/sys/compat/common/kern_sa_60.c:1.1
--- /dev/null	Sun Feb 19 17:40:46 2012
+++ src/sys/compat/common/kern_sa_60.c	Sun Feb 19 17:40:46 2012
@@ -0,0 +1,84 @@
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+
+__KERNEL_RCSID(1, $NetBSD: kern_sa_60.c,v 1.1 2012/02/19 17:40:46 matt Exp $);
+
+#include sys/systm.h
+#include sys/syscall.h
+#include sys/syscallargs.h
+
+int
+compat_60_sys_sa_register(lwp_t *l,
+	const struct compat_60_sys_sa_register_args *uap,
+	register_t *retval)
+{
+	return sys_nosys(l, uap, retval);
+}
+
+int
+compat_60_sys_sa_stacks(lwp_t *l,
+	const struct compat_60_sys_sa_stacks_args *uap,
+	register_t *retval)
+{
+	return sys_nosys(l, uap, retval);
+}
+
+int
+compat_60_sys_sa_enable(lwp_t *l,
+	const void *uap,
+	register_t *retval)
+{
+	return sys_nosys(l, uap, retval);
+}
+
+int
+compat_60_sys_sa_setconcurrency(lwp_t *l,
+	const struct compat_60_sys_sa_setconcurrency_args *uap,
+	register_t *retval)
+{
+	return sys_nosys(l, uap, retval);
+}
+
+int
+compat_60_sys_sa_yield(lwp_t *l,
+	const void *uap,
+	register_t *retval)
+{
+	return sys_nosys(l, uap, retval);
+}
+
+int
+compat_60_sys_sa_preempt(lwp_t *l,
+	const struct compat_60_sys_sa_preempt_args *uap,
+	register_t *retval)
+{
+	return sys_nosys(l, uap, retval);
+}



CVS commit: src/sys/compat/common

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:19:04 UTC 2012

Modified Files:
src/sys/compat/common: vfs_syscalls_50.c

Log Message:
Remove the proplib goop from the COMPAT_50 code for the old quotactl;
use the new VFS_QUOTACTL instead.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/compat/common/vfs_syscalls_50.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/vfs_syscalls_50.c
diff -u src/sys/compat/common/vfs_syscalls_50.c:1.13 src/sys/compat/common/vfs_syscalls_50.c:1.14
--- src/sys/compat/common/vfs_syscalls_50.c:1.13	Sun Jan 29 07:16:00 2012
+++ src/sys/compat/common/vfs_syscalls_50.c	Sun Jan 29 07:19:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_50.c,v 1.13 2012/01/29 07:16:00 dholland Exp $	*/
+/*	$NetBSD: vfs_syscalls_50.c,v 1.14 2012/01/29 07:19:04 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_50.c,v 1.13 2012/01/29 07:16:00 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_50.c,v 1.14 2012/01/29 07:19:04 dholland Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -63,7 +63,7 @@ __KERNEL_RCSID(0, $NetBSD: vfs_syscalls
 #include ufs/lfs/lfs_extern.h
 
 #include sys/quota.h
-#include quota/quotaprop.h
+#include sys/quotactl.h
 #include ufs/ufs/quota1.h
 
 #include compat/common/compat_util.h
@@ -329,222 +329,115 @@ compat_50_sys_quotactl(struct lwp *l, co
 	} */
 	struct mount *mp;
 	int error;
-	uint8_t error8;
 	struct vnode *vp;
 	int q1cmd = SCARG(uap, cmd);
-	prop_dictionary_t dict, data, cmd;
-	prop_array_t cmds, datas;
 	char *bufpath;
 	struct dqblk dqblk;
-	struct quotaval qv[QUOTA_NLIMITS];
-	uint64_t *values[QUOTA_NLIMITS];
+	struct quotakey key;
+	struct quotaval blocks, files;
+	struct quotastat qstat;
+	struct vfs_quotactl_args args;
 	int idtype;
 
-	values[QUOTA_LIMIT_BLOCK] = qv[QUOTA_LIMIT_BLOCK].qv_hardlimit;
-	values[QUOTA_LIMIT_FILE] = qv[QUOTA_LIMIT_FILE].qv_hardlimit;
-
 	error = namei_simple_user(SCARG(uap, path),
 NSM_FOLLOW_TRYEMULROOT, vp);
 	if (error != 0)
 		return (error);   
-	error = ENOMEM;
+
 	mp = vp-v_mount;
-	if ((dict = quota_prop_create()) == NULL)
-		goto out;
-	if ((cmds = prop_array_create()) == NULL)
-		goto out_dict;
-	if ((datas = prop_array_create()) == NULL)
-		goto out_cmds;
+	idtype = quota_idtype_from_ufs(q1cmd  SUBCMDMASK);
 
-	switch((q1cmd  ~SUBCMDMASK)  SUBCMDSHIFT) {
+	switch ((q1cmd  ~SUBCMDMASK)  SUBCMDSHIFT) {
 	case Q_QUOTAON:
-		data = prop_dictionary_create();
-		if (data == NULL)
-			goto out_datas;
 		bufpath = malloc(PATH_MAX * sizeof(char), M_TEMP, M_WAITOK);
-		if (bufpath == NULL)
-			goto out_data;
 		error = copyinstr(SCARG(uap, arg), bufpath, PATH_MAX, NULL);
 		if (error != 0) {
 			free(bufpath, M_TEMP);
-			goto out_data;
+			break;
 		}
-		if (!prop_dictionary_set_cstring(data, quotafile, bufpath))
-			error = ENOMEM;
+
+		args.qc_op = QUOTACTL_QUOTAON;
+		args.u.quotaon.qc_quotafile = bufpath;
+		args.u.quotaon.qc_idtype = idtype;
+		error = VFS_QUOTACTL(mp, args);
+
 		free(bufpath, M_TEMP);
-		if (error)
-			goto out_data;
-		error = ENOMEM;
-		if (!prop_array_add_and_rel(datas, data))
-			goto out_datas;
-		idtype = quota_idtype_from_ufs(q1cmd  SUBCMDMASK);
-		if (!quota_prop_add_command(cmds, quotaon,
-		ufs_quota_class_names[idtype],
-		datas))
-			goto out_cmds;
-		goto do_quotaonoff;
+		break;
 
 	case Q_QUOTAOFF:
-		error = ENOMEM;
-		idtype = quota_idtype_from_ufs(q1cmd  SUBCMDMASK);
-		if (!quota_prop_add_command(cmds, quotaoff,
-		ufs_quota_class_names[idtype],
-		datas))
-			goto out_cmds;
-do_quotaonoff:
-		if (!prop_dictionary_set_and_rel(dict, commands, cmds))
-			goto out_dict;
-		error = vfs_quotactl(mp, dict);
-		if (error)
-			goto out_dict;
-		if ((error = quota_get_cmds(dict, cmds)) != 0)
-			goto out_dict;
-		cmd = prop_array_get(cmds, 0);
-		if (cmd == NULL) {
-			error = EINVAL;
-			goto out_dict;
-		}
-		if (!prop_dictionary_get_int8(cmd, return, error8)) {
-			error = EINVAL;
-			goto out_dict;
-		}
-		error = error8;
-		goto out_dict;
+		args.qc_op = QUOTACTL_QUOTAOFF;
+		args.u.quotaoff.qc_idtype = idtype;
+		error = VFS_QUOTACTL(mp, args);
+		break;
 
 	case Q_GETQUOTA:
-		error = ENOMEM;
-		data = prop_dictionary_create();
-		if (data == NULL)
-			goto out_datas;
-		if (!prop_dictionary_set_uint32(data, id, SCARG(uap, uid)))
-			goto out_data;
-		if (!prop_array_add_and_rel(datas, data))
-			goto out_datas;
-		idtype = quota_idtype_from_ufs(q1cmd  SUBCMDMASK);
-		if (!quota_prop_add_command(cmds, get,
-		ufs_quota_class_names[idtype],
-		datas))
-			goto out_cmds;
-		if (!prop_dictionary_set_and_rel(dict, commands, cmds))
-			goto out_dict;
-		error = vfs_quotactl(mp, dict);
-		if (error)
-			goto out_dict;
-		if ((error = 

CVS commit: src/sys/compat/common

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:19:48 UTC 2012

Modified Files:
src/sys/compat/common: vfs_syscalls_50.c

Log Message:
Some further tidying for the COMPAT_50 quotactl code. Mostly cosmetic,
but also use PNBUF_GET() and PNBUF_PUT() for a path buffer instead of
malloc with M_TEMP.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/compat/common/vfs_syscalls_50.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/vfs_syscalls_50.c
diff -u src/sys/compat/common/vfs_syscalls_50.c:1.14 src/sys/compat/common/vfs_syscalls_50.c:1.15
--- src/sys/compat/common/vfs_syscalls_50.c:1.14	Sun Jan 29 07:19:04 2012
+++ src/sys/compat/common/vfs_syscalls_50.c	Sun Jan 29 07:19:48 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_50.c,v 1.14 2012/01/29 07:19:04 dholland Exp $	*/
+/*	$NetBSD: vfs_syscalls_50.c,v 1.15 2012/01/29 07:19:48 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_50.c,v 1.14 2012/01/29 07:19:04 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_50.c,v 1.15 2012/01/29 07:19:48 dholland Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -51,7 +51,6 @@ __KERNEL_RCSID(0, $NetBSD: vfs_syscalls
 #include sys/proc.h
 #include sys/uio.h
 #include sys/dirent.h
-#include sys/malloc.h
 #include sys/kauth.h
 #include sys/time.h
 #include sys/vfs_syscalls.h
@@ -327,17 +326,17 @@ compat_50_sys_quotactl(struct lwp *l, co
 		syscallarg(int) uid;
 		syscallarg(void *) arg; 
 	} */
-	struct mount *mp;
-	int error;
 	struct vnode *vp;
-	int q1cmd = SCARG(uap, cmd);
-	char *bufpath;
+	struct mount *mp;
+	int q1cmd;
+	int idtype;
+	char *qfile;
 	struct dqblk dqblk;
 	struct quotakey key;
 	struct quotaval blocks, files;
 	struct quotastat qstat;
 	struct vfs_quotactl_args args;
-	int idtype;
+	int error;
 
 	error = namei_simple_user(SCARG(uap, path),
 NSM_FOLLOW_TRYEMULROOT, vp);
@@ -345,23 +344,24 @@ compat_50_sys_quotactl(struct lwp *l, co
 		return (error);   
 
 	mp = vp-v_mount;
+	q1cmd = SCARG(uap, cmd);
 	idtype = quota_idtype_from_ufs(q1cmd  SUBCMDMASK);
 
 	switch ((q1cmd  ~SUBCMDMASK)  SUBCMDSHIFT) {
 	case Q_QUOTAON:
-		bufpath = malloc(PATH_MAX * sizeof(char), M_TEMP, M_WAITOK);
-		error = copyinstr(SCARG(uap, arg), bufpath, PATH_MAX, NULL);
+		qfile = PNBUF_GET();
+		error = copyinstr(SCARG(uap, arg), qfile, PATH_MAX, NULL);
 		if (error != 0) {
-			free(bufpath, M_TEMP);
+			PNBUF_PUT(qfile);
 			break;
 		}
 
 		args.qc_op = QUOTACTL_QUOTAON;
-		args.u.quotaon.qc_quotafile = bufpath;
+		args.u.quotaon.qc_quotafile = qfile;
 		args.u.quotaon.qc_idtype = idtype;
 		error = VFS_QUOTACTL(mp, args);
 
-		free(bufpath, M_TEMP);
+		PNBUF_PUT(qfile);
 		break;
 
 	case Q_QUOTAOFF:



CVS commit: src/sys/compat/common

2012-01-04 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Wed Jan  4 14:31:17 UTC 2012

Modified Files:
src/sys/compat/common: kern_time_50.c

Log Message:
Instead of calling clockctl_ioctl directly, lookup the cdevsw and
call its d_ioctl function.  This should fix an undefined reference to
`clockctlioctl' when you build a kernel that has COMPAT_50 but does not
have pseudo-device clockctl.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/compat/common/kern_time_50.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/kern_time_50.c
diff -u src/sys/compat/common/kern_time_50.c:1.21 src/sys/compat/common/kern_time_50.c:1.22
--- src/sys/compat/common/kern_time_50.c:1.21	Wed Jan  4 13:45:55 2012
+++ src/sys/compat/common/kern_time_50.c	Wed Jan  4 14:31:17 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time_50.c,v 1.21 2012/01/04 13:45:55 apb Exp $	*/
+/*	$NetBSD: kern_time_50.c,v 1.22 2012/01/04 14:31:17 apb Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_time_50.c,v 1.21 2012/01/04 13:45:55 apb Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_time_50.c,v 1.22 2012/01/04 14:31:17 apb Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_aio.h
@@ -38,6 +38,7 @@ __KERNEL_RCSID(0, $NetBSD: kern_time_50
 #endif
 
 #include sys/param.h
+#include sys/conf.h
 #include sys/systm.h
 #include sys/namei.h
 #include sys/filedesc.h
@@ -625,6 +626,10 @@ compat50_clockctlioctl(dev_t dev, u_long
 struct lwp *l)
 {
 	int error = 0;
+	const struct cdevsw *cd = cdevsw_lookup(dev);
+
+	if (cd == NULL || cd-d_ioctl == NULL)
+		return ENXIO;
 
 	switch (cmd) {
 	case CLOCKCTL_OSETTIMEOFDAY: {
@@ -672,7 +677,7 @@ compat50_clockctlioctl(dev_t dev, u_long
 	}
 	case CLOCKCTL_ONTP_ADJTIME:
 		/* The ioctl number changed but the data did not change. */
-		error = clockctlioctl(dev, CLOCKCTL_NTP_ADJTIME,
+		error = (cd-d_ioctl)(dev, CLOCKCTL_NTP_ADJTIME,
 		data, flags, l);
 		break;
 	default:



CVS commit: src/sys/compat/common

2011-08-11 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Aug 11 21:23:09 UTC 2011

Modified Files:
src/sys/compat/common: Makefile

Log Message:
add libcompat.o/.po targets for COMPAT_AS=obj


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/compat/common/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/Makefile
diff -u src/sys/compat/common/Makefile:1.46 src/sys/compat/common/Makefile:1.47
--- src/sys/compat/common/Makefile:1.46	Mon Jan 17 15:57:04 2011
+++ src/sys/compat/common/Makefile	Thu Aug 11 21:23:09 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.46 2011/01/17 15:57:04 pooka Exp $
+#	$NetBSD: Makefile,v 1.47 2011/08/11 21:23:09 jmcneill Exp $
 
 LIB=		compat
 NOPIC=		# defined
@@ -57,5 +57,15 @@
 .undef DESTDIR
 .include bsd.lib.mk
 
+lib${LIB}.o:: ${OBJS}
+	@echo building standard ${LIB} library
+	@rm -f lib${LIB}.o
+	@${LD} -r -o lib${LIB}.o `NM=${NM} ${LORDER} ${OBJS} | ${TSORT}`
+
+lib${LIB}.po:: ${POBJS}
+	@echo building profiled ${LIB} library
+	@rm -f lib${LIB}.po
+	@${LD} -r -o lib${LIB}.po `NM=${NM} ${LORDER} ${POBJS} | ${TSORT}`
+
 showsources: ${SRCS}
 	@echo ${.ALLSRC}



CVS commit: src/sys/compat/common

2011-08-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Aug  8 23:44:06 UTC 2011

Modified Files:
src/sys/compat/common: compat_mod.c

Log Message:
COMPAT_16 code only exists on amd64 in the presence of COMPAT_NETBSD32.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/compat/common/compat_mod.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.13 src/sys/compat/common/compat_mod.c:1.14
--- src/sys/compat/common/compat_mod.c:1.13	Sun Mar  6 17:08:33 2011
+++ src/sys/compat/common/compat_mod.c	Mon Aug  8 23:44:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.13 2011/03/06 17:08:33 bouyer Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.14 2011/08/08 23:44:06 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: compat_mod.c,v 1.13 2011/03/06 17:08:33 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: compat_mod.c,v 1.14 2011/08/08 23:44:06 jakllsch Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -63,9 +63,11 @@
 int	ttcompat(struct tty *, u_long, void *, int, struct lwp *);
 
 #ifdef COMPAT_16
+#if !(defined(__amd64__)  !defined(COMPAT_NETBSD32))
 extern char sigcode[], esigcode[];
 struct uvm_object *emul_netbsd_object;
 #endif
+#endif
 
 extern krwlock_t exec_lock;
 extern krwlock_t ttcompat_lock;
@@ -157,9 +159,11 @@
 #endif
 
 #if defined(COMPAT_16)
+#if !(defined(__amd64__)  !defined(COMPAT_NETBSD32))
 	{ SYS_compat_16___sigaction14, 0, (sy_call_t *)compat_16_sys___sigaction14 },
 	{ SYS_compat_16___sigreturn14, 0, (sy_call_t *)compat_16_sys___sigreturn14 },
 #endif
+#endif
 
 #if defined(COMPAT_20)
 	{ SYS_compat_20_fhstatfs, 0, (sy_call_t *)compat_20_sys_fhstatfs },
@@ -254,6 +258,7 @@
 		ttcompatvec = ttcompat;
 #endif
 #ifdef COMPAT_16
+#if !(defined(__amd64__)  !defined(COMPAT_NETBSD32))
 		KASSERT(emul_netbsd.e_sigobject == NULL);
 		rw_enter(exec_lock, RW_WRITER);
 		emul_netbsd.e_sigcode = sigcode;
@@ -263,6 +268,7 @@
 		KASSERT(sendsig_sigcontext_vec == NULL);
 		sendsig_sigcontext_vec = sendsig_sigcontext;
 #endif
+#endif
 #if defined(COMPAT_09) || defined(COMPAT_43)
 		compat_sysctl_init();
 #endif
@@ -305,6 +311,7 @@
 		}
 #endif
 #ifdef COMPAT_16
+#if !(defined(__amd64__)  !defined(COMPAT_NETBSD32))
 		/*
 		 * The sigobject may persist if still in use, but
 		 * is reference counted so will die eventually.
@@ -319,6 +326,7 @@
 		emul_netbsd.e_esigcode = NULL;
 		emul_netbsd.e_sigobject = NULL;
 		rw_exit(exec_lock);
+#endif
 #endif	/* COMPAT_16 */
 #if defined(COMPAT_09) || defined(COMPAT_43)
 		compat_sysctl_fini();



CVS commit: src/sys/compat/common

2011-06-05 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Sun Jun  5 09:37:10 UTC 2011

Modified Files:
src/sys/compat/common: compat_sigaltstack.h

Log Message:
Use 'curlwp' here insteald of the 'l' - which isn't passsed as an arg
to the #define, but will always be curlwp.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/common/compat_sigaltstack.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_sigaltstack.h
diff -u src/sys/compat/common/compat_sigaltstack.h:1.2 src/sys/compat/common/compat_sigaltstack.h:1.3
--- src/sys/compat/common/compat_sigaltstack.h:1.2	Sat Jun 16 20:04:27 2007
+++ src/sys/compat/common/compat_sigaltstack.h	Sun Jun  5 09:37:10 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: compat_sigaltstack.h,v 1.2 2007/06/16 20:04:27 dsl Exp $*/
+/*  $NetBSD: compat_sigaltstack.h,v 1.3 2011/06/05 09:37:10 dsl Exp $*/
 
 /* Wrapper for calling sigaltstack1() from compat (or other) code */
 
@@ -34,7 +34,7 @@
 			| (css.ss_flags  ss_disable ? SS_DISABLE : 0); \
 	} \
 \
-	error = sigaltstack1(l, SCARG_COMPAT_PTR(uap, nss) ? nss : 0, \
+	error = sigaltstack1(curlwp, SCARG_COMPAT_PTR(uap, nss) ? nss : 0, \
 SCARG_COMPAT_PTR(uap, oss) ? oss : 0); \
 	if (error) \
 		return (error); \



CVS commit: src/sys/compat/common

2011-03-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar  4 01:36:56 UTC 2011

Modified Files:
src/sys/compat/common: kern_time_50.c

Log Message:
PR/44674: Taylor R Campbell: Fix compat copyin and copyout routines which
were obviously broken.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/compat/common/kern_time_50.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/kern_time_50.c
diff -u src/sys/compat/common/kern_time_50.c:1.18 src/sys/compat/common/kern_time_50.c:1.19
--- src/sys/compat/common/kern_time_50.c:1.18	Wed Jan 19 05:21:16 2011
+++ src/sys/compat/common/kern_time_50.c	Thu Mar  3 20:36:56 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time_50.c,v 1.18 2011/01/19 10:21:16 tsutsui Exp $	*/
+/*	$NetBSD: kern_time_50.c,v 1.19 2011/03/04 01:36:56 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_time_50.c,v 1.18 2011/01/19 10:21:16 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_time_50.c,v 1.19 2011/03/04 01:36:56 christos Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_aio.h
@@ -453,8 +453,10 @@
 tscopyin(const void *u, void *s, size_t len)
 {
 	struct timespec50 ts50;
-	KASSERT(len == sizeof(ts50));
-	int error = copyin(u, ts50, len);
+	int error;
+
+	KASSERT(len == sizeof(struct timespec));
+	error = copyin(u, ts50, sizeof(ts50));
 	if (error)
 		return error;
 	timespec50_to_timespec(ts50, s);
@@ -465,12 +467,10 @@
 tscopyout(const void *s, void *u, size_t len)
 {
 	struct timespec50 ts50;
-	KASSERT(len == sizeof(ts50));
+
+	KASSERT(len == sizeof(struct timespec));
 	timespec_to_timespec50(s, ts50);
-	int error = copyout(ts50, u, len);
-	if (error)
-		return error;
-	return 0;
+	return copyout(ts50, u, sizeof(ts50));
 }
 
 int



CVS commit: src/sys/compat/common

2011-01-19 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Jan 19 10:21:17 UTC 2011

Modified Files:
src/sys/compat/common: compat_mod.c if_43.c kern_sig_13.c kern_sig_43.c
kern_time_30.c kern_time_50.c kern_xxx_12.c sysv_msg_14.c
sysv_msg_50.c sysv_sem_14.c sysv_sem_50.c sysv_shm_14.c
sysv_shm_50.c uipc_syscalls_40.c uipc_syscalls_50.c
vfs_syscalls_12.c vfs_syscalls_40.c vm_12.c vm_43.c

Log Message:
Remove includes sys/mount.h and sys/sched.h added for sys/syscallargs.h.
Now they are handled by $sysarghdrextra in sys/kern/syscalls.conf.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/compat/common/compat_mod.c
cvs rdiff -u -r1.3 -r1.4 src/sys/compat/common/if_43.c \
src/sys/compat/common/kern_time_30.c
cvs rdiff -u -r1.19 -r1.20 src/sys/compat/common/kern_sig_13.c \
src/sys/compat/common/vm_12.c
cvs rdiff -u -r1.33 -r1.34 src/sys/compat/common/kern_sig_43.c
cvs rdiff -u -r1.17 -r1.18 src/sys/compat/common/kern_time_50.c
cvs rdiff -u -r1.14 -r1.15 src/sys/compat/common/kern_xxx_12.c
cvs rdiff -u -r1.18 -r1.19 src/sys/compat/common/sysv_msg_14.c
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/common/sysv_msg_50.c \
src/sys/compat/common/sysv_sem_50.c src/sys/compat/common/sysv_shm_50.c \
src/sys/compat/common/uipc_syscalls_50.c \
src/sys/compat/common/vfs_syscalls_40.c
cvs rdiff -u -r1.15 -r1.16 src/sys/compat/common/sysv_sem_14.c
cvs rdiff -u -r1.16 -r1.17 src/sys/compat/common/sysv_shm_14.c \
src/sys/compat/common/vm_43.c
cvs rdiff -u -r1.6 -r1.7 src/sys/compat/common/uipc_syscalls_40.c
cvs rdiff -u -r1.28 -r1.29 src/sys/compat/common/vfs_syscalls_12.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.11 src/sys/compat/common/compat_mod.c:1.12
--- src/sys/compat/common/compat_mod.c:1.11	Fri Mar  5 16:55:56 2010
+++ src/sys/compat/common/compat_mod.c	Wed Jan 19 10:21:16 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.11 2010/03/05 16:55:56 pooka Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.12 2011/01/19 10:21:16 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: compat_mod.c,v 1.11 2010/03/05 16:55:56 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: compat_mod.c,v 1.12 2011/01/19 10:21:16 tsutsui Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -49,7 +49,6 @@
 #include sys/rwlock.h
 #include sys/tty.h
 #include sys/signalvar.h
-#include sys/sched.h	/* for cpuset_t */
 #include sys/syscall.h
 #include sys/syscallargs.h
 #include sys/syscallvar.h

Index: src/sys/compat/common/if_43.c
diff -u src/sys/compat/common/if_43.c:1.3 src/sys/compat/common/if_43.c:1.4
--- src/sys/compat/common/if_43.c:1.3	Sat Nov  6 17:20:07 2010
+++ src/sys/compat/common/if_43.c	Wed Jan 19 10:21:16 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_43.c,v 1.3 2010/11/06 17:20:07 christos Exp $	*/
+/*	$NetBSD: if_43.c,v 1.4 2011/01/19 10:21:16 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_43.c,v 1.3 2010/11/06 17:20:07 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_43.c,v 1.4 2011/01/19 10:21:16 tsutsui Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_compat_netbsd.h
@@ -56,7 +56,6 @@
 #include sys/mbuf.h		/* for MLEN */
 #include sys/protosw.h
 
-#include sys/mount.h
 #include sys/syscallargs.h
 
 #include net/if.h
Index: src/sys/compat/common/kern_time_30.c
diff -u src/sys/compat/common/kern_time_30.c:1.3 src/sys/compat/common/kern_time_30.c:1.4
--- src/sys/compat/common/kern_time_30.c:1.3	Sun Jan 11 12:19:14 2009
+++ src/sys/compat/common/kern_time_30.c	Wed Jan 19 10:21:16 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time_30.c,v 1.3 2009/01/11 12:19:14 tsutsui Exp $	*/
+/*	$NetBSD: kern_time_30.c,v 1.4 2011/01/19 10:21:16 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_time_30.c,v 1.3 2009/01/11 12:19:14 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_time_30.c,v 1.4 2011/01/19 10:21:16 tsutsui Exp $);
 
 #include opt_ntp.h
 
@@ -49,7 +49,6 @@
 #include compat/sys/time.h
 #include compat/sys/timex.h
 
-#include sys/sched.h
 #include sys/syscallargs.h
 
 int

Index: src/sys/compat/common/kern_sig_13.c
diff -u src/sys/compat/common/kern_sig_13.c:1.19 src/sys/compat/common/kern_sig_13.c:1.20
--- src/sys/compat/common/kern_sig_13.c:1.19	Mon Apr 28 20:23:41 2008
+++ src/sys/compat/common/kern_sig_13.c	Wed Jan 19 10:21:16 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sig_13.c,v 1.19 2008/04/28 20:23:41 martin Exp $	*/
+/*	$NetBSD: kern_sig_13.c,v 1.20 2011/01/19 10:21:16 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 

CVS commit: src/sys/compat/common

2010-11-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov  6 17:20:07 UTC 2010

Modified Files:
src/sys/compat/common: if_43.c

Log Message:
can't map the old and the new SIO calls the way we did before because the
numbers have changed. Instead provide a switch. Keep the old code there,
to handle cases we did not handle in the first switch, but this is a hack
and should be removed.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/common/if_43.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/if_43.c
diff -u src/sys/compat/common/if_43.c:1.2 src/sys/compat/common/if_43.c:1.3
--- src/sys/compat/common/if_43.c:1.2	Mon Mar 16 20:08:10 2009
+++ src/sys/compat/common/if_43.c	Sat Nov  6 13:20:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_43.c,v 1.2 2009/03/17 00:08:10 dyoung Exp $	*/
+/*	$NetBSD: if_43.c,v 1.3 2010/11/06 17:20:07 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_43.c,v 1.2 2009/03/17 00:08:10 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_43.c,v 1.3 2010/11/06 17:20:07 christos Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_compat_netbsd.h
@@ -86,80 +86,130 @@
 	if (IOCPARM_LEN(cmd) != sizeof(struct oifreq))
 		return cmd;
 
-	ncmd = ((cmd)  ~(IOCPARM_MASK  IOCPARM_SHIFT)) | 
-		(sizeof(struct ifreq)  IOCPARM_SHIFT);
-
-	switch (ncmd) {
-	case BIOCGETIF:
-	case BIOCSETIF:
-	case GREDSOCK:
-	case GREGADDRD:
-	case GREGADDRS:
-	case GREGPROTO:
-	case GRESADDRD:
-	case GRESADDRS:
-	case GRESPROTO:
-	case GRESSOCK:
+	switch (cmd) {
+	case OSIOCSIFADDR:
+		return SIOCSIFADDR;
+	case OOSIOCGIFADDR:
+		return SIOCGIFADDR;
+	case OSIOCSIFDSTADDR:
+		return SIOCSIFDSTADDR;
+	case OOSIOCGIFDSTADDR:
+		return SIOCGIFDSTADDR;
+	case OSIOCSIFFLAGS:
+		return SIOCSIFFLAGS;
+	case OSIOCGIFFLAGS:
+		return SIOCGIFFLAGS;
+	case OOSIOCGIFBRDADDR:
+		return SIOCGIFBRDADDR;
+	case OSIOCSIFBRDADDR:
+		return SIOCSIFBRDADDR;
+	case OOSIOCGIFCONF:
+		return SIOCGIFCONF;
+	case OOSIOCGIFNETMASK:
+		return SIOCGIFNETMASK;
+	case OSIOCSIFNETMASK:
+		return SIOCSIFNETMASK;
+	case OSIOCGIFCONF:
+		return SIOCGIFCONF;
+	case OSIOCADDMULTI:
+		return SIOCADDMULTI;
+	case OSIOCDELMULTI:
+		return SIOCDELMULTI;
+	case OSIOCSIFMEDIA:
+		return SIOCSIFMEDIA;
+	case OSIOCGIFMTU:
+		return SIOCGIFMTU;
+	case OSIOCGIFDATA:
+		return SIOCGIFDATA;
+	case OSIOCZIFDATA:
+		return SIOCZIFDATA;
+	case OBIOCGETIF:
+		return BIOCGETIF;
+	case OBIOCSETIF:
+		return BIOCSETIF;
+	case OTAPGIFNAME:
+		return TAPGIFNAME;
+	default:
+		/*
+		 * XXX: the following code should be removed and the
+		 * needing treatment ioctls should move to the switch
+		 * above.
+		 */
+		ncmd = ((cmd)  ~(IOCPARM_MASK  IOCPARM_SHIFT)) | 
+		(sizeof(struct ifreq)  IOCPARM_SHIFT);
+		switch (ncmd) {
+		case BIOCGETIF:
+		case BIOCSETIF:
+		case GREDSOCK:
+		case GREGADDRD:
+		case GREGADDRS:
+		case GREGPROTO:
+		case GRESADDRD:
+		case GRESADDRS:
+		case GRESPROTO:
+		case GRESSOCK:
 #ifdef COMPAT_20
-	case OSIOCG80211STATS:
-	case OSIOCG80211ZSTATS:
+		case OSIOCG80211STATS:
+		case OSIOCG80211ZSTATS:
 #endif /* COMPAT_20 */
-	case SIOCADDMULTI:
-	case SIOCDELMULTI:
-	case SIOCDIFADDR:
-	case SIOCDIFADDR_IN6:
-	case SIOCDIFPHYADDR:
-	case SIOCGDEFIFACE_IN6:
-	case SIOCG80211NWID:
-	case SIOCG80211STATS:
-	case SIOCG80211ZSTATS:
-	case SIOCGIFADDR:
-	case SIOCGIFADDR_IN6:
-	case SIOCGIFAFLAG_IN6:
-	case SIOCGIFALIFETIME_IN6:
-	case SIOCGIFBRDADDR:
-	case SIOCGIFDLT:
-	case SIOCGIFDSTADDR:
-	case SIOCGIFDSTADDR_IN6:
-	case SIOCGIFFLAGS:
-	case SIOCGIFGENERIC:
-	case SIOCGIFMETRIC:
-	case SIOCGIFMTU:
-	case SIOCGIFNETMASK:
-	case SIOCGIFNETMASK_IN6:
-	case SIOCGIFPDSTADDR:
-	case SIOCGIFPDSTADDR_IN6:
-	case SIOCGIFPSRCADDR:
-	case SIOCGIFPSRCADDR_IN6:
-	case SIOCGIFSTAT_ICMP6:
-	case SIOCGIFSTAT_IN6:
-	case SIOCGPVCSIF:
-	case SIOCGVH:
-	case SIOCIFCREATE:
-	case SIOCIFDESTROY:
-	case SIOCS80211NWID:
-	case SIOCSDEFIFACE_IN6:
-	case SIOCSIFADDR:
-	case SIOCSIFADDR_IN6:
-	case SIOCSIFBRDADDR:
-	case SIOCSIFDSTADDR:
-	case SIOCSIFDSTADDR_IN6:
-	case SIOCSIFFLAGS:
-	case SIOCSIFGENERIC:
-	case SIOCSIFMEDIA:
-	case SIOCSIFMETRIC:
-	case SIOCSIFMTU:
-	case SIOCSIFNETMASK:
-	case SIOCSIFNETMASK_IN6:
-	case SIOCSNDFLUSH_IN6:
-	case SIOCSPFXFLUSH_IN6:
-	case SIOCSPVCSIF:
-	case SIOCSRTRFLUSH_IN6:
-	case SIOCSVH:
-	case TAPGIFNAME:
-		return ncmd;
+		case SIOCADDMULTI:
+		case SIOCDELMULTI:
+		case SIOCDIFADDR:
+		case SIOCDIFADDR_IN6:
+		case SIOCDIFPHYADDR:
+		case SIOCGDEFIFACE_IN6:
+		case SIOCG80211NWID:
+		case SIOCG80211STATS:
+		case SIOCG80211ZSTATS:
+		case SIOCGIFADDR:
+		case SIOCGIFADDR_IN6:
+		case SIOCGIFAFLAG_IN6:
+		case SIOCGIFALIFETIME_IN6:
+		case SIOCGIFBRDADDR:
+		case SIOCGIFDLT:
+		case SIOCGIFDSTADDR:
+		case SIOCGIFDSTADDR_IN6:
+		case SIOCGIFFLAGS:
+		case SIOCGIFGENERIC:
+		case SIOCGIFMETRIC:

CVS commit: src/sys/compat/common

2009-12-21 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Mon Dec 21 15:13:13 UTC 2009

Modified Files:
src/sys/compat/common: compat_mod.c

Log Message:
Remove SYS_compat_50_mq_timedreceive/SYS_compat_50_mq_timedsend
duplicate entries.

Fix a KASSERT when unloading the compat kernel module.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/compat/common/compat_mod.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.9 src/sys/compat/common/compat_mod.c:1.10
--- src/sys/compat/common/compat_mod.c:1.9	Sun Nov 22 19:09:16 2009
+++ src/sys/compat/common/compat_mod.c	Mon Dec 21 15:13:13 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.9 2009/11/22 19:09:16 mbalmer Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.10 2009/12/21 15:13:13 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: compat_mod.c,v 1.9 2009/11/22 19:09:16 mbalmer Exp $);
+__KERNEL_RCSID(0, $NetBSD: compat_mod.c,v 1.10 2009/12/21 15:13:13 njoly Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -231,8 +231,6 @@
 # endif
 	{ SYS_compat_50___fhstat40, 0, (sy_call_t *)compat_50_sys___fhstat40 },
 	{ SYS_compat_50_aio_suspend, 0, (sy_call_t *)compat_50_sys_aio_suspend },
-	{ SYS_compat_50_mq_timedreceive, 0, (sy_call_t *)compat_50_sys_mq_timedreceive },
-	{ SYS_compat_50_mq_timedsend, 0, (sy_call_t *)compat_50_sys_mq_timedsend },
 #endif
 	{ 0, 0, NULL },
 };



CVS commit: src/sys/compat/common

2009-10-12 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Mon Oct 12 23:41:51 UTC 2009

Modified Files:
src/sys/compat/common: kern_time_50.c

Log Message:
compat_50_sys_aio_suspend:
- fix the buffer size.
- use kmem_alloc instead of kmem_zalloc for buffers which we will
  overwrite soon.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/compat/common/kern_time_50.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/kern_time_50.c
diff -u src/sys/compat/common/kern_time_50.c:1.9 src/sys/compat/common/kern_time_50.c:1.10
--- src/sys/compat/common/kern_time_50.c:1.9	Mon Oct  5 23:49:47 2009
+++ src/sys/compat/common/kern_time_50.c	Mon Oct 12 23:41:51 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time_50.c,v 1.9 2009/10/05 23:49:47 rmind Exp $	*/
+/*	$NetBSD: kern_time_50.c,v 1.10 2009/10/12 23:41:51 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_time_50.c,v 1.9 2009/10/05 23:49:47 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_time_50.c,v 1.10 2009/10/12 23:41:51 yamt Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_aio.h
@@ -386,13 +386,13 @@
 			return error;
 		timespec50_to_timespec(ts50, ts);
 	}
-	list = kmem_zalloc(nent * sizeof(struct aio_job), KM_SLEEP);
-	error = copyin(SCARG(uap, list), list, nent * sizeof(struct aiocb));
+	list = kmem_alloc(nent * sizeof(*list), KM_SLEEP);
+	error = copyin(SCARG(uap, list), list, nent * sizeof(*list));
 	if (error)
 		goto out;
 	error = aio_suspend1(l, list, nent, SCARG(uap, timeout) ? ts : NULL);
 out:
-	kmem_free(list, nent * sizeof(struct aio_job));
+	kmem_free(list, nent * sizeof(*list));
 	return error;
 #else
 	return ENOSYS;



CVS commit: src/sys/compat/common

2009-08-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Aug 13 03:53:13 UTC 2009

Modified Files:
src/sys/compat/common: compat_exec.c

Log Message:
#include opt_execfmt.h and only compile innards if EXEC_AOUT is defined.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/compat/common/compat_exec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_exec.c
diff -u src/sys/compat/common/compat_exec.c:1.15 src/sys/compat/common/compat_exec.c:1.16
--- src/sys/compat/common/compat_exec.c:1.15	Sat Dec  8 18:35:53 2007
+++ src/sys/compat/common/compat_exec.c	Thu Aug 13 03:53:13 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_exec.c,v 1.15 2007/12/08 18:35:53 dsl Exp $	*/
+/*	$NetBSD: compat_exec.c,v 1.16 2009/08/13 03:53:13 matt Exp $	*/
 
 /*
  * Copyright (c) 1993, 1994 Christopher G. Demetriou
@@ -31,7 +31,11 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: compat_exec.c,v 1.15 2007/12/08 18:35:53 dsl Exp $);
+__KERNEL_RCSID(0, $NetBSD: compat_exec.c,v 1.16 2009/08/13 03:53:13 matt Exp $);
+
+#ifdef _KERNEL_OPT
+#include opt_execfmt.h
+#endif
 
 #include sys/param.h
 #include sys/systm.h
@@ -40,6 +44,7 @@
 #include sys/exec.h
 #include sys/resourcevar.h
 
+#ifdef EXEC_AOUT
 /*
  * exec_aout_prep_oldzmagic():
  *	Prepare the vmcmds to build a vmspace for an old ZMAGIC
@@ -174,3 +179,4 @@
 	epp-ep_dsize = (dsize  0) ? dsize : 0;
 	return (*epp-ep_esch-es_setup_stack)(l, epp);
 }
+#endif /* EXEC_AOUT */



CVS commit: src/sys/compat/common

2009-07-18 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Jul 19 02:41:27 UTC 2009

Modified Files:
src/sys/compat/common: compat_mod.c kern_time_50.c

Log Message:
- Use #ifdef AIO, instead of #ifdef notyet.  Not a solution, but at
  least gets it working for MONOLITHIC kernel.
- Similarily add #ifdef MQUEUE for mqueue compat.
- Amend TNF license to be 2-clause.  Approved by christos.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/compat/common/compat_mod.c \
src/sys/compat/common/kern_time_50.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.7 src/sys/compat/common/compat_mod.c:1.8
--- src/sys/compat/common/compat_mod.c:1.7	Tue Jan 13 20:47:47 2009
+++ src/sys/compat/common/compat_mod.c	Sun Jul 19 02:41:27 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.7 2009/01/13 20:47:47 martin Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.8 2009/07/19 02:41:27 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: compat_mod.c,v 1.7 2009/01/13 20:47:47 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: compat_mod.c,v 1.8 2009/07/19 02:41:27 rmind Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -231,6 +231,8 @@
 # endif
 	{ SYS_compat_50___fhstat40, 0, (sy_call_t *)compat_50_sys___fhstat40 },
 	{ SYS_compat_50_aio_suspend, 0, (sy_call_t *)compat_50_sys_aio_suspend },
+	{ SYS_compat_50_mq_timedreceive, 0, (sy_call_t *)compat_50_sys_mq_timedreceive },
+	{ SYS_compat_50_mq_timedsend, 0, (sy_call_t *)compat_50_sys_mq_timedsend },
 #endif
 	{ 0, 0, NULL },
 };
Index: src/sys/compat/common/kern_time_50.c
diff -u src/sys/compat/common/kern_time_50.c:1.7 src/sys/compat/common/kern_time_50.c:1.8
--- src/sys/compat/common/kern_time_50.c:1.7	Sun Mar 29 19:21:19 2009
+++ src/sys/compat/common/kern_time_50.c	Sun Jul 19 02:41:27 2009
@@ -1,7 +1,7 @@
-/*	$NetBSD: kern_time_50.c,v 1.7 2009/03/29 19:21:19 christos Exp $	*/
+/*	$NetBSD: kern_time_50.c,v 1.8 2009/07/19 02:41:27 rmind Exp $	*/
 
 /*-
- * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -15,13 +15,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- *This product includes software developed by the NetBSD
- *Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *contributors may be used to endorse or promote products derived
- *from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -36,10 +29,12 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_time_50.c,v 1.7 2009/03/29 19:21:19 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_time_50.c,v 1.8 2009/07/19 02:41:27 rmind Exp $);
 
 #ifdef _KERNEL_OPT
+#include opt_aio.h
 #include opt_ntp.h
+#include opt_mqueue.h
 #endif
 
 #include sys/param.h
@@ -373,7 +368,7 @@
 		syscallarg(int) nent;
 		syscallarg(const struct timespec50 *) timeout;
 	} */
-#ifdef notyet
+#ifdef AIO
 	struct aiocb **list;
 	struct timespec ts;
 	struct timespec50 ts50;
@@ -542,6 +537,7 @@
 		syscallarg(unsigned) msg_prio;
 		syscallarg(const struct timespec50 *) abs_timeout;
 	} */
+#ifdef MQUEUE
 	int t;
 	int error;
 	struct timespec50 ts50;
@@ -561,6 +557,9 @@
 
 	return mq_send1(l, SCARG(uap, mqdes), SCARG(uap, msg_ptr),
 	SCARG(uap, msg_len), SCARG(uap, msg_prio), t);
+#else
+	return ENOSYS;
+#endif
 }
 
 int
@@ -574,6 +573,7 @@
 		syscallarg(unsigned *) msg_prio;
 		syscallarg(const struct timespec50 *) abs_timeout;
 	} */
+#ifdef MQUEUE
 	int error, t;
 	ssize_t mlen;
 	struct timespec ts;
@@ -598,6 +598,9 @@
 		*retval = mlen;
 
 	return error;
+#else
+	return ENOSYS;
+#endif
 }
 
 static int