CVS commit: src/sys/arch/atari/include

2011-12-18 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Dec 18 09:12:18 UTC 2011

Modified Files:
src/sys/arch/atari/include: types.h

Log Message:
Restore __HAVE_MM_MD_READWRITE which was added for 5.99.53 in rev 1.14
but removed by merge botch on __HAVE_NEW_STYLE_BUS_H changes in rev 1.15.

Fixes /dev/nvram: Device not configured problem on installboot(8)
reported by David Ross.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/atari/include/types.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/atari/include/types.h
diff -u src/sys/arch/atari/include/types.h:1.15 src/sys/arch/atari/include/types.h:1.16
--- src/sys/arch/atari/include/types.h:1.15	Sun Jul 17 23:40:16 2011
+++ src/sys/arch/atari/include/types.h	Sun Dec 18 09:12:18 2011
@@ -1,10 +1,11 @@
-/*	$NetBSD: types.h,v 1.15 2011/07/17 23:40:16 dyoung Exp $	*/
+/*	$NetBSD: types.h,v 1.16 2011/12/18 09:12:18 tsutsui Exp $	*/
 
 #ifndef _MACHINE_TYPES_H_
 #define	_MACHINE_TYPES_H_
 
 #include m68k/types.h
 
+#define __HAVE_MM_MD_READWRITE
 #define __HAVE_NEW_STYLE_BUS_H
 
 #endif



CVS commit: src/sys/arch/algor/conf

2011-12-18 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Dec 18 11:10:33 UTC 2011

Modified Files:
src/sys/arch/algor/conf: P5064

Log Message:
SYMTAB_SPACE.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/algor/conf/P5064

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/algor/conf/P5064
diff -u src/sys/arch/algor/conf/P5064:1.70 src/sys/arch/algor/conf/P5064:1.71
--- src/sys/arch/algor/conf/P5064:1.70	Sun Dec 18 05:49:22 2011
+++ src/sys/arch/algor/conf/P5064	Sun Dec 18 11:10:33 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: P5064,v 1.70 2011/12/18 05:49:22 dholland Exp $
+#	$NetBSD: P5064,v 1.71 2011/12/18 11:10:33 kiyohara Exp $
 #
 # Algorithmics P-5064 kernel.
 #
@@ -7,7 +7,7 @@ include	arch/algor/conf/std.algor
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		P5064-$Revision: 1.70 $
+#ident 		P5064-$Revision: 1.71 $
 
 maxusers 32
 
@@ -25,7 +25,7 @@ options 	DIAGNOSTIC		# Cheap kernel cons
 options 	DDB			# kernel debugger
 makeoptions	DEBUG=-g
 #makeoptions	DEBUGLIST=pattern1 pattern2 ...
-options 	SYMTAB_SPACE=465000
+options 	SYMTAB_SPACE=47
 
 # File systems
 file-system	FFS		# Fast file system



CVS commit: src/external/bsd/mdocml/dist

2011-12-18 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Sun Dec 18 13:40:08 UTC 2011

Modified Files:
src/external/bsd/mdocml/dist: arch.in

Log Message:
Lowercase arch strings, and add missing ones.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.5 -r1.2 src/external/bsd/mdocml/dist/arch.in

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

Modified files:

Index: src/external/bsd/mdocml/dist/arch.in
diff -u src/external/bsd/mdocml/dist/arch.in:1.1.1.5 src/external/bsd/mdocml/dist/arch.in:1.2
--- src/external/bsd/mdocml/dist/arch.in:1.1.1.5	Wed Jan 12 22:57:09 2011
+++ src/external/bsd/mdocml/dist/arch.in	Sun Dec 18 13:40:08 2011
@@ -26,31 +26,54 @@
  * REMEMBER TO ADD NEW ARCHITECTURES TO MDOC.7!
  */
 
-LINE(alpha,		Alpha)
-LINE(amd64,		AMD64)
-LINE(amiga,		Amiga)
-LINE(arc,		ARC)
-LINE(arm,		ARM)
-LINE(armish,		ARMISH)
-LINE(aviion,		AViiON)
-LINE(hp300,		HP300)
-LINE(hppa,		HPPA)
-LINE(hppa64,		HPPA64)
+LINE(acorn26,		acorn26)
+LINE(acorn32,		acorn32)
+LINE(alpha,		alpha)
+LINE(amd64,		amd64)
+LINE(amiga,		amiga)
+LINE(arc,		arc)
+LINE(arm,		arm)
+LINE(armish,		armish)
+LINE(atari,		atari)
+LINE(aviion,		aviion)
+LINE(cobalt,		cobalt)
+LINE(dreamcast,	dreamcast)
+LINE(emips,		emips)
+LINE(evbarm,		evbarm)
+LINE(evbmips,		evbmips)
+LINE(evbppc,		evbppc)
+LINE(hp300,		hp300)
+LINE(hp700,		hp700)
+LINE(hpcarm,		hpcarm)
+LINE(hpcmips,		hpcmips)
+LINE(hpcsh,		hpcsh)
+LINE(hppa,		hppa)
+LINE(hppa64,		hppa64)
 LINE(i386,		i386)
