CVS commit: src/sys/dev

2017-09-29 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Sep 30 05:37:55 UTC 2017

Modified Files:
src/sys/dev: audio.c

Log Message:
Improve logic in audio_initbufs().  No functional changes intended.


To generate a diff of this commit:
cvs rdiff -u -r1.408 -r1.409 src/sys/dev/audio.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/dev/audio.c
diff -u src/sys/dev/audio.c:1.408 src/sys/dev/audio.c:1.409
--- src/sys/dev/audio.c:1.408	Tue Sep 26 04:34:59 2017
+++ src/sys/dev/audio.c	Sat Sep 30 05:37:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.408 2017/09/26 04:34:59 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.409 2017/09/30 05:37:55 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.408 2017/09/26 04:34:59 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.409 2017/09/30 05:37:55 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -2027,12 +2027,14 @@ audio_initbufs(struct audio_softc *sc, s
 		((vc->sc_open & AUOPEN_READ) || vc == sc->sc_hwvc)) {
 		audio_init_ringbuffer(sc, &vc->sc_mrr,
 		AUMODE_RECORD);
-		if (sc->sc_opens == 0 && hw->init_input &&
-		(vc->sc_mode & AUMODE_RECORD)) {
-			error = hw->init_input(sc->hw_hdl, vc->sc_mrr.s.start,
-   vc->sc_mrr.s.end - vc->sc_mrr.s.start);
-			if (error)
-return error;
+		if (sc->sc_opens == 0 && (vc->sc_mode & AUMODE_RECORD)) {
+			if (hw->init_input) {
+error = hw->init_input(sc->hw_hdl,
+vc->sc_mrr.s.start,
+vc->sc_mrr.s.end - vc->sc_mrr.s.start);
+if (error)
+	return error;
+			}
 		}
 	}
 
@@ -2041,12 +2043,14 @@ audio_initbufs(struct audio_softc *sc, s
 		audio_init_ringbuffer(sc, &vc->sc_mpr,
 		AUMODE_PLAY);
 		vc->sc_sil_count = 0;
-		if (sc->sc_opens == 0 && hw->init_output &&
-		(vc->sc_mode & AUMODE_PLAY)) {
-			error = hw->init_output(sc->hw_hdl, vc->sc_mpr.s.start,
-	vc->sc_mpr.s.end - vc->sc_mpr.s.start);
-			if (error)
-return error;
+		if (sc->sc_opens == 0 && (vc->sc_mode & AUMODE_PLAY)) {
+			if (hw->init_output) {
+error = hw->init_output(sc->hw_hdl,
+vc->sc_mpr.s.start,
+vc->sc_mpr.s.end - vc->sc_mpr.s.start);
+if (error)
+	return error;
+			}
 		}
 	}
 



CVS commit: src/sys/arch/x68k/dev

2017-09-29 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Sep 30 04:07:04 UTC 2017

Modified Files:
src/sys/arch/x68k/dev: vs.c vsvar.h

Log Message:
Avoid magic numbers and give appropriate names.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/x68k/dev/vs.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x68k/dev/vsvar.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/arch/x68k/dev/vs.c
diff -u src/sys/arch/x68k/dev/vs.c:1.48 src/sys/arch/x68k/dev/vs.c:1.49
--- src/sys/arch/x68k/dev/vs.c:1.48	Sat Sep  2 15:40:31 2017
+++ src/sys/arch/x68k/dev/vs.c	Sat Sep 30 04:07:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vs.c,v 1.48 2017/09/02 15:40:31 isaki Exp $	*/
+/*	$NetBSD: vs.c,v 1.49 2017/09/30 04:07:04 isaki Exp $	*/
 
 /*
  * Copyright (c) 2001 Tetsuya Isaki. All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.48 2017/09/02 15:40:31 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.49 2017/09/30 04:07:04 isaki Exp $");
 
 #include "audio.h"
 #include "vs.h"
@@ -510,7 +510,8 @@ vs_start_output(void *hdl, void *block, 
 	(int)block - (int)KVADDR(vd), blksize);
 
 	if (sc->sc_active == 0) {
-		bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSM6258_STAT, 2);
+		bus_space_write_1(sc->sc_iot, sc->sc_ioh,
+			MSM6258_CMD, MSM6258_CMD_PLAY_START);
 		sc->sc_active = 1;
 	}
 
@@ -555,7 +556,8 @@ vs_start_input(void *hdl, void *block, i
 	(int)block - (int)KVADDR(vd), blksize);
 
 	if (sc->sc_active == 0) {
-		bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSM6258_STAT, 4);
+		bus_space_write_1(sc->sc_iot, sc->sc_ioh,
+			MSM6258_CMD, MSM6258_CMD_REC_START);
 		sc->sc_active = 1;
 	}
 
@@ -572,7 +574,8 @@ vs_halt_output(void *hdl)
 	if (sc->sc_active) {
 		/* stop ADPCM play */
 		dmac_abort_xfer(sc->sc_dma_ch->ch_softc, sc->sc_current.xfer);
-		bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSM6258_STAT, 1);
+		bus_space_write_1(sc->sc_iot, sc->sc_ioh,
+			MSM6258_CMD, MSM6258_CMD_STOP);
 		sc->sc_active = 0;
 	}
 
@@ -589,7 +592,8 @@ vs_halt_input(void *hdl)
 	if (sc->sc_active) {
 		/* stop ADPCM recoding */
 		dmac_abort_xfer(sc->sc_dma_ch->ch_softc, sc->sc_current.xfer);
-		bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSM6258_STAT, 1);
+		bus_space_write_1(sc->sc_iot, sc->sc_ioh,
+			MSM6258_CMD, MSM6258_CMD_STOP);
 		sc->sc_active = 0;
 	}
 

Index: src/sys/arch/x68k/dev/vsvar.h
diff -u src/sys/arch/x68k/dev/vsvar.h:1.15 src/sys/arch/x68k/dev/vsvar.h:1.16
--- src/sys/arch/x68k/dev/vsvar.h:1.15	Sat Sep  2 12:52:55 2017
+++ src/sys/arch/x68k/dev/vsvar.h	Sat Sep 30 04:07:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vsvar.h,v 1.15 2017/09/02 12:52:55 isaki Exp $	*/
+/*	$NetBSD: vsvar.h,v 1.16 2017/09/30 04:07:04 isaki Exp $	*/
 
 /*
  * Copyright (c) 2001 Tetsuya Isaki. All rights reserved.
@@ -59,8 +59,12 @@
 #define VS_MAX_BUFSIZE	(65536*4) /* XXX: enough? */
 
 /* XXX: msm6258vreg.h */