-LINE(landisk,		LANDISK)
-LINE(loongson,	Loongson)
-LINE(luna88k,		Luna88k)
-LINE(mac68k,		Mac68k)
-LINE(macppc,		MacPPC)
-LINE(mips64,		MIPS64)
-LINE(mvme68k,		MVME68k)
-LINE(mvme88k,		MVME88k)
-LINE(mvmeppc,		MVMEPPC)
-LINE(pmax,		PMAX)
-LINE(sgi,		SGI)
-LINE(socppc,		SOCPPC)
-LINE(sparc,		SPARC)
-LINE(sparc64,		SPARC64)
-LINE(sun3,		Sun3)
-LINE(vax,		VAX)
-LINE(zaurus,		Zaurus)
+LINE(landisk,		landisk)
+LINE(loongson,	loongson)
+LINE(luna88k,		luna88k)
+LINE(mac68k,		mac68k)
+LINE(m68k,		m68k)
+LINE(macppc,		macppc)
+LINE(mips64,		mips64)
+LINE(mvme68k,		mvme68k)
+LINE(mvme88k,		mvme88k)
+LINE(mvmeppc,		mvmeppc)
+LINE(next68k,		next68k)
+LINE(pmax,		pmax)
+LINE(prep,		prep)
+LINE(sandpoint,	sandpoint)
+LINE(sgi,		sgi)
+LINE(sgimips,		sgimips)
+LINE(socppc,		socppc)
+LINE(sparc,		sparc)
+LINE(sparc64,		sparc64)
+LINE(sun2,		sun2)
+LINE(sun3,		sun3)
+LINE(vax,		vax)
+LINE(x68k,		x68k)
+LINE(x86,		x86)
+LINE(x86_64,		x86_64)
+LINE(xen,		xen)
+LINE(zaurus,		zaurus)



CVS commit: src/sys/arch/sandpoint/sandpoint

2011-12-18 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Dec 18 14:29:00 UTC 2011

Modified Files:
src/sys/arch/sandpoint/sandpoint: eumb.c mainbus.c

Log Message:
Replaced conf_args by mainbus_attach_args.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sandpoint/sandpoint/eumb.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/sandpoint/sandpoint/mainbus.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/sandpoint/sandpoint/eumb.c
diff -u src/sys/arch/sandpoint/sandpoint/eumb.c:1.5 src/sys/arch/sandpoint/sandpoint/eumb.c:1.6
--- src/sys/arch/sandpoint/sandpoint/eumb.c:1.5	Fri Jul  1 19:16:06 2011
+++ src/sys/arch/sandpoint/sandpoint/eumb.c	Sun Dec 18 14:28:59 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: eumb.c,v 1.5 2011/07/01 19:16:06 dyoung Exp $ */
+/* $NetBSD: eumb.c,v 1.6 2011/12/18 14:28:59 phx Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,14 +30,14 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: eumb.c,v 1.5 2011/07/01 19:16:06 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: eumb.c,v 1.6 2011/12/18 14:28:59 phx Exp $);
 
 #include sys/param.h
 #include sys/device.h
 #include sys/tty.h
 #include sys/systm.h
 
-#include sys/bus.h
+#include machine/autoconf.h
 #include machine/intr.h
 
 #include sandpoint/sandpoint/eumbvar.h
@@ -56,33 +56,35 @@ extern struct cfdriver eumb_cd;
 static int
 eumb_match(device_t parent, cfdata_t cf, void *aux)
 {
-	const char **ca_name = aux; /* XXX */
+	struct mainbus_attach_args *ma = aux;
 
-	if (strcmp(*ca_name, eumb_cd.cd_name) != 0)
-		return (0);
-	return (1);
+	if (strcmp(ma-ma_name, eumb_cd.cd_name) != 0)
+		return 0;
+	return 1;
 }
 
 static void
 eumb_attach(device_t parent, device_t self, void *aux)
 {
 
-	printf(\n);
-	config_search_ia(eumb_search, self, eumb, NULL);
+	aprint_naive(\n);
+	aprint_normal(\n);
+	config_search_ia(eumb_search, self, eumb, aux);
 }
 
 static int
 eumb_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
 {
+	struct mainbus_attach_args *ma = aux;
 	struct eumb_attach_args eaa;
 
 	eaa.eumb_name = cf-cf_name;
-	eaa.eumb_bt = sandpoint_eumb_space_tag;
+	eaa.eumb_bt = ma-ma_bst;
 	eaa.eumb_unit = cf-cf_loc[EUMBCF_UNIT];
 if (config_match(parent, cf, eaa)  0)
 config_attach(parent, cf, eaa, eumb_print);
 
-	return (0);
+	return 0;
 }
 
 static int