-#define MSM6258_STAT	0
-#define MSM6258_DATA	1
+#define MSM6258_CMD 	0		/* W */
+#define MSM6258_CMD_STOP	(0x01)
+#define MSM6258_CMD_PLAY_START	(0x02)
+#define MSM6258_CMD_REC_START	(0x04)
+#define MSM6258_STAT	0		/* R */
+#define MSM6258_DATA	1		/* R/W */
 
 struct vs_dma {
 	bus_dma_tag_t		vd_dmat;



CVS commit: src/sys/arch/powerpc/oea

2017-09-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Sep 30 03:34:04 UTC 2017

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
use 7450 HID0 bitmask on 7447A and 7448 as well


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/powerpc/oea/cpu_subr.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/arch/powerpc/oea/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.85 src/sys/arch/powerpc/oea/cpu_subr.c:1.86
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.85	Tue Jul 11 03:07:22 2017
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Sat Sep 30 03:34:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.85 2017/07/11 03:07:22 maya Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.86 2017/09/30 03:34:04 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.85 2017/07/11 03:07:22 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.86 2017/09/30 03:34:04 macallan Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -652,6 +652,8 @@ cpu_setup(device_t self, struct cpu_info
 	case MPC601:
 		bitmask = HID0_601_BITMASK;
 		break;
+	case MPC7447A:
+	case MPC7448:
 	case MPC7450:
 	case MPC7455:
 	case MPC7457:



CVS commit: src/sys/arch/macppc/dev

2017-09-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 29 22:38:18 UTC 2017

Modified Files:
src/sys/arch/macppc/dev: smu.c

Log Message:
provide crude but working fan control based on sensor readings


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/macppc/dev/smu.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/arch/macppc/dev/smu.c
diff -u src/sys/arch/macppc/dev/smu.c:1.1 src/sys/arch/macppc/dev/smu.c:1.2
--- src/sys/arch/macppc/dev/smu.c:1.1	Tue Jun  6 15:58:17 2017
+++ src/sys/arch/macppc/dev/smu.c	Fri Sep 29 22:38:18 2017
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -81,12 +82,29 @@ struct smu_iicbus {
 #define SMU_MAX_IICBUS		3
 #define SMU_MAX_SME_SENSORS	SMU_MAX_FANS
 
+struct smu_zone {
+	bool (*filter)(const envsys_data_t *);
+	int nfans;
+	int fans[SMU_MAX_FANS];
+	int threshold, step;
+	int duty;
+};
+
+
+#define SMU_ZONE_CPUS	0
+#define SMU_ZONE_DRIVES	1
+#define SMU_ZONE_SLOTS	2
+#define SMU_ZONES	3
+
+#define C_TO_uK(n) (n * 100 + 27315)
+
 struct smu_softc {
 	device_t sc_dev;
 	int sc_node;
 	struct sysctlnode *sc_sysctl_me;
 
 	kmutex_t sc_cmd_lock;
+	kmutex_t sc_msg_lock;
 	struct smu_cmd *sc_cmd;
 	paddr_t sc_cmd_paddr;
 	int sc_dbell_mbox;
@@ -103,6 +121,10 @@ struct smu_softc {
 
 	struct sysmon_envsys *sc_sme;
 	envsys_data_t sc_sme_sensors[SMU_MAX_SME_SENSORS];
+
+	struct smu_zone sc_zones[SMU_ZONES];
+	lwp_t *sc_thread;
+	bool sc_dying;
 };
 
 #define SMU_CMD_FAN	0x4a
@@ -137,6 +159,13 @@ static int smu_iicbus_exec(void *, i2c_o
 size_t, void *, size_t, int);
 static int smu_sysctl_fan_rpm(SYSCTLFN_ARGS);
 
+static void smu_setup_zones(struct smu_softc *);
+static void smu_adjust_zone(struct smu_softc *, int);
+static void smu_adjust(void *);
+static bool is_cpu_sensor(const envsys_data_t *);
+static bool is_drive_sensor(const envsys_data_t *);
+static bool is_slots_sensor(const envsys_data_t *);
+
 CFATTACH_DECL_NEW(smu, sizeof(struct smu_softc),
 smu_match, smu_attach, NULL, NULL);
 
@@ -187,6 +216,7 @@ smu_attach(device_t parent, device_t sel
 		smu0 = sc;
 
 	printf("\n");
+	smu_setup_zones(sc);
 }
 
 static int
@@ -498,7 +528,7 @@ smu_sme_refresh(struct sysmon_envsys *sm
 static int
 smu_do_cmd(struct smu_softc *sc, struct smu_cmd *cmd, int timo)
 {
-	int gpio, ret;
+	int gpio, ret, bail;
 	u_char ack;
 
 	mutex_enter(&sc->sc_cmd_lock);
@@ -517,15 +547,23 @@ smu_do_cmd(struct smu_softc *sc, struct 
 	obio_write_4(sc->sc_dbell_mbox, sc->sc_cmd_paddr);
 	obio_write_1(sc->sc_dbell_gpio, 0x04);
 
-	do {
-		ret = tsleep(sc->sc_cmd, PWAIT, "smu_cmd", (timo * hz) / 1000);
+	bail = 0;
+
+	gpio = obio_read_1(sc->sc_dbell_gpio);
+
+	while (((gpio & 0x07) != 0x07) && (bail < timo)) {
+		ret = tsleep(sc->sc_cmd, PWAIT, "smu_cmd", mstohz(10));
 		if (ret != 0) {
-			mutex_exit(&sc->sc_cmd_lock);
-			return (ret);
+			bail++;
 		}
 		gpio = obio_read_1(sc->sc_dbell_gpio);
-	} while ((gpio & 0x07) != 0x07);
+	}
 
+	if ((gpio & 0x07) != 0x07) {
+		mutex_exit(&sc->sc_cmd_lock);
+		return EWOULDBLOCK;
+	}
+		
 	__asm volatile ("dcbf 0,%0; sync" :: "r"(sc->sc_cmd) : "memory");
 
 	ack = (~cmd->cmd) & 0xff;
@@ -825,3 +863,149 @@ SYSCTL_SETUP(smu_sysctl_setup, "SMU sysc
 	CTLFLAG_PERMANENT, CTLTYPE_NODE, "machdep", NULL,
 	NULL, 0, NULL, 0, CTL_MACHDEP, CTL_EOL);
 }
+
+static void
+smu_setup_zones(struct smu_softc *sc)
+{
+	struct smu_zone *z;
+	struct smu_fan *f;
+	int i;
+
+	/* find CPU fans */
+	z = &sc->sc_zones[SMU_ZONE_CPUS];
+	z->nfans = 0;
+	for (i = 0; i < SMU_MAX_FANS; i++) {
+		f = &sc->sc_fans[i];
+		if (strstr(f->location, "CPU") != NULL) {
+			z->fans[z->nfans] = i;
+			z->nfans++;
+		}
+	}
+	printf("using %d fans for CPU zone\n", z->nfans);
+	z->threshold = C_TO_uK(45);
+	z->duty = 150;
+	z->step = 3;	
+	z->filter = is_cpu_sensor;
+
+	z = &sc->sc_zones[SMU_ZONE_DRIVES];
+	z->nfans = 0;
+	for (i = 0; i < SMU_MAX_FANS; i++) {
+		f = &sc->sc_fans[i];
+		if (strstr(f->location, "DRIVE") != NULL) {
+			z->fans[z->nfans] = i;
+			z->nfans++;
+		}
+	}
+	printf("using %d fans for drive bay zone\n", z->nfans);
+	z->threshold = C_TO_uK(40);
+	z->duty = 150;
+	z->step = 2;
+	z->filter = is_drive_sensor;
+
+	z = &sc->sc_zones[SMU_ZONE_SLOTS];
+	z->nfans = 0;
+	for (i = 0; i < SMU_MAX_FANS; i++) {
+		f = &sc->sc_fans[i];
+		if ((strstr(f->location, "BACKSIDE") != NULL) ||
+		(strstr(f->location, "SLOTS") != NULL)) {
+			z->fans[z->nfans] = i;
+			z->nfans++;
+		}
+	}
+	printf("using %d fans for expansion slots zone\n", z->nfans);
+	z->threshold = C_TO_uK(40);
+	z->duty = 150;
+	z->step = 2;
+	z->filter = is_slots_sensor;
+
+	sc->sc_dying = false;
+	kthread_create(PRI_NONE, 0, curcpu(), smu_adjust, sc, &sc->sc_thread,
+	"fan control"); 
+}
+
+static void
+smu_adjust_zone(struct smu_softc *sc, int which)
+{
+	struct smu_zone *z = &sc->sc_zones[which];
+	struct smu_fan *f;
+	long temp, ne

CVS commit: src/share/man/man8

2017-09-29 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Sep 29 21:48:17 UTC 2017

Modified Files:
src/share/man/man8: compat_linux.8

Log Message:
Mention that linux and linux32 emulations are not loaded automatically
for modular kernels, and mention how to enable that. Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/share/man/man8/compat_linux.8

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

Modified files:

Index: src/share/man/man8/compat_linux.8
diff -u src/share/man/man8/compat_linux.8:1.38 src/share/man/man8/compat_linux.8:1.39
--- src/share/man/man8/compat_linux.8:1.38	Mon Jul  3 21:31:00 2017
+++ src/share/man/man8/compat_linux.8	Fri Sep 29 21:48:17 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: compat_linux.8,v 1.38 2017/07/03 21:31:00 wiz Exp $
+.\"	$NetBSD: compat_linux.8,v 1.39 2017/09/29 21:48:17 wiz Exp $
 .\"
 .\" Copyright (c) 1995 Frank van der Linden
 .\" All rights reserved.
@@ -29,7 +29,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 30, 2007
+.Dd September 29, 2017
 .Dt COMPAT_LINUX 8
 .Os
 .Sh NAME
@@ -393,9 +393,7 @@ for further information.
 .Ss Setting up other files
 Newer version of Linux use
 .Pa /etc/nsswitch.conf
-for network information, such as
-.Tn NIS
-and DNS.
+for network information, such as NIS and DNS.
 You must create or get a valid copy of this file and put it in
 .Pa /emul/linux/etc .
 .Ss Finding the necessary files
@@ -537,6 +535,17 @@ directory, namely:
 Be warned: the first link mentioned here makes SVGAlib binaries
 work, but may confuse others, so you may have to remove it again at
 some point.
+.Sh CAVEATS
+When using a modular kernel (see
+.Xr module 7 ) ,
+the linux and linux32 emulations are not loaded automatically (for
+security reasons).
+To enable autoloading, set the appropriate
+.Xr sysctl 8 Ap s :
+.Bd -literal
+sysctl -w emul.linux.enabled=1
+sysctl -w emul.linux32.enabled=1
+.Ed
 .Sh BUGS
 The information about Linux distributions may become outdated.
 .Pp



CVS commit: src/usr.bin/mkubootimage

2017-09-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Sep 29 21:18:28 UTC 2017

Modified Files:
src/usr.bin/mkubootimage: mkubootimage.1 mkubootimage.c uboot.h

Log Message:
add sh arch


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/mkubootimage/mkubootimage.1
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/mkubootimage/mkubootimage.c
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/mkubootimage/uboot.h

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

Modified files:

Index: src/usr.bin/mkubootimage/mkubootimage.1
diff -u src/usr.bin/mkubootimage/mkubootimage.1:1.10 src/usr.bin/mkubootimage/mkubootimage.1:1.11
--- src/usr.bin/mkubootimage/mkubootimage.1:1.10	Sat Jul 15 12:10:31 2017
+++ src/usr.bin/mkubootimage/mkubootimage.1	Fri Sep 29 21:18:28 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mkubootimage.1,v 1.10 2017/07/15 12:10:31 wiz Exp $
+.\"	$NetBSD: mkubootimage.1,v 1.11 2017/09/29 21:18:28 jmcneill Exp $
 .\"
 .\" Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd July 15, 2017
+.Dd September 29, 2017
 .Dt MKUBOOTIMAGE 1
 .Os
 .Sh NAME
@@ -36,7 +36,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl h
-.Fl A No ( arm Ns | Ns arm64 Ns | Ns i386 Ns | Ns mips Ns | Ns mips64 Ns | Ns or1k Ns | Ns powerpc )
+.Fl A No ( arm Ns | Ns arm64 Ns | Ns i386 Ns | Ns mips Ns | Ns mips64 Ns | Ns or1k Ns | Ns powerpc Ns | Ns sh )
 .Fl a Ar address
 .Op Fl C Po bz2 Ns | Ns gz Ns | Ns lzma Ns | Ns lzo Ns | Ns none Pc
 .Op Fl E Ar address
@@ -55,7 +55,7 @@ utility is used to create an image for D
 .Pp
 The arguments are as follows:
 .Bl -tag -width indent
-.It Fl A No ( arm Ns | Ns arm64 Ns | Ns i386 Ns | Ns mips Ns | Ns mips64 Ns | Ns or1k Ns | Ns powerpc )
+.It Fl A No ( arm Ns | Ns arm64 Ns | Ns i386 Ns | Ns mips Ns | Ns mips64 Ns | Ns or1k Ns | Ns powerpc Ns | Ns sh )
 Defines the architecture.
 This is required.
 .It Fl a Ar address

Index: src/usr.bin/mkubootimage/mkubootimage.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.20 src/usr.bin/mkubootimage/mkubootimage.c:1.21
--- src/usr.bin/mkubootimage/mkubootimage.c:1.20	Sat Jul 15 11:13:08 2017
+++ src/usr.bin/mkubootimage/mkubootimage.c	Fri Sep 29 21:18:28 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.20 2017/07/15 11:13:08 jmcneill Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.21 2017/09/29 21:18:28 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill 
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: mkubootimage.c,v 1.20 2017/07/15 11:13:08 jmcneill Exp $");
+__RCSID("$NetBSD: mkubootimage.c,v 1.21 2017/09/29 21:18:28 jmcneill Exp $");
 
 #include 
 #include 
@@ -106,12 +106,13 @@ static const struct uboot_arch {
 	const char *name;
 } uboot_arch[] = {
 	{ IH_ARCH_ARM,		"arm" },
+	{ IH_ARCH_ARM64,	"arm64" },
 	{ IH_ARCH_I386,		"i386" },
 	{ IH_ARCH_MIPS,		"mips" },
 	{ IH_ARCH_MIPS64,	"mips64" },
 	{ IH_ARCH_PPC,		"powerpc" },
 	{ IH_ARCH_OPENRISC,	"or1k" },
-	{ IH_ARCH_ARM64,	"arm64" },
+	{ IH_ARCH_SH,		"sh" },
 };
 
 static enum uboot_image_arch
@@ -219,7 +220,7 @@ __dead static void
 usage(void)
 {
 	fprintf(stderr, "usage: mkubootimage -A "
-	"");
+	"");
 	fprintf(stderr, " -C ");
 	fprintf(stderr, " -O ");
 	fprintf(stderr, " -T ");

Index: src/usr.bin/mkubootimage/uboot.h
diff -u src/usr.bin/mkubootimage/uboot.h:1.7 src/usr.bin/mkubootimage/uboot.h:1.8
--- src/usr.bin/mkubootimage/uboot.h:1.7	Sat Jul 15 11:13:08 2017
+++ src/usr.bin/mkubootimage/uboot.h	Fri Sep 29 21:18:28 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: uboot.h,v 1.7 2017/07/15 11:13:08 jmcneill Exp $ */
+/* $NetBSD: uboot.h,v 1.8 2017/09/29 21:18:28 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill 
@@ -43,6 +43,7 @@ enum uboot_image_arch {
 	IH_ARCH_MIPS = 5,
 	IH_ARCH_MIPS64 = 6,
 	IH_ARCH_PPC = 7,
+	IH_ARCH_SH = 9,
 	IH_ARCH_OPENRISC = 21,
 	IH_ARCH_ARM64 = 22
 };



CVS commit: [jdolecek-ncq] src/sys/arch/amiga/dev

2017-09-29 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Sep 29 20:07:40 UTC 2017

Modified Files:
src/sys/arch/amiga/dev [jdolecek-ncq]: wdc_xsurf.c

Log Message:
remove  include again, atavar.h no longer needs it


To generate a diff of this commit:
cvs rdiff -u -r1.2.30.3 -r1.2.30.4 src/sys/arch/amiga/dev/wdc_xsurf.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/arch/amiga/dev/wdc_xsurf.c
diff -u src/sys/arch/amiga/dev/wdc_xsurf.c:1.2.30.3 src/sys/arch/amiga/dev/wdc_xsurf.c:1.2.30.4
--- src/sys/arch/amiga/dev/wdc_xsurf.c:1.2.30.3	Wed Sep 27 07:19:33 2017
+++ src/sys/arch/amiga/dev/wdc_xsurf.c	Fri Sep 29 20:07:40 2017
@@ -1,4 +1,4 @@
-/*  $NetBSD: wdc_xsurf.c,v 1.2.30.3 2017/09/27 07:19:33 jdolecek Exp $ */
+/*  $NetBSD: wdc_xsurf.c,v 1.2.30.4 2017/09/29 20:07:40 jdolecek Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -35,7 +35,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 



CVS commit: [jdolecek-ncq] src/sys/dev/ata

2017-09-29 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Sep 29 20:05:07 UTC 2017

Modified Files:
src/sys/dev/ata [jdolecek-ncq]: TODO.ncq ata.c atavar.h

Log Message:
introduce ATA_BSIZE and use it instead of DEV_BSIZE for get params and
recovery, where they are by spec 512 bytes and not negotiable


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.46 -r1.1.2.47 src/sys/dev/ata/TODO.ncq
cvs rdiff -u -r1.132.8.38 -r1.132.8.39 src/sys/dev/ata/ata.c
cvs rdiff -u -r1.92.8.28 -r1.92.8.29 src/sys/dev/ata/atavar.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/dev/ata/TODO.ncq
diff -u src/sys/dev/ata/TODO.ncq:1.1.2.46 src/sys/dev/ata/TODO.ncq:1.1.2.47
--- src/sys/dev/ata/TODO.ncq:1.1.2.46	Thu Sep 28 20:34:23 2017
+++ src/sys/dev/ata/TODO.ncq	Fri Sep 29 20:05:07 2017
@@ -2,10 +2,6 @@ Bugs
 
 test wd* at umass?, confirm the ata_channel kludge works
 
-stop using DEV_BSIZE when really meaning ATA sector size and revert
- inclusion in:
-cvs rdiff -u -r1.2.30.1 -r1.2.30.2 src/sys/arch/amiga/dev/wdc_xsurf.c
-
 Other random notes (do outside the NCQ branch):
 -
 do biodone() in wddone() starting the dump to not leak bufs when dumping from

Index: src/sys/dev/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.132.8.38 src/sys/dev/ata/ata.c:1.132.8.39
--- src/sys/dev/ata/ata.c:1.132.8.38	Wed Sep 27 19:05:57 2017
+++ src/sys/dev/ata/ata.c	Fri Sep 29 20:05:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.132.8.38 2017/09/27 19:05:57 jdolecek Exp $	*/
+/*	$NetBSD: ata.c,v 1.132.8.39 2017/09/29 20:05:07 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.38 2017/09/27 19:05:57 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.39 2017/09/29 20:05:07 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -961,7 +961,7 @@ ata_get_params(struct ata_drive_datas *d
 		return CMD_AGAIN;
 	}
 
-	tb = kmem_zalloc(DEV_BSIZE, KM_SLEEP);
+	tb = kmem_zalloc(ATA_BSIZE, KM_SLEEP);
 	memset(prms, 0, sizeof(struct ataparams));
 
 	if (drvp->drive_type == ATA_DRIVET_ATA) {
@@ -982,7 +982,7 @@ ata_get_params(struct ata_drive_datas *d
 	}
 	xfer->c_ata_c.flags = AT_READ | flags;
 	xfer->c_ata_c.data = tb;
-	xfer->c_ata_c.bcount = DEV_BSIZE;
+	xfer->c_ata_c.bcount = ATA_BSIZE;
 	if ((*atac->atac_bustype_ata->ata_exec_command)(drvp,
 		xfer) != ATACMD_COMPLETE) {
 		ATADEBUG_PRINT(("ata_get_parms: wdc_exec_command failed\n"),
@@ -1044,7 +1044,7 @@ ata_get_params(struct ata_drive_datas *d
 
 	rv = CMD_OK;
  out:
-	kmem_free(tb, DEV_BSIZE);
+	kmem_free(tb, ATA_BSIZE);
 	ata_free_xfer(chp, xfer);
 	return rv;
 }
@@ -1110,7 +1110,7 @@ ata_read_log_ext_ncq(struct ata_drive_da
 	xfer = ata_get_xfer_ext(chp, C_RECOVERY, 0);
 
 	tb = drvp->recovery_blk;
-	memset(tb, 0, DEV_BSIZE);
+	memset(tb, 0, sizeof(drvp->recovery_blk));
 
 	/*
 	 * We could use READ LOG DMA EXT if drive supports it (i.e.
@@ -1128,7 +1128,7 @@ ata_read_log_ext_ncq(struct ata_drive_da
 	xfer->c_ata_c.flags = AT_READ | AT_LBA | AT_LBA48 | flags;
 	xfer->c_ata_c.timeout = 1000; /* 1s */
 	xfer->c_ata_c.data = tb;
-	xfer->c_ata_c.bcount = DEV_BSIZE;
+	xfer->c_ata_c.bcount = sizeof(drvp->recovery_blk);
 
 	if ((*atac->atac_bustype_ata->ata_exec_command)(drvp,
 		xfer) != ATACMD_COMPLETE) {
@@ -1141,7 +1141,7 @@ ata_read_log_ext_ncq(struct ata_drive_da
 	}
 
 	cksum = 0;
-	for (int i = 0; i < DEV_BSIZE; i++)
+	for (int i = 0; i < sizeof(drvp->recovery_blk); i++)
 		cksum += tb[i];
 	if (cksum != 0) {
 		aprint_error_dev(drvp->drv_softc,

Index: src/sys/dev/ata/atavar.h
diff -u src/sys/dev/ata/atavar.h:1.92.8.28 src/sys/dev/ata/atavar.h:1.92.8.29
--- src/sys/dev/ata/atavar.h:1.92.8.28	Wed Sep 27 19:05:57 2017
+++ src/sys/dev/ata/atavar.h	Fri Sep 29 20:05:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: atavar.h,v 1.92.8.28 2017/09/27 19:05:57 jdolecek Exp $	*/
+/*	$NetBSD: atavar.h,v 1.92.8.29 2017/09/29 20:05:07 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -207,6 +207,8 @@ struct ata_xfer {
 #define ATA_MAX_OPENINGS	32
 #define ATA_REAL_OPENINGS(op)	((op) > 1 ? (op) - 1 : 1)
 
+#define ATA_BSIZE		512	/* Standard ATA block size (bytes) */
+
 /* Per-channel queue of ata_xfers */
 #ifndef ATABUS_PRIVATE
 struct ata_queue;
@@ -329,7 +331,7 @@ struct ata_drive_datas {
 	daddr_t	badsect[127];	/* 126 plus trailing -1 marker */
 
 	/* Recovery buffer */
-	uint8_t recovery_blk[DEV_BSIZE];
+	uint8_t recovery_blk[ATA_BSIZE];
 };
 
 /* User config flags that force (or disable) the use of a mode */



CVS commit: src/bin/sh

2017-09-29 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Sep 29 17:53:57 UTC 2017

Modified Files:
src/bin/sh: eval.c jobs.c

Log Message:
DEBUG only changes (non-debug, ie: normal, shell unaffected)
Add a little extra info in a few of the trace messages.


To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/bin/sh/eval.c
cvs rdiff -u -r1.88 -r1.89 src/bin/sh/jobs.c

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

Modified files:

Index: src/bin/sh/eval.c
diff -u src/bin/sh/eval.c:1.151 src/bin/sh/eval.c:1.152
--- src/bin/sh/eval.c:1.151	Fri Jun 30 23:01:21 2017
+++ src/bin/sh/eval.c	Fri Sep 29 17:53:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: eval.c,v 1.151 2017/06/30 23:01:21 kre Exp $	*/
+/*	$NetBSD: eval.c,v 1.152 2017/09/29 17:53:57 kre Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)eval.c	8.9 (Berkeley) 6/8/95";
 #else
-__RCSID("$NetBSD: eval.c,v 1.151 2017/06/30 23:01:21 kre Exp $");
+__RCSID("$NetBSD: eval.c,v 1.152 2017/09/29 17:53:57 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -1056,7 +1056,8 @@ evalcommand(union node *cmd, int flgs, s
 	/* Execute the command. */
 	switch (cmdentry.cmdtype) {
 	case CMDFUNCTION:
-		VXTRACE(DBG_EVAL, ("Shell function:  "), trargs(argv));
+		VXTRACE(DBG_EVAL, ("Shell function%s:  ",vforked?" VF":""),
+		trargs(argv));
 		redirect(cmd->ncmd.redirect, flags & EV_MORE ? REDIR_PUSH : 0);
 		saveparam = shellparam;
 		shellparam.malloc = 0;
@@ -1126,7 +1127,7 @@ evalcommand(union node *cmd, int flgs, s
 
 	case CMDBUILTIN:
 	case CMDSPLBLTIN:
-		VXTRACE(DBG_EVAL, ("builtin command:  "), trargs(argv));
+		VXTRACE(DBG_EVAL, ("builtin command%s:  ",vforked?" VF":""), trargs(argv));
 		mode = (cmdentry.u.bltin == execcmd) ? 0 : REDIR_PUSH;
 		if (flags == EV_BACKCMD) {
 			memout.nleft = 0;
@@ -1204,7 +1205,8 @@ evalcommand(union node *cmd, int flgs, s
 		break;
 
 	default:
-		VXTRACE(DBG_EVAL, ("normal command:  "), trargs(argv));
+		VXTRACE(DBG_EVAL, ("normal command%s:  ", vforked?" VF":""),
+		trargs(argv));
 		redirect(cmd->ncmd.redirect, 
 		(vforked ? REDIR_VFORK : 0) | REDIR_KEEP);
 		if (!vforked)

Index: src/bin/sh/jobs.c
diff -u src/bin/sh/jobs.c:1.88 src/bin/sh/jobs.c:1.89
--- src/bin/sh/jobs.c:1.88	Mon Jul 24 14:17:11 2017
+++ src/bin/sh/jobs.c	Fri Sep 29 17:53:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.88 2017/07/24 14:17:11 kre Exp $	*/
+/*	$NetBSD: jobs.c,v 1.89 2017/09/29 17:53:57 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)jobs.c	8.5 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: jobs.c,v 1.88 2017/07/24 14:17:11 kre Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.89 2017/09/29 17:53:57 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -913,7 +913,7 @@ forkparent(struct job *jp, union node *n
 		if (/* iflag && rootshell && */ n)
 			commandtext(ps, n);
 	}
-	CTRACE(DBG_JOBS, ("In parent shell:  child = %d\n", pid));
+	CTRACE(DBG_JOBS, ("In parent shell: child = %d (mode %d)\n",pid,mode));
 	return pid;
 }
 
@@ -926,7 +926,7 @@ forkchild(struct job *jp, union node *n,
 	const char *nullerr = "Can't open %s";
 
 	wasroot = rootshell;
-	CTRACE(DBG_JOBS, ("Child shell %d\n", getpid()));
+	CTRACE(DBG_JOBS, ("Child shell %d%s\n",getpid(),vforked?" vforked":""));
 	if (!vforked)
 		rootshell = 0;
 



CVS commit: src/sys

2017-09-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 29 17:47:29 UTC 2017

Modified Files:
src/sys/compat/linux32/common: linux32_mod.c linux32_sysctl.c
linux32_sysctl.h
src/sys/kern: kern_exec.c

Log Message:
Remove compat_linux32 from the autoload list and add a enable/disable
sysctl, like compat_linux.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/compat/linux32/common/linux32_mod.c
cvs rdiff -u -r1.16 -r1.17 src/sys/compat/linux32/common/linux32_sysctl.c
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/linux32/common/linux32_sysctl.h
cvs rdiff -u -r1.445 -r1.446 src/sys/kern/kern_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/linux32/common/linux32_mod.c
diff -u src/sys/compat/linux32/common/linux32_mod.c:1.7 src/sys/compat/linux32/common/linux32_mod.c:1.8
--- src/sys/compat/linux32/common/linux32_mod.c:1.7	Thu Dec  3 23:51:24 2015
+++ src/sys/compat/linux32/common/linux32_mod.c	Fri Sep 29 17:47:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_mod.c,v 1.7 2015/12/03 23:51:24 pgoyette Exp $	*/
+/*	$NetBSD: linux32_mod.c,v 1.8 2017/09/29 17:47:29 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux32_mod.c,v 1.7 2015/12/03 23:51:24 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_mod.c,v 1.8 2017/09/29 17:47:29 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_execfmt.h"
@@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux32_mod.
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -77,6 +78,38 @@ static struct execsw linux32_execsw[] = 
 #endif
 };
 
+int linux32_enabled = 0;
+
+int
+linux32_sysctl_enable(SYSCTLFN_ARGS)
+{
+	struct sysctlnode node;
+	int error, val;
+
+	val = *(int *)rnode->sysctl_data;
+
+	node = *rnode;
+	node.sysctl_data = &val;
+
+	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	if (error != 0 || newp == NULL)
+		return error;
+
+	if (val == 1) {
+		error = exec_add(linux32_execsw, __arraycount(linux32_execsw));
+	} else if (val == 0) {
+		error = exec_remove(linux32_execsw, __arraycount(linux32_execsw));
+	} else {
+		error = EINVAL;
+	}
+	if (error)
+		return error;
+
+	*(int *)rnode->sysctl_data = val;
+
+	return 0;
+}
+
 static int
 compat_linux32_modcmd(modcmd_t cmd, void *arg)
 {
@@ -84,19 +117,16 @@ compat_linux32_modcmd(modcmd_t cmd, void
 
 	switch (cmd) {
 	case MODULE_CMD_INIT:
+		linux32_enabled = 0;
 		linux32_sysctl_init();
-		error = exec_add(linux32_execsw,
-		__arraycount(linux32_execsw));
-		if (error != 0)
-			linux32_sysctl_fini();
-		return error;
+		return 0;
 
 	case MODULE_CMD_FINI:
-		error = exec_remove(linux32_execsw,
-		__arraycount(linux32_execsw));
-		if (error == 0)
-			linux32_sysctl_fini();
-		return error;
+		error = exec_remove(linux32_execsw, __arraycount(linux32_execsw));
+		if (error)
+			return error;
+		linux32_sysctl_fini();
+		return 0;
 
 	default:
 		return ENOTTY;

Index: src/sys/compat/linux32/common/linux32_sysctl.c
diff -u src/sys/compat/linux32/common/linux32_sysctl.c:1.16 src/sys/compat/linux32/common/linux32_sysctl.c:1.17
--- src/sys/compat/linux32/common/linux32_sysctl.c:1.16	Fri May 16 12:22:32 2014
+++ src/sys/compat/linux32/common/linux32_sysctl.c	Fri Sep 29 17:47:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_sysctl.c,v 1.16 2014/05/16 12:22:32 martin Exp $ */
+/*	$NetBSD: linux32_sysctl.c,v 1.17 2017/09/29 17:47:29 maxv Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -31,7 +31,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux32_sysctl.c,v 1.16 2014/05/16 12:22:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_sysctl.c,v 1.17 2017/09/29 17:47:29 maxv Exp $");
 
 #include 
 #include 
@@ -70,6 +70,7 @@ struct sysctlnode linux32_sysctl_root = 
 
 static struct sysctllog *linux32_clog1;
 static struct sysctllog *linux32_clog2;
+extern int linux32_enabled;
 
 void
 linux32_sysctl_fini(void)
@@ -119,6 +120,12 @@ linux32_sysctl_init(void)
 		   NULL, 0, linux32_version, sizeof(linux32_version),
 		   CTL_EMUL, EMUL_LINUX32, EMUL_LINUX32_KERN,
 		   EMUL_LINUX32_KERN_VERSION, CTL_EOL);
+	sysctl_createv(&linux32_clog1, 0, NULL, NULL,
+		   CTLFLAG_READWRITE,
+		   CTLTYPE_INT, "enabled",
+		   SYSCTL_DESCR("Linux 32 bit compat enabled."),
+		   linux32_sysctl_enable, 0, &linux32_enabled, 0,
+		   CTL_EMUL, EMUL_LINUX32, CTL_CREATE, CTL_EOL);
 
 	sysctl_createv(&linux32_clog2, 0, &node, &node,
 		   CTLFLAG_PERMANENT,

Index: src/sys/compat/linux32/common/linux32_sysctl.h
diff -u src/sys/compat/linux32/common/linux32_sysctl.h:1.2 src/sys/compat/linux32/common/linux32_sysctl.h:1.3
--- src/sys/compat/linux32/common/linux32_sysctl.h:1.2	Wed Nov 19 18:36:04 2008
+++ src/sys/compat/linux32/common/linux32_sysctl.h	Fri Sep 29 17:47:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBS

CVS commit: src/sys/miscfs/procfs

2017-09-29 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Sep 29 17:27:26 UTC 2017

Modified Files:
src/sys/miscfs/procfs: procfs_status.c

Log Message:
Use %ju and (intmax_t) to unbreak i386 build.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/miscfs/procfs/procfs_status.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/miscfs/procfs/procfs_status.c
diff -u src/sys/miscfs/procfs/procfs_status.c:1.38 src/sys/miscfs/procfs/procfs_status.c:1.39
--- src/sys/miscfs/procfs/procfs_status.c:1.38	Fri Sep 29 12:57:05 2017
+++ src/sys/miscfs/procfs/procfs_status.c	Fri Sep 29 17:27:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_status.c,v 1.38 2017/09/29 12:57:05 christos Exp $	*/
+/*	$NetBSD: procfs_status.c,v 1.39 2017/09/29 17:27:26 kre Exp $	*/
 
 /*
  * Copyright (c) 1993
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_status.c,v 1.38 2017/09/29 12:57:05 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_status.c,v 1.39 2017/09/29 17:27:26 kre Exp $");
 
 #include 
 #include 
@@ -129,11 +129,11 @@ procfs_status_netbsd(struct lwp *l, stru
 		ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf), "\n");
 
 		ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf),
-		"VmPeak:\t%8lu kB\n", p->p_rlimit[RLIMIT_DATA].rlim_cur / 1024);
+		"VmPeak:\t%8ju kB\n", (intmax_t)p->p_rlimit[RLIMIT_DATA].rlim_cur / 1024);
 		ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf),
-		"VmSize:\t%8lu kB\n", p->p_rlimit[RLIMIT_DATA].rlim_cur / 1024);
+		"VmSize:\t%8ju kB\n", (intmax_t)p->p_rlimit[RLIMIT_DATA].rlim_cur / 1024);
 		ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf),
-		"VmRSS:\t%8lu kB\n", p->p_rlimit[RLIMIT_RSS].rlim_cur / 1024);
+		"VmRSS:\t%8ju kB\n", (intmax_t)p->p_rlimit[RLIMIT_RSS].rlim_cur / 1024);
 
 	} else {
 /* comm pid ppid pgid sid maj,min ctty,sldr start ut st wmsg uid gid groups ... */



CVS commit: src/sys

2017-09-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 29 17:08:00 UTC 2017

Modified Files:
src/sys/compat/linux/common: linux_mod.c linux_sysctl.c linux_sysctl.h
src/sys/kern: kern_exec.c

Log Message:
Remove compat_linux from the autoload list, and add a sysctl to enable or
disable it - which defaults to disabled. The following command is now
required to use linux binaries:

sysctl -w emul.linux.enabled=1

After a discussion on tech-kern@. All the other ideas to reduce the attack
surface have drawbacks, and this sysctl seems to be the best option.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/compat/linux/common/linux_mod.c
cvs rdiff -u -r1.43 -r1.44 src/sys/compat/linux/common/linux_sysctl.c
cvs rdiff -u -r1.5 -r1.6 src/sys/compat/linux/common/linux_sysctl.h
cvs rdiff -u -r1.444 -r1.445 src/sys/kern/kern_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/linux/common/linux_mod.c
diff -u src/sys/compat/linux/common/linux_mod.c:1.6 src/sys/compat/linux/common/linux_mod.c:1.7
--- src/sys/compat/linux/common/linux_mod.c:1.6	Thu Dec  3 02:51:01 2015
+++ src/sys/compat/linux/common/linux_mod.c	Fri Sep 29 17:08:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_mod.c,v 1.6 2015/12/03 02:51:01 pgoyette Exp $	*/
+/*	$NetBSD: linux_mod.c,v 1.7 2017/09/29 17:08:00 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_mod.c,v 1.6 2015/12/03 02:51:01 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_mod.c,v 1.7 2017/09/29 17:08:00 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_execfmt.h"
@@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_mod.c,
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -118,6 +119,38 @@ static struct execsw linux_execsw[] = {
 #endif
 };
 
+int linux_enabled = 0;
+
+int
+linux_sysctl_enable(SYSCTLFN_ARGS)
+{
+	struct sysctlnode node;
+	int error, val;
+
+	val = *(int *)rnode->sysctl_data;
+
+	node = *rnode;
+	node.sysctl_data = &val;
+
+	error = sysctl_lookup(SYSCTLFN_CALL(&node));
+	if (error != 0 || newp == NULL)
+		return error;
+
+	if (val == 1) {
+		error = exec_add(linux_execsw, __arraycount(linux_execsw));
+	} else if (val == 0) {
+		error = exec_remove(linux_execsw, __arraycount(linux_execsw));
+	} else {
+		error = EINVAL;
+	}
+	if (error)
+		return error;
+
+	*(int *)rnode->sysctl_data = val;
+
+	return 0;
+}
+
 static int
 compat_linux_modcmd(modcmd_t cmd, void *arg)
 {
@@ -125,22 +158,18 @@ compat_linux_modcmd(modcmd_t cmd, void *
 
 	switch (cmd) {
 	case MODULE_CMD_INIT:
+		linux_enabled = 0;
 		linux_futex_init();
 		linux_sysctl_init();
-		error = exec_add(linux_execsw,
-		__arraycount(linux_execsw));
-		if (error != 0)
-			linux_sysctl_fini();
-		return error;
+		return 0;
 
 	case MODULE_CMD_FINI:
-		error = exec_remove(linux_execsw,
-		__arraycount(linux_execsw));
-		if (error == 0) {
-			linux_sysctl_fini();
-			linux_futex_fini();
-		}
-		return error;
+		error = exec_remove(linux_execsw, __arraycount(linux_execsw));
+		if (error)
+			return error;
+		linux_sysctl_fini();
+		linux_futex_fini();
+		return 0;
 
 	default:
 		return ENOTTY;

Index: src/sys/compat/linux/common/linux_sysctl.c
diff -u src/sys/compat/linux/common/linux_sysctl.c:1.43 src/sys/compat/linux/common/linux_sysctl.c:1.44
--- src/sys/compat/linux/common/linux_sysctl.c:1.43	Fri May 16 12:22:32 2014
+++ src/sys/compat/linux/common/linux_sysctl.c	Fri Sep 29 17:08:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_sysctl.c,v 1.43 2014/05/16 12:22:32 martin Exp $	*/
+/*	$NetBSD: linux_sysctl.c,v 1.44 2017/09/29 17:08:00 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_sysctl.c,v 1.43 2014/05/16 12:22:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_sysctl.c,v 1.44 2017/09/29 17:08:00 maxv Exp $");
 
 #include 
 #include 
@@ -70,6 +70,7 @@ struct sysctlnode linux_sysctl_root = {
 
 static struct sysctllog *linux_clog1;
 static struct sysctllog *linux_clog2;
+extern int linux_enabled;
 
 void
 linux_sysctl_fini(void)
@@ -112,6 +113,7 @@ linux_sysctl_init(void)
 		   SYSCTL_DESCR("Linux emulation settings"),
 		   NULL, 0, NULL, 0,
 		   CTL_EMUL, EMUL_LINUX, CTL_EOL);
+
 	sysctl_createv(&linux_clog2, 0, NULL, NULL,
 		   CTLFLAG_PERMANENT,
 		   CTLTYPE_NODE, "kern",
@@ -140,6 +142,13 @@ linux_sysctl_init(void)
 		   CTL_EMUL, EMUL_LINUX, EMUL_LINUX_KERN,
 		   EMUL_LINUX_KERN_VERSION, CTL_EOL);
 
+	sysctl_createv(&linux_clog2, 0, NULL, NULL,
+		   CTLFLAG_READWRITE,
+		   CTLTYPE_INT, "enabled",
+		   SYSCTL_DESCR("Linux compat enabled."),
+		   linux_sysctl_enable, 0, &linux_enabled, 0,
+		   CTL_EMUL, EMUL_LINUX, CTL_CREATE, CTL_EOL);
+
 	linux_sysctl_root.sysctl_flags &= ~CTLFLAG_READ

CVS commit: src/sys/netipsec

2017-09-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Sep 29 14:59:43 UTC 2017

Modified Files:
src/sys/netipsec: key.c

Log Message:
humanize printing of ip addresses


To generate a diff of this commit:
cvs rdiff -u -r1.228 -r1.229 src/sys/netipsec/key.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/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.228 src/sys/netipsec/key.c:1.229
--- src/sys/netipsec/key.c:1.228	Thu Sep 28 13:21:42 2017
+++ src/sys/netipsec/key.c	Fri Sep 29 10:59:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.228 2017/09/28 17:21:42 christos Exp $	*/
+/*	$NetBSD: key.c,v 1.229 2017/09/29 14:59:43 christos Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.228 2017/09/28 17:21:42 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.229 2017/09/29 14:59:43 christos Exp $");
 
 /*
  * This code is referd to RFC 2367
@@ -4633,6 +4633,7 @@ key_sockaddr_match(
 {
 	const struct sockaddr_in *sin1, *sin2;
 	const struct sockaddr_in6 *sin61, *sin62;
+	char s1[IPSEC_ADDRSTRLEN], s2[IPSEC_ADDRSTRLEN];
 
 	if (sa1->sa_family != sa2->sa_family || sa1->sa_len != sa2->sa_len) {
 		KEYDEBUG_PRINTF(KEYDEBUG_MATCH,
@@ -4654,17 +4655,20 @@ key_sockaddr_match(
 		sin2 = (const struct sockaddr_in *)sa2;
 		if (sin1->sin_addr.s_addr != sin2->sin_addr.s_addr) {
 			KEYDEBUG_PRINTF(KEYDEBUG_MATCH,
-			"addr fail %#x != %#x\n",
-			sin1->sin_addr.s_addr, sin2->sin_addr.s_addr);
+			"addr fail %s != %s\n",
+			(in_print(s1, sizeof(s1), &sin1->sin_addr), s1),
+			(in_print(s2, sizeof(s2), &sin2->sin_addr), s2));
 			return 0;
 		}
 		if (key_portcomp(sin1->sin_port, sin2->sin_port, howport)) {
 			return 0;
 		}
 		KEYDEBUG_PRINTF(KEYDEBUG_MATCH,
-		"addr success %#x[%d] == %#x[%d]\n",
-		sin1->sin_addr.s_addr, sin1->sin_port,
-		sin2->sin_addr.s_addr, sin2->sin_port);
+		"addr success %s[%d] == %s[%d]\n",
+		(in_print(s1, sizeof(s1), &sin1->sin_addr), s1),
+		sin1->sin_port,
+		(in_print(s2, sizeof(s2), &sin2->sin_addr), s2),
+		sin2->sin_port);
 		break;
 	case AF_INET6:
 		sin61 = (const struct sockaddr_in6 *)sa1;



CVS commit: src/sys/dev/i2c

2017-09-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 29 14:17:47 UTC 2017

Modified Files:
src/sys/dev/i2c: adm1021.c

Log Message:
get sensor descriptions from OpenFirmware if we know how
this needs to be generalized


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/i2c/adm1021.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/dev/i2c/adm1021.c
diff -u src/sys/dev/i2c/adm1021.c:1.15 src/sys/dev/i2c/adm1021.c:1.16
--- src/sys/dev/i2c/adm1021.c:1.15	Wed Sep 20 22:44:28 2017
+++ src/sys/dev/i2c/adm1021.c	Fri Sep 29 14:17:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: adm1021.c,v 1.15 2017/09/20 22:44:28 macallan Exp $ */
+/*	$NetBSD: adm1021.c,v 1.16 2017/09/29 14:17:47 macallan Exp $ */
 /*	$OpenBSD: adm1021.c,v 1.27 2007/06/24 05:34:35 dlg Exp $	*/
 
 /*
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 1.15 2017/09/20 22:44:28 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 1.16 2017/09/29 14:17:47 macallan Exp $");
 
 #include 
 #include 
@@ -47,6 +47,14 @@ __KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 
 
 #include 
 
+#ifdef macppc
+#define HAVE_OF 1
+#endif
+
+#ifdef HAVE_OF
+#include 
+#endif
+
 /* Registers */
 #define ADM1021_INT_TEMP	0x00	/* Internal temperature value */
 #define ADM1021_EXT_TEMP	0x01	/* External temperature value */
@@ -322,7 +330,10 @@ admtemp_attach(device_t parent, device_t
 	struct i2c_attach_args *ia = aux;
 	uint8_t cmd, data, stat, comp, rev;
 	char name[ADMTEMP_NAMELEN];
-
+#ifdef HAVE_OF
+	char ename[64], iname[64];
+	int ch;
+#endif
 	sc->sc_tag = ia->ia_tag;
 	sc->sc_addr = ia->ia_addr;
 
@@ -384,10 +395,27 @@ admtemp_attach(device_t parent, device_t
 	sc->sc_sensor[ADMTEMP_EXT].units = ENVSYS_STEMP;
 	sc->sc_sensor[ADMTEMP_INT].flags = ENVSYS_FMONLIMITS;
 	sc->sc_sensor[ADMTEMP_EXT].flags = ENVSYS_FMONLIMITS;
+#ifdef HAVE_OF
+	strcpy(iname, "internal");
+	strcpy(ename, "external");
+	ch = OF_child(ia->ia_cookie);
+	if (ch != 0) {
+		OF_getprop(ch, "location", iname, 64);
+		ch = OF_peer(ch);
+		if (ch != 0) {
+			OF_getprop(ch, "location", ename, 64);
+		}
+	}	
+	strlcpy(sc->sc_sensor[ADMTEMP_INT].desc, iname,
+	sizeof(sc->sc_sensor[ADMTEMP_INT].desc));
+	strlcpy(sc->sc_sensor[ADMTEMP_EXT].desc, ename,
+	sizeof(sc->sc_sensor[ADMTEMP_EXT].desc));
+#else
 	strlcpy(sc->sc_sensor[ADMTEMP_INT].desc, "internal",
 	sizeof(sc->sc_sensor[ADMTEMP_INT].desc));
 	strlcpy(sc->sc_sensor[ADMTEMP_EXT].desc, "external",
 	sizeof(sc->sc_sensor[ADMTEMP_EXT].desc));
+#endif
 	sc->sc_sme = sysmon_envsys_create();
 	if (sysmon_envsys_sensor_attach(
 	sc->sc_sme, &sc->sc_sensor[ADMTEMP_INT])) {



CVS commit: src/sys/arch/macppc/dev

2017-09-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 29 14:15:42 UTC 2017

Modified Files:
src/sys/arch/macppc/dev: pmu.c

Log Message:
pass the right device node to i2c devices


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/macppc/dev/pmu.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/arch/macppc/dev/pmu.c
diff -u src/sys/arch/macppc/dev/pmu.c:1.28 src/sys/arch/macppc/dev/pmu.c:1.29
--- src/sys/arch/macppc/dev/pmu.c:1.28	Fri Sep  1 20:10:08 2017
+++ src/sys/arch/macppc/dev/pmu.c	Fri Sep 29 14:15:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmu.c,v 1.28 2017/09/01 20:10:08 macallan Exp $ */
+/*	$NetBSD: pmu.c,v 1.29 2017/09/29 14:15:42 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.28 2017/09/01 20:10:08 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.29 2017/09/29 14:15:42 macallan Exp $");
 
 #include 
 #include 
@@ -373,7 +373,7 @@ pmu_attach(device_t parent, device_t sel
 prop_dictionary_set(dev, "compatible", data);
 prop_object_release(data);
 prop_dictionary_set_uint32(dev, "addr", addr);
-prop_dictionary_set_uint64(dev, "cookie", node);
+prop_dictionary_set_uint64(dev, "cookie", devs);
 prop_array_add(cfg, dev);
 prop_object_release(dev);
 			skip:



CVS commit: src/tests/rump/kernspace

2017-09-29 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Sep 29 13:19:57 UTC 2017

Modified Files:
src/tests/rump/kernspace: kernspace.h

Log Message:
Add declaration. build fix

sorry, I forgot to commit this file.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/rump/kernspace/kernspace.h

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

Modified files:

Index: src/tests/rump/kernspace/kernspace.h
diff -u src/tests/rump/kernspace/kernspace.h:1.4 src/tests/rump/kernspace/kernspace.h:1.5
--- src/tests/rump/kernspace/kernspace.h:1.4	Fri Jan 14 13:08:00 2011
+++ src/tests/rump/kernspace/kernspace.h	Fri Sep 29 13:19:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernspace.h,v 1.4 2011/01/14 13:08:00 pooka Exp $	*/
+/*	$NetBSD: kernspace.h,v 1.5 2017/09/29 13:19:57 maya Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -40,6 +40,7 @@ void rumptest_thread(void);
 void rumptest_tsleep(void);
 void rumptest_alloc(size_t);
 void rumptest_lockme(enum locktest);
+void rumptest_workqueue1(void);
 
 void rumptest_sendsig(char *);
 void rumptest_localsig(int);



CVS commit: src/sys/miscfs/procfs

2017-09-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Sep 29 12:57:05 UTC 2017

Modified Files:
src/sys/miscfs/procfs: procfs_status.c

Log Message:
Split the status printing routines (one for NetBSD and one for Linux) for
simplicity (Robert Swindelis)


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/miscfs/procfs/procfs_status.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/miscfs/procfs/procfs_status.c
diff -u src/sys/miscfs/procfs/procfs_status.c:1.37 src/sys/miscfs/procfs/procfs_status.c:1.38
--- src/sys/miscfs/procfs/procfs_status.c:1.37	Mon Nov 14 03:55:51 2016
+++ src/sys/miscfs/procfs/procfs_status.c	Fri Sep 29 08:57:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_status.c,v 1.37 2016/11/14 08:55:51 kre Exp $	*/
+/*	$NetBSD: procfs_status.c,v 1.38 2017/09/29 12:57:05 christos Exp $	*/
 
 /*
  * Copyright (c) 1993
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_status.c,v 1.37 2016/11/14 08:55:51 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_status.c,v 1.38 2017/09/29 12:57:05 christos Exp $");
 
 #include 
 #include 
@@ -88,13 +88,8 @@ __KERNEL_RCSID(0, "$NetBSD: procfs_statu
 
 #include 
 
-int
-procfs_dostatus(
-struct lwp *curl,
-struct lwp *l,
-struct pfsnode *pfs,
-struct uio *uio
-)
+static int
+procfs_status_netbsd(struct lwp *l, struct uio *uio)
 {
 	struct session *sess;
 	struct tty *tp;
@@ -102,13 +97,12 @@ procfs_dostatus(
 	struct proc *p = l->l_proc;
 	char *ps;
 	const char *sep;
+	const char *emulname = curlwp->l_proc->p_emul->e_name;
 	int pid, ppid, pgid, sid;
 	u_int i;
 	char psbuf[256+MAXHOSTNAMELEN];		/* XXX - conservative */
 	uint16_t ngroups;
 
-	if (uio->uio_rw != UIO_READ)
-		return (EOPNOTSUPP);
 
 	mutex_enter(proc_lock);
 	mutex_enter(p->p_lock);
@@ -119,67 +113,149 @@ procfs_dostatus(
 	sess = p->p_pgrp->pg_session;
 	sid = sess->s_sid;
 
+	ps = psbuf;
+	if (strncmp(emulname, "linux", 5) == 0) {
+		ps += snprintf(ps, sizeof(psbuf), "Name:\t%s\n", p->p_comm);
+		ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf), "Pid:\t%d\n", pid);
+		ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf), "PPid:\t%d\n", ppid);
+		ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf), "TracerPid:\t%d\n", 0);
+
+		cr = p->p_cred;
+		ngroups = kauth_cred_ngroups(cr);
+		ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf), "Groups:\t");
+		for (i = 0; i < ngroups; i++)
+			ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf), "%d ",
+			kauth_cred_group(cr, i));
+		ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf), "\n");
+
+		ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf),
+		"VmPeak:\t%8lu kB\n", p->p_rlimit[RLIMIT_DATA].rlim_cur / 1024);
+		ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf),
+		"VmSize:\t%8lu kB\n", p->p_rlimit[RLIMIT_DATA].rlim_cur / 1024);
+		ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf),
+		"VmRSS:\t%8lu kB\n", p->p_rlimit[RLIMIT_RSS].rlim_cur / 1024);
+
+	} else {
 /* comm pid ppid pgid sid maj,min ctty,sldr start ut st wmsg uid gid groups ... */
 
-	ps = psbuf;
-	memcpy(ps, p->p_comm, MAXCOMLEN);
-	ps[MAXCOMLEN] = '\0';
-	ps += strlen(ps);
-	ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf), " %d %d %d %d ",
-	pid, ppid, pgid, sid);
-
-	if ((p->p_lflag & PL_CONTROLT) && (tp = sess->s_ttyp))
-		ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf), "%llu,%llu ",
-		(unsigned long long)major(tp->t_dev),
-		(unsigned long long)minor(tp->t_dev));
-	else
-		ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf), "%d,%d ",
-		-1, -1);
-
-	sep = "";
-	if (sess->s_ttyvp) {
-		ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf), "%sctty", sep);
-		sep = ",";
-	}
-	if (SESS_LEADER(p)) {
-		ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf), "%ssldr", sep);
-		sep = ",";
+		memcpy(ps, p->p_comm, MAXCOMLEN);
+		ps[MAXCOMLEN] = '\0';
+		ps += strlen(ps);
+		ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf), " %d %d %d %d ",
+		pid, ppid, pgid, sid);
+
+		if ((p->p_lflag & PL_CONTROLT) && (tp = sess->s_ttyp))
+			ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf), "%llu,%llu ",
+			(unsigned long long)major(tp->t_dev),
+			(unsigned long long)minor(tp->t_dev));
+		else
+			ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf), "%d,%d ",
+			-1, -1);
+
+		sep = "";
+		if (sess->s_ttyvp) {
+			ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf), "%sctty", sep);
+			sep = ",";
+		}
+		if (SESS_LEADER(p)) {
+			ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf), "%ssldr", sep);
+			sep = ",";
+		}
+		if (*sep != ',')
+			ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf), "noflags");
+
+		ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf), " %lld,%ld",
+		(long long)p->p_stats->p_start.tv_sec,
+		(long)p->p_stats->p_start.tv_usec);
+
+		{
+			struct timeval ut, st;
+
+			calcru(p, &ut, &st, (void *) 0, NULL);
+			ps += snprintf(ps, sizeof(psbuf) - (ps - psbuf),
+			" %lld,%ld %lld,%ld", (long long)ut.tv_sec,
+			

CVS commit: src

2017-09-29 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Sep 29 12:42:37 UTC 2017

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/tests/rump/kernspace: Makefile
src/tests/rump/rumpkern: Makefile
Added Files:
src/tests/rump/kernspace: workqueue.c
src/tests/rump/rumpkern: t_workqueue.c

Log Message:
Add simple test for workqueue(9)


To generate a diff of this commit:
cvs rdiff -u -r1.224 -r1.225 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.762 -r1.763 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.5 -r1.6 src/tests/rump/kernspace/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/rump/kernspace/workqueue.c
cvs rdiff -u -r1.15 -r1.16 src/tests/rump/rumpkern/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/rump/rumpkern/t_workqueue.c

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

Modified files:

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.224 src/distrib/sets/lists/debug/mi:1.225
--- src/distrib/sets/lists/debug/mi:1.224	Wed Aug 16 13:53:19 2017
+++ src/distrib/sets/lists/debug/mi	Fri Sep 29 12:42:36 2017
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.224 2017/08/16 13:53:19 joerg Exp $
+# $NetBSD: mi,v 1.225 2017/09/29 12:42:36 maya Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -2306,6 +2306,7 @@
 ./usr/libdata/debug/usr/tests/rump/rumpkern/t_signals.debug		tests-syscall-debug	debug,atf,rump
 ./usr/libdata/debug/usr/tests/rump/rumpkern/t_threads.debug		tests-syscall-debug	debug,atf,rump
 ./usr/libdata/debug/usr/tests/rump/rumpkern/t_tsleep.debug		tests-syscall-debug	debug,atf,rump
+./usr/libdata/debug/usr/tests/rump/rumpkern/t_workqueue.debug		tests-syscall-debug	debug,atf,rump
 ./usr/libdata/debug/usr/tests/rump/rumpkern/t_vm.debug			tests-syscall-debug	debug,atf,rump
 ./usr/libdata/debug/usr/tests/rump/rumpvfs/t_basic.debug		tests-syscall-debug	debug,atf,rump
 ./usr/libdata/debug/usr/tests/rump/rumpvfs/t_etfs.debug		tests-syscall-debug	debug,atf,rump

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.762 src/distrib/sets/lists/tests/mi:1.763
--- src/distrib/sets/lists/tests/mi:1.762	Wed Sep 20 09:36:20 2017
+++ src/distrib/sets/lists/tests/mi	Fri Sep 29 12:42:36 2017
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.762 2017/09/20 09:36:20 ozaki-r Exp $
+# $NetBSD: mi,v 1.763 2017/09/29 12:42:36 maya Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3416,6 +3416,7 @@
 ./usr/tests/rump/rumpkern/t_sp			tests-rump-tests	atf,rump
 ./usr/tests/rump/rumpkern/t_threads		tests-rump-tests	atf,rump
 ./usr/tests/rump/rumpkern/t_tsleep		tests-rump-tests	atf,rump
+./usr/tests/rump/rumpkern/t_workqueue		tests-rump-tests	atf,rump
 ./usr/tests/rump/rumpkern/t_vm			tests-rump-tests	atf,rump
 ./usr/tests/rump/rumpnet			tests-rump-tests	compattestfile,atf
 ./usr/tests/rump/rumpnet/Atffile		tests-rump-tests	atf,rump

Index: src/tests/rump/kernspace/Makefile
diff -u src/tests/rump/kernspace/Makefile:1.5 src/tests/rump/kernspace/Makefile:1.6
--- src/tests/rump/kernspace/Makefile:1.5	Fri Jan 14 13:08:00 2011
+++ src/tests/rump/kernspace/Makefile	Fri Sep 29 12:42:36 2017
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.5 2011/01/14 13:08:00 pooka Exp $
+#	$NetBSD: Makefile,v 1.6 2017/09/29 12:42:36 maya Exp $
 #
 
 .include 
 
 LIB=	kernspace
-SRCS=	thread.c busypage.c tsleep.c alloc.c lockme.c sendsig.c
+SRCS=	thread.c busypage.c tsleep.c alloc.c lockme.c workqueue.c sendsig.c
 
 RUMPTOP=${NETBSDSRCDIR}/sys/rump
 

Index: src/tests/rump/rumpkern/Makefile
diff -u src/tests/rump/rumpkern/Makefile:1.15 src/tests/rump/rumpkern/Makefile:1.16
--- src/tests/rump/rumpkern/Makefile:1.15	Tue Jun 10 04:28:40 2014
+++ src/tests/rump/rumpkern/Makefile	Fri Sep 29 12:42:37 2017
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.15 2014/06/10 04:28:40 he Exp $
+# $NetBSD: Makefile,v 1.16 2017/09/29 12:42:37 maya Exp $
 
 .include 
 
@@ -12,6 +12,7 @@ TESTS_C+=	t_modlinkset
 TESTS_C+=	t_signals
 TESTS_C+=	t_threads
 TESTS_C+=	t_tsleep
+TESTS_C+=	t_workqueue
 TESTS_C+=	t_vm
 
 TESTS_SH=	t_sp

Added files:

Index: src/tests/rump/kernspace/workqueue.c
diff -u /dev/null src/tests/rump/kernspace/workqueue.c:1.1
--- /dev/null	Fri Sep 29 12:42:37 2017
+++ src/tests/rump/kernspace/workqueue.c	Fri Sep 29 12:42:36 2017
@@ -0,0 +1,98 @@
+/*	$NetBSD: workqueue.c,v 1.1 2017/09/29 12:42:36 maya Exp $	*/
+
+/*-
+ * Copyright (c) 2017 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * 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 

CVS commit: src/tests/rump/rumpkern

2017-09-29 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Sep 29 10:22:36 UTC 2017

Modified Files:
src/tests/rump/rumpkern: t_threads.c

Log Message:
Run both tests (rather than rumptest_threadjoin twice)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/rump/rumpkern/t_threads.c

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

Modified files:

Index: src/tests/rump/rumpkern/t_threads.c
diff -u src/tests/rump/rumpkern/t_threads.c:1.2 src/tests/rump/rumpkern/t_threads.c:1.3
--- src/tests/rump/rumpkern/t_threads.c:1.2	Fri Jan 13 21:30:43 2017
+++ src/tests/rump/rumpkern/t_threads.c	Fri Sep 29 10:22:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_threads.c,v 1.2 2017/01/13 21:30:43 christos Exp $	*/
+/*	$NetBSD: t_threads.c,v 1.3 2017/09/29 10:22:36 maya Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@ ATF_TC_BODY(kthread, tc)
 	rump_init();
 
 	rump_schedule();
-	rumptest_threadjoin(); /* panics if fails */
+	rumptest_thread(); /* panics if fails */
 	rump_unschedule();
 }
 



CVS commit: src/share/man/man4

2017-09-29 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Sep 29 08:46:47 UTC 2017

Modified Files:
src/share/man/man4: vnd.4

Log Message:
Remove outdated BUGS entry - vnd does work on sparse files.

(thanks hannken in 2011-06-29)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/share/man/man4/vnd.4

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

Modified files:

Index: src/share/man/man4/vnd.4
diff -u src/share/man/man4/vnd.4:1.18 src/share/man/man4/vnd.4:1.19
--- src/share/man/man4/vnd.4:1.18	Sun Jul  8 22:47:41 2012
+++ src/share/man/man4/vnd.4	Fri Sep 29 08:46:47 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: vnd.4,v 1.18 2012/07/08 22:47:41 wiz Exp $
+.\"	$NetBSD: vnd.4,v 1.19 2017/09/29 08:46:47 maya Exp $
 .\"
 .\" Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd December 18, 2009
+.Dd September 29, 2017
 .Dt VND 4
 .Os
 .Sh NAME
@@ -97,7 +97,3 @@ The compression handling is based on cod
 The
 .Nm
 driver does not work if the file does not reside in a local filesystem.
-.Pp
-The
-.Nm
-driver does not work if the file is sparse.