@@ -94,5 +96,5 @@ eumb_print(void *aux, const char *pnp)
 		printf(%s at %s, eaa-eumb_name, pnp);
 	if (eaa-eumb_unit != EUMBCF_UNIT_DEFAULT)
 		printf( unit %d, eaa-eumb_unit);
-	return (UNCONF);
+	return UNCONF;
 }

Index: src/sys/arch/sandpoint/sandpoint/mainbus.c
diff -u src/sys/arch/sandpoint/sandpoint/mainbus.c:1.25 src/sys/arch/sandpoint/sandpoint/mainbus.c:1.26
--- src/sys/arch/sandpoint/sandpoint/mainbus.c:1.25	Sat Dec 17 20:20:38 2011
+++ src/sys/arch/sandpoint/sandpoint/mainbus.c	Sun Dec 18 14:28:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.25 2011/12/17 20:20:38 phx Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.26 2011/12/18 14:28:59 phx Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.25 2011/12/17 20:20:38 phx Exp $);
+__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.26 2011/12/18 14:28:59 phx Exp $);
 
 #include opt_pci.h
 #include pci.h
@@ -48,11 +48,6 @@ __KERNEL_RCSID(0, $NetBSD: mainbus.c,v 
 #include dev/pci/pcivar.h
 #include dev/pci/pciconf.h
 
-/* XXX go away! */
-struct conf_args {
-	const char *ca_name;
-};
-
 int	mainbus_match(device_t, cfdata_t, void *);
 void	mainbus_attach(device_t, device_t, void *);
 int	mainbus_print(void *, const char *);
@@ -78,7 +73,6 @@ mainbus_match(device_t parent, cfdata_t 
 void
 mainbus_attach(device_t parent, device_t self, void *aux)
 {
-	struct conf_args ca;
 	struct mainbus_attach_args mba;
 	struct pcibus_attach_args pba;
 #if defined(PCI_NETBSD_CONFIGURE)
@@ -88,10 +82,12 @@ mainbus_attach(device_t parent, device_t
 	aprint_naive(\n);
 	aprint_normal(\n);
 
-	ca.ca_name = cpu;
-	config_found_ia(self, mainbus, ca, mainbus_print);
-	ca.ca_name = eumb;
-	config_found_ia(self, mainbus, ca, mainbus_print);
+	mba.ma_name = cpu;
+	config_found_ia(self, mainbus, mba, mainbus_print);
+
+	mba.ma_name = eumb;
+	mba.ma_bst = sandpoint_eumb_space_tag;
+	config_found_ia(self, mainbus, mba, mainbus_print);
 
 	mba.ma_name = cfi;
 	mba.ma_bst = sandpoint_flash_space_tag;
@@ -140,9 +136,9 @@ extern struct cfdriver cpu_cd;
 int
 cpu_match(device_t parent, cfdata_t cf, void *aux)
 {
-	struct conf_args *ca = aux;
+	struct mainbus_attach_args *mba = aux;
 
-	if (strcmp(ca-ca_name, cpu_cd.cd_name) != 0)
+	if (strcmp(mba-ma_name, cpu_cd.cd_name) != 0)
 		return 0;
 	if (cpu_info[0].ci_dev != NULL)
 		return 0;
@@ -154,15 +150,15 @@ void
 cpu_attach(device_t parent, device_t self, void *aux)
 {
 
-	(void) cpu_attach_common(self, 0);
+	

CVS commit: src/usr.sbin/isibootd

2011-12-18 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Dec 18 14:45:24 UTC 2011

Modified Files:
src/usr.sbin/isibootd: isibootd.c

Log Message:
Rename FRAME* macro to TRFS_FRAME* for readability and
workaround for powerpc builds. Pointed out by phx@.

XXX: powerpc/frame.h shouldn't pollute userland namespace anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/isibootd/isibootd.c

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

Modified files:

Index: src/usr.sbin/isibootd/isibootd.c
diff -u src/usr.sbin/isibootd/isibootd.c:1.1 src/usr.sbin/isibootd/isibootd.c:1.2
--- src/usr.sbin/isibootd/isibootd.c:1.1	Sat Dec 17 13:24:18 2011
+++ src/usr.sbin/isibootd/isibootd.c	Sun Dec 18 14:45:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: isibootd.c,v 1.1 2011/12/17 13:24:18 tsutsui Exp $	*/
+/*	$NetBSD: isibootd.c,v 1.2 2011/12/18 14:45:23 tsutsui Exp $	*/
 /*	Id: isiboot.c,v 1.2 1999/12/26 14:33:33 nisimura Exp 	*/
 
 /*-
@@ -62,8 +62,8 @@
  * Following data format depends on m68k order, and aligned harmful
  * to RISC processors.
  */
-#define	FRAMETYPE	0x80df
-#define	FRAMELEN	1468
+#define	TRFS_FRAMETYPE	0x80df
+#define	TRFS_FRAMELEN	1468
 struct frame {
 	uint8_t dst[ETHER_ADDR_LEN];
 	uint8_t src[ETHER_ADDR_LEN];
@@ -74,7 +74,7 @@ struct frame {
 	uint8_t pad_1;
 	uint8_t pos[4];
 	uint8_t siz[4];
-	uint8_t data[FRAMELEN - 28];
+	uint8_t data[TRFS_FRAMELEN - 28];
 } __packed;
 
 struct station {
@@ -112,7 +112,7 @@ static char *etheraddr(uint8_t *);
 static int pickif(char *, uint8_t *);
 static __dead void usage(void);
 
-#define	FRAME(buf)	((buf) + ((struct bpf_hdr *)(buf))-bh_hdrlen)
+#define	TRFS_FRAME(buf)	((buf) + ((struct bpf_hdr *)(buf))-bh_hdrlen)
 
 #define	PATH_DEFBOOTDIR	/tftpboot
 
@@ -185,7 +185,7 @@ main(int argc, char *argv[])
 	for (;;) {
 		poll(pollfd, 1, INFTIM);
 		read(pollfd.fd, iobuf, iolen);	/* returns 1468 */
-		fp = (struct frame *)FRAME(iobuf);
+		fp = (struct frame *)TRFS_FRAME(iobuf);
 
 		/* ignore own TX packets */
 		if (memcmp(fp-src, station.addr, ETHER_ADDR_LEN) == 0)
@@ -269,7 +269,7 @@ main(int argc, char *argv[])
 		}
 		memcpy(fp-dst, fp-src, ETHER_ADDR_LEN);
 		memcpy(fp-src, station.addr, ETHER_ADDR_LEN);
-		write(pollfd.fd, fp, FRAMELEN);
+		write(pollfd.fd, fp, TRFS_FRAMELEN);
 	}
 	/* NOTREACHED */
 }
@@ -348,8 +348,8 @@ etheraddr(uint8_t *e)
 
 static struct bpf_insn bpf_insn[] = {
 	{ BPF_LD|BPF_H|BPF_ABS,  0, 0, offsetof(struct frame, type) },
-	{ BPF_JMP|BPF_JEQ|BPF_K, 0, 1, FRAMETYPE },
-	{ BPF_RET|BPF_K, 0, 0, FRAMELEN },
+	{ BPF_JMP|BPF_JEQ|BPF_K, 0, 1, TRFS_FRAMETYPE },
+	{ BPF_RET|BPF_K, 0, 0, TRFS_FRAMELEN },
 	{ BPF_RET|BPF_K, 0, 0, 0x0 }
 };
 static struct bpf_program bpf_pgm = {



CVS commit: src/doc

2011-12-18 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Dec 18 17:19:57 UTC 2011

Modified Files:
src/doc: CHANGES

Log Message:
Add two late entries:
 - x68k bootloader fix for X68060
 - m68k FPE hyperbotic and trigonometric functions


To generate a diff of this commit:
cvs rdiff -u -r1.1636 -r1.1637 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1636 src/doc/CHANGES:1.1637
--- src/doc/CHANGES:1.1636	Sat Dec 17 13:29:50 2011
+++ src/doc/CHANGES	Sun Dec 18 17:19:57 2011
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1636 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1637 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -1142,7 +1142,10 @@ Changes from NetBSD 5.0 to NetBSD 6.0:
 	amd64: Switch to GDB 7.3.1.  [christos 20111008]
 	i386: Switch to GDB 7.3.1.  [christos 20111008]
 	zoneinfo: Import tzdata2011l. [apb 20111010]
+	x68k: Fix bootloader failure on X68030+060turbo. [tsutsui 20111011]
 	sqlite: Import of pre-release of SQLite 3.6.9 [joerg 20111013]
+	m68k: Add hyperbotic and trigonometric functions to m68k FPE.
+		[tsutsui,isaki 20111015]
 	vmt(4): Add a VMware Tools driver, from OpenBSD. [jmcneill 20111017]
 	zoneinfo: Import tzdata2011m. [apb 20111024]
 	sparc: Switch to GDB 7.3.1.  [mrg 20111024]



CVS commit: src/tests/lib/libc/sys

2011-12-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 18 22:25:20 UTC 2011

Modified Files:
src/tests/lib/libc/sys: t_timer_create.c

Log Message:
test timer expiration.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sys/t_timer_create.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/lib/libc/sys/t_timer_create.c
diff -u src/tests/lib/libc/sys/t_timer_create.c:1.2 src/tests/lib/libc/sys/t_timer_create.c:1.3
--- src/tests/lib/libc/sys/t_timer_create.c:1.2	Sat Sep 17 14:52:21 2011
+++ src/tests/lib/libc/sys/t_timer_create.c	Sun Dec 18 17:25:20 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_timer_create.c,v 1.2 2011/09/17 18:52:21 jruoho Exp $ */
+/*	$NetBSD: t_timer_create.c,v 1.3 2011/12/18 22:25:20 christos Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -37,9 +37,6 @@
 static timer_t t;
 static bool fail = true;
 
-static void	timer_signal_handler(int, siginfo_t *, void *);
-static void	timer_signal_create(clockid_t);
-
 static void
 timer_signal_handler(int signo, siginfo_t *si, void *osi)
 {
@@ -54,7 +51,7 @@ timer_signal_handler(int signo, siginfo_
 }
 
 static void
-timer_signal_create(clockid_t cid)
+timer_signal_create(clockid_t cid, bool expire)
 {
 	struct itimerspec tim;
 	struct sigaction act;
@@ -96,7 +93,7 @@ timer_signal_create(clockid_t cid)
 	/*
 	 * Start the timer. After this, unblock the signal.
 	 */
-	tim.it_value.tv_sec = 1;
+	tim.it_value.tv_sec = expire ? 5 : 1;
 	tim.it_value.tv_nsec = 0;
 
 	ATF_REQUIRE(timer_settime(t, 0, tim, NULL) == 0);
@@ -104,8 +101,15 @@ timer_signal_create(clockid_t cid)
 	(void)sigprocmask(SIG_UNBLOCK, set, NULL);
 	(void)sleep(2);
 
-	if (fail != false)
-		atf_tc_fail(timer failed to fire);
+	if (expire) {
+		if (!fail)
+			atf_tc_fail(timer fired too soon);
+	} else {
+		if (fail)
+			atf_tc_fail(timer failed to fire);
+	}
+
+	ATF_REQUIRE(timer_delete(t) == 0);
 }
 
 ATF_TC(timer_create_err);
@@ -145,7 +149,7 @@ ATF_TC_HEAD(timer_create_real, tc)
 
 ATF_TC_BODY(timer_create_real, tc)
 {
-	timer_signal_create(CLOCK_REALTIME);
+	timer_signal_create(CLOCK_REALTIME, false);
 }
 
 ATF_TC(timer_create_mono);
@@ -159,7 +163,35 @@ ATF_TC_HEAD(timer_create_mono, tc)
 
 ATF_TC_BODY(timer_create_mono, tc)
 {
-	timer_signal_create(CLOCK_MONOTONIC);
+	timer_signal_create(CLOCK_MONOTONIC, false);
+}
+
+ATF_TC(timer_create_real_expire);
+ATF_TC_HEAD(timer_create_real_expire, tc)
+{
+
+	atf_tc_set_md_var(tc, descr,
+	Checks timer_create(2) with CLOCK_REALTIME and sigevent(3), 
+	SIGEV_SIGNAL, with expiration);
+}
+
+ATF_TC_BODY(timer_create_real_expire, tc)
+{
+	timer_signal_create(CLOCK_REALTIME, true);
+}
+
+ATF_TC(timer_create_mono_expire);
+ATF_TC_HEAD(timer_create_mono_expire, tc)
+{
+
+	atf_tc_set_md_var(tc, descr,
+	Checks timer_create(2) with CLOCK_MONOTONIC and sigevent(3), 
+	SIGEV_SIGNAL, with expiration);
+}
+
+ATF_TC_BODY(timer_create_mono_expire, tc)
+{
+	timer_signal_create(CLOCK_MONOTONIC, true);
 }
 
 ATF_TP_ADD_TCS(tp)
@@ -168,6 +200,8 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, timer_create_err);
 	ATF_TP_ADD_TC(tp, timer_create_real);
 	ATF_TP_ADD_TC(tp, timer_create_mono);
+	ATF_TP_ADD_TC(tp, timer_create_real_expire);
+	ATF_TP_ADD_TC(tp, timer_create_mono_expire);
 
 	return atf_no_error();
 }



CVS commit: src/sys

2011-12-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 18 22:30:25 UTC 2011

Modified Files:
src/sys/kern: kern_time.c subr_time.c
src/sys/sys: timevar.h

Log Message:
Fix monotonic interval timers.


To generate a diff of this commit:
cvs rdiff -u -r1.170 -r1.171 src/sys/kern/kern_time.c
cvs rdiff -u -r1.8 -r1.9 src/sys/kern/subr_time.c
cvs rdiff -u -r1.29 -r1.30 src/sys/sys/timevar.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/kern/kern_time.c
diff -u src/sys/kern/kern_time.c:1.170 src/sys/kern/kern_time.c:1.171
--- src/sys/kern/kern_time.c:1.170	Thu Oct 27 12:12:52 2011
+++ src/sys/kern/kern_time.c	Sun Dec 18 17:30:25 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time.c,v 1.170 2011/10/27 16:12:52 christos Exp $	*/
+/*	$NetBSD: kern_time.c,v 1.171 2011/12/18 22:30:25 christos Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_time.c,v 1.170 2011/10/27 16:12:52 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_time.c,v 1.171 2011/12/18 22:30:25 christos Exp $);
 
 #include sys/param.h
 #include sys/resourcevar.h
@@ -674,7 +674,10 @@ timer_settime(struct ptimer *pt)
 			 * Don't need to check tshzto() return value, here.
 			 * callout_reset() does it for us.
 			 */
-			callout_reset(pt-pt_ch, tshzto(pt-pt_time.it_value),
+			callout_reset(pt-pt_ch,
+			pt-pt_type == CLOCK_MONOTONIC ?
+			tshztoup(pt-pt_time.it_value) :
+			tshzto(pt-pt_time.it_value),
 			realtimerexpire, pt);
 		}
 	} else {
@@ -1004,7 +1007,11 @@ realtimerexpire(void *arg)
 		return;
 	}
 
-	getnanotime(now);
+	if (pt-pt_type == CLOCK_MONOTONIC) {
+		getnanouptime(now);
+	} else {
+		getnanotime(now);
+	}
 	backwards = (timespeccmp(pt-pt_time.it_value, now, ));
 	timespecadd(pt-pt_time.it_value, pt-pt_time.it_interval, next);
 	/* Handle the easy case of non-overflown timers first. */
@@ -1031,7 +1038,8 @@ realtimerexpire(void *arg)
 	 * Don't need to check tshzto() return value, here.
 	 * callout_reset() does it for us.
 	 */
-	callout_reset(pt-pt_ch, tshzto(pt-pt_time.it_value),
+	callout_reset(pt-pt_ch, pt-pt_type == CLOCK_MONOTONIC ?
+	tshztoup(pt-pt_time.it_value) : tshzto(pt-pt_time.it_value),
 	realtimerexpire, pt);
 	mutex_spin_exit(timer_lock);
 }

Index: src/sys/kern/subr_time.c
diff -u src/sys/kern/subr_time.c:1.8 src/sys/kern/subr_time.c:1.9
--- src/sys/kern/subr_time.c:1.8	Wed Jan 26 14:15:13 2011
+++ src/sys/kern/subr_time.c	Sun Dec 18 17:30:25 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_time.c,v 1.8 2011/01/26 19:15:13 drochner Exp $	*/
+/*	$NetBSD: subr_time.c,v 1.9 2011/12/18 22:30:25 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_time.c,v 1.8 2011/01/26 19:15:13 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_time.c,v 1.9 2011/12/18 22:30:25 christos Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -129,6 +129,18 @@ tshzto(const struct timespec *tsp)
 	timespecsub(ts, now, ts);
 	return tstohz(ts);
 }
+
+int
+tshztoup(const struct timespec *tsp)
+{
+	struct timespec now, ts;
+
+	ts = *tsp;	/* Don't modify original tsp. */
+	getnanouptime(now);
+	timespecsub(ts, now, ts);
+	return tstohz(ts);
+}
+
 /*
  * Compute number of ticks in the specified amount of time.
  */

Index: src/sys/sys/timevar.h
diff -u src/sys/sys/timevar.h:1.29 src/sys/sys/timevar.h:1.30
--- src/sys/sys/timevar.h:1.29	Thu Apr  8 07:51:13 2010
+++ src/sys/sys/timevar.h	Sun Dec 18 17:30:25 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: timevar.h,v 1.29 2010/04/08 11:51:13 njoly Exp $	*/
+/*	$NetBSD: timevar.h,v 1.30 2011/12/18 22:30:25 christos Exp $	*/
 
 /*
  *  Copyright (c) 2005, 2008 The NetBSD Foundation.
@@ -156,6 +156,7 @@ int	dotimer_gettime(int, struct proc *, 
 int	dotimer_settime(int, struct itimerspec *, struct itimerspec *, int,
 	struct proc *);
 int	tshzto(const struct timespec *);
+int	tshztoup(const struct timespec *);
 int	tvhzto(const struct timeval *);
 void	inittimecounter(void);
 int	itimerfix(struct timeval *);



CVS commit: src/external/bsd/atf/dist/atf-run

2011-12-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 18 22:34:06 UTC 2011

Modified Files:
src/external/bsd/atf/dist/atf-run: timer.cpp timer.hpp

Log Message:
Don't use antiquated BSD API's that require global variable, use posix timers
instead.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 src/external/bsd/atf/dist/atf-run/timer.cpp \
src/external/bsd/atf/dist/atf-run/timer.hpp

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

Modified files:

Index: src/external/bsd/atf/dist/atf-run/timer.cpp
diff -u src/external/bsd/atf/dist/atf-run/timer.cpp:1.1.1.2 src/external/bsd/atf/dist/atf-run/timer.cpp:1.2
--- src/external/bsd/atf/dist/atf-run/timer.cpp:1.1.1.2	Wed Oct 20 05:14:23 2010
+++ src/external/bsd/atf/dist/atf-run/timer.cpp	Sun Dec 18 17:34:06 2011
@@ -27,9 +27,7 @@
 // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 //
 
-extern C {
-#include signal.h
-}
+#include csignal
 
 #include cerrno
 
@@ -46,56 +44,69 @@ namespace impl = atf::atf_run;
 // Auxiliary functions.
 // 
 
-namespace sigalrm {
-
-bool m_fired = false;
-impl::timer* m_timer = NULL;
-
+static
 void
-handler(const int signo)
+handler(int signo, siginfo_t *si, void *uc)
 {
-PRE(signo == SIGALRM);
+impl::timer *timer = static_castimpl::timer *(si-si_value.sival_ptr);
 
-m_fired = true;
-m_timer-timeout_callback();
+timer-setfired();
+timer-timeout_callback();
 }
 
-} // anonymous namespace
-
 // 
 // The timer class.
 // 
 
-impl::timer::timer(const unsigned int seconds)
+impl::timer::timer(const unsigned int seconds) : m_fired(false)
 {
-sigalrm::m_fired = false;
-sigalrm::m_timer = this;
-m_sigalrm.reset(new signal_programmer(SIGALRM, sigalrm::handler));
-
-::itimerval timeval;
-timeval.it_interval.tv_sec = 0;
-timeval.it_interval.tv_usec = 0;
-timeval.it_value.tv_sec = seconds;
-timeval.it_value.tv_usec = 0;
+struct sigaction sa;
+::sigemptyset(sa.sa_mask);
+sa.sa_flags = SA_SIGINFO;
+sa.sa_sigaction = ::handler;
+if (::sigaction(SIGALRM, sa, m_old_sa) == -1)
+throw system_error(IMPL_NAME ::timer::timer,
+   Failed to set signal handler, errno);
+	
+
+::sigevent se;
+se.sigev_notify = SIGEV_SIGNAL;
+se.sigev_signo = SIGALRM;
+se.sigev_value.sival_ptr = static_castvoid *(this);
+se.sigev_notify_function = NULL;
+se.sigev_notify_attributes = NULL;
+if (::timer_create(CLOCK_MONOTONIC, se, m_timer) == -1) {
+	::sigaction(SIGALRM, m_old_sa, NULL);
+throw system_error(IMPL_NAME ::timer::timer,
+   Failed to create timer, errno);
+}
 
-if (::setitimer(ITIMER_REAL, timeval, m_old_timeval) == -1)
+::itimerspec it;
+it.it_interval.tv_sec = 0;
+it.it_interval.tv_nsec = 0;
+it.it_value.tv_sec = seconds;
+it.it_value.tv_nsec = 0;
+if (::timer_settime(m_timer, 0, it, m_old_it) == -1) {
+	::sigaction(SIGALRM, m_old_sa, NULL);
+	::timer_delete(m_timer);
 throw system_error(IMPL_NAME ::timer::timer,
Failed to program timer, errno);
+}
 }
 
 impl::timer::~timer(void)
 {
-const int ret = ::setitimer(ITIMER_REAL, m_old_timeval, NULL);
+int ret = ::timer_delete(m_timer);
+INV(ret != -1);
+ret = ::sigaction(SIGALRM, m_old_sa, NULL);
 INV(ret != -1);
-sigalrm::m_timer = NULL;
-sigalrm::m_fired = false;
 }
 
 bool
 impl::timer::fired(void)
 const
 {
-return sigalrm::m_fired;
+return m_fired;
 }
 
 // 
@@ -121,5 +132,5 @@ impl::child_timer::timeout_callback(void
 
 // Should use killpg(2) but, according to signal(7), using this system
 // call in a signal handler context is not safe.
-::kill(m_pid, SIGKILL);
+::killpg(-m_pid, SIGKILL);
 }
Index: src/external/bsd/atf/dist/atf-run/timer.hpp
diff -u src/external/bsd/atf/dist/atf-run/timer.hpp:1.1.1.2 src/external/bsd/atf/dist/atf-run/timer.hpp:1.2
--- src/external/bsd/atf/dist/atf-run/timer.hpp:1.1.1.2	Wed Oct 20 05:14:23 2010
+++ src/external/bsd/atf/dist/atf-run/timer.hpp	Sun Dec 18 17:34:06 2011
@@ -30,12 +30,8 @@
 #if !defined(_ATF_RUN_ALARM_HPP_)
 #define _ATF_RUN_ALARM_HPP_
 
-extern C {
-#include sys/time.h
-#include sys/types.h
-}
-
-#include memory
+#include ctime
+#include csignal
 
 #include atf-c++/utils.hpp
 
@@ -49,14 +45,17 @@ class signal_programmer;
 // 
 
 class timer : utils::noncopyable {
-::itimerval m_old_timeval;
-std::auto_ptr signal_programmer  m_sigalrm;
+::timer_t m_timer;
+::itimerspec m_old_it;
+struct sigaction 

CVS commit: src/tests/net/bpf

2011-12-18 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Dec 18 22:51:00 UTC 2011

Modified Files:
src/tests/net/bpf: t_bpf.c

Log Message:
Remove unused variable


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/bpf/t_bpf.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/net/bpf/t_bpf.c
diff -u src/tests/net/bpf/t_bpf.c:1.2 src/tests/net/bpf/t_bpf.c:1.3
--- src/tests/net/bpf/t_bpf.c:1.2	Mon Jan  3 02:53:15 2011
+++ src/tests/net/bpf/t_bpf.c	Sun Dec 18 22:51:00 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_bpf.c,v 1.2 2011/01/03 02:53:15 christos Exp $	*/
+/*	$NetBSD: t_bpf.c,v 1.3 2011/12/18 22:51:00 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -76,7 +76,6 @@ ATF_TC_BODY(bpfwriteleak, tc)
 	char buf[28]; /* sizeof(garbage)  etherhdrlen */
 	struct ifreq ifr;
 	int ifnum, bpfd;
-	u_int x;
 
 	RZ(rump_init());
 	RZ(rump_pub_shmif_create(NULL, ifnum));
@@ -84,7 +83,6 @@ ATF_TC_BODY(bpfwriteleak, tc)
 
 	RL(bpfd = rump_sys_open(/dev/bpf, O_RDWR));
 	RL(rump_sys_ioctl(bpfd, BIOCSETIF, ifr));
-x = 1;
 	RL(rump_sys_ioctl(bpfd, BIOCSFEEDBACK, ifr));
 
 	if (getmtdata() != 0)



CVS commit: src/sys/miscfs/procfs

2011-12-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Dec 19 03:02:31 UTC 2011

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

Log Message:
don't produce different output if we are super user.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/miscfs/procfs/procfs_linux.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_linux.c
diff -u src/sys/miscfs/procfs/procfs_linux.c:1.63 src/sys/miscfs/procfs/procfs_linux.c:1.64
--- src/sys/miscfs/procfs/procfs_linux.c:1.63	Fri Dec 16 15:45:07 2011
+++ src/sys/miscfs/procfs/procfs_linux.c	Sun Dec 18 22:02:31 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: procfs_linux.c,v 1.63 2011/12/16 20:45:07 christos Exp $  */
+/*  $NetBSD: procfs_linux.c,v 1.64 2011/12/19 03:02:31 christos Exp $  */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: procfs_linux.c,v 1.63 2011/12/16 20:45:07 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: procfs_linux.c,v 1.64 2011/12/19 03:02:31 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -593,12 +593,9 @@ procfs_domounts(struct lwp *curl, struct
 	char *bf, *mtab = NULL;
 	size_t mtabsz = 0;
 	struct mount *mp, *nmp;
-	int error = 0, suser, root = 0;
+	int error = 0, root = 0;
 	struct cwdinfo *cwdi = curl-l_proc-p_cwdi;
 
-	suser = kauth_authorize_generic(curl-l_cred,
-	KAUTH_GENERIC_ISSUSER, NULL) == 0;
-
 	bf = malloc(LBFSZ, M_TEMP, M_WAITOK);
 
 	mutex_enter(mountlist_lock);
@@ -609,9 +606,9 @@ procfs_domounts(struct lwp *curl, struct
 		if (vfs_busy(mp, nmp))
 			continue;
 
-		if ((error = dostatvfs(mp, sfs, curl, MNT_WAIT, suser)) == 0)
+		if ((error = dostatvfs(mp, sfs, curl, MNT_WAIT, 0)) == 0)
 			root |= procfs_format_sfs(mtab, mtabsz, bf, LBFSZ,
-			sfs, curl, suser);
+			sfs, curl, 0);
 
 		vfs_unbusy(mp, false, nmp);
 	}



CVS commit: src/external/bsd/atf/dist/atf-run

2011-12-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Dec 19 03:16:06 UTC 2011

Modified Files:
src/external/bsd/atf/dist/atf-run: timer.cpp

Log Message:
fix killing code I just broke, and give program a chance to cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/atf/dist/atf-run/timer.cpp

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

Modified files:

Index: src/external/bsd/atf/dist/atf-run/timer.cpp
diff -u src/external/bsd/atf/dist/atf-run/timer.cpp:1.2 src/external/bsd/atf/dist/atf-run/timer.cpp:1.3
--- src/external/bsd/atf/dist/atf-run/timer.cpp:1.2	Sun Dec 18 17:34:06 2011
+++ src/external/bsd/atf/dist/atf-run/timer.cpp	Sun Dec 18 22:16:05 2011
@@ -128,9 +128,10 @@ impl::child_timer::~child_timer(void)
 void
 impl::child_timer::timeout_callback(void)
 {
+static const timespec ts = { 1, 0 };
 m_terminate = true;
-
-// Should use killpg(2) but, according to signal(7), using this system
-// call in a signal handler context is not safe.
-::killpg(-m_pid, SIGKILL);
+::kill(-m_pid, SIGTERM);
+::nanosleep(ts, NULL);
+if (::kill(-m_pid, 0) != -1)
+	::kill(-m_pid, SIGKILL);
 }