CVS commit: src/crypto/external/bsd/openssl/dist/apps

2009-08-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 15 01:03:03 UTC 2009

Modified Files:
src/crypto/external/bsd/openssl/dist/apps: ocsp.c

Log Message:
don't try to free a buffer that came from the arguments, make a copy instead.
This can happen if we specify --port


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 src/crypto/external/bsd/openssl/dist/apps/ocsp.c

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

Modified files:

Index: src/crypto/external/bsd/openssl/dist/apps/ocsp.c
diff -u src/crypto/external/bsd/openssl/dist/apps/ocsp.c:1.1.1.2 src/crypto/external/bsd/openssl/dist/apps/ocsp.c:1.2
--- src/crypto/external/bsd/openssl/dist/apps/ocsp.c:1.1.1.2	Wed Aug  5 14:32:05 2009
+++ src/crypto/external/bsd/openssl/dist/apps/ocsp.c	Fri Aug 14 21:03:03 2009
@@ -226,7 +226,7 @@
 			if (args[1])
 {
 args++;
-port = *args;
+port = BUF_strdup(*args);
 }
 			else badarg = 1;
 			}



CVS commit: src/crypto/external/bsd/openssl/dist/crypto/bio

2009-08-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 15 01:25:54 UTC 2009

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/bio: b_sock.c

Log Message:
This code is really broken. It allocates struct sockaddr on the stack
and expects to work with IPV6. Tell the hints that we only want IPV4
for now, so that we don't try to bind to an IPV6 address as returned
by getaddrinfo, and then we bash in V4 in the family!
jeez


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/crypto/external/bsd/openssl/dist/crypto/bio/b_sock.c

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

Modified files:

Index: src/crypto/external/bsd/openssl/dist/crypto/bio/b_sock.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/bio/b_sock.c:1.1.1.1 src/crypto/external/bsd/openssl/dist/crypto/bio/b_sock.c:1.2
--- src/crypto/external/bsd/openssl/dist/crypto/bio/b_sock.c:1.1.1.1	Sun Jul 19 19:03:00 2009
+++ src/crypto/external/bsd/openssl/dist/crypto/bio/b_sock.c	Fri Aug 14 21:25:54 2009
@@ -663,6 +663,8 @@
 		else if (h[0]=='*'  h[1]=='\0')
 			h=NULL;
 		}
+	/* XXX: below we cast to sockaddr_in! */
+	hint.ai_family = AF_INET;
 
 	if ((*p_getaddrinfo.f)(h,p,hint,res)) break;
 	server = *res-ai_addr;



CVS commit: src/usr.bin/mktemp

2009-08-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 15 20:02:28 UTC 2009

Modified Files:
src/usr.bin/mktemp: mktemp.1 mktemp.c

Log Message:
add -p tmpdir option to override $TMPDIR from the command line like linux
has.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/mktemp/mktemp.1
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/mktemp/mktemp.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.bin/mktemp/mktemp.1
diff -u src/usr.bin/mktemp/mktemp.1:1.17 src/usr.bin/mktemp/mktemp.1:1.18
--- src/usr.bin/mktemp/mktemp.1:1.17	Tue Sep 19 15:01:44 2006
+++ src/usr.bin/mktemp/mktemp.1	Sat Aug 15 16:02:28 2009
@@ -1,4 +1,4 @@
-.\ $NetBSD: mktemp.1,v 1.17 2006/09/19 19:01:44 wiz Exp $
+.\ $NetBSD: mktemp.1,v 1.18 2009/08/15 20:02:28 christos Exp $
 .\ From: $FreeBSD: src/usr.bin/mktemp/mktemp.1,v 1.5 1999/08/28 01:04:13 peter Exp $
 .\ From: $OpenBSD: mktemp.1,v 1.8 1998/03/19 06:13:37 millert Exp $
 .\
@@ -31,7 +31,7 @@
 .\
 .\ $FreeBSD: src/usr.bin/mktemp/mktemp.1,v 1.5 1999/08/28 01:04:13 peter Exp $
 .\
-.Dd January 12, 2006
+.Dd August 15, 2009
 .Dt MKTEMP 1
 .Os
 .Sh NAME
@@ -40,6 +40,7 @@
 .Sh SYNOPSIS
 .Nm mktemp
 .Op Fl dqu
+.Op Fl p Ar tmpdir
 .Bro
 .Fl t Ar prefix
 .No |
@@ -89,6 +90,9 @@
 .Ev TMPDIR
 is not set is
 .Pa /tmp .
+The default location of the temporary directory can be overriden with the
+.Fl p Ar tmpdir
+option.
 The template string created will consist of the
 .Ar prefix
 followed by a

Index: src/usr.bin/mktemp/mktemp.c
diff -u src/usr.bin/mktemp/mktemp.c:1.10 src/usr.bin/mktemp/mktemp.c:1.11
--- src/usr.bin/mktemp/mktemp.c:1.10	Sat Dec 15 14:44:52 2007
+++ src/usr.bin/mktemp/mktemp.c	Sat Aug 15 16:02:28 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: mktemp.c,v 1.10 2007/12/15 19:44:52 perry Exp $ */
+/* $NetBSD: mktemp.c,v 1.11 2009/08/15 20:02:28 christos Exp $ */
 
 /*-
  * Copyright (c) 1994, 1995, 1996, 1998 Peter Wemm pe...@netplex.com.au
@@ -50,7 +50,7 @@
 #include unistd.h
 
 #if defined(__RCSID)  !defined(__lint)
-__RCSID($NetBSD: mktemp.c,v 1.10 2007/12/15 19:44:52 perry Exp $);
+__RCSID($NetBSD: mktemp.c,v 1.11 2009/08/15 20:02:28 christos Exp $);
 #endif /* !__lint */
 
 static void usage(void) __dead;
@@ -66,15 +66,20 @@
 
 	setprogname(*argv);
 	ret = dflag = qflag = tflag = uflag = 0;
+	tmpdir = NULL;
 	prefix = mktemp;
 	name = NULL;
 
-	while ((c = getopt(argc, argv, dqt:u)) != -1)
+	while ((c = getopt(argc, argv, dp:qt:u)) != -1)
 		switch (c) {
 		case 'd':
 			dflag++;
 			break;
 
+		case 'p':
+			tmpdir = optarg;
+			break;
+			
 		case 'q':
 			qflag++;
 			break;
@@ -96,7 +101,8 @@
 	argv += optind;
 
 	if (tflag) {
-		tmpdir = getenv(TMPDIR);
+		if (tmpdir == NULL)
+			tmpdir = getenv(TMPDIR);
 		if (tmpdir == NULL)
 			(void)asprintf(name, %s%s., _PATH_TMP,
 			prefix);
@@ -116,7 +122,11 @@
 	/* generate all requested files */
 	while (name != NULL || argc  0) {
 		if (name == NULL) {
-			name = strdup(argv[0]);
+			if (tmpdir)
+(void)asprintf(name, %s/%s,
+tmpdir, argv[0]);
+			else
+name = strdup(argv[0]);
 			argv++;
 			argc--;
 		}
@@ -155,7 +165,7 @@
 usage(void)
 {
 	(void)fprintf(stderr,
-		Usage: %s [-dqu] {-t prefix | template ...}\n,
-		getprogname());
+	Usage: %s [-dqu] [-p tmpdir] {-t prefix | template ...}\n,
+	getprogname());
 	exit (1);
 }



CVS commit: xsrc/external/mit/libXt/dist/src

2009-08-16 Thread Christos Zoulas
Module Name:xsrc
Committed By:   christos
Date:   Sun Aug 16 14:16:33 UTC 2009

Modified Files:
xsrc/external/mit/libXt/dist/src: TMparse.c

Log Message:
Fix DEBUG build.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 xsrc/external/mit/libXt/dist/src/TMparse.c

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

Modified files:

Index: xsrc/external/mit/libXt/dist/src/TMparse.c
diff -u xsrc/external/mit/libXt/dist/src/TMparse.c:1.1.1.2 xsrc/external/mit/libXt/dist/src/TMparse.c:1.2
--- xsrc/external/mit/libXt/dist/src/TMparse.c:1.1.1.2	Wed Jul  8 22:00:18 2009
+++ xsrc/external/mit/libXt/dist/src/TMparse.c	Sun Aug 16 10:16:33 2009
@@ -364,8 +364,8 @@
 #ifdef DEBUG
 # ifdef notdef
 {Timer,	NULLQUARK, _XtTimerEventType,ParseNone,	NULL},
-# endif /* notdef */
 {EventTimer,	NULLQUARK, _XtEventTimerEventType,ParseNone,NULL},
+# endif /* notdef */
 #endif /* DEBUG */
 
 /* Event Name,	  Quark, Event Type,	Detail Parser, Closure */



CVS commit: src

2009-08-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 16 19:33:39 UTC 2009

Modified Files:
src/distrib/sets/lists/base: md.amd64 md.sparc64 shl.mi
src/include: fts.h
src/lib/libc: shlib_version
src/lib/libc/compat/gen: Makefile.inc
src/lib/libc/gen: fts.c
Added Files:
src/lib/libc/compat/gen: compat___fts50.c

Log Message:
Version fts one more time! This is the most versioned API ever... Bump
fts_level from short to int to avoid a potential DoS.
From Maksymilian Arciemowicz


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/distrib/sets/lists/base/md.amd64
cvs rdiff -u -r1.56 -r1.57 src/distrib/sets/lists/base/md.sparc64
cvs rdiff -u -r1.484 -r1.485 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.18 -r1.19 src/include/fts.h
cvs rdiff -u -r1.213 -r1.214 src/lib/libc/shlib_version
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/compat/gen/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/lib/libc/compat/gen/compat___fts50.c
cvs rdiff -u -r1.38 -r1.39 src/lib/libc/gen/fts.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/base/md.amd64
diff -u src/distrib/sets/lists/base/md.amd64:1.62 src/distrib/sets/lists/base/md.amd64:1.63
--- src/distrib/sets/lists/base/md.amd64:1.62	Mon Aug  3 11:59:41 2009
+++ src/distrib/sets/lists/base/md.amd64	Sun Aug 16 15:33:38 2009
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.62 2009/08/03 15:59:41 plunky Exp $
+# $NetBSD: md.amd64,v 1.63 2009/08/16 19:33:38 christos Exp $
 ./dev/lms0	base-obsolete		obsolete
 ./dev/mms0	base-obsolete		obsolete
 ./libexec/ld.elf_so-i386			base-sys-shlib		compat,pic
@@ -64,7 +64,7 @@
 ./usr/lib/i386/libbz2.so.1			base-compat-shlib	compat,pic
 ./usr/lib/i386/libbz2.so.1.1			base-compat-shlib	compat,pic
 ./usr/lib/i386/libc.so.12			base-compat-shlib	compat,pic
-./usr/lib/i386/libc.so.12.169			base-compat-shlib	compat,pic
+./usr/lib/i386/libc.so.12.170			base-compat-shlib	compat,pic
 ./usr/lib/i386/libcom_err.so.6			base-compat-shlib	compat,pic,kerberos
 ./usr/lib/i386/libcom_err.so.6.0		base-compat-shlib	compat,pic,kerberos
 ./usr/lib/i386/libcrypt.so.1			base-compat-shlib	compat,pic

Index: src/distrib/sets/lists/base/md.sparc64
diff -u src/distrib/sets/lists/base/md.sparc64:1.56 src/distrib/sets/lists/base/md.sparc64:1.57
--- src/distrib/sets/lists/base/md.sparc64:1.56	Mon Aug  3 11:59:41 2009
+++ src/distrib/sets/lists/base/md.sparc64	Sun Aug 16 15:33:38 2009
@@ -1,4 +1,4 @@
-# $NetBSD: md.sparc64,v 1.56 2009/08/03 15:59:41 plunky Exp $
+# $NetBSD: md.sparc64,v 1.57 2009/08/16 19:33:38 christos Exp $
 ./libexec/ld.elf_so-sparc			base-sysutil-bin	compat,pic
 ./sbin/edlabel	base-sysutil-root
 ./usr/bin/fdformatbase-util-bin
@@ -63,7 +63,7 @@
 ./usr/lib/sparc/libbz2.so.1			base-compat-shlib	compat,pic
 ./usr/lib/sparc/libbz2.so.1.1			base-compat-shlib	compat,pic
 ./usr/lib/sparc/libc.so.12			base-compat-shlib	compat,pic
-./usr/lib/sparc/libc.so.12.169			base-compat-shlib	compat,pic
+./usr/lib/sparc/libc.so.12.170			base-compat-shlib	compat,pic
 ./usr/lib/sparc/libcom_err.so.6			base-compat-shlib	compat,pic
 ./usr/lib/sparc/libcom_err.so.6.0		base-compat-shlib	compat,pic
 ./usr/lib/sparc/libcrypt.so.1			base-compat-shlib	compat,pic

Index: src/distrib/sets/lists/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.484 src/distrib/sets/lists/base/shl.mi:1.485
--- src/distrib/sets/lists/base/shl.mi:1.484	Mon Aug  3 11:59:41 2009
+++ src/distrib/sets/lists/base/shl.mi	Sun Aug 16 15:33:38 2009
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.484 2009/08/03 15:59:41 plunky Exp $
+# $NetBSD: shl.mi,v 1.485 2009/08/16 19:33:38 christos Exp $
 #
 # Note:	Don't delete entries from here - mark them as obsolete instead,
 #	unless otherwise stated below.
@@ -13,7 +13,7 @@
 #
 # Note:	libtermcap and libtermlib are hardlinked and share the same version.
 #
-./lib/libc.so.12.169base-sys-shlib		dynamicroot
+./lib/libc.so.12.170base-sys-shlib		dynamicroot
 ./lib/libcrypt.so.1.0base-sys-shlib		dynamicroot
 ./lib/libcrypto.so.6.0base-crypto-shlib	crypto,dynamicroot
 ./lib/libdevmapper.so.1.0			base-lvm-shlib		lvm,dynamicroot
@@ -60,7 +60,7 @@
 ./usr/lib/libbluetooth.so.4.2			base-sys-shlib
 ./usr/lib/libbsdmalloc.so.0.0			base-sys-shlib
 ./usr/lib/libbz2.so.1.1base-sys-shlib
-./usr/lib/libc.so.12.169			base-sys-shlib
+./usr/lib/libc.so.12.170			base-sys-shlib
 ./usr/lib/libcom_err.so.6.0			base-krb5-shlib		kerberos
 ./usr/lib/libcrypt.so.1.0			base-sys-shlib
 ./usr/lib/libcrypto.so.6.0			base-crypto-shlib	crypto

Index: src/include/fts.h
diff -u src/include/fts.h:1.18 src/include/fts.h:1.19
--- src/include/fts.h:1.18	Sat Jan 10 22:04:12 2009
+++ src/include/fts.h	Sun Aug 16 15:33:38 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: fts.h,v 1.18 2009/01/11 03:04:12 christos Exp $	*/
+/*	$NetBSD: fts.h,v 1.19 2009/08/16 19:33:38 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ 

CVS commit: src/sys/kern

2009-08-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 16 20:28:19 UTC 2009

Modified Files:
src/sys/kern: init_sysctl.c

Log Message:
provide compatibility for the older variant of kern.consdev, which used
a 32 bit dev_t. Reported by mrg.


To generate a diff of this commit:
cvs rdiff -u -r1.164 -r1.165 src/sys/kern/init_sysctl.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/kern/init_sysctl.c
diff -u src/sys/kern/init_sysctl.c:1.164 src/sys/kern/init_sysctl.c:1.165
--- src/sys/kern/init_sysctl.c:1.164	Sun May 24 17:41:26 2009
+++ src/sys/kern/init_sysctl.c	Sun Aug 16 16:28:19 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_sysctl.c,v 1.164 2009/05/24 21:41:26 ad Exp $ */
+/*	$NetBSD: init_sysctl.c,v 1.165 2009/08/16 20:28:19 christos Exp $ */
 
 /*-
  * Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: init_sysctl.c,v 1.164 2009/05/24 21:41:26 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: init_sysctl.c,v 1.165 2009/08/16 20:28:19 christos Exp $);
 
 #include opt_sysv.h
 #include opt_compat_netbsd32.h
@@ -2865,6 +2865,7 @@
 sysctl_consdev(SYSCTLFN_ARGS)
 {
 	dev_t consdev;
+	uint32_t oconsdev;
 	struct sysctlnode node;
 
 	if (cn_tab != NULL)
@@ -2872,8 +2873,19 @@
 	else
 		consdev = NODEV;
 	node = *rnode;
-	node.sysctl_data = consdev;
-	node.sysctl_size = sizeof(consdev);
+	switch (*oldlenp) {
+	case sizeof(consdev):
+		node.sysctl_data = consdev;
+		node.sysctl_size = sizeof(consdev);
+		break;
+	case sizeof(oconsdev):
+		oconsdev = (uint32_t)consdev;
+		node.sysctl_data = oconsdev;
+		node.sysctl_size = sizeof(oconsdev);
+		break;
+	default:
+		return EINVAL;
+	}
 	return (sysctl_lookup(SYSCTLFN_CALL(node)));
 }
 



CVS commit: src/usr.bin/ftp

2009-08-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Aug 17 09:08:17 UTC 2009

Modified Files:
src/usr.bin/ftp: fetch.c

Log Message:
back out previous; luke says:
'@' is a reserved URI char per RFC 3986, use %40


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/usr.bin/ftp/fetch.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.bin/ftp/fetch.c
diff -u src/usr.bin/ftp/fetch.c:1.190 src/usr.bin/ftp/fetch.c:1.191
--- src/usr.bin/ftp/fetch.c:1.190	Sat Aug 15 22:49:23 2009
+++ src/usr.bin/ftp/fetch.c	Mon Aug 17 05:08:16 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: fetch.c,v 1.190 2009/08/16 02:49:23 christos Exp $	*/
+/*	$NetBSD: fetch.c,v 1.191 2009/08/17 09:08:16 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: fetch.c,v 1.190 2009/08/16 02:49:23 christos Exp $);
+__RCSID($NetBSD: fetch.c,v 1.191 2009/08/17 09:08:16 christos Exp $);
 #endif /* not lint */
 
 /*
@@ -374,7 +374,7 @@
 		*path = ftp_strdup(ep);
 	}
 
-	cp = strrchr(thost, '@');	/* look for user[:pass]@ in URLs */
+	cp = strchr(thost, '@');	/* look for user[:pass]@ in URLs */
 	if (cp != NULL) {
 		if (*utype == FTP_URL_T)
 			anonftp = 0;	/* disable anonftp */



CVS commit: src/sys/compat/linux32/common

2009-08-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 18 02:02:58 UTC 2009

Modified Files:
src/sys/compat/linux32/common: linux32_ioctl.c

Log Message:
add the video ioctls so that the 32 bit skype works with video
more commits to come


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/compat/linux32/common/linux32_ioctl.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_ioctl.c
diff -u src/sys/compat/linux32/common/linux32_ioctl.c:1.12 src/sys/compat/linux32/common/linux32_ioctl.c:1.13
--- src/sys/compat/linux32/common/linux32_ioctl.c:1.12	Wed Nov 19 13:36:04 2008
+++ src/sys/compat/linux32/common/linux32_ioctl.c	Mon Aug 17 22:02:58 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_ioctl.c,v 1.12 2008/11/19 18:36:04 ad Exp $ */
+/*	$NetBSD: linux32_ioctl.c,v 1.13 2009/08/18 02:02:58 christos Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -32,12 +32,13 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: linux32_ioctl.c,v 1.12 2008/11/19 18:36:04 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: linux32_ioctl.c,v 1.13 2009/08/18 02:02:58 christos Exp $);
 
 #include sys/types.h
 #include sys/param.h
 #include sys/time.h
 #include sys/ucred.h
+#include sys/ioctl.h
 
 #include compat/netbsd32/netbsd32.h
 #include compat/netbsd32/netbsd32_syscallargs.h
@@ -102,6 +103,23 @@
 			break;
 		}
 		break;
+	case 'V':	/* video4linux2 */
+	case 'd':	/* drm */
+	{
+		struct sys_ioctl_args ua;
+		u_long com = 0;
+		if (SCARG(uap, com)  IOC_IN)
+			com |= IOC_OUT;
+		if (SCARG(uap, com)  IOC_OUT)
+			com |= IOC_IN;
+		SCARG(ua, fd) = SCARG(uap, fd);
+		SCARG(ua, com) = SCARG(uap, com);
+		SCARG(ua, com) = ~IOC_DIRMASK;
+		SCARG(ua, com) |= com;
+		SCARG(ua, data) = SCARG_P32(uap, data);
+		error = sys_ioctl(l, (const void *)ua, retval);
+		break;
+	}
 	case 0x89:
 		error = linux32_ioctl_socket(l, uap, retval);
 		break;



CVS commit: src/sys/compat/linux/common

2009-08-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 18 02:04:14 UTC 2009

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

Log Message:
more debugging for mmap


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/compat/linux/common/linux_oldmmap.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_oldmmap.c
diff -u src/sys/compat/linux/common/linux_oldmmap.c:1.71 src/sys/compat/linux/common/linux_oldmmap.c:1.72
--- src/sys/compat/linux/common/linux_oldmmap.c:1.71	Wed Dec  3 07:51:11 2008
+++ src/sys/compat/linux/common/linux_oldmmap.c	Mon Aug 17 22:04:14 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_oldmmap.c,v 1.71 2008/12/03 12:51:11 ad Exp $	*/
+/*	$NetBSD: linux_oldmmap.c,v 1.72 2009/08/18 02:04:14 christos Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: linux_oldmmap.c,v 1.71 2008/12/03 12:51:11 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: linux_oldmmap.c,v 1.72 2009/08/18 02:04:14 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -86,8 +86,10 @@
 	if ((error = copyin(SCARG(uap, lmp), lmap, sizeof lmap)))
 		return error;
 
-	if (lmap.lm_offset  PAGE_MASK)
+	if (lmap.lm_offset  PAGE_MASK) {
+		DPRINTF((old_mmap: 0x%x\n, lmap.lm_offset));
 		return EINVAL;
+	}
 
 	SCARG(nlmap,addr) = lmap.lm_addr;
 	SCARG(nlmap,len) = lmap.lm_len;
@@ -95,9 +97,10 @@
 	SCARG(nlmap,flags) = lmap.lm_flags;
 	SCARG(nlmap,fd) = lmap.lm_fd;
 	SCARG(nlmap,offset) = lmap.lm_offset;
-	DPRINTF((old_mmap(%#x, %u, %u, %u, %d, %u)\n,
+	error = linux_sys_mmap(l, nlmap, retval);
+	DPRINTF((old_mmap(%#x, %u, %u, %u, %d, %u) = %d\n,
 	lmap.lm_addr, lmap.lm_len, lmap.lm_prot, lmap.lm_flags,
-	lmap.lm_fd, lmap.lm_offset));
-	return linux_sys_mmap(l, nlmap, retval);
+	lmap.lm_fd, lmap.lm_offset, error));
+	return error;
 }
 



CVS commit: src/sys

2009-08-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 18 02:17:09 UTC 2009

Modified Files:
src/sys/dev: video.c
src/sys/sys: videoio.h

Log Message:
1. some of the video24linux structs are not as machine independent as their
   authors want them to be. For the buffer ioctls, define new ioctls with
   the 32 bit buffer sizes. For the format struct, define it as packed
   so it is the same on 32 and 64 bit. (I might need to version this)
2. the mmapped buffers need to be page aligned, otherwise mmap(2) does
   not work. Make it so.
All this makes my ricoh camera work with emul-linux and skype running on
amd64. Next is sound!


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/video.c
cvs rdiff -u -r1.5 -r1.6 src/sys/sys/videoio.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/video.c
diff -u src/sys/dev/video.c:1.21 src/sys/dev/video.c:1.22
--- src/sys/dev/video.c:1.21	Tue Jul  7 17:55:17 2009
+++ src/sys/dev/video.c	Mon Aug 17 22:17:09 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: video.c,v 1.21 2009/07/07 21:55:17 njoly Exp $ */
+/* $NetBSD: video.c,v 1.22 2009/08/18 02:17:09 christos Exp $ */
 
 /*
  * Copyright (c) 2008 Patrick Mahoney p...@polycrystal.org
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: video.c,v 1.21 2009/07/07 21:55:17 njoly Exp $);
+__KERNEL_RCSID(0, $NetBSD: video.c,v 1.22 2009/08/18 02:17:09 christos Exp $);
 
 #include video.h
 #if NVIDEO  0
@@ -69,6 +69,8 @@
 #define DPRINTFN(n,x)
 #endif
 
+#define PAGE_ALIGN(a)		(((a) + PAGE_SIZE - 1)  ~(PAGE_SIZE - 1))
+
 #define VIDEO_DRIVER_VERSION 1
 
 /* TODO: move to sys/intr.h */
@@ -1237,6 +1239,50 @@
 }
 
 
+static void
+buf32tobuf(const void *data, struct v4l2_buffer *buf)
+{
+	const struct v4l2_buffer32 *b32 = data;
+
+	buf-index = b32-index;
+	buf-type = b32-type;
+	buf-bytesused = b32-bytesused;
+	buf-flags = b32-flags;
+	buf-field = b32-field;
+	buf-timestamp.tv_sec = b32-timestamp.tv_sec;
+	buf-timestamp.tv_usec = b32-timestamp.tv_usec;
+	buf-timecode = b32-timecode;
+	buf-sequence = b32-sequence;
+	buf-memory = b32-memory;
+	buf-m.offset = b32-m.offset;
+	/* XXX: Handle userptr */
+	buf-length = b32-length;
+	buf-input = b32-input;
+	buf-reserved = b32-reserved;
+}
+
+static void
+buftobuf32(void *data, const struct v4l2_buffer *buf)
+{
+	struct v4l2_buffer32 *b32 = data;
+
+	b32-index = buf-index;
+	b32-type = buf-type;
+	b32-bytesused = buf-bytesused;
+	b32-flags = buf-flags;
+	b32-field = buf-field;
+	b32-timestamp.tv_sec = (uint32_t)buf-timestamp.tv_sec;
+	b32-timestamp.tv_usec = buf-timestamp.tv_usec;
+	b32-timecode = buf-timecode;
+	b32-sequence = buf-sequence;
+	b32-memory = buf-memory;
+	b32-m.offset = buf-m.offset;
+	/* XXX: Handle userptr */
+	b32-length = buf-length;
+	b32-input = buf-input;
+	b32-reserved = buf-reserved;
+}
+
 int
 videoioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
 {
@@ -1250,10 +1296,10 @@
 	struct v4l2_control *control;
 	struct v4l2_queryctrl *query;
 	struct v4l2_requestbuffers *reqbufs;
-	struct v4l2_buffer *buf;
+	struct v4l2_buffer *buf, bufspace;
 	v4l2_std_id *stdid;
 	enum v4l2_buf_type *typep;
-	int *ip;
+	int *ip, error;
 
 	sc = device_private(device_lookup(video_cd, VIDEOUNIT(dev)));
 
@@ -1354,14 +1400,27 @@
 	case VIDIOC_QUERYBUF:
 		buf = data;
 		return video_query_buf(sc, buf);
+	case VIDIOC_QUERYBUF32:
+		buf32tobuf(data, buf = bufspace);
+		if ((error = video_query_buf(sc, buf)) != 0)
+			return error;
+		buftobuf32(data, buf);
+		return 0;
 	case VIDIOC_QBUF:
 		buf = data;
 		return video_queue_buf(sc, buf);
-		break;
+	case VIDIOC_QBUF32:
+		buf32tobuf(data, buf = bufspace);
+		return video_queue_buf(sc, buf);
 	case VIDIOC_DQBUF:
 		buf = data;
 		return video_dequeue_buf(sc, buf);
-		break;
+	case VIDIOC_DQBUF32:
+		buf32tobuf(data, buf = bufspace);
+		if ((error = video_dequeue_buf(sc, buf)) != 0)
+			return error;
+		buftobuf32(data, buf);
+		return 0;
 	case VIDIOC_STREAMON:
 		typep = data;
 		return video_stream_on(sc, *typep);
@@ -1404,6 +1463,9 @@
 	case VIDIOC_QUERYBUF:
 		str = VIDIOC_QUERYBUF;
 		break;
+	case VIDIOC_QUERYBUF32:
+		str = VIDIOC_QUERYBUF32;
+		break;
 	case VIDIOC_G_FBUF:
 		str = VIDIOC_G_FBUF;
 		break;
@@ -1416,9 +1478,15 @@
 	case VIDIOC_QBUF:
 		str = VIDIOC_QBUF;
 		break;
+	case VIDIOC_QBUF32:
+		str = VIDIOC_QBUF32;
+		break;
 	case VIDIOC_DQBUF:
 		str = VIDIOC_DQBUF;
 		break;
+	case VIDIOC_DQBUF32:
+		str = VIDIOC_DQBUF32;
+		break;
 	case VIDIOC_STREAMON:
 		str = VIDIOC_STREAMON;
 		break;
@@ -1758,7 +1826,7 @@
 	struct video_buffer **oldbuf;
 	struct v4l2_buffer *buf;
 
-	size = vs-vs_format.sample_size * nbufs;
+	size = PAGE_ALIGN(vs-vs_format.sample_size) * nbufs;
 	err = scatter_buf_set_size(vs-vs_data, size);
 	if (err != 0)
 		return err;
@@ -1809,7 +1877,7 @@
 		buf-sequence = 0;
 		buf-memory = V4L2_MEMORY_MMAP;
 		buf-m.offset = offset;

CVS commit: src/sys/dev/acpi

2009-08-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 19 00:19:37 UTC 2009

Modified Files:
src/sys/dev/acpi: sony_acpi.c

Log Message:
the new acpi code seems to return NULL for the hardwareId string.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/acpi/sony_acpi.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/acpi/sony_acpi.c
diff -u src/sys/dev/acpi/sony_acpi.c:1.9 src/sys/dev/acpi/sony_acpi.c:1.10
--- src/sys/dev/acpi/sony_acpi.c:1.9	Tue Aug 18 12:41:02 2009
+++ src/sys/dev/acpi/sony_acpi.c	Tue Aug 18 20:19:37 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: sony_acpi.c,v 1.9 2009/08/18 16:41:02 jmcneill Exp $	*/
+/*	$NetBSD: sony_acpi.c,v 1.10 2009/08/19 00:19:37 christos Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sony_acpi.c,v 1.9 2009/08/18 16:41:02 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: sony_acpi.c,v 1.10 2009/08/19 00:19:37 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -454,7 +454,8 @@
 	if (ACPI_FAILURE(rv) || devinfo == NULL)
 		return AE_OK;	/* we don't want to stop searching */
 
-	if (strncmp(devinfo-HardwareId.String, SNY6001, 7) == 0)
+	if (devinfo-HardwareId.String 
+	strncmp(devinfo-HardwareId.String, SNY6001, 7) == 0)
 		sc-sc_has_pic = true;
 
 	AcpiOsFree(devinfo);



CVS commit: src/sys/compat/ossaudio

2009-08-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 22 23:31:16 UTC 2009

Modified Files:
src/sys/compat/ossaudio: ossaudio.c

Log Message:
add a lot more debugging and error checking. Alas, skype seems to be happy
getting back our values, but still does not work.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/compat/ossaudio/ossaudio.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/ossaudio/ossaudio.c
diff -u src/sys/compat/ossaudio/ossaudio.c:1.64 src/sys/compat/ossaudio/ossaudio.c:1.65
--- src/sys/compat/ossaudio/ossaudio.c:1.64	Thu Nov 13 05:05:52 2008
+++ src/sys/compat/ossaudio/ossaudio.c	Sat Aug 22 19:31:16 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ossaudio.c,v 1.64 2008/11/13 10:05:52 ad Exp $	*/
+/*	$NetBSD: ossaudio.c,v 1.65 2009/08/22 23:31:16 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ossaudio.c,v 1.64 2008/11/13 10:05:52 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: ossaudio.c,v 1.65 2009/08/22 23:31:16 christos Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -66,6 +66,88 @@
 
 static void setblocksize(file_t *, struct audio_info *);
 
+#ifdef AUDIO_DEBUG
+static const char *
+compat_ossaudio_getcmd(u_long cmd)
+{
+	static char buf[64];
+	switch (cmd) {
+#define _DO(_a) \
+	case _a: \
+		return # _a;
+_DO(OSS_SNDCTL_DSP_RESET)
+_DO(OSS_SNDCTL_DSP_SYNC)
+_DO(OSS_SNDCTL_DSP_SPEED)
+_DO(OSS_SOUND_PCM_READ_RATE)
+_DO(OSS_SNDCTL_DSP_STEREO)
+_DO(OSS_SNDCTL_DSP_GETBLKSIZE)
+_DO(OSS_SNDCTL_DSP_SETFMT)
+_DO(OSS_SOUND_PCM_READ_BITS)
+_DO(OSS_SNDCTL_DSP_CHANNELS)
+_DO(OSS_SOUND_PCM_READ_CHANNELS)
+_DO(OSS_SOUND_PCM_WRITE_FILTER)
+_DO(OSS_SOUND_PCM_READ_FILTER)
+_DO(OSS_SNDCTL_DSP_POST)
+_DO(OSS_SNDCTL_DSP_SUBDIVIDE)
+_DO(OSS_SNDCTL_DSP_SETFRAGMENT)
+_DO(OSS_SNDCTL_DSP_GETFMTS)
+_DO(OSS_SNDCTL_DSP_GETOSPACE)
+_DO(OSS_SNDCTL_DSP_GETISPACE)
+_DO(OSS_SNDCTL_DSP_NONBLOCK)
+_DO(OSS_SNDCTL_DSP_GETCAPS)
+_DO(OSS_SNDCTL_DSP_GETTRIGGER)
+_DO(OSS_SNDCTL_DSP_SETTRIGGER)
+_DO(OSS_SNDCTL_DSP_GETIPTR)
+_DO(OSS_SNDCTL_DSP_GETOPTR)
+_DO(OSS_SNDCTL_DSP_MAPINBUF)
+_DO(OSS_SNDCTL_DSP_MAPOUTBUF)
+_DO(OSS_SNDCTL_DSP_SETSYNCRO)
+_DO(OSS_SNDCTL_DSP_SETDUPLEX)
+_DO(OSS_SNDCTL_DSP_GETODELAY)
+_DO(OSS_SNDCTL_DSP_PROFILE)
+_DO(OSS_SOUND_MIXER_INFO)
+_DO(OSS_SOUND_OLD_MIXER_INFO)
+_DO(OSS_GET_VERSION)
+_DO(OSS_SEQ_RESET)
+_DO(OSS_SEQ_SYNC)
+_DO(OSS_SYNTH_INFO)
+_DO(OSS_SEQ_CTRLRATE)
+_DO(OSS_SEQ_GETOUTCOUNT)
+_DO(OSS_SEQ_GETINCOUNT)
+_DO(OSS_SEQ_PERCMODE)
+_DO(OSS_SEQ_TESTMIDI)
+_DO(OSS_SEQ_RESETSAMPLES)
+_DO(OSS_SEQ_NRSYNTHS)
+_DO(OSS_SEQ_NRMIDIS)
+#ifdef notyet
+_DO(OSS_MIDI_INFO)
+#endif
+_DO(OSS_SEQ_THRESHOLD)
+_DO(OSS_MEMAVL)
+_DO(OSS_FM_4OP_ENABLE)
+_DO(OSS_SEQ_PANIC)
+_DO(OSS_SEQ_OUTOFBAND)
+_DO(OSS_SEQ_GETTIME)
+_DO(OSS_ID)
+_DO(OSS_CONTROL)
+_DO(OSS_REMOVESAMPLE)
+_DO(OSS_TMR_TIMEBASE)
+_DO(OSS_TMR_START)
+_DO(OSS_TMR_STOP)
+_DO(OSS_TMR_CONTINUE)
+_DO(OSS_TMR_TEMPO)
+_DO(OSS_TMR_SOURCE)
+_DO(OSS_TMR_METRONOME)
+_DO(OSS_TMR_SELECT)
+#undef _DO
+	default:
+		(void)snprintf(buf, sizeof(buf), *0x%lx*, cmd);
+		return buf;
+	}
+}
+#endif
+
+
 static int
 compat_ossaudio_modcmd(modcmd_t cmd, void *arg)
 {
@@ -108,7 +190,7 @@
 	}
 
 	com = SCARG(uap, com);
-	DPRINTF((oss_ioctl_audio: com=%08lx\n, com));
+	DPRINTF((%s: com=%s\n, __func__, compat_ossaudio_getcmd(com)));
 
 	retval[0] = 0;
 
@@ -116,13 +198,17 @@
 	switch (com) {
 	case OSS_SNDCTL_DSP_RESET:
 		error = ioctlf(fp, AUDIO_FLUSH, NULL);
-		if (error)
+		if (error) {
+			DPRINTF((%s: AUDIO_FLUSH %d\n, __func__, error));
 			goto out;
+		}
 		break;
 	case OSS_SNDCTL_DSP_SYNC:
 		error = ioctlf(fp, AUDIO_DRAIN, NULL);
-		if (error)
+		if (error) {
+			DPRINTF((%s: AUDIO_DRAIN %d\n, __func__, error));
 			goto out;
+		}
 		break;
 	case OSS_SNDCTL_DSP_POST:
 		/* This call is merely advisory, and may be a nop. */
@@ -130,56 +216,93 @@
 	case OSS_SNDCTL_DSP_SPEED:
 		AUDIO_INITINFO(tmpinfo);
 		error = copyin(SCARG(uap, data), idat, sizeof idat);
-		if (error)
+		if (error) {
+			DPRINTF((%s: SNDCTL_DSP_SPEED %d\n,
+			 __func__, error));
 			goto out;
+		}
 		tmpinfo.play.sample_rate =
 		tmpinfo.record.sample_rate = idat;
+		DPRINTF((%s: SNDCTL_DSP_SPEED  %d\n, __func__, idat));
 		error = ioctlf(fp, AUDIO_SETINFO, tmpinfo);
-		DPRINTF((oss_sys_ioctl: SNDCTL_DSP_SPEED %d = %d\n,
-			 idat, error));
-		if (error)
+		if (error) {
+			DPRINTF((%s: SNDCTL_DSP_SPEED %d = %d\n,
+			 __func__, idat, error));
 			goto out;
+		}
 		/* fall into ... */
 	case OSS_SOUND_PCM_READ_RATE:
 		error = ioctlf(fp, AUDIO_GETBUFINFO, tmpinfo);
-		if (error)
+		if (error) {
+			DPRINTF((%s: AUDIO_GETBUFINFO %d\n,
+			 __func__, error));
 			goto out;
+		}
 		idat = tmpinfo.play.sample_rate;
+		DPRINTF((%s: SNDCTL_PCM_READ_RATE  %d\n, __func__, idat));
 		error = copyout(idat, SCARG(uap, data), sizeof idat);
-		if (error)
+		if 

CVS commit: src/usr.sbin/sti

2009-08-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Aug 27 19:40:06 UTC 2009

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

Log Message:
port to non NetBSD systems.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sti/sti.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/sti/sti.c
diff -u src/usr.sbin/sti/sti.c:1.7 src/usr.sbin/sti/sti.c:1.8
--- src/usr.sbin/sti/sti.c:1.7	Mon Apr 28 16:24:17 2008
+++ src/usr.sbin/sti/sti.c	Thu Aug 27 15:40:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: sti.c,v 1.7 2008/04/28 20:24:17 martin Exp $	*/
+/*	$NetBSD: sti.c,v 1.8 2009/08/27 19:40:06 christos Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -29,7 +29,9 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: sti.c,v 1.7 2008/04/28 20:24:17 martin Exp $);
+#ifdef __RCSID
+__RCSID($NetBSD: sti.c,v 1.8 2009/08/27 19:40:06 christos Exp $);
+#endif
 
 #include sys/param.h
 #include sys/ioctl.h
@@ -40,14 +42,21 @@
 #include unistd.h
 #include fcntl.h
 #include err.h
-#include vis.h
 #include errno.h
+#ifdef __RCSID
+#include vis.h
+#else
+#define setprogname(a)
+extern const char *__progname;
+#define getprogname() __progname
+#endif
 
 static int
 unescape(const char **pp, int *state)
 {
 	char ch, out;
 
+#ifdef __RCSID
 	while ((ch = *(*pp)++) != '\0') {
 		switch(unvis(out, ch, state, 0)) {
 		case 0:
@@ -65,6 +74,48 @@
 	}
 	if (unvis(out, '\0', state, UNVIS_END) == UNVIS_VALID)
 		return out;
+#else
+	switch ((ch = *(*pp)++)) {
+	case '\0':
+		goto out;
+	case '^':
+		ch = *(*pp)++;
+		return CTRL(ch);
+	case '\\':
+		switch (ch = *(*pp)++) {
+		case 'a': return '\a';
+		case 'b': return '\b';
+		case 'e': return '\e';
+		case 'f': return '\f';
+		case 't': return '\t';
+		case 'n': return '\n';
+		case 'r': return '\r';
+		case 'v': return '\v';
+		case '\\': return '\\';
+
+		case '0': case '1': case '2': case '3':
+		case '4': case '5': case '6': case '7':
+			out = 0;
+			if (ch = '0'  ch  '8') {
+out = out * 8 + ch - '0';
+ch = *(*pp)++;
+if (ch = '0'  ch  '8') {
+	out = out * 8 + ch - '0';
+	ch = *(*pp)++;
+	if (ch = '0'  ch  '8')
+		out = out * 8 + ch - '0';
+}
+			}
+			return out;
+		default:
+		break;
+		}
+		break;
+	default:
+		return ch;
+	}
+out:
+#endif
 	errno = ENODATA;
 	return -1;
 }
@@ -127,10 +178,21 @@
 
 	if (argc == 0) {
 		char *line;
+#ifndef __RCSID
+		line = malloc(10240);
+		while (fgets(line, 10240, stdin) != NULL) {
+			char *p;
+			if ((p = strrchr(line, '\n')) != NULL)
+*p = '\0';
+			sendstr(fd, line);
+		}
+		free(line);
+#else
 		while ((line = fparseln(stdin, NULL, NULL, NULL, 0)) != NULL) {
 			sendstr(fd, line);
 			free(line);
 		}
+#endif
 	} else {
 		for (; argc--; argv++) {
 			sendstr(fd, *argv);



CVS commit: src/usr.bin/mail

2009-08-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Aug 28 14:26:50 UTC 2009

Modified Files:
src/usr.bin/mail: mime_decode.c mime_detach.c

Log Message:
Don't barf on malformed mime messages (missing mime version). From Anon Ymous


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/mail/mime_decode.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/mail/mime_detach.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.bin/mail/mime_decode.c
diff -u src/usr.bin/mail/mime_decode.c:1.15 src/usr.bin/mail/mime_decode.c:1.16
--- src/usr.bin/mail/mime_decode.c:1.15	Fri Apr 10 09:08:25 2009
+++ src/usr.bin/mail/mime_decode.c	Fri Aug 28 10:26:50 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: mime_decode.c,v 1.15 2009/04/10 13:08:25 christos Exp $	*/
+/*	$NetBSD: mime_decode.c,v 1.16 2009/08/28 14:26:50 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 
 #include sys/cdefs.h
 #ifndef __lint__
-__RCSID($NetBSD: mime_decode.c,v 1.15 2009/04/10 13:08:25 christos Exp $);
+__RCSID($NetBSD: mime_decode.c,v 1.16 2009/08/28 14:26:50 christos Exp $);
 #endif /* not __lint__ */
 
 #include assert.h
@@ -266,8 +266,15 @@
 		filename = savestr(filename);	/* save it! */
 	}
 	mip-mi_filename = filename;
-}
 
+	/*
+	 * XXX: If we have a Content-Type in the header, then assume
+	 * we also have a MIME-Version: 1.0.  This fixes some broken
+	 * MIME headers that I have seen occasionally.
+	 */
+	if (mip-mi_version == NULL  mip-mi_type != NULL)
+		mip-mi_version = MIME_VERSION;
+}
 
 static struct message *
 salloc_message(int flag, long block, short offset)

Index: src/usr.bin/mail/mime_detach.c
diff -u src/usr.bin/mail/mime_detach.c:1.4 src/usr.bin/mail/mime_detach.c:1.5
--- src/usr.bin/mail/mime_detach.c:1.4	Fri Apr 10 09:08:25 2009
+++ src/usr.bin/mail/mime_detach.c	Fri Aug 28 10:26:50 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: mime_detach.c,v 1.4 2009/04/10 13:08:25 christos Exp $	*/
+/*	$NetBSD: mime_detach.c,v 1.5 2009/08/28 14:26:50 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 
 #include sys/cdefs.h
 #ifndef __lint__
-__RCSID($NetBSD: mime_detach.c,v 1.4 2009/04/10 13:08:25 christos Exp $);
+__RCSID($NetBSD: mime_detach.c,v 1.5 2009/08/28 14:26:50 christos Exp $);
 #endif /* not __lint__ */
 
 #include assert.h
@@ -178,26 +178,36 @@
 {
 	char *pathname;
 	char *prompt;
+	const char *partstr;
+	const char *subtype;
+
+	/*
+	 * XXX: If partstr == NULL, we probably shouldn't be detaching
+	 * anything, but let's be liberal and try to do something with
+	 * the block anyway.
+	 */
+	partstr = mip-mi_partstr  mip-mi_partstr[0] ? mip-mi_partstr : 0;
+	subtype = mip-mi_subtype ? mip-mi_subtype : unknown;
 
 	/*
 	 * Get the suggested target pathname.
 	 */
 	if (mip-mi_filename != NULL)
-		(void)sasprintf(pathname, %s/%s, mip-mi_detachdir, mip-mi_filename);
+		(void)sasprintf(pathname, %s/%s, mip-mi_detachdir,
+		mip-mi_filename);
 	else {
 		if (mip-mi_detachall == 0)
 			return NULL;
 
 		(void)sasprintf(pathname, %s/msg-%s.part-%s.%s,
 		mip-mi_detachdir, mip-mi_msgstr,
-		mip-mi_partstr[0] ? mip-mi_partstr : 0,
-		mip-mi_subtype ? mip-mi_subtype : unknown);
+		partstr, subtype);
 	}
 
 	/*
 	 * Make up the prompt
 	 */
-	(void)sasprintf(prompt, %-7s filename: , mip-mi_partstr);
+	(void)sasprintf(prompt, %-7s filename: , partstr);
 
 	/*
 	 * The main loop.
@@ -218,7 +228,7 @@
 return NULL;
 			continue;
 		}
-		switch (detach_open_core(fname, mip-mi_partstr)) {
+		switch (detach_open_core(fname, partstr)) {
 		case DETACH_OPEN_OK:
 			return fname;
 		case DETACH_NEXT:



CVS commit: src/sys/sys

2009-08-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Aug 28 15:15:04 UTC 2009

Modified Files:
src/sys/sys: unistd.h

Log Message:
- Bump posix version to 200112L, we should be mostly compliant now.
- Add text from FreeBSD explaining the values
- Add missing defines as undef'ed.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/sys/unistd.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/sys/unistd.h
diff -u src/sys/sys/unistd.h:1.50 src/sys/sys/unistd.h:1.51
--- src/sys/sys/unistd.h:1.50	Tue Aug 18 01:05:56 2009
+++ src/sys/sys/unistd.h	Fri Aug 28 11:15:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: unistd.h,v 1.50 2009/08/18 05:05:56 yamt Exp $	*/
+/*	$NetBSD: unistd.h,v 1.51 2009/08/28 15:15:03 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -59,64 +59,103 @@
 /* saved set-user-ID and set-group-ID */
 #endif
 
-#define	_POSIX_VERSION		199009L
-#define	_POSIX2_VERSION		199212L
+#define	_POSIX_VERSION			200112L
+#define	_POSIX2_VERSION			199212L
 
 /* execution-time symbolic constants */
-/* asynchronous I/O is available */
-#define	_POSIX_ASYNCHRONOUS_IO	200112L
-/* chown requires appropriate privileges */
-#define	_POSIX_CHOWN_RESTRICTED	1
-/* clock selection */
-#define	_POSIX_CLOCK_SELECTION	-1
-/* too-long path components generate errors */
-#define	_POSIX_NO_TRUNC		1
-/* may disable terminal special characters */
-#define	_POSIX_VDISABLE		__CAST(unsigned char, '\377')
-/* file synchronization is available */
-#define	_POSIX_FSYNC		1
-/* synchronized I/O is available */
-#define	_POSIX_SYNCHRONIZED_IO	1
-/* memory mapped files */
-#define	_POSIX_MAPPED_FILES	1
-/* memory locking of whole address space */
-#define	_POSIX_MEMLOCK		1
-/* memory locking address ranges */
-#define	_POSIX_MEMLOCK_RANGE	1
-/* memory access protections */
-#define	_POSIX_MEMORY_PROTECTION 1
-/* message passing is available */
-#define	_POSIX_MESSAGE_PASSING	200112L
-/* monotonic clock */
-#define	_POSIX_MONOTONIC_CLOCK	200112L
-/* priority scheduling */
+
+/*
+ * POSIX options and option groups we unconditionally do or don't
+ * implement.  Those options which are implemented (or not) entirely
+ * in user mode are defined in unistd.h.  Please keep this list in
+ * alphabetical order.
+ *
+ * Anything which is defined as zero below **must** have an
+ * implementation for the corresponding sysconf() which is able to
+ * determine conclusively whether or not the feature is supported.
+ * Anything which is defined as other than -1 below **must** have
+ * complete headers, types, and function declarations as specified by
+ * the POSIX standard; however, if the relevant sysconf() function
+ * returns -1, the functions may be stubbed out.
+ */
+	/* Advisory information */
+#undef	_POSIX_ADVISORY_INFO
+	/* asynchronous I/O is available */
+#define	_POSIX_ASYNCHRONOUS_IO		200112L
+	/* barriers */
+#define	_POSIX_BARRIERS			200112L
+	/* chown requires correct privileges */
+#define	_POSIX_CHOWN_RESTRICTED		1
+	/* clock selection */
+#define	_POSIX_CLOCK_SELECTION		-1
+	/* CPU type */
+#undef	_POSIX_CPUTYPE
+	/* file synchronization is available */
+#define	_POSIX_FSYNC			1
+	/* support IPv6 */
+#define	_POSIX_IPV6			0
+	/* job control is available */
+#define	_POSIX_JOB_CONTROL		1
+	/* memory mapped files */
+#define	_POSIX_MAPPED_FILES		1
+	/* memory locking whole address space */
+#define	_POSIX_MEMLOCK			1
+	/* memory locking address ranges */
+#define	_POSIX_MEMLOCK_RANGE		1
+	/* memory access protections */
+#define	_POSIX_MEMORY_PROTECTION	1
+	/* message passing is available */
+#define	_POSIX_MESSAGE_PASSING		200112L
+	/* monotonic clock */
+#define	_POSIX_MONOTONIC_CLOCK		200112L
+	/* too-long path comp generate errors */
+#define	_POSIX_NO_TRUNC			1
+	/* prioritized I/O */
+#define	_POSIX_PRIORITIZED_IO		-1
+	/* priority scheduling */
 #define	_POSIX_PRIORITY_SCHEDULING	200112L
-/* threads */
-#define	_POSIX_THREADS		200112L
-/* _r functions */
-#define	_POSIX_THREAD_SAFE_FUNCTIONS	200112L
-/* pthread_attr functions for stack size */
+	/* raw sockets */
+#define	_POSIX_RAW_SOCKETS		200112L
+	/* read/write locks */
+#define	_POSIX_READER_WRITER_LOCKS	200112L
+	/* realtime signals */
+#undef	_POSIX_REALTIME_SIGNALS
+	/* regular expressions */
+#define	_POSIX_REGEXP			1
+	/* semaphores */
+#define	_POSIX_SEMAPHORES		0
+	/* shared memory */
+#undef	_POSIX_SHARED_MEMORY_OBJECTS
+	/* shell */
+#define	_POSIX_SHELL			1
+	/* spin locks */
+#define	_POSIX_SPIN_LOCKS		200112L
+	/* sporadic server */
+#undef	_POSIX_SPORADIC_SERVER
+	/* synchronized I/O is available */
+#define	_POSIX_SYNCHRONIZED_IO		1
+	/* threads */
+#define	_POSIX_THREADS			200112L
+	/* pthread_attr for stack size */
 #define	

CVS commit: src/lib/libedit

2009-08-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 30 15:41:05 UTC 2009

Modified Files:
src/lib/libedit: sys.h term.c
src/lib/libedit/readline: readline.h

Log Message:
use __sun || sun instead of _SunOS, from Jess Thrysoee


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libedit/sys.h
cvs rdiff -u -r1.53 -r1.54 src/lib/libedit/term.c
cvs rdiff -u -r1.27 -r1.28 src/lib/libedit/readline/readline.h

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

Modified files:

Index: src/lib/libedit/sys.h
diff -u src/lib/libedit/sys.h:1.10 src/lib/libedit/sys.h:1.11
--- src/lib/libedit/sys.h:1.10	Fri Feb  6 15:08:13 2009
+++ src/lib/libedit/sys.h	Sun Aug 30 11:41:05 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys.h,v 1.10 2009/02/06 20:08:13 sketch Exp $	*/
+/*	$NetBSD: sys.h,v 1.11 2009/08/30 15:41:05 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -101,7 +101,7 @@
 #define	REGEX		/* Use POSIX.2 regular expression functions */
 #undef	REGEXP		/* Use UNIX V8 regular expression functions */
 
-#ifdef __SunOS
+#if defined(sun) || defined(__sun)
 extern int tgetent(char *, const char *);
 extern int tgetflag(char *);
 extern int tgetnum(char *);

Index: src/lib/libedit/term.c
diff -u src/lib/libedit/term.c:1.53 src/lib/libedit/term.c:1.54
--- src/lib/libedit/term.c:1.53	Fri Jul 17 08:27:57 2009
+++ src/lib/libedit/term.c	Sun Aug 30 11:41:05 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: term.c,v 1.53 2009/07/17 12:27:57 christos Exp $	*/
+/*	$NetBSD: term.c,v 1.54 2009/08/30 15:41:05 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = @(#)term.c	8.2 (Berkeley) 4/30/95;
 #else
-__RCSID($NetBSD: term.c,v 1.53 2009/07/17 12:27:57 christos Exp $);
+__RCSID($NetBSD: term.c,v 1.54 2009/08/30 15:41:05 christos Exp $);
 #endif
 #endif /* not lint  not SCCSID */
 
@@ -60,7 +60,8 @@
 #include ncurses.h
 #endif
 /* Solaris's term.h does horrid things. */
-#if (defined(HAVE_TERM_H)  !defined(__SunOS))
+
+#if defined(HAVE_TERM_H)  !defined(sun)  !defined(__sun)
 #include term.h
 #endif
 #include sys/types.h

Index: src/lib/libedit/readline/readline.h
diff -u src/lib/libedit/readline/readline.h:1.27 src/lib/libedit/readline/readline.h:1.28
--- src/lib/libedit/readline/readline.h:1.27	Thu Jul  9 15:02:04 2009
+++ src/lib/libedit/readline/readline.h	Sun Aug 30 11:41:05 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: readline.h,v 1.27 2009/07/09 19:02:04 christos Exp $	*/
+/*	$NetBSD: readline.h,v 1.28 2009/08/30 15:41:05 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #ifndef CTRL
 #include sys/ioctl.h
-#if !defined(__sun)  !defined(__hpux)  !defined(_AIX)
+#if !defined(sun)  !defined(__sun)  !defined(__hpux)  !defined(_AIX)
 #include sys/ttydefaults.h
 #endif
 #ifndef CTRL



CVS commit: src/sys/sys

2009-08-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 30 16:38:48 UTC 2009

Modified Files:
src/sys/sys: unistd.h

Log Message:
Change _POSIX2_VERSION for shells and utilities to 200112L to match
_POSIX_VERSION. Requested by Channa.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/sys/unistd.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/sys/unistd.h
diff -u src/sys/sys/unistd.h:1.51 src/sys/sys/unistd.h:1.52
--- src/sys/sys/unistd.h:1.51	Fri Aug 28 11:15:03 2009
+++ src/sys/sys/unistd.h	Sun Aug 30 12:38:48 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: unistd.h,v 1.51 2009/08/28 15:15:03 christos Exp $	*/
+/*	$NetBSD: unistd.h,v 1.52 2009/08/30 16:38:48 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -60,7 +60,7 @@
 #endif
 
 #define	_POSIX_VERSION			200112L
-#define	_POSIX2_VERSION			199212L
+#define	_POSIX2_VERSION			200112L
 
 /* execution-time symbolic constants */
 



CVS commit: src/lib/libedit

2009-08-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Aug 31 00:05:43 UTC 2009

Modified Files:
src/lib/libedit: sys.h term.c
src/lib/libedit/readline: readline.h

Log Message:
delete defined(sun), it could be invaded in the user namespace. Suggested
by mrg@


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libedit/sys.h
cvs rdiff -u -r1.54 -r1.55 src/lib/libedit/term.c
cvs rdiff -u -r1.28 -r1.29 src/lib/libedit/readline/readline.h

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

Modified files:

Index: src/lib/libedit/sys.h
diff -u src/lib/libedit/sys.h:1.11 src/lib/libedit/sys.h:1.12
--- src/lib/libedit/sys.h:1.11	Sun Aug 30 11:41:05 2009
+++ src/lib/libedit/sys.h	Sun Aug 30 20:05:43 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys.h,v 1.11 2009/08/30 15:41:05 christos Exp $	*/
+/*	$NetBSD: sys.h,v 1.12 2009/08/31 00:05:43 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -101,7 +101,7 @@
 #define	REGEX		/* Use POSIX.2 regular expression functions */
 #undef	REGEXP		/* Use UNIX V8 regular expression functions */
 
-#if defined(sun) || defined(__sun)
+#if defined(__sun)
 extern int tgetent(char *, const char *);
 extern int tgetflag(char *);
 extern int tgetnum(char *);

Index: src/lib/libedit/term.c
diff -u src/lib/libedit/term.c:1.54 src/lib/libedit/term.c:1.55
--- src/lib/libedit/term.c:1.54	Sun Aug 30 11:41:05 2009
+++ src/lib/libedit/term.c	Sun Aug 30 20:05:43 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: term.c,v 1.54 2009/08/30 15:41:05 christos Exp $	*/
+/*	$NetBSD: term.c,v 1.55 2009/08/31 00:05:43 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = @(#)term.c	8.2 (Berkeley) 4/30/95;
 #else
-__RCSID($NetBSD: term.c,v 1.54 2009/08/30 15:41:05 christos Exp $);
+__RCSID($NetBSD: term.c,v 1.55 2009/08/31 00:05:43 christos Exp $);
 #endif
 #endif /* not lint  not SCCSID */
 
@@ -61,7 +61,7 @@
 #endif
 /* Solaris's term.h does horrid things. */
 
-#if defined(HAVE_TERM_H)  !defined(sun)  !defined(__sun)
+#if defined(HAVE_TERM_H)  !defined(__sun)
 #include term.h
 #endif
 #include sys/types.h

Index: src/lib/libedit/readline/readline.h
diff -u src/lib/libedit/readline/readline.h:1.28 src/lib/libedit/readline/readline.h:1.29
--- src/lib/libedit/readline/readline.h:1.28	Sun Aug 30 11:41:05 2009
+++ src/lib/libedit/readline/readline.h	Sun Aug 30 20:05:43 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: readline.h,v 1.28 2009/08/30 15:41:05 christos Exp $	*/
+/*	$NetBSD: readline.h,v 1.29 2009/08/31 00:05:43 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #ifndef CTRL
 #include sys/ioctl.h
-#if !defined(sun)  !defined(__sun)  !defined(__hpux)  !defined(_AIX)
+#if !defined(__sun)  !defined(__hpux)  !defined(_AIX)
 #include sys/ttydefaults.h
 #endif
 #ifndef CTRL



CVS commit: src/distrib/sets/lists/xcomp

2009-09-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Sep  4 17:46:06 UTC 2009

Modified Files:
src/distrib/sets/lists/xcomp: md.amd64 md.i386

Log Message:
PR/41991: Joachim Kuebart: add debug libs for libdrm_intel and unmark the
regular lib as profile.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/distrib/sets/lists/xcomp/md.amd64
cvs rdiff -u -r1.24 -r1.25 src/distrib/sets/lists/xcomp/md.i386

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/xcomp/md.amd64
diff -u src/distrib/sets/lists/xcomp/md.amd64:1.18 src/distrib/sets/lists/xcomp/md.amd64:1.19
--- src/distrib/sets/lists/xcomp/md.amd64:1.18	Fri Jun 12 08:36:50 2009
+++ src/distrib/sets/lists/xcomp/md.amd64	Fri Sep  4 13:46:06 2009
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.18 2009/06/12 12:36:50 njoly Exp $
+# $NetBSD: md.amd64,v 1.19 2009/09/04 17:46:06 christos Exp $
 ./usr/X11R6/include/xf86Optrec.h			-unknown-	x11
 ./usr/X11R6/include/xf86Parser.h			-unknown-	x11
 ./usr/X11R6/man/cat3/XF86VidMode.0			-unknown-	.cat,x11
@@ -71,7 +71,8 @@
 ./usr/X11R6/man/man3/XF86VidModeValidateModeLine.3	-unknown-	.man,x11
 ./usr/X11R6/man/man4/fpit.4-unknown-	.man,x11
 ./usr/X11R7/include/intel_bufmgr.h			-unknown-	xorg
-./usr/X11R7/lib/libdrm_intel.a-unknown-	profile,xorg
+./usr/X11R7/lib/libdrm_intel.a-unknown-	xorg
+./usr/X11R7/lib/libdrm_intel_g.a			-unknown-	debuglib,xorg
 ./usr/X11R7/lib/libdrm_intel_p.a			-unknown-	profile,xorg
 ./usr/X11R7/lib/libdrm_intel_pic.a			-unknown-	xorg
 ./usr/libdata/debug/usr/X11R6/bin/XFree86.debug		-unknown-	debug,x11

Index: src/distrib/sets/lists/xcomp/md.i386
diff -u src/distrib/sets/lists/xcomp/md.i386:1.24 src/distrib/sets/lists/xcomp/md.i386:1.25
--- src/distrib/sets/lists/xcomp/md.i386:1.24	Fri Jun 12 08:36:50 2009
+++ src/distrib/sets/lists/xcomp/md.i386	Fri Sep  4 13:46:06 2009
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.24 2009/06/12 12:36:50 njoly Exp $
+# $NetBSD: md.i386,v 1.25 2009/09/04 17:46:06 christos Exp $
 ./usr/X11R6/include/xf86Optrec.h			-unknown-	x11
 ./usr/X11R6/include/xf86Parser.h			-unknown-	x11
 ./usr/X11R6/man/cat3/XF86VidMode.0			-unknown-	.cat,x11
@@ -71,7 +71,8 @@
 ./usr/X11R6/man/man3/XF86VidModeValidateModeLine.3	-unknown-	.man,x11
 ./usr/X11R6/man/man4/fpit.4-unknown-	.man,x11
 ./usr/X11R7/include/intel_bufmgr.h			-unknown-	xorg
-./usr/X11R7/lib/libdrm_intel.a-unknown-	profile,xorg
+./usr/X11R7/lib/libdrm_intel.a-unknown-	xorg
+./usr/X11R7/lib/libdrm_intel_g.a			-unknown-	debuglib,xorg
 ./usr/X11R7/lib/libdrm_intel_p.a			-unknown-	profile,xorg
 ./usr/X11R7/lib/libdrm_intel_pic.a			-unknown-	xorg
 ./usr/libdata/debug/usr/X11R6/bin/XFree86.debug		-unknown-	debug,x11



CVS commit: src/bin/pax

2009-09-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Sep  6 13:38:50 UTC 2009

Modified Files:
src/bin/pax: pax.1

Log Message:
too many dots. noted by anon-ymous


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/bin/pax/pax.1

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

Modified files:

Index: src/bin/pax/pax.1
diff -u src/bin/pax/pax.1:1.55 src/bin/pax/pax.1:1.56
--- src/bin/pax/pax.1:1.55	Sun Dec  2 16:13:23 2007
+++ src/bin/pax/pax.1	Sun Sep  6 09:38:50 2009
@@ -1,4 +1,4 @@
-.\$NetBSD: pax.1,v 1.55 2007/12/02 21:13:23 wiz Exp $
+.\$NetBSD: pax.1,v 1.56 2009/09/06 13:38:50 christos Exp $
 .\
 .\ Copyright (c) 1992 Keith Muller.
 .\ Copyright (c) 1992, 1993
@@ -33,7 +33,7 @@
 .\
 .\	@(#)pax.1	8.4 (Berkeley) 4/18/94
 .\
-.Dd April 23, 2007
+.Dd September 6, 2009
 .Dt PAX 1
 .Os
 .Sh NAME
@@ -1257,11 +1257,11 @@
 ownership when copying directory trees.
 This can be done with the following commands:
 .Dl cd olddir
-.Dl pax -rw -pe .\ .../newdir
+.Dl pax -rw -pe .\ ../newdir
 which will copy the contents of
 .Pa olddir
 into
-.Pa .../newdir ,
+.Pa ../newdir ,
 preserving ownership, permissions and access times.
 .Pp
 The command:



CVS commit: src/lib/libedit

2009-09-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Sep  7 21:24:34 UTC 2009

Modified Files:
src/lib/libedit: histedit.h history.c readline.c
src/lib/libedit/readline: readline.h

Log Message:
apply apple patches from:
http://opensource.apple.com/source/libedit/libedit-11/patches/


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/lib/libedit/histedit.h
cvs rdiff -u -r1.33 -r1.34 src/lib/libedit/history.c
cvs rdiff -u -r1.84 -r1.85 src/lib/libedit/readline.c
cvs rdiff -u -r1.29 -r1.30 src/lib/libedit/readline/readline.h

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

Modified files:

Index: src/lib/libedit/histedit.h
diff -u src/lib/libedit/histedit.h:1.40 src/lib/libedit/histedit.h:1.41
--- src/lib/libedit/histedit.h:1.40	Mon May 11 14:33:30 2009
+++ src/lib/libedit/histedit.h	Mon Sep  7 17:24:33 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: histedit.h,v 1.40 2009/05/11 18:33:30 christos Exp $	*/
+/*	$NetBSD: histedit.h,v 1.41 2009/09/07 21:24:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -204,6 +204,10 @@
 #define	H_SETUNIQUE	20	/* , int);		*/
 #define	H_GETUNIQUE	21	/* , void);		*/
 #define	H_DEL		22	/* , int);		*/
+#define	H_NEXT_EVDATA	23	/* , const int, histdata_t *);	*/
+#define	H_DELDATA	24	/* , int, histdata_t *);*/
+#define	H_REPLACE	25	/* , const char *, histdata_t);	*/
+
 
 
 /*

Index: src/lib/libedit/history.c
diff -u src/lib/libedit/history.c:1.33 src/lib/libedit/history.c:1.34
--- src/lib/libedit/history.c:1.33	Fri Feb  6 09:40:32 2009
+++ src/lib/libedit/history.c	Mon Sep  7 17:24:33 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: history.c,v 1.33 2009/02/06 14:40:32 sketch Exp $	*/
+/*	$NetBSD: history.c,v 1.34 2009/09/07 21:24:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = @(#)history.c	8.1 (Berkeley) 6/4/93;
 #else
-__RCSID($NetBSD: history.c,v 1.33 2009/02/06 14:40:32 sketch Exp $);
+__RCSID($NetBSD: history.c,v 1.34 2009/09/07 21:24:33 christos Exp $);
 #endif
 #endif /* not lint  not SCCSID */
 
@@ -121,6 +121,7 @@
  */
 typedef struct hentry_t {
 	HistEvent ev;		/* What we return		 */
+	void *data;		/* data */
 	struct hentry_t *next;	/* Next entry			 */
 	struct hentry_t *prev;	/* Previous entry		 */
 } hentry_t;
@@ -150,6 +151,9 @@
 private int history_def_insert(history_t *, HistEvent *, const char *);
 private void history_def_delete(history_t *, HistEvent *, hentry_t *);
 
+private int history_deldata_nth(history_t *, HistEvent *, int, void **);
+private int history_set_nth(ptr_t, HistEvent *, int);
+
 #define	history_def_setsize(p, num)(void) (((history_t *)p)-max = (num))
 #define	history_def_getsize(p)  (((history_t *)p)-cur)
 #define	history_def_getunique(p) (history_t *)p)-flags)  H_UNIQUE) != 0)
@@ -340,6 +344,31 @@
 }
 
 
+/* history_set_nth():
+ *	Default function to set the current event in the history to the
+ *	n-th one.
+ */
+private int
+history_set_nth(ptr_t p, HistEvent *ev, int n)
+{
+	history_t *h = (history_t *) p;
+
+	if (h-cur == 0) {
+		he_seterrev(ev, _HE_EMPTY_LIST);
+		return (-1);
+	}
+	for (h-cursor = h-list.prev; h-cursor != h-list;
+	h-cursor = h-cursor-prev)
+		if (n-- = 0)
+			break;
+	if (h-cursor == h-list) {
+		he_seterrev(ev, _HE_NOT_FOUND);
+		return (-1);
+	}
+	return (0);
+}
+
+
 /* history_def_add():
  *	Append string to element
  */
@@ -368,6 +397,24 @@
 }
 
 
+private int
+history_deldata_nth(history_t *h, HistEvent *ev,
+int num, void **data)
+{
+	if (history_set_nth(h, ev, num) != 0)
+		return (-1);
+	/* magic value to skip delete (just set to n-th history) */
+	if (data == (void **)-1)
+		return (0);
+	ev-str = strdup(h-cursor-ev.str);
+	ev-num = h-cursor-ev.num;
+	if (data)
+		*data = h-cursor-data;
+	history_def_delete(h, ev, h-cursor);
+	return (0);
+}
+
+
 /* history_def_del():
  *	Delete element hp of the h list
  */
@@ -397,8 +444,11 @@
 	HistEventPrivate *evp = (void *)hp-ev;
 	if (hp == h-list)
 		abort();
-	if (h-cursor == hp)
+	if (h-cursor == hp) {
 		h-cursor = hp-prev;
+		if (h-cursor == h-list)
+			h-cursor = hp-next;
+	}
 	hp-prev-next = hp-next;
 	hp-next-prev = hp-prev;
 	h_free((ptr_t) evp-str);
@@ -421,6 +471,7 @@
 		h_free((ptr_t)h-cursor);
 		goto oomem;
 	}
+	h-cursor-data = NULL;
 	h-cursor-ev.num = ++h-eventid;
 	h-cursor-next = h-list.next;
 	h-cursor-prev = h-list;
@@ -792,6 +843,23 @@
 }
 
 
+private int
+history_next_evdata(History *h, HistEvent *ev, int num, void **d)
+{
+	int retval;
+
+	for (retval = HCURR(h, ev); retval != -1; retval = HPREV(h, ev))
+		if (num-- = 0) {
+			if (d)
+*d = ((history_t *)h-h_ref)-cursor-data;
+			return (0);
+		}
+
+	he_seterrev(ev, _HE_NOT_FOUND);
+	return (-1);
+}
+
+
 /* history_next_event():
  *	Find the next event, with number given
  */
@@ -981,11 +1049,42 @@
 		retval = 0;
 		break;
 
+	case H_NEXT_EVDATA:
+	{
+		int num = va_arg(va, int);
+		void **d = va_arg(va, void **);
+		retval = 

CVS commit: src/sys/netinet6

2009-09-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep 19 13:11:02 UTC 2009

Modified Files:
src/sys/netinet6: in6.c in6_ifattach.c in6_ifattach.h

Log Message:
backout the changes that establish a workqueue to synchronize the addresses
for arg and gre because they cause a race condition by calling ioctl() during
interface initialization. To make this work correctly we would need to
synchronize all interface init routines.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/netinet6/in6.c
cvs rdiff -u -r1.84 -r1.85 src/sys/netinet6/in6_ifattach.c
cvs rdiff -u -r1.12 -r1.13 src/sys/netinet6/in6_ifattach.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/netinet6/in6.c
diff -u src/sys/netinet6/in6.c:1.153 src/sys/netinet6/in6.c:1.154
--- src/sys/netinet6/in6.c:1.153	Fri Sep 11 18:06:29 2009
+++ src/sys/netinet6/in6.c	Sat Sep 19 09:11:02 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6.c,v 1.153 2009/09/11 22:06:29 dyoung Exp $	*/
+/*	$NetBSD: in6.c,v 1.154 2009/09/19 13:11:02 christos Exp $	*/
 /*	$KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: in6.c,v 1.153 2009/09/11 22:06:29 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: in6.c,v 1.154 2009/09/19 13:11:02 christos Exp $);
 
 #include opt_inet.h
 #include opt_pfil_hooks.h
@@ -76,7 +76,6 @@
 #include sys/socketvar.h
 #include sys/sockio.h
 #include sys/systm.h
-#include sys/once.h
 #include sys/proc.h
 #include sys/time.h
 #include sys/kernel.h
@@ -2239,11 +2238,8 @@
 void *
 in6_domifattach(struct ifnet *ifp)
 {
-	static ONCE_DECL(ifwqest);
 	struct in6_ifextra *ext;
 
-	RUN_ONCE(ifwqest, in6_ifaddrs_wq_establish);
-
 	ext = malloc(sizeof(*ext), M_IFADDR, M_WAITOK|M_ZERO);
 
 	ext-in6_ifstat = malloc(sizeof(struct in6_ifstat),

Index: src/sys/netinet6/in6_ifattach.c
diff -u src/sys/netinet6/in6_ifattach.c:1.84 src/sys/netinet6/in6_ifattach.c:1.85
--- src/sys/netinet6/in6_ifattach.c:1.84	Thu Aug 13 05:04:03 2009
+++ src/sys/netinet6/in6_ifattach.c	Sat Sep 19 09:11:02 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_ifattach.c,v 1.84 2009/08/13 09:04:03 cegger Exp $	*/
+/*	$NetBSD: in6_ifattach.c,v 1.85 2009/09/19 13:11:02 christos Exp $	*/
 /*	$KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: in6_ifattach.c,v 1.84 2009/08/13 09:04:03 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: in6_ifattach.c,v 1.85 2009/09/19 13:11:02 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -43,7 +43,6 @@
 #include sys/syslog.h
 #include sys/md5.h
 #include sys/socketvar.h
-#include sys/workqueue.h
 
 #include net/if.h
 #include net/if_dl.h
@@ -62,41 +61,12 @@
 
 #include net/net_osdep.h
 
-/* Record of an interface to add a link-local and possibly a loopback
- * IPv6 address to, processed on a workqueue(9) by in6_ifaddrs_worker.
- */
-struct in6_ifaddr_work {
-	struct work	iw_work;
-	struct ifindexgen {
-		int	ig_idx;		/* Interface index */
-		int	ig_gen;		/* Interface index generation */
-	}		iw_idxgen,	/* Identify of the interface
-	 * to receive a link-local and
-	 * possibly a loopback address.
-	 */
-			iw_alt_idxgen;	/* Optional identity of a second
-	 * interface. If iw_alt_present
-	 * is true, this field
-	 * identifies a second interface
-	 * whose EUI64 we use to derive
-	 * the link-local address for
-	 * the interface indicated by
-	 * iw_idxgen.
-	 */
-	bool		iw_alt_present;	/* iff true, iw_alt_idxgen is valid. */ 
-};
-
 unsigned long in6_maxmtu = 0;
 
 int ip6_auto_linklocal = 1;	/* enable by default */
 
 callout_t in6_tmpaddrtimer_ch;
 
-static struct workqueue *in6_ifaddrs_wq = NULL;
-
-static void in6_ifaddrs_schedule(struct ifnet *, struct ifnet *);
-static void in6_ifaddrs_init(struct ifnet *, struct ifnet *);
-static void in6_ifaddrs_worker(struct work *, void *);
 
 #if 0
 static int get_hostid_ifid(struct ifnet *, struct in6_addr *);
@@ -782,6 +752,8 @@
 void
 in6_ifattach(struct ifnet *ifp, struct ifnet *altifp)
 {
+	struct in6_ifaddr *ia;
+	struct in6_addr in6;
 
 	/* some of the interfaces are inherently not IPv6 capable */
 	switch (ifp-if_type) {
@@ -840,26 +812,6 @@
 		return;
 	}
 
-	/* Assign addresses to ifp in another thread in order to
-	 * avoid re-entering ifp-if_ioctl().
-	 */
-	in6_ifaddrs_schedule(ifp, altifp);
-}
-
-/* in6_ifaddrs_init
- *
- * Add a link-local address to ifp, and if ifp is a loopback address,
- * add a loopback address to it, too.
- *
- * If altifp is not NULL, derive the link-local address of ifp from the
- * EUI64 of altifp.
- */
-void
-in6_ifaddrs_init(struct ifnet *ifp, struct ifnet *altifp)
-{
-	struct in6_addr in6;
-	struct in6_ifaddr *ia;
-
 	/*
 	 * assign loopback address for loopback interface.
 	 * XXX multiple loopback interface case.
@@ -884,95 +836,6 @@
 	

CVS commit: src/sys/dev/pci

2009-09-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Sep 20 01:09:24 UTC 2009

Modified Files:
src/sys/dev/pci: files.pci pcidevs

Log Message:
PR/42100: Dave J. Barnes: Support for old toshiba PICCOLO IDE controllers.


To generate a diff of this commit:
cvs rdiff -u -r1.319 -r1.320 src/sys/dev/pci/files.pci
cvs rdiff -u -r1.995 -r1.996 src/sys/dev/pci/pcidevs

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/pci/files.pci
diff -u src/sys/dev/pci/files.pci:1.319 src/sys/dev/pci/files.pci:1.320
--- src/sys/dev/pci/files.pci:1.319	Sun Sep  6 13:25:56 2009
+++ src/sys/dev/pci/files.pci	Sat Sep 19 21:09:24 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: files.pci,v 1.319 2009/09/06 17:25:56 sborrill Exp $
+#	$NetBSD: files.pci,v 1.320 2009/09/20 01:09:24 christos Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -337,6 +337,11 @@
 attach	ixpide at pci
 file	dev/pci/ixpide.c	ixpide
 
+# Toshiba PICCOLO IDE controllers
+device	toshide: ata, ata_dma, pciide_common, wdc_common
+attach	toshide at pci
+file	dev/pci/toshide.c	toshide
+
 # PCI-PCI bridge chips
 device	ppb: pcibus
 attach	ppb at pci

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.995 src/sys/dev/pci/pcidevs:1.996
--- src/sys/dev/pci/pcidevs:1.995	Sat Aug  1 17:34:21 2009
+++ src/sys/dev/pci/pcidevs	Sat Sep 19 21:09:24 2009
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.995 2009/08/01 21:34:21 matt Exp $
+$NetBSD: pcidevs,v 1.996 2009/09/20 01:09:24 christos Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -3961,11 +3961,16 @@
 
 /* Toshiba products */
 product TOSHIBA2 PORTEGE	0x0001	Portege Notebook
+product TOSHIBA2 PICCOLO	0x0101	Piccolo IDE Controller
+product TOSHIBA2 PICCOLO2	0x0102	Piccolo 2 IDE Controller
+product TOSHIBA2 PICCOLO3	0x0103	Piccolo 3 IDE Controller
+product TOSHIBA2 PICCOLO5	0x0105	Piccolo 5 IDE Controller
 product TOSHIBA2 HOST		0x0601	Host Bridge/Controller
 product TOSHIBA2 ISA		0x0602	PCI-ISA Bridge
 product TOSHIBA2 ToPIC95	0x0603	ToPIC95 PCI-CardBus Bridge
 product TOSHIBA2 ToPIC95B	0x060a	ToPIC95B PCI-CardBus Bridge
 product TOSHIBA2 ToPIC97	0x060f	ToPIC97 PCI-CardBus Bridge
+product TOSHIBA2 SANREMO	0x0618	SanRemo? Triangle Host Bridge
 product TOSHIBA2 SMCARD		0x0804	Smart Media Controller
 product TOSHIBA2 SDCARD		0x0805	Secure Digital Card Controller Type-A
 product TOSHIBA2 ToPIC100	0x0617	ToPIC100 PCI-CardBus Bridge



CVS commit: src/sys/dev/pci

2009-09-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Sep 20 01:10:12 UTC 2009

Added Files:
src/sys/dev/pci: pciide_piccolo_reg.h toshide.c

Log Message:
PR/42100: Dave J. Barnes: Support for old toshiba PICCOLO IDE controllers.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/pciide_piccolo_reg.h \
src/sys/dev/pci/toshide.c

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

Added files:

Index: src/sys/dev/pci/pciide_piccolo_reg.h
diff -u /dev/null src/sys/dev/pci/pciide_piccolo_reg.h:1.1
--- /dev/null	Sat Sep 19 21:10:12 2009
+++ src/sys/dev/pci/pciide_piccolo_reg.h	Sat Sep 19 21:10:12 2009
@@ -0,0 +1,82 @@
+/*	$NetBSD: pciide_piccolo.h_reg.h,v 1.0 2008/04/28 00:00:00 djb  	*/
+
+/*
+ * Copyright (c) 2009 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 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.
+ */
+
+/*
+ * Register definitions for the Toshiba PICCOLO, by SWAG!
+ */
+
+#define PICCOLO_PIO_TIMING 0x50
+#define PICCOLO_DMA_TIMING 0x5c
+
+#define PICCOLO_PIO_MASK 0xe088
+#define PICCOLO_DMA_MASK 0xe088
+#define PICCOLO_UDMA_MASK 0x78ffe088
+
+/* TIMING SWAG!!! */
+
+/* 
+ * first digit is command active, next two are front porch and back porch 
+ * command active = minimum for mode 
+ * front porch + back porch + command active = cycle time for mode
+ * values below may need adjustment 
+ */
+static const u_int32_t piccolo_pio_times[]
+__unused = {
+/*programmed   actual   */
+	0x0566, 
+	0x0433,
+	0x0311,
+	0x0201,
+	0x0200,		/* PIO 4, 150ns cycle (120ns is spec), 90ns command active (70ns is spec), 30ns setup and hold */
+	0x0100
+	   
+};
+
+static const u_int32_t piccolo_sw_dma_times[]
+__unused = {
+/*programmed   actual   */
+	0x0f77		
+};
+
+static const u_int32_t piccolo_mw_dma_times[]
+ __unused = {
+/*programmed   actual   */
+	0x0655,
+	0x0200,
+	0x0200,
+	0x0100 
+};
+
+/* XXX Is MSB UDMA enable? Can't set it. Seems to work without being set. */
+static const u_int32_t piccolo_udma_times[]
+__unused = {
+/*programmed   actual   */
+	0x84000222,
+	0x83000111,
+	0x8200	/* UDMA 2, 120ns cycle (117ns is spec), 60ns command active (55ns is spec), 30ns setup and hold */  
+};
Index: src/sys/dev/pci/toshide.c
diff -u /dev/null src/sys/dev/pci/toshide.c:1.1
--- /dev/null	Sat Sep 19 21:10:12 2009
+++ src/sys/dev/pci/toshide.c	Sat Sep 19 21:10:12 2009
@@ -0,0 +1,271 @@
+/*	$NetBSD: toshide.c,v 1.1 2009/09/20 01:10:12 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2009 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 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
+ * 

CVS commit: src/sys/dev/pci

2009-09-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Sep 20 01:12:30 UTC 2009

Modified Files:
src/sys/dev/pci: toshide.c

Log Message:
remove dup decl.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/toshide.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/pci/toshide.c
diff -u src/sys/dev/pci/toshide.c:1.1 src/sys/dev/pci/toshide.c:1.2
--- src/sys/dev/pci/toshide.c:1.1	Sat Sep 19 21:10:12 2009
+++ src/sys/dev/pci/toshide.c	Sat Sep 19 21:12:30 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: toshide.c,v 1.1 2009/09/20 01:10:12 christos Exp $	*/
+/*	$NetBSD: toshide.c,v 1.2 2009/09/20 01:12:30 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: toshide.c,v 1.1 2009/09/20 01:10:12 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: toshide.c,v 1.2 2009/09/20 01:12:30 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -170,7 +170,7 @@
 	struct pciide_softc *sc = CHAN_TO_PCIIDE(chp);
 	u_int32_t idedma_ctl;
 	int drive, s;
-	pcireg_t pxdx, pxdx_prime;
+	pcireg_t pxdx;
 #ifdef TOSHIDE_DEBUG
 	pcireg_t pxdx_prime;
 #endif



CVS commit: src/sys/arch

2009-09-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Sep 20 01:14:31 UTC 2009

Modified Files:
src/sys/arch/amd64/conf: GENERIC
src/sys/arch/i386/conf: GENERIC

Log Message:
add toshide


To generate a diff of this commit:
cvs rdiff -u -r1.252 -r1.253 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.944 -r1.945 src/sys/arch/i386/conf/GENERIC

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/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.252 src/sys/arch/amd64/conf/GENERIC:1.253
--- src/sys/arch/amd64/conf/GENERIC:1.252	Mon Sep  7 18:59:47 2009
+++ src/sys/arch/amd64/conf/GENERIC	Sat Sep 19 21:14:31 2009
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.252 2009/09/07 22:59:47 jmcneill Exp $
+# $NetBSD: GENERIC,v 1.253 2009/09/20 01:14:31 christos Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.252 $
+#ident 		GENERIC-$Revision: 1.253 $
 
 maxusers	64		# estimated number of users
 
@@ -563,6 +563,7 @@
 siside* at pci? dev ? function ?	# SiS IDE controllers
 slide*  at pci? dev ? function ?	# Symphony Labs IDE controllers
 svwsata* at pci? dev ? function ?	# ServerWorks SATA controllers
+toshide* at pci? dev ? function ?	# TOSHIBA PICCOLO controllers
 viaide* at pci? dev ? function ?	# VIA/AMD/Nvidia IDE controllers
 
 # PCMCIA IDE controllers
@@ -933,7 +934,7 @@
 auixp*	at pci? dev ? function ?	# ATI IXP AC'97 Audio
 autri*	at pci? dev ? function ?	# Trident 4DWAVE based AC'97 Audio
 auvia*	at pci? dev ? function ?	# VIA AC'97 audio
-azalia*	at pci? dev ? function ?	# High Definition Audio
+#azalia*	at pci? dev ? function ?	# High Definition Audio
 clcs*	at pci? dev ? function ?	# Cirrus Logic CS4280
 clct*	at pci? dev ? function ?	# Cirrus Logic CS4281
 cmpci*	at pci? dev ? function ?	# C-Media CMI8338/8738

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.944 src/sys/arch/i386/conf/GENERIC:1.945
--- src/sys/arch/i386/conf/GENERIC:1.944	Mon Sep  7 18:59:09 2009
+++ src/sys/arch/i386/conf/GENERIC	Sat Sep 19 21:14:31 2009
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.944 2009/09/07 22:59:09 jmcneill Exp $
+# $NetBSD: GENERIC,v 1.945 2009/09/20 01:14:31 christos Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.944 $
+#ident 		GENERIC-$Revision: 1.945 $
 
 maxusers	64		# estimated number of users
 
@@ -819,6 +819,7 @@
 slide*  	at pci? dev ? function ?	# Symphony Labs IDE controllers
 svwsata* 	at pci? dev ? function ?	# ServerWorks SATA controllers
 stpcide*	at pci? dev ? function ?	# STMicro STPC IDE controllers
+toshide*	at pci? dev ? function ?	# TOSHIBA PICCOLO controllers
 viaide* 	at pci? dev ? function ?	# VIA/AMD/Nvidia IDE controllers
 
 # ISA Plug-and-Play IDE controllers



CVS commit: src/etc

2009-09-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 24 14:53:36 UTC 2009

Modified Files:
src/etc: MAKEDEV.tmpl

Log Message:
fix dri/drm confusiog


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/etc/MAKEDEV.tmpl

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

Modified files:

Index: src/etc/MAKEDEV.tmpl
diff -u src/etc/MAKEDEV.tmpl:1.128 src/etc/MAKEDEV.tmpl:1.129
--- src/etc/MAKEDEV.tmpl:1.128	Sun Sep  6 13:25:55 2009
+++ src/etc/MAKEDEV.tmpl	Thu Sep 24 10:53:36 2009
@@ -1,5 +1,5 @@
 #!/bin/sh -
-#	$NetBSD: MAKEDEV.tmpl,v 1.128 2009/09/06 17:25:55 sborrill Exp $
+#	$NetBSD: MAKEDEV.tmpl,v 1.129 2009/09/24 14:53:36 christos Exp $
 #
 # Copyright (c) 2003,2007,2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -742,7 +742,7 @@
 	makedev putter
 	makedev drvctl
 	makedev video
-	makedev dri0
+	makedev drm0
 	makedev altmem
 	makedev zfs
 	makedev local # do this last
@@ -1909,9 +1909,10 @@
 	mkdev atabus$unit c %atabus_chr% $unit 644
 	;;
 
-dri*)
+drm*)
+	unit=${i#drm}
 	makedir dri 755
-	mkdev dri/card$unit c %dri_chr% $unit 660
+	mkdev dri/card$unit c %drm_chr% $unit 660
 	;;
 
 drvctl)



CVS commit: src/distrib

2009-09-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Sep 25 14:09:27 UTC 2009

Modified Files:
src/distrib/common: Makefile.bootcd
src/distrib/i386/cdroms: Makefile.cdrom

Log Message:
Exit with 1 so that we stay in single user mode when sysinst exits with 'x'.
Otherwise things get messed up (no /dev). From Anon Ymous


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/distrib/common/Makefile.bootcd
cvs rdiff -u -r1.12 -r1.13 src/distrib/i386/cdroms/Makefile.cdrom

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

Modified files:

Index: src/distrib/common/Makefile.bootcd
diff -u src/distrib/common/Makefile.bootcd:1.16 src/distrib/common/Makefile.bootcd:1.17
--- src/distrib/common/Makefile.bootcd:1.16	Tue Dec  2 05:06:00 2008
+++ src/distrib/common/Makefile.bootcd	Fri Sep 25 10:09:27 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.bootcd,v 1.16 2008/12/02 10:06:00 hubertf Exp $
+#	$NetBSD: Makefile.bootcd,v 1.17 2009/09/25 14:09:27 christos Exp $
 #
 # Makefile snipped to create a CD/DVD ISO
 #
@@ -67,6 +67,7 @@
 RM?=		rm
 MKDIR?=		mkdir -p
 CHMOD?=		chmod
+ECHO?=		echo
 
 
 CLEANFILES+=	${CDBASE}.iso

Index: src/distrib/i386/cdroms/Makefile.cdrom
diff -u src/distrib/i386/cdroms/Makefile.cdrom:1.12 src/distrib/i386/cdroms/Makefile.cdrom:1.13
--- src/distrib/i386/cdroms/Makefile.cdrom:1.12	Sun Aug 30 18:30:30 2009
+++ src/distrib/i386/cdroms/Makefile.cdrom	Fri Sep 25 10:09:27 2009
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.cdrom,v 1.12 2009/08/30 22:30:30 hubertf Exp $
+# $NetBSD: Makefile.cdrom,v 1.13 2009/09/25 14:09:27 christos Exp $
 
 .include bsd.own.mk
 
@@ -48,6 +48,9 @@
 image_md_pre:
 	${MKDIR} cdrom/etc
 	${CP} ${.CURDIR}/../../ramdisks/common/dot.profile cdrom/etc/rc
+	${ECHO}   cdrom/etc/rc
+	${ECHO} # exit to single user mode  cdrom/etc/rc
+	${ECHO} exit 1  cdrom/etc/rc
 	${MKDIR} cdrom/mnt2 cdrom/targetroot
 	${CP} ${SYSINSTDIR}/sysinst cdrom
 	${CHMOD} ugo+rx cdrom/sysinst



CVS commit: src/usr.bin/xlint/lint1

2009-10-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  2 18:17:16 UTC 2009

Modified Files:
src/usr.bin/xlint/lint1: init.c

Log Message:
change initialization from non const of regular variables to c99 instead of
gnu since c99 now has it.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/xlint/lint1/init.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.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.23 src/usr.bin/xlint/lint1/init.c:1.24
--- src/usr.bin/xlint/lint1/init.c:1.23	Sat Apr 26 12:14:23 2008
+++ src/usr.bin/xlint/lint1/init.c	Fri Oct  2 14:17:16 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.23 2008/04/26 16:14:23 christos Exp $	*/
+/*	$NetBSD: init.c,v 1.24 2009/10/02 18:17:16 christos Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include sys/cdefs.h
 #if defined(__RCSID)  !defined(lint)
-__RCSID($NetBSD: init.c,v 1.23 2008/04/26 16:14:23 christos Exp $);
+__RCSID($NetBSD: init.c,v 1.24 2009/10/02 18:17:16 christos Exp $);
 #endif
 
 #include stdlib.h
@@ -587,7 +587,7 @@
 		if (conaddr(tn, sym, offs) == -1) {
 			if (sc == AUTO || sc == REG) {
 /* non-constant initializer */
-(void)gnuism(177);
+(void)c99ism(177);
 			} else {
 /* non-constant initializer */
 error(177);



CVS commit: src/usr.bin/xlint/lint1

2009-10-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  2 19:01:14 UTC 2009

Modified Files:
src/usr.bin/xlint/lint1: cgram.y decl.c lint1.h tree.c

Log Message:
recognize struct __packed x { }; in addition to struct x { } __packed;


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.47 -r1.48 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.59 -r1.60 src/usr.bin/xlint/lint1/tree.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.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.45 src/usr.bin/xlint/lint1/cgram.y:1.46
--- src/usr.bin/xlint/lint1/cgram.y:1.45	Fri Oct  2 11:03:45 2009
+++ src/usr.bin/xlint/lint1/cgram.y	Fri Oct  2 15:01:13 2009
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.45 2009/10/02 15:03:45 christos Exp $ */
+/* $NetBSD: cgram.y,v 1.46 2009/10/02 19:01:13 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include sys/cdefs.h
 #if defined(__RCSID)  !defined(lint)
-__RCSID($NetBSD: cgram.y,v 1.45 2009/10/02 15:03:45 christos Exp $);
+__RCSID($NetBSD: cgram.y,v 1.46 2009/10/02 19:01:13 christos Exp $);
 #endif
 
 #include stdlib.h
@@ -591,7 +591,8 @@
 	;
 
 struct:
-	  T_SOU {
+	  struct type_attribute
+	| T_SOU {
 		symtyp = FTAG;
 		pushdecl($1 == STRUCT ? MOS : MOU);
 		dcs-d_offset = 0;

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.47 src/usr.bin/xlint/lint1/decl.c:1.48
--- src/usr.bin/xlint/lint1/decl.c:1.47	Fri Oct  2 11:03:45 2009
+++ src/usr.bin/xlint/lint1/decl.c	Fri Oct  2 15:01:13 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.47 2009/10/02 15:03:45 christos Exp $ */
+/* $NetBSD: decl.c,v 1.48 2009/10/02 19:01:13 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include sys/cdefs.h
 #if defined(__RCSID)  !defined(lint)
-__RCSID($NetBSD: decl.c,v 1.47 2009/10/02 15:03:45 christos Exp $);
+__RCSID($NetBSD: decl.c,v 1.48 2009/10/02 19:01:13 christos Exp $);
 #endif
 
 #include sys/param.h
@@ -484,19 +484,13 @@
 	}
 }
 
-void
-addpacked(void)
+static void
+setpackedsize(type_t *tp)
 {
 	str_t *sp;
 	sym_t *mem;
-	type_t *tp = dcs-d_type;
 	char buf[256];
 
-	if (tp == NULL)
-		LERROR(no type attr);
-
-	tp-t_ispacked = 1;
-
 	switch (tp-t_tspec) {
 	case STRUCT:
 		sp = tp-t_str;
@@ -519,6 +513,15 @@
 	}
 }
 
+void
+addpacked(void)
+{
+	if (dcs-d_type == NULL) {
+		dcs-d_ispacked = 1;
+	} else
+		setpackedsize(dcs-d_type);
+}
+
 /*
  * Remember a qualifier which is part of the declaration specifiers
  * (and not the declarator) in the top element of the declaration stack.
@@ -1624,6 +1627,7 @@
 		if (tag-s_scl == NOSCL) {
 			tag-s_scl = scl;
 			tag-s_type = tp = getblk(sizeof (type_t));
+			tp-t_ispacked = dcs-d_ispacked;
 		} else {
 			tp = tag-s_type;
 		}
@@ -1733,7 +1737,6 @@
 }
 
 /*
- * Completes the type of a tag in a struct/union/enum declaration.
  * tp points to the type of the, tag, fmem to the list of members/enums.
  */
 type_t *
@@ -1751,8 +1754,11 @@
 		align(dcs-d_stralign, 0);
 		sp = tp-t_str;
 		sp-align = dcs-d_stralign;
-		sp-size = dcs-d_offset;
 		sp-memb = fmem;
+		if (tp-t_ispacked)
+			setpackedsize(tp);
+		else
+			sp-size = dcs-d_offset;
 		if (sp-size == 0) {
 			/* zero sized %s */
 			(void)c99ism(47, ttab[t].tt_name);

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.23 src/usr.bin/xlint/lint1/lint1.h:1.24
--- src/usr.bin/xlint/lint1/lint1.h:1.23	Fri Oct  2 11:03:45 2009
+++ src/usr.bin/xlint/lint1/lint1.h	Fri Oct  2 15:01:14 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.23 2009/10/02 15:03:45 christos Exp $ */
+/* $NetBSD: lint1.h,v 1.24 2009/10/02 19:01:14 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -329,6 +329,7 @@
 	u_int	d_proto : 1;	/* current funct. decl. is prototype */
 	u_int	d_notyp : 1;	/* set if no type specifier was present */
 	u_int	d_asm : 1;	/* set if d_ctx == AUTO and asm() present */
+	u_int	d_ispacked : 1;	/* packed */
 	type_t	*d_tagtyp;	/* tag during member declaration */
 	sym_t	*d_fargs;	/* list of arguments during function def. */
 	pos_t	d_fdpos;	/* position of function definition */

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.59 src/usr.bin/xlint/lint1/tree.c:1.60
--- src/usr.bin/xlint/lint1/tree.c:1.59	Sat May  2 12:10:49 2009
+++ src/usr.bin/xlint/lint1/tree.c	Fri Oct  2 15:01:14 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.59 2009/05/02 16:10:49 christos Exp $	*/
+/*	$NetBSD: tree.c,v 1.60 2009/10/02 19:01:14 christos Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include sys/cdefs.h
 #if defined(__RCSID)  !defined(lint)
-__RCSID($NetBSD: tree.c,v 1.59 

CVS commit: src/usr.bin/xlint/lint1

2009-10-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  2 19:02:16 UTC 2009

Modified Files:
src/usr.bin/xlint/lint1: tree.c

Log Message:
remove debugging


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/usr.bin/xlint/lint1/tree.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.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.60 src/usr.bin/xlint/lint1/tree.c:1.61
--- src/usr.bin/xlint/lint1/tree.c:1.60	Fri Oct  2 15:01:14 2009
+++ src/usr.bin/xlint/lint1/tree.c	Fri Oct  2 15:02:16 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.60 2009/10/02 19:01:14 christos Exp $	*/
+/*	$NetBSD: tree.c,v 1.61 2009/10/02 19:02:16 christos Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include sys/cdefs.h
 #if defined(__RCSID)  !defined(lint)
-__RCSID($NetBSD: tree.c,v 1.60 2009/10/02 19:01:14 christos Exp $);
+__RCSID($NetBSD: tree.c,v 1.61 2009/10/02 19:02:16 christos Exp $);
 #endif
 
 #include stdlib.h
@@ -3093,7 +3093,6 @@
 #else
 	st = UINT;
 #endif
-printf(size %p = %ld\n, tp, (int64_t)(elem * elsz / CHAR_BIT));
 	return (getinode(st, (int64_t)(elem * elsz / CHAR_BIT)));
 }
 



CVS commit: src/usr.bin/xlint/lint1

2009-10-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  2 20:45:06 UTC 2009

Modified Files:
src/usr.bin/xlint/lint1: decl.c

Log Message:
fix typedef struct __packed


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/usr.bin/xlint/lint1/decl.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.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.48 src/usr.bin/xlint/lint1/decl.c:1.49
--- src/usr.bin/xlint/lint1/decl.c:1.48	Fri Oct  2 15:01:13 2009
+++ src/usr.bin/xlint/lint1/decl.c	Fri Oct  2 16:45:06 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.48 2009/10/02 19:01:13 christos Exp $ */
+/* $NetBSD: decl.c,v 1.49 2009/10/02 20:45:06 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include sys/cdefs.h
 #if defined(__RCSID)  !defined(lint)
-__RCSID($NetBSD: decl.c,v 1.48 2009/10/02 19:01:13 christos Exp $);
+__RCSID($NetBSD: decl.c,v 1.49 2009/10/02 20:45:06 christos Exp $);
 #endif
 
 #include sys/param.h
@@ -254,8 +254,10 @@
 addtype(type_t *tp)
 {
 	tspec_t	t;
-//	char buf[1024];
-// printf(addtype %s\n, tyname(buf, sizeof(buf), tp));
+#ifdef DEBUG
+	char buf[1024];
+	printf(addtype %s\n, tyname(buf, sizeof(buf), tp));
+#endif
 	if (tp-t_typedef) {
 		if (dcs-d_type != NULL || dcs-d_atyp != NOTSPEC ||
 		dcs-d_lmod != NOTSPEC || dcs-d_smod != NOTSPEC) {
@@ -516,9 +518,9 @@
 void
 addpacked(void)
 {
-	if (dcs-d_type == NULL) {
+	if (dcs-d_type == NULL)
 		dcs-d_ispacked = 1;
-	} else
+	else
 		setpackedsize(dcs-d_type);
 }
 
@@ -1639,6 +1641,7 @@
 		tag-s_scl = scl;
 		tag-s_blklev = -1;
 		tag-s_type = tp = getblk(sizeof (type_t));
+		tp-t_ispacked = dcs-d_ispacked;
 		dcs-d_nxt-d_nedecl = 1;
 	}
 



CVS commit: src/usr.bin/xlint/lint1

2009-10-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  2 21:04:03 UTC 2009

Modified Files:
src/usr.bin/xlint/lint1: decl.c externs1.h tree.c

Log Message:
compute sizes by the new tsize() function.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.61 -r1.62 src/usr.bin/xlint/lint1/tree.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.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.49 src/usr.bin/xlint/lint1/decl.c:1.50
--- src/usr.bin/xlint/lint1/decl.c:1.49	Fri Oct  2 16:45:06 2009
+++ src/usr.bin/xlint/lint1/decl.c	Fri Oct  2 17:04:03 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.49 2009/10/02 20:45:06 christos Exp $ */
+/* $NetBSD: decl.c,v 1.50 2009/10/02 21:04:03 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include sys/cdefs.h
 #if defined(__RCSID)  !defined(lint)
-__RCSID($NetBSD: decl.c,v 1.49 2009/10/02 20:45:06 christos Exp $);
+__RCSID($NetBSD: decl.c,v 1.50 2009/10/02 21:04:03 christos Exp $);
 #endif
 
 #include sys/param.h
@@ -497,14 +497,16 @@
 	case STRUCT:
 		sp = tp-t_str;
 		sp-size = 0;
-		for (mem = sp-memb; mem != NULL; mem = mem-s_nxt)
-			sp-size += size(mem-s_type-t_tspec);
+		for (mem = sp-memb; mem != NULL; mem = mem-s_nxt) {
+			size_t x = (size_t)tsize(mem-s_type);
+			sp-size += x;
+		}
 		break;
 	case UNION:
 		sp = tp-t_str;
 		sp-size = 0;
 		for (mem = sp-memb; mem != NULL; mem = mem-s_nxt) {
-			size_t x = size(mem-s_type-t_tspec);
+			size_t x = (size_t)tsize(mem-s_type);
 			if (x  sp-size)
 sp-size = x;
 		}

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.28 src/usr.bin/xlint/lint1/externs1.h:1.29
--- src/usr.bin/xlint/lint1/externs1.h:1.28	Fri Oct  2 11:03:45 2009
+++ src/usr.bin/xlint/lint1/externs1.h	Fri Oct  2 17:04:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.28 2009/10/02 15:03:45 christos Exp $	*/
+/*	$NetBSD: externs1.h,v 1.29 2009/10/02 21:04:03 christos Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -210,6 +210,7 @@
 extern	void	chkmisc(tnode_t *, int, int, int, int, int, int);
 extern	int	conaddr(tnode_t *, sym_t **, ptrdiff_t *);
 extern	strg_t	*catstrg(strg_t *, strg_t *);
+extern  int64_t tsize(type_t *);
 
 /*
  * func.c

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.61 src/usr.bin/xlint/lint1/tree.c:1.62
--- src/usr.bin/xlint/lint1/tree.c:1.61	Fri Oct  2 15:02:16 2009
+++ src/usr.bin/xlint/lint1/tree.c	Fri Oct  2 17:04:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.61 2009/10/02 19:02:16 christos Exp $	*/
+/*	$NetBSD: tree.c,v 1.62 2009/10/02 21:04:03 christos Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include sys/cdefs.h
 #if defined(__RCSID)  !defined(lint)
-__RCSID($NetBSD: tree.c,v 1.61 2009/10/02 19:02:16 christos Exp $);
+__RCSID($NetBSD: tree.c,v 1.62 2009/10/02 21:04:03 christos Exp $);
 #endif
 
 #include stdlib.h
@@ -3030,14 +3030,26 @@
 	return (getcnode(tn-tn_type, v));
 }
 
+
 /*
  * Create a constant node for sizeof.
  */
 tnode_t *
 bldszof(type_t *tp)
 {
-	int	elem, elsz;
 	tspec_t	st;
+#if SIZEOF_IS_ULONG
+	st = ULONG;
+#else
+	st = UINT;
+#endif
+	return getinode(st, tsize(tp) / CHAR_BIT);
+}
+
+int64_t
+tsize(type_t *tp)
+{
+	int	elem, elsz;
 
 	elem = 1;
 	while (tp-t_tspec == ARRAY) {
@@ -3088,12 +3100,7 @@
 		break;
 	}
 
-#if SIZEOF_IS_ULONG
-	st = ULONG;
-#else
-	st = UINT;
-#endif
-	return (getinode(st, (int64_t)(elem * elsz / CHAR_BIT)));
+	return (int64_t)(elem * elsz);
 }
 
 /*



CVS commit: src/external/apache2/mDNSResponder/dist

2009-10-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  2 21:05:10 UTC 2009

Modified Files:
src/external/apache2/mDNSResponder/dist/mDNSCore: mDNSEmbeddedAPI.h
src/external/apache2/mDNSResponder/dist/mDNSShared: dnssd_ipc.h

Log Message:
if __packed exists, use it. I might revert this later when I fully implement
attribute for lint.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/apache2/mDNSResponder/dist/mDNSCore/mDNSEmbeddedAPI.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/apache2/mDNSResponder/dist/mDNSShared/dnssd_ipc.h

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

Modified files:

Index: src/external/apache2/mDNSResponder/dist/mDNSCore/mDNSEmbeddedAPI.h
diff -u src/external/apache2/mDNSResponder/dist/mDNSCore/mDNSEmbeddedAPI.h:1.1.1.1 src/external/apache2/mDNSResponder/dist/mDNSCore/mDNSEmbeddedAPI.h:1.2
--- src/external/apache2/mDNSResponder/dist/mDNSCore/mDNSEmbeddedAPI.h:1.1.1.1	Tue Sep 29 18:14:06 2009
+++ src/external/apache2/mDNSResponder/dist/mDNSCore/mDNSEmbeddedAPI.h	Fri Oct  2 17:05:10 2009
@@ -1040,7 +1040,10 @@
 // In the event that structures are not packed correctly, mDNS_Init() will detect this and report an error, so the
 // developer will know what's wrong, and can investigate what needs to be done on that compiler to provide proper packing.
 #ifndef packedstruct
- #if ((__GNUC__  2) || ((__GNUC__ == 2)  (__GNUC_MINOR__ = 9)))
+ #ifdef __packed
+  #define packedstruct struct __packed
+  #define packedunion  union __packed
+ #elif ((__GNUC__  2) || ((__GNUC__ == 2)  (__GNUC_MINOR__ = 9)))
   #define packedstruct struct __attribute__((__packed__))
   #define packedunion  union  __attribute__((__packed__))
  #else

Index: src/external/apache2/mDNSResponder/dist/mDNSShared/dnssd_ipc.h
diff -u src/external/apache2/mDNSResponder/dist/mDNSShared/dnssd_ipc.h:1.1.1.1 src/external/apache2/mDNSResponder/dist/mDNSShared/dnssd_ipc.h:1.2
--- src/external/apache2/mDNSResponder/dist/mDNSShared/dnssd_ipc.h:1.1.1.1	Tue Sep 29 18:14:16 2009
+++ src/external/apache2/mDNSResponder/dist/mDNSShared/dnssd_ipc.h	Fri Oct  2 17:05:10 2009
@@ -234,7 +234,10 @@
 // structures correctly anyway, so a plain struct is usually fine. In the event that structures are not packed
 // correctly, our compile-time assertion checks will catch it and prevent inadvertent generation of non-working code.
 #ifndef packedstruct
- #if ((__GNUC__  2) || ((__GNUC__ == 2)  (__GNUC_MINOR__ = 9)))
+ #ifdef __packed
+  #define packedstruct struct __packed
+  #define packedunion  union  __packed
+ #elif ((__GNUC__  2) || ((__GNUC__ == 2)  (__GNUC_MINOR__ = 9)))
   #define packedstruct struct __attribute__((__packed__))
   #define packedunion  union  __attribute__((__packed__))
  #else



CVS commit: src/sys/sys

2009-10-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  2 21:05:28 UTC 2009

Modified Files:
src/sys/sys: cdefs.h

Log Message:
lint knows __packed now.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/sys/cdefs.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/sys/cdefs.h
diff -u src/sys/sys/cdefs.h:1.77 src/sys/sys/cdefs.h:1.78
--- src/sys/sys/cdefs.h:1.77	Sat Aug  8 17:23:15 2009
+++ src/sys/sys/cdefs.h	Fri Oct  2 17:05:28 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: cdefs.h,v 1.77 2009/08/08 21:23:15 christos Exp $	*/
+/*	$NetBSD: cdefs.h,v 1.78 2009/10/02 21:05:28 christos Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -228,7 +228,11 @@
 #define	__used		__unused
 #endif
 
-#if __GNUC_PREREQ__(2, 7)
+#if defined(__lint__)
+#define	__packed	__packed
+#define	__aligned(x)	/* delete */
+#define	__section(x)	/* delete */
+#elif __GNUC_PREREQ__(2, 7)
 #define	__packed	__attribute__((__packed__))
 #define	__aligned(x)	__attribute__((__aligned__(x)))
 #define	__section(x)	__attribute__((__section__(x)))
@@ -236,10 +240,6 @@
 #define	__packed	_Pragma(packed 1)
 #define	__aligned(x)   	_Pragma(aligned  __STRING(x))
 #define	__section(x)   	_Pragma(section  ## x)
-#elif defined(__lint__)
-#define	__packed	/* delete */
-#define	__aligned(x)	/* delete */
-#define	__section(x)	/* delete */
 #else
 #define	__packed	error: no __packed for this compiler
 #define	__aligned(x)	error: no __aligned for this compiler



CVS commit: src/usr.bin/xlint/lint1

2009-10-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct  3 01:35:20 UTC 2009

Modified Files:
src/usr.bin/xlint/lint1: cgram.y

Log Message:
accept struct { ... } __packed name;


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/usr.bin/xlint/lint1/cgram.y

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/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.46 src/usr.bin/xlint/lint1/cgram.y:1.47
--- src/usr.bin/xlint/lint1/cgram.y:1.46	Fri Oct  2 15:01:13 2009
+++ src/usr.bin/xlint/lint1/cgram.y	Fri Oct  2 21:35:20 2009
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.46 2009/10/02 19:01:13 christos Exp $ */
+/* $NetBSD: cgram.y,v 1.47 2009/10/03 01:35:20 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include sys/cdefs.h
 #if defined(__RCSID)  !defined(lint)
-__RCSID($NetBSD: cgram.y,v 1.46 2009/10/02 19:01:13 christos Exp $);
+__RCSID($NetBSD: cgram.y,v 1.47 2009/10/03 01:35:20 christos Exp $);
 #endif
 
 #include stdlib.h
@@ -684,6 +684,7 @@
 	| noclass_declmods typespec {
 		addtype($2);
 	  }
+	| noclass_declspecs type_attribute
 	| noclass_declspecs T_QUAL {
 		addqual($2);
 	  }



CVS commit: src/sys/rump/librump/rumpkern

2009-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct  3 22:55:48 UTC 2009

Modified Files:
src/sys/rump/librump/rumpkern: emul.c

Log Message:
Need proc_uidmatch


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/rump/librump/rumpkern/emul.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/rump/librump/rumpkern/emul.c
diff -u src/sys/rump/librump/rumpkern/emul.c:1.96 src/sys/rump/librump/rumpkern/emul.c:1.97
--- src/sys/rump/librump/rumpkern/emul.c:1.96	Thu Sep 24 17:00:09 2009
+++ src/sys/rump/librump/rumpkern/emul.c	Sat Oct  3 18:55:48 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: emul.c,v 1.96 2009/09/24 21:00:09 pooka Exp $	*/
+/*	$NetBSD: emul.c,v 1.97 2009/10/03 22:55:48 christos Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: emul.c,v 1.96 2009/09/24 21:00:09 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: emul.c,v 1.97 2009/10/03 22:55:48 christos Exp $);
 
 #include sys/param.h
 #include sys/malloc.h
@@ -619,6 +619,13 @@
 	panic(%s: not implemented, __func__);
 }
 
+int
+proc_uidmatch(kauth_cred_t cred, kauth_cred_t target)
+{
+
+	panic(%s: not implemented, __func__);
+}
+
 void
 proc_crmod_enter(void)
 {



CVS commit: src/lib/libpthread

2009-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct  3 23:49:50 UTC 2009

Modified Files:
src/lib/libpthread: pthread.c

Log Message:
Don't just look only at the first element in the deadqueue to find lwp's
to reuse, because if we lose the race with the kernel we are never going
to reuse any elements. Look in the whole list instead.
XXX: should be pulled up to 5.x


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/lib/libpthread/pthread.c

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

Modified files:

Index: src/lib/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.112 src/lib/libpthread/pthread.c:1.113
--- src/lib/libpthread/pthread.c:1.112	Thu Jul  2 05:59:00 2009
+++ src/lib/libpthread/pthread.c	Sat Oct  3 19:49:50 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.112 2009/07/02 09:59:00 joerg Exp $	*/
+/*	$NetBSD: pthread.c,v 1.113 2009/10/03 23:49:50 christos Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: pthread.c,v 1.112 2009/07/02 09:59:00 joerg Exp $);
+__RCSID($NetBSD: pthread.c,v 1.113 2009/10/03 23:49:50 christos Exp $);
 
 #define	__EXPOSE_STACK	1
 
@@ -353,23 +353,17 @@
 	 */
 	if (!PTQ_EMPTY(pthread__deadqueue)) {
 		pthread_mutex_lock(pthread__deadqueue_lock);
-		newthread = PTQ_FIRST(pthread__deadqueue);
-		if (newthread != NULL) {
-			PTQ_REMOVE(pthread__deadqueue, newthread, pt_deadq);
-			pthread_mutex_unlock(pthread__deadqueue_lock);
+		PTQ_FOREACH(newthread, pthread__deadqueue, pt_deadq) {
 			/* Still running? */
-			if (newthread-pt_lwpctl-lc_curcpu !=
-			LWPCTL_CPU_EXITED 
-			(_lwp_kill(newthread-pt_lid, 0) == 0 ||
-			errno != ESRCH)) {
-pthread_mutex_lock(pthread__deadqueue_lock);
-PTQ_INSERT_TAIL(pthread__deadqueue,
-newthread, pt_deadq);
-pthread_mutex_unlock(pthread__deadqueue_lock);
-newthread = NULL;
-			}
-		} else
-			pthread_mutex_unlock(pthread__deadqueue_lock);
+			if (newthread-pt_lwpctl-lc_curcpu ==
+			LWPCTL_CPU_EXITED ||
+			(_lwp_kill(newthread-pt_lid, 0) == -1 
+			errno == ESRCH))
+break;
+		}
+		if (newthread)
+			PTQ_REMOVE(pthread__deadqueue, newthread, pt_deadq);
+		pthread_mutex_unlock(pthread__deadqueue_lock);
 	}
 
 	/*



CVS commit: src/etc

2009-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct  4 01:40:53 UTC 2009

Modified Files:
src/etc: master.passwd

Log Message:
mdnsd home should not be /var/www!


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/etc/master.passwd

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

Modified files:

Index: src/etc/master.passwd
diff -u src/etc/master.passwd:1.40 src/etc/master.passwd:1.41
--- src/etc/master.passwd:1.40	Tue Sep 29 19:56:27 2009
+++ src/etc/master.passwd	Sat Oct  3 21:40:53 2009
@@ -14,6 +14,6 @@
 _timedc:*:22:22::0:0: pseudo-user:/nonexistent:/sbin/nologin
 _sdpd:*:23:23::0:0: pseudo-user:/nonexistent:/sbin/nologin
 _httpd:*:24:24::0:0: pseudo-user:/var/www:/sbin/nologin
-_mdnsd:*:25:25::0:0: pseudo-user:/var/www:/sbin/nologin
+_mdnsd:*:25:25::0:0: pseudo-user:/nonexistent:/sbin/nologin
 uucp:*:66:1::0:0:UNIX-to-UNIX Copy:/nonexistent:/sbin/nologin
 nobody:*:32767:39::0:0:Unprivileged user:/nonexistent:/sbin/nologin



CVS commit: src/regress/usr.bin/xlint/lint1

2009-10-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct  4 15:12:42 UTC 2009

Added Files:
src/regress/usr.bin/xlint/lint1: test26.c

Log Message:
add packed tests.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/regress/usr.bin/xlint/lint1/test26.c

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

Added files:

Index: src/regress/usr.bin/xlint/lint1/test26.c
diff -u /dev/null src/regress/usr.bin/xlint/lint1/test26.c:1.1
--- /dev/null	Sun Oct  4 11:12:42 2009
+++ src/regress/usr.bin/xlint/lint1/test26.c	Sun Oct  4 11:12:41 2009
@@ -0,0 +1,35 @@
+/* packed tests */
+
+struct in_addr {
+	int x;
+};
+struct	ip_timestamp {
+	char ipt_code;
+	char ipt_len;
+	char ipt_ptr;
+	unsigned int ipt_flg:4,
+		 ipt_oflw:4;
+	union ipt_timestamp {
+		 int	ipt_time[1];
+		 struct	ipt_ta {
+			struct in_addr ipt_addr;
+			int ipt_time;
+		 } ipt_ta[1] __packed;
+	} ipt_timestamp __packed;
+} __packed;
+
+typedef struct __packed {
+	int x;
+} t;
+
+struct x {
+	char c;
+	long l;
+} __packed;
+
+struct y {
+	char c;
+	long l;
+};
+
+int a[sizeof(struct y) - sizeof(struct x) - 1];



CVS commit: src/lib/libm

2009-10-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct  4 22:04:30 UTC 2009

Modified Files:
src/lib/libm: Makefile shlib_version
Added Files:
src/lib/libm/man: fdim.3 fmax.3
src/lib/libm/src: s_fdim.c s_fmax.c s_fmaxf.c s_fmaxl.c s_fmin.c
s_fminf.c s_fminl.c

Log Message:
add f{min,max,dim}{,l,f} from FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/lib/libm/Makefile
cvs rdiff -u -r1.9 -r1.10 src/lib/libm/shlib_version
cvs rdiff -u -r0 -r1.1 src/lib/libm/man/fdim.3 src/lib/libm/man/fmax.3
cvs rdiff -u -r0 -r1.1 src/lib/libm/src/s_fdim.c src/lib/libm/src/s_fmax.c \
src/lib/libm/src/s_fmaxf.c src/lib/libm/src/s_fmaxl.c \
src/lib/libm/src/s_fmin.c src/lib/libm/src/s_fminf.c \
src/lib/libm/src/s_fminl.c

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

Modified files:

Index: src/lib/libm/Makefile
diff -u src/lib/libm/Makefile:1.89 src/lib/libm/Makefile:1.90
--- src/lib/libm/Makefile:1.89	Sun Jan 18 15:42:11 2009
+++ src/lib/libm/Makefile	Sun Oct  4 18:04:30 2009
@@ -1,4 +1,4 @@
-#  $NetBSD: Makefile,v 1.89 2009/01/18 20:42:11 he Exp $
+#  $NetBSD: Makefile,v 1.90 2009/10/04 22:04:30 christos Exp $
 #
 #  @(#)Makefile 5.1beta 93/09/24
 #
@@ -136,7 +136,9 @@
 	w_pow.c w_powf.c w_remainder.c w_remainderf.c w_scalb.c w_scalbf.c \
 	w_sinh.c w_sinhf.c w_sqrt.c w_sqrtf.c \
 	lrint.c lrintf.c llrint.c llrintf.c lround.c lroundf.c llround.c \
-	llroundf.c
+	llroundf.c \
+	s_fmax.c s_fmaxf.c s_fmaxl.c s_fmin.c s_fminf.c s_fminl.c s_fdim.c
+
 # Also in libc.
 #COMMON_SRCS += s_frexp.c s_ldexp.c s_modf.c
 
@@ -186,7 +188,7 @@
 	cos.3 cosh.3 erf.3 exp.3 fabs.3 floor.3 fmod.3 frexp.3 hypot.3 ieee.3 \
 	ieee_test.3 isinff.3 j0.3 ldexp.3 lgamma.3 lrint.3 \
 	math.3 modf.3 rint.3 round.3 sin.3 sinh.3 \
-	sqrt.3 tan.3 tanh.3 trunc.3
+	sqrt.3 tan.3 tanh.3 trunc.3 fmax.3 fdim.3
 
 MLINKS+=acos.3 acosf.3
 MLINKS+=acosh.3 acoshf.3
@@ -227,6 +229,13 @@
 MLINKS+=tanh.3 tanhf.3
 MLINKS+=round.3 roundf.3
 MLINKS+=trunc.3 truncf.3
+MLINKS+=fmax.3 fmaxl.3
+MLINKS+=fmax.3 fmaxf.3
+MLINKS+=fmax.3 fmin.3
+MLINKS+=fmax.3 fminl.3
+MLINKS+=fmax.3 fminf.3
+MLINKS+=fdim.3 fdiml.3
+MLINKS+=fdim.3 fdimf.3
 
 .if (${MKCOMPLEX} != no)
 .include ${.CURDIR}/complex/Makefile.inc

Index: src/lib/libm/shlib_version
diff -u src/lib/libm/shlib_version:1.9 src/lib/libm/shlib_version:1.10
--- src/lib/libm/shlib_version:1.9	Mon Aug 20 12:01:30 2007
+++ src/lib/libm/shlib_version	Sun Oct  4 18:04:30 2009
@@ -1,5 +1,5 @@
-#	$NetBSD: shlib_version,v 1.9 2007/08/20 16:01:30 drochner Exp $
+#	$NetBSD: shlib_version,v 1.10 2009/10/04 22:04:30 christos Exp $
 #	Remember to update distrib/sets/lists/base/shl.* when changing
 #
 major=0
-minor=6
+minor=7

Added files:

Index: src/lib/libm/man/fdim.3
diff -u /dev/null src/lib/libm/man/fdim.3:1.1
--- /dev/null	Sun Oct  4 18:04:30 2009
+++ src/lib/libm/man/fdim.3	Sun Oct  4 18:04:30 2009
@@ -0,0 +1,87 @@
+.\ Copyright (c) 2004 David Schultz d...@freebsd.org
+.\ 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 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 AUTHOR 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 AUTHOR 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.
+.\
+.\ $FreeBSD: src/lib/msun/man/fdim.3,v 1.1 2004/06/30 07:04:01 das Exp $
+.\ $NetBSD: fdim.3,v 1.1 2009/10/04 22:04:30 christos Exp $
+.\
+.Dd June 29, 2004
+.Dt FDIM 3
+.Os
+.Sh NAME
+.Nm fdim ,
+.Nm fdimf ,
+.Nm fdiml
+.Nd positive difference functions
+.Sh LIBRARY
+.Lb libm
+.Sh SYNOPSIS
+.In math.h
+.Ft double
+.Fn fdim double x double y
+.Ft float
+.Fn fdimf float x float y
+.Ft long double
+.Fn fdiml long double x long double y
+.Sh DESCRIPTION
+The
+.Fn fdim ,
+.Fn fdimf ,
+and
+.Fn fdiml
+functions return the positive difference between
+.Fa x
+and
+.Fa y .
+That is, if
+.Fa x\- Ns Fa y
+is 

CVS commit: src/distrib/sets/lists/comp

2009-10-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct  4 22:10:42 UTC 2009

Modified Files:
src/distrib/sets/lists/comp: mi

Log Message:
document f{dim,min,max}{,l,f}


To generate a diff of this commit:
cvs rdiff -u -r1.1316 -r1.1317 src/distrib/sets/lists/comp/mi

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/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1316 src/distrib/sets/lists/comp/mi:1.1317
--- src/distrib/sets/lists/comp/mi:1.1316	Fri Oct  2 14:50:14 2009
+++ src/distrib/sets/lists/comp/mi	Sun Oct  4 18:10:42 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1316 2009/10/02 18:50:14 elad Exp $
+#	$NetBSD: mi,v 1.1317 2009/10/04 22:10:42 christos Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -5451,6 +5451,9 @@
 ./usr/share/man/cat3/fabs.0			comp-c-catman		.cat
 ./usr/share/man/cat3/fabsf.0			comp-c-catman		.cat
 ./usr/share/man/cat3/fclose.0			comp-c-catman		.cat
+./usr/share/man/cat3/fdim.0			comp-c-catman		.cat
+./usr/share/man/cat3/fdimf.0			comp-c-catman		.cat
+./usr/share/man/cat3/fdiml.0			comp-c-catman		.cat
 ./usr/share/man/cat3/fdopen.0			comp-c-catman		.cat
 ./usr/share/man/cat3/fdopendir.0		comp-c-catman		.cat
 ./usr/share/man/cat3/feof.0			comp-c-catman		.cat
@@ -5493,6 +5496,12 @@
 ./usr/share/man/cat3/floorf.0			comp-c-catman		.cat
 ./usr/share/man/cat3/flushinp.0			comp-c-catman		.cat
 ./usr/share/man/cat3/flushok.0			comp-c-catman		.cat
+./usr/share/man/cat3/fmax.0			comp-c-catman		.cat
+./usr/share/man/cat3/fmaxf.0			comp-c-catman		.cat
+./usr/share/man/cat3/fmaxl.0			comp-c-catman		.cat
+./usr/share/man/cat3/fmin.0			comp-c-catman		.cat
+./usr/share/man/cat3/fminf.0			comp-c-catman		.cat
+./usr/share/man/cat3/fminl.0			comp-c-catman		.cat
 ./usr/share/man/cat3/fmod.0			comp-c-catman		.cat
 ./usr/share/man/cat3/fmodf.0			comp-c-catman		.cat
 ./usr/share/man/cat3/fmtcheck.0			comp-c-catman		.cat
@@ -10977,6 +10986,9 @@
 ./usr/share/man/html3/fabs.html			comp-c-htmlman		html
 ./usr/share/man/html3/fabsf.html		comp-c-htmlman		html
 ./usr/share/man/html3/fclose.html		comp-c-htmlman		html
+./usr/share/man/html3/fdim.html			comp-c-htmlman		html
+./usr/share/man/html3/fdimf.html		comp-c-htmlman		html
+./usr/share/man/html3/fdiml.html		comp-c-htmlman		html
 ./usr/share/man/html3/fdopen.html		comp-c-htmlman		html
 ./usr/share/man/html3/fdopendir.html		comp-c-htmlman		html
 ./usr/share/man/html3/feof.html			comp-c-htmlman		html
@@ -11018,6 +11030,12 @@
 ./usr/share/man/html3/floorf.html		comp-c-htmlman		html
 ./usr/share/man/html3/flushinp.html		comp-c-htmlman		html
 ./usr/share/man/html3/flushok.html		comp-c-htmlman		html
+./usr/share/man/html3/fmax.html			comp-c-htmlman		html
+./usr/share/man/html3/fmaxf.html		comp-c-htmlman		html
+./usr/share/man/html3/fmaxl.html		comp-c-htmlman		html
+./usr/share/man/html3/fmin.html			comp-c-htmlman		html
+./usr/share/man/html3/fminf.html		comp-c-htmlman		html
+./usr/share/man/html3/fminl.html		comp-c-htmlman		html
 ./usr/share/man/html3/fmod.html			comp-c-htmlman		html
 ./usr/share/man/html3/fmodf.html		comp-c-htmlman		html
 ./usr/share/man/html3/fmtcheck.html		comp-c-htmlman		html
@@ -16413,6 +16431,9 @@
 ./usr/share/man/man3/fabs.3			comp-c-man		.man
 ./usr/share/man/man3/fabsf.3			comp-c-man		.man
 ./usr/share/man/man3/fclose.3			comp-c-man		.man
+./usr/share/man/man3/fdim.3			comp-c-man		.man
+./usr/share/man/man3/fdimf.3			comp-c-man		.man
+./usr/share/man/man3/fdiml.3			comp-c-man		.man
 ./usr/share/man/man3/fdopen.3			comp-c-man		.man
 ./usr/share/man/man3/fdopendir.3		comp-c-man		.man
 ./usr/share/man/man3/feof.3			comp-c-man		.man
@@ -16455,6 +16476,12 @@
 ./usr/share/man/man3/floorf.3			comp-c-man		.man
 ./usr/share/man/man3/flushinp.3			comp-c-man		.man
 ./usr/share/man/man3/flushok.3			comp-c-man		.man
+./usr/share/man/man3/fmax.3			comp-c-man		.man
+./usr/share/man/man3/fmaxf.3			comp-c-man		.man
+./usr/share/man/man3/fmaxl.3			comp-c-man		.man
+./usr/share/man/man3/fmin.3			comp-c-man		.man
+./usr/share/man/man3/fminf.3			comp-c-man		.man
+./usr/share/man/man3/fminl.3			comp-c-man		.man
 ./usr/share/man/man3/fmod.3			comp-c-man		.man
 ./usr/share/man/man3/fmodf.3			comp-c-man		.man
 ./usr/share/man/man3/fmtcheck.3			comp-c-man		.man



CVS commit: src/doc

2009-10-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct  4 22:11:39 UTC 2009

Modified Files:
src/doc: CHANGES

Log Message:
mention f{dim,min,max}{,f,l}


To generate a diff of this commit:
cvs rdiff -u -r1.1303 -r1.1304 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.1303 src/doc/CHANGES:1.1304
--- src/doc/CHANGES:1.1303	Fri Oct  2 17:44:02 2009
+++ src/doc/CHANGES	Sun Oct  4 18:11:39 2009
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1303 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1304 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -417,3 +417,4 @@
 		[jmcneill 20091002]
 	i386: Add support for VIA C7 temperature sensors. [jmcneill 20091002]
 	dhcpcd(8): Import dhcpcd-5.1.1. [roy 20091002]
+	libm(3): Add f{dim,max,min}{,f,l} from FreeBSD [christos 20091004]



CVS commit: src/sys/dev/wscons

2009-10-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct  4 22:24:15 UTC 2009

Modified Files:
src/sys/dev/wscons: wsdisplay_compat_usl.c

Log Message:
Don't call usl_sync_check_sig from an interrupt context. Call it only if waitok.
Stack trace:mutex_vector_enter - usl_sync_check_sig - usl_detachproc -
wsdisplay_switch - wskbd_translate - wskbd_input -
pckbd_input - pckbcintr - intr_biglock_wrapper -
Xintr_ioapic_edge1
Reported by Anon Ymous


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/wscons/wsdisplay_compat_usl.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/wscons/wsdisplay_compat_usl.c
diff -u src/sys/dev/wscons/wsdisplay_compat_usl.c:1.45 src/sys/dev/wscons/wsdisplay_compat_usl.c:1.46
--- src/sys/dev/wscons/wsdisplay_compat_usl.c:1.45	Thu Apr 24 11:35:28 2008
+++ src/sys/dev/wscons/wsdisplay_compat_usl.c	Sun Oct  4 18:24:15 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay_compat_usl.c,v 1.45 2008/04/24 15:35:28 ad Exp $ */
+/* $NetBSD: wsdisplay_compat_usl.c,v 1.46 2009/10/04 22:24:15 christos Exp $ */
 
 /*
  * Copyright (c) 1998
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wsdisplay_compat_usl.c,v 1.45 2008/04/24 15:35:28 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: wsdisplay_compat_usl.c,v 1.46 2009/10/04 22:24:15 christos Exp $);
 
 #include opt_compat_freebsd.h
 #include opt_compat_netbsd.h
@@ -191,8 +191,10 @@
 	 */
 	sd-s_callback = callback;
 	sd-s_cbarg = cbarg;
-	if (!usl_sync_check_sig(sd, sd-s_relsig, SF_DETACHPENDING))	
-		return (0);
+	if (waitok) {
+		if (!usl_sync_check_sig(sd, sd-s_relsig, SF_DETACHPENDING))	
+			return (0);
+	}
 
 	callout_schedule(sd-s_detach_ch, wscompat_usl_synctimeout * hz);
 	return (EAGAIN);



CVS commit: src/include

2009-10-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct  4 22:59:25 UTC 2009

Modified Files:
src/include: math.h

Log Message:
oops forgot to commit that one--- Add f{dim,min,max}{,l,f}


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/include/math.h

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

Modified files:

Index: src/include/math.h
diff -u src/include/math.h:1.48 src/include/math.h:1.49
--- src/include/math.h:1.48	Sat Feb 21 20:34:01 2009
+++ src/include/math.h	Sun Oct  4 18:59:25 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: math.h,v 1.48 2009/02/22 01:34:01 martin Exp $	*/
+/*	$NetBSD: math.h,v 1.49 2009/10/04 22:59:25 christos Exp $	*/
 
 /*
  * 
@@ -352,6 +352,15 @@
 #define islessequal(x, y)	(!isunordered((x), (y))  (x) = (y))
 #define islessgreater(x, y)	(!isunordered((x), (y))  \
  ((x)  (y) || (y)  (x)))
+double	fdim(double, double);
+double	fmax(double, double);
+double	fmin(double, double);
+float	fdimf(float, float);
+float	fmaxf(float, float);
+float	fminf(float, float);
+long double fdiml(long double, long double);
+long double fmaxl(long double, long double);
+long double fminl(long double, long double);
 
 #endif /* !_ANSI_SOURCE  ... */
 



CVS commit: src/sys/net

2009-10-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Oct  5 17:58:15 UTC 2009

Modified Files:
src/sys/net: bpf.c

Log Message:
add the error from ifpromisc to the panic.


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/sys/net/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/sys/net/bpf.c
diff -u src/sys/net/bpf.c:1.146 src/sys/net/bpf.c:1.147
--- src/sys/net/bpf.c:1.146	Sat Apr 11 19:05:26 2009
+++ src/sys/net/bpf.c	Mon Oct  5 13:58:15 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf.c,v 1.146 2009/04/11 23:05:26 christos Exp $	*/
+/*	$NetBSD: bpf.c,v 1.147 2009/10/05 17:58:15 christos Exp $	*/
 
 /*
  * Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bpf.c,v 1.146 2009/04/11 23:05:26 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: bpf.c,v 1.147 2009/10/05 17:58:15 christos Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_bpf.h
@@ -342,14 +342,14 @@
 		 */
   		error = ifpromisc(bp-bif_ifp, 0);
 		if (error  error != EINVAL)
-			panic(bpf: ifpromisc failed);
+			panic(%s: ifpromisc failed: %d, __func__, error);
 	}
 	/* Remove d from the interface's descriptor list. */
 	p = bp-bif_dlist;
 	while (*p != d) {
 		p = (*p)-bd_next;
 		if (*p == 0)
-			panic(bpf_detachd: descriptor not in list);
+			panic(%s: descriptor not in list, __func__);
 	}
 	*p = (*p)-bd_next;
 	if (bp-bif_dlist == 0)



CVS commit: src/bin/sh

2009-10-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct  6 20:05:10 UTC 2009

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

Log Message:
fix regression exit1: Don't exec the last command in a subshell if it has
trap[0] (trap EXIT) set. Fork instead to give the shell a chance to execute
the trap when it is done.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/bin/sh/eval.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.96 src/bin/sh/eval.c:1.97
--- src/bin/sh/eval.c:1.96	Mon Jan 19 14:47:11 2009
+++ src/bin/sh/eval.c	Tue Oct  6 16:05:10 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: eval.c,v 1.96 2009/01/19 19:47:11 christos Exp $	*/
+/*	$NetBSD: eval.c,v 1.97 2009/10/06 20:05:10 christos 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.96 2009/01/19 19:47:11 christos Exp $);
+__RCSID($NetBSD: eval.c,v 1.97 2009/10/06 20:05:10 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -665,6 +665,7 @@
 }
 
 int vforked = 0;
+extern char *trap[];
 
 /*
  * Execute a simple command.
@@ -820,7 +821,7 @@
 	}
 
 	/* Fork off a child process if necessary. */
-	if (cmd-ncmd.backgnd
+	if (cmd-ncmd.backgnd || trap[0]
 	 || (cmdentry.cmdtype == CMDNORMAL  (flags  EV_EXIT) == 0)
 	 || ((flags  EV_BACKCMD) != 0
 	 ((cmdentry.cmdtype != CMDBUILTIN  cmdentry.cmdtype != CMDSPLBLTIN)



CVS commit: src/bin/sh

2009-10-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct  7 18:12:11 UTC 2009

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

Log Message:
only for when trap if we are going to exit.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/bin/sh/eval.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.97 src/bin/sh/eval.c:1.98
--- src/bin/sh/eval.c:1.97	Tue Oct  6 16:05:10 2009
+++ src/bin/sh/eval.c	Wed Oct  7 14:12:11 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: eval.c,v 1.97 2009/10/06 20:05:10 christos Exp $	*/
+/*	$NetBSD: eval.c,v 1.98 2009/10/07 18:12:11 christos 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.97 2009/10/06 20:05:10 christos Exp $);
+__RCSID($NetBSD: eval.c,v 1.98 2009/10/07 18:12:11 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -821,7 +821,7 @@
 	}
 
 	/* Fork off a child process if necessary. */
-	if (cmd-ncmd.backgnd || trap[0]
+	if (cmd-ncmd.backgnd || (trap[0]  (flags  EV_EXIT) != 0)
 	 || (cmdentry.cmdtype == CMDNORMAL  (flags  EV_EXIT) == 0)
 	 || ((flags  EV_BACKCMD) != 0
 	 ((cmdentry.cmdtype != CMDBUILTIN  cmdentry.cmdtype != CMDSPLBLTIN)



CVS commit: src/common/lib/libprop

2009-10-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct 10 21:27:46 UTC 2009

Modified Files:
src/common/lib/libprop: prop_kern.c

Log Message:
make this compile again.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/common/lib/libprop/prop_kern.c

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

Modified files:

Index: src/common/lib/libprop/prop_kern.c
diff -u src/common/lib/libprop/prop_kern.c:1.11 src/common/lib/libprop/prop_kern.c:1.12
--- src/common/lib/libprop/prop_kern.c:1.11	Sat Oct 10 14:06:54 2009
+++ src/common/lib/libprop/prop_kern.c	Sat Oct 10 17:27:46 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: prop_kern.c,v 1.11 2009/10/10 18:06:54 bad Exp $	*/
+/*	$NetBSD: prop_kern.c,v 1.12 2009/10/10 21:27:46 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2009 The NetBSD Foundation, Inc.
@@ -332,6 +332,7 @@
 	return _prop_object_copyin(pref, type, objp);
 }
 
+#ifdef notyet
 /*
  * prop_array_copyin --
  *	Copy in an array passed as a syscall arg.
@@ -353,6 +354,7 @@
 	return (_prop_object_copyin(pref, PROP_TYPE_DICTIONARY,
 	  (prop_object_t *)dictp));
 }
+#endif
 
 
 /*



CVS commit: src/gnu/usr.bin/gettext/include

2009-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Oct 12 22:20:50 UTC 2009

Modified Files:
src/gnu/usr.bin/gettext/include: config.h

Log Message:
we have getdelim now!


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/gnu/usr.bin/gettext/include/config.h

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

Modified files:

Index: src/gnu/usr.bin/gettext/include/config.h
diff -u src/gnu/usr.bin/gettext/include/config.h:1.3 src/gnu/usr.bin/gettext/include/config.h:1.4
--- src/gnu/usr.bin/gettext/include/config.h:1.3	Sun Jul 17 05:22:03 2005
+++ src/gnu/usr.bin/gettext/include/config.h	Mon Oct 12 18:20:50 2009
@@ -182,7 +182,7 @@
 #define HAVE_GETCWD 1
 
 /* Define to 1 if you have the `getdelim' function. */
-/* #undef HAVE_GETDELIM */
+#define HAVE_GETDELIM 1
 
 /* Define to 1 if you have the `getegid' function. */
 #define HAVE_GETEGID 1



CVS commit: src/usr.sbin/sup/source

2009-10-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct 13 12:11:20 UTC 2009

Modified Files:
src/usr.sbin/sup/source: expand.c

Log Message:
- use const where appropriate
- don't cast return value from malloc


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/sup/source/expand.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/sup/source/expand.c
diff -u src/usr.sbin/sup/source/expand.c:1.16 src/usr.sbin/sup/source/expand.c:1.17
--- src/usr.sbin/sup/source/expand.c:1.16	Fri Jul 20 12:39:05 2007
+++ src/usr.sbin/sup/source/expand.c	Tue Oct 13 08:11:19 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: expand.c,v 1.16 2007/07/20 16:39:05 christos Exp $	*/
+/*	$NetBSD: expand.c,v 1.17 2009/10/13 12:11:19 christos Exp $	*/
 
 /*
  * Copyright (c) 1991 Carnegie Mellon University
@@ -80,7 +80,7 @@
 static char pathbuf[MAXPATHLEN];
 static char *path, *pathp, *lastpathp;
 
-static char *globchars = {[*?;/* meta characters */
+static const char globchars[] = {[*?;/* meta characters */
 static char *entp;		/* current dir entry pointer */
 
 static char **BUFFER;		/* pointer to the buffer */
@@ -95,7 +95,7 @@
 static int execbrc(char *, char *);
 static int match(char *, char *);
 static int amatch(char *, char *);
-static void addone(char *, char *);
+static void addone(char *, const char *);
 static int addpath(char);
 static int gethdir(char *, int);
 
@@ -361,7 +361,7 @@
 }
 
 static void 
-addone(char *s1, char *s2)
+addone(char *s1, const char *s2)
 {
 	char *ep;
 
@@ -369,7 +369,7 @@
 		bufcnt = BUFSIZE + 1;
 		longjmp(sjbuf, 1);
 	}
-	ep = (char *) malloc(strlen(s1) + strlen(s2) + 1);
+	ep = malloc(strlen(s1) + strlen(s2) + 1);
 	if (ep == 0) {
 		bufcnt = -1;
 		longjmp(sjbuf, 1);



CVS commit: src/usr.bin/printf

2009-10-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct 13 19:28:31 UTC 2009

Modified Files:
src/usr.bin/printf: printf.c

Log Message:
Avoid segv on printf '%*s' 666, from Maksymilian Arciemowicz


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/printf/printf.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.bin/printf/printf.c
diff -u src/usr.bin/printf/printf.c:1.33 src/usr.bin/printf/printf.c:1.34
--- src/usr.bin/printf/printf.c:1.33	Mon Jul 21 10:19:24 2008
+++ src/usr.bin/printf/printf.c	Tue Oct 13 15:28:31 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: printf.c,v 1.33 2008/07/21 14:19:24 lukem Exp $	*/
+/*	$NetBSD: printf.c,v 1.34 2009/10/13 19:28:31 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = @(#)printf.c	8.2 (Berkeley) 3/22/95;
 #else
-__RCSID($NetBSD: printf.c,v 1.33 2008/07/21 14:19:24 lukem Exp $);
+__RCSID($NetBSD: printf.c,v 1.34 2009/10/13 19:28:31 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -155,7 +155,7 @@
 	gargv = ++argv;
 
 #define SKIP1	#-+ 0
-#define SKIP2	*0123456789
+#define SKIP2	0123456789
 	do {
 		/*
 		 * Basic algorithm is to scan the format string for conversion
@@ -185,13 +185,23 @@
 
 			/* skip to field width */
 			fmt += strspn(fmt, SKIP1);
-			fieldwidth = *fmt == '*' ? getwidth() : -1;
+			if (*fmt == '*') {
+fmt++;
+fieldwidth = getwidth();
+			} else
+fieldwidth = -1;
 
 			/* skip to possible '.', get following precision */
 			fmt += strspn(fmt, SKIP2);
-			if (*fmt == '.')
-++fmt;
-			precision = *fmt == '*' ? getwidth() : -1;
+			if (*fmt == '.') {
+fmt++;
+if (*fmt == '*') {
+	fmt++;
+	precision = getwidth();
+} else
+	precision = -1;
+			} else
+precision = -1;
 
 			fmt += strspn(fmt, SKIP2);
 



CVS commit: src/sys/net

2011-03-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 30 21:34:08 UTC 2011

Modified Files:
src/sys/net: bpf.c

Log Message:
lib/44807: something broken in stat(2), return that we are a character
device in st_mode.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/net/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/sys/net/bpf.c
diff -u src/sys/net/bpf.c:1.163 src/sys/net/bpf.c:1.164
--- src/sys/net/bpf.c:1.163	Wed Mar 30 14:04:27 2011
+++ src/sys/net/bpf.c	Wed Mar 30 17:34:08 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf.c,v 1.163 2011/03/30 18:04:27 bouyer Exp $	*/
+/*	$NetBSD: bpf.c,v 1.164 2011/03/30 21:34:08 christos Exp $	*/
 
 /*
  * Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bpf.c,v 1.163 2011/03/30 18:04:27 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: bpf.c,v 1.164 2011/03/30 21:34:08 christos Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_bpf.h
@@ -1178,6 +1178,7 @@
 	st-st_ctimespec = st-st_birthtimespec = d-bd_btime;
 	st-st_uid = kauth_cred_geteuid(fp-f_cred);
 	st-st_gid = kauth_cred_getegid(fp-f_cred);
+	st-st_mode = S_IFCHR;
 	KERNEL_UNLOCK_ONE(NULL);
 	return 0;
 }



CVS commit: src/lib/libc/net

2011-04-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr  3 22:14:15 UTC 2011

Modified Files:
src/lib/libc/net: getservbyname_r.c getservbyport_r.c

Log Message:
Protect against stack smashes (Maksymilian Arciemowicz)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/net/getservbyname_r.c \
src/lib/libc/net/getservbyport_r.c

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

Modified files:

Index: src/lib/libc/net/getservbyname_r.c
diff -u src/lib/libc/net/getservbyname_r.c:1.7 src/lib/libc/net/getservbyname_r.c:1.8
--- src/lib/libc/net/getservbyname_r.c:1.7	Sat Apr 24 20:54:46 2010
+++ src/lib/libc/net/getservbyname_r.c	Sun Apr  3 18:14:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: getservbyname_r.c,v 1.7 2010/04/25 00:54:46 joerg Exp $	*/
+/*	$NetBSD: getservbyname_r.c,v 1.8 2011/04/03 22:14:15 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)getservbyname.c	8.1 (Berkeley) 6/4/93;
 #else
-__RCSID($NetBSD: getservbyname_r.c,v 1.7 2010/04/25 00:54:46 joerg Exp $);
+__RCSID($NetBSD: getservbyname_r.c,v 1.8 2011/04/03 22:14:15 christos Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -69,12 +69,14 @@
 		namelen = strlen(name);
 		if (namelen == 0 || namelen  255)
 			return NULL;
-		if (proto != NULL  *proto == '\0')
-			return NULL;
-		if (proto != NULL)
+		if (proto != NULL) {
 			protolen = strlen(proto);
-		else
+			if (protolen == 0 || protolen  255)
+return NULL;
+		} else
 			protolen = 0;
+		if (namelen + protolen  255)
+			return NULL;
 
 		buf[0] = namelen;
 		buf[1] = protolen;
Index: src/lib/libc/net/getservbyport_r.c
diff -u src/lib/libc/net/getservbyport_r.c:1.7 src/lib/libc/net/getservbyport_r.c:1.8
--- src/lib/libc/net/getservbyport_r.c:1.7	Sat Apr 24 20:54:46 2010
+++ src/lib/libc/net/getservbyport_r.c	Sun Apr  3 18:14:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: getservbyport_r.c,v 1.7 2010/04/25 00:54:46 joerg Exp $	*/
+/*	$NetBSD: getservbyport_r.c,v 1.8 2011/04/03 22:14:15 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)getservbyport.c	8.1 (Berkeley) 6/4/93;
 #else
-__RCSID($NetBSD: getservbyport_r.c,v 1.7 2010/04/25 00:54:46 joerg Exp $);
+__RCSID($NetBSD: getservbyport_r.c,v 1.8 2011/04/03 22:14:15 christos Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -67,11 +67,11 @@
 
 		port = be16toh(port);
 
-		if (proto != NULL  *proto == '\0')
-			return NULL;
-		if (proto != NULL)
+		if (proto != NULL) {
 			protolen = strlen(proto);
-		else
+			if (protolen == 0 || protolen  255)
+return NULL;
+		} else
 			protolen = 0;
 		if (port  0 || port  65536)
 			return NULL;



CVS commit: src/lib/libc/arch/i386/gen

2011-04-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr  6 21:55:36 UTC 2011

Modified Files:
src/lib/libc/arch/i386/gen: infinityl.c

Log Message:
fix long double infinity.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/arch/i386/gen/infinityl.c

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

Modified files:

Index: src/lib/libc/arch/i386/gen/infinityl.c
diff -u src/lib/libc/arch/i386/gen/infinityl.c:1.2 src/lib/libc/arch/i386/gen/infinityl.c:1.3
--- src/lib/libc/arch/i386/gen/infinityl.c:1.2	Sun Jun 12 01:21:26 2005
+++ src/lib/libc/arch/i386/gen/infinityl.c	Wed Apr  6 17:55:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: infinityl.c,v 1.2 2005/06/12 05:21:26 lukem Exp $	*/
+/*	$NetBSD: infinityl.c,v 1.3 2011/04/06 21:55:36 christos Exp $	*/
 
 /*
  * IEEE-compatible infinityl.c for little-endian 80-bit format -- public domain.
@@ -7,10 +7,10 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: infinityl.c,v 1.2 2005/06/12 05:21:26 lukem Exp $);
+__RCSID($NetBSD: infinityl.c,v 1.3 2011/04/06 21:55:36 christos Exp $);
 #endif /* LIBC_SCCS and not lint */
 
 #include math.h
 
 const union __long_double_u __infinityl =
-	{ { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0x7f, 0, 0 } };
+	{ { 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0x7f, 0, 0 } };



CVS commit: src/sys/dev/videomode

2011-04-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  9 20:53:39 UTC 2011

Modified Files:
src/sys/dev/videomode: edid.c pickmode.c

Log Message:
- little KNF
- use struct copy instead of memcpy
- snprintf(%s) - strlcpy
- fix NUL termination


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/videomode/edid.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/videomode/pickmode.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/videomode/edid.c
diff -u src/sys/dev/videomode/edid.c:1.9 src/sys/dev/videomode/edid.c:1.10
--- src/sys/dev/videomode/edid.c:1.9	Sat Apr  9 14:18:28 2011
+++ src/sys/dev/videomode/edid.c	Sat Apr  9 16:53:39 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: edid.c,v 1.9 2011/04/09 18:18:28 jdc Exp $ */
+/* $NetBSD: edid.c,v 1.10 2011/04/09 20:53:39 christos Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */ 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: edid.c,v 1.9 2011/04/09 18:18:28 jdc Exp $);
+__KERNEL_RCSID(0, $NetBSD: edid.c,v 1.10 2011/04/09 20:53:39 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -91,7 +91,7 @@
 
 	for (n = 0; n  edid_nvendors; n++)
 		if (memcmp(edid_vendors[n].vendor, vendor, 3) == 0)
-			return (edid_vendors[n].name);
+			return edid_vendors[n].name;
 #endif
 	return NULL;
 }
@@ -103,9 +103,9 @@
 	int	n;
 
 	for (n = 0; n  edid_nproducts; n++)
-		if ((edid_products[n].product == product) 
-		(memcmp(edid_products[n].vendor, vendor, 3) == 0))
-			return (edid_products[n].name);
+		if (edid_products[n].product == product 
+		memcmp(edid_products[n].vendor, vendor, 3) == 0)
+			return (edid_products[n].name;
 #endif	/* EDIDVERBOSE */
 	return NULL;
 
@@ -116,11 +116,11 @@
 {
 	for (;;) {
 		switch (*ptr) {
-		case 0:
+		case '\0':
 			return;
 		case '\r':
 		case '\n':
-			*ptr = 0;
+			*ptr = '\0';
 			return;
 		}
 		ptr++;
@@ -264,8 +264,7 @@
 		edid-edid_modes[i].hdisplay,
 		edid-edid_modes[i].vdisplay,
 		DIVIDE(DIVIDE(edid-edid_modes[i].dot_clock * 1000,
-			   edid-edid_modes[i].htotal),
-			edid-edid_modes[i].vtotal));
+		edid-edid_modes[i].htotal), edid-edid_modes[i].vtotal));
 		printf( (%d %d %d %d %d %d %d,
 		edid-edid_modes[i].dot_clock,
 		edid-edid_modes[i].hsync_start,
@@ -285,8 +284,8 @@
 		edid-edid_preferred_mode-hdisplay,
 		edid-edid_preferred_mode-vdisplay,
 		DIVIDE(DIVIDE(edid-edid_preferred_mode-dot_clock * 1000,
-			   edid-edid_preferred_mode-htotal),
-			edid-edid_preferred_mode-vtotal));
+		edid-edid_preferred_mode-htotal),
+		edid-edid_preferred_mode-vtotal));
 }
 
 static const struct videomode *
@@ -312,9 +311,8 @@
 		mode-vdisplay == edid-edid_modes[i].vdisplay 
 		refresh == DIVIDE(DIVIDE(
 		edid-edid_modes[i].dot_clock * 1000,
-		edid-edid_modes[i].htotal),
-		edid-edid_modes[i].vtotal)) {
-			return (edid-edid_modes[i]);
+		edid-edid_modes[i].htotal), edid-edid_modes[i].vtotal)) {
+			return edid-edid_modes[i];
 		}
 	}
 	return NULL;
@@ -351,13 +349,11 @@
 	f = EDID_STD_TIMING_VFREQ(data);
 
 	/* first try to lookup the mode as a DMT timing */
-	snprintf(name, sizeof (name), %dx%dx%d, x, y, f);
+	snprintf(name, sizeof(name), %dx%dx%d, x, y, f);
 	if ((lookup = edid_mode_lookup_list(name)) != NULL) {
 		*vmp = *lookup;
-	}
-
-	/* failing that, calculate it using gtf */
-	else {
+	} else {
+		/* failing that, calculate it using gtf */
 		/*
 		 * Hmm. I'm not using alternate GTF timings, which
 		 * could, in theory, be present.
@@ -429,68 +425,53 @@
 	struct videomode	mode, *exist_mode;
 
 	if (EDID_BLOCK_IS_DET_TIMING(data)) {
-		if (edid_det_timing(data, mode)) {
-			/* Does this mode already exist? */
-			exist_mode = edid_search_mode(edid, mode);
-			if (exist_mode != NULL) {
-memcpy(exist_mode, mode,
-sizeof(struct videomode));
-if (edid-edid_preferred_mode == NULL) {
-	edid-edid_preferred_mode =
-	exist_mode;
-}
-			} else {
-edid-edid_modes[edid-edid_nmodes] = mode;
-if (edid-edid_preferred_mode == NULL) {
-	edid-edid_preferred_mode =
-	edid-edid_modes[edid-edid_nmodes];
-}
-edid-edid_nmodes++;	
-			}
+		if (!edid_det_timing(data, mode)) {
+			return;
+		/* Does this mode already exist? */
+		exist_mode = edid_search_mode(edid, mode);
+		if (exist_mode != NULL) {
+			*exist_mode = mode;
+			if (edid-edid_preferred_mode == NULL)
+edid-edid_preferred_mode = exist_mode;
+		} else {
+			edid-edid_modes[edid-edid_nmodes] = mode;
+			if (edid-edid_preferred_mode == NULL)
+edid-edid_preferred_mode =
+edid-edid_modes[edid-edid_nmodes];
+			edid-edid_nmodes++;	
 		}
 		return;
 	}
 
 	switch (EDID_BLOCK_TYPE(data)) {
 	case EDID_DESC_BLOCK_TYPE_SERIAL:
-		memcpy(edid-edid_serial,
-		data + EDID_DESC_ASCII_DATA_OFFSET,
+		memcpy(edid-edid_serial, data + EDID_DESC_ASCII_DATA_OFFSET,
 		

CVS commit: src/sys/dev/videomode

2011-04-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  9 22:09:06 UTC 2011

Modified Files:
src/sys/dev/videomode: edid.c

Log Message:
make this compile again.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/videomode/edid.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/videomode/edid.c
diff -u src/sys/dev/videomode/edid.c:1.10 src/sys/dev/videomode/edid.c:1.11
--- src/sys/dev/videomode/edid.c:1.10	Sat Apr  9 16:53:39 2011
+++ src/sys/dev/videomode/edid.c	Sat Apr  9 18:09:05 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: edid.c,v 1.10 2011/04/09 20:53:39 christos Exp $ */
+/* $NetBSD: edid.c,v 1.11 2011/04/09 22:09:05 christos Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */ 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: edid.c,v 1.10 2011/04/09 20:53:39 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: edid.c,v 1.11 2011/04/09 22:09:05 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -105,7 +105,7 @@
 	for (n = 0; n  edid_nproducts; n++)
 		if (edid_products[n].product == product 
 		memcmp(edid_products[n].vendor, vendor, 3) == 0)
-			return (edid_products[n].name;
+			return edid_products[n].name;
 #endif	/* EDIDVERBOSE */
 	return NULL;
 
@@ -425,7 +425,7 @@
 	struct videomode	mode, *exist_mode;
 
 	if (EDID_BLOCK_IS_DET_TIMING(data)) {
-		if (!edid_det_timing(data, mode)) {
+		if (!edid_det_timing(data, mode))
 			return;
 		/* Does this mode already exist? */
 		exist_mode = edid_search_mode(edid, mode);



CVS commit: src/sys/kern

2011-04-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  9 23:03:59 UTC 2011

Modified Files:
src/sys/kern: uipc_socket2.c

Log Message:
Preserve SB_ASYNC on the accepted socket. From: Dmitry Matveev
http://mail-index.netbsd.org/tech-net/2011/02/17/msg002457.html


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/kern/uipc_socket2.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/kern/uipc_socket2.c
diff -u src/sys/kern/uipc_socket2.c:1.106 src/sys/kern/uipc_socket2.c:1.107
--- src/sys/kern/uipc_socket2.c:1.106	Wed Dec 30 17:12:12 2009
+++ src/sys/kern/uipc_socket2.c	Sat Apr  9 19:03:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_socket2.c,v 1.106 2009/12/30 22:12:12 elad Exp $	*/
+/*	$NetBSD: uipc_socket2.c,v 1.107 2011/04/09 23:03:59 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uipc_socket2.c,v 1.106 2009/12/30 22:12:12 elad Exp $);
+__KERNEL_RCSID(0, $NetBSD: uipc_socket2.c,v 1.107 2011/04/09 23:03:59 christos Exp $);
 
 #include opt_mbuftrace.h
 #include opt_sb_max.h
@@ -285,8 +285,8 @@
 	so-so_rcv.sb_lowat = head-so_rcv.sb_lowat;
 	so-so_rcv.sb_timeo = head-so_rcv.sb_timeo;
 	so-so_snd.sb_timeo = head-so_snd.sb_timeo;
-	so-so_rcv.sb_flags |= head-so_rcv.sb_flags  SB_AUTOSIZE;
-	so-so_snd.sb_flags |= head-so_snd.sb_flags  SB_AUTOSIZE;
+	so-so_rcv.sb_flags |= head-so_rcv.sb_flags  (SB_AUTOSIZE | SB_ASYNC);
+	so-so_snd.sb_flags |= head-so_snd.sb_flags  (SB_AUTOSIZE | SB_ASYNC);
 	soqinsque(head, so, soqueue);
 	error = (*so-so_proto-pr_usrreq)(so, PRU_ATTACH, NULL, NULL,
 	NULL, NULL);



CVS commit: src/sys/sys

2011-04-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 00:04:37 UTC 2011

Modified Files:
src/sys/sys: siginfo.h

Log Message:
Make lwpid part of siginfo so that it can be passed to userland.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/sys/siginfo.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/sys/siginfo.h
diff -u src/sys/sys/siginfo.h:1.20 src/sys/sys/siginfo.h:1.21
--- src/sys/sys/siginfo.h:1.20	Sun Jan  2 13:12:01 2011
+++ src/sys/sys/siginfo.h	Sat Apr  9 20:04:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: siginfo.h,v 1.20 2011/01/02 18:12:01 skrll Exp $	 */
+/*	$NetBSD: siginfo.h,v 1.21 2011/04/10 00:04:37 christos Exp $	 */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -60,6 +60,12 @@
 		struct {
 			pid_t	_pid;
 			uid_t	_uid;
+			lwpid_t	_lid;
+		} _lwp;
+
+		struct {
+			pid_t	_pid;
+			uid_t	_uid;
 			int	_status;
 			clock_t	_utime;
 			clock_t	_stime;
@@ -82,7 +88,6 @@
 	u_long			ksi_flags;	/* 4 or 8 bytes (LP64) */
 	CIRCLEQ_ENTRY(ksiginfo) ksi_list;
 	struct _ksiginfo	ksi_info;
-	lwpid_t			ksi_lid;	/* 0, or directed to LWP */
 } ksiginfo_t;
 
 #define	KSI_TRAP	0x01	/* signal caused by trap */
@@ -140,6 +145,9 @@
 #define	si_value	_info._reason._rt._value
 #define	si_pid		_info._reason._child._pid
 #define	si_uid		_info._reason._child._uid
+#if defined(_NETBSD_SOURCE)
+#define	si_lid		_info._reason._lwp._lid
+#endif
 #define	si_status	_info._reason._child._status
 #define	si_utime	_info._reason._child._utime
 #define	si_stime	_info._reason._child._stime
@@ -157,12 +165,15 @@
 #define	ksi_errno	ksi_info._errno
 
 #define	ksi_value	ksi_info._reason._rt._value
+
 #define	ksi_pid		ksi_info._reason._child._pid
 #define	ksi_uid		ksi_info._reason._child._uid
 #define	ksi_status	ksi_info._reason._child._status
 #define	ksi_utime	ksi_info._reason._child._utime
 #define	ksi_stime	ksi_info._reason._child._stime
 
+#define	ksi_lid		ksi_info._reason._lwp._lid /* 0, or directed to LWP */
+
 #define	ksi_addr	ksi_info._reason._fault._addr
 #define	ksi_trap	ksi_info._reason._fault._trap
 



CVS commit: src/usr.bin/kdump

2011-04-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 00:05:51 UTC 2011

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
print detailed info about other SI_ codes.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/usr.bin/kdump/kdump.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.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.106 src/usr.bin/kdump/kdump.c:1.107
--- src/usr.bin/kdump/kdump.c:1.106	Mon Jan 10 00:15:17 2011
+++ src/usr.bin/kdump/kdump.c	Sat Apr  9 20:05:51 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.106 2011/01/10 05:15:17 christos Exp $	*/
+/*	$NetBSD: kdump.c,v 1.107 2011/04/10 00:05:51 christos Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = @(#)kdump.c	8.4 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: kdump.c,v 1.106 2011/01/10 05:15:17 christos Exp $);
+__RCSID($NetBSD: kdump.c,v 1.107 2011/04/10 00:05:51 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -943,14 +943,17 @@
 si-si_uid, si-si_value.sival_ptr);
 return;
 			case SI_ASYNCIO:
-code = SI_ASYNCIO;
-break;
 			case SI_MESGQ:
-code = SI_MESGQ;
-break;
+printf(: code=%s with sigval %p)\n,
+si-si_code == SI_ASYNCIO ?
+SI_ASYNCIO : SI_MESGQ,
+si-si_value.sival_ptr);
+return;
 			case SI_LWP:
-code = SI_LWP;
-break;
+printf(: code=SI_LWP sent by pid=%d, uid=%d 
+with target lid=%d)\n, si-si_pid,
+si-si_uid, si-si_lid);
+return;
 			default:
 code = NULL;
 break;



CVS commit: src/sys/sys

2011-04-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 14:37:20 UTC 2011

Modified Files:
src/sys/sys: siginfo.h

Log Message:
revert previous. breaks things in subtle ways (ntpdate gets stuck on boot,
shell processes get stuck on ^C)


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/sys/siginfo.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/sys/siginfo.h
diff -u src/sys/sys/siginfo.h:1.21 src/sys/sys/siginfo.h:1.22
--- src/sys/sys/siginfo.h:1.21	Sat Apr  9 20:04:37 2011
+++ src/sys/sys/siginfo.h	Sun Apr 10 10:37:20 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: siginfo.h,v 1.21 2011/04/10 00:04:37 christos Exp $	 */
+/*	$NetBSD: siginfo.h,v 1.22 2011/04/10 14:37:20 christos Exp $	 */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -60,12 +60,6 @@
 		struct {
 			pid_t	_pid;
 			uid_t	_uid;
-			lwpid_t	_lid;
-		} _lwp;
-
-		struct {
-			pid_t	_pid;
-			uid_t	_uid;
 			int	_status;
 			clock_t	_utime;
 			clock_t	_stime;
@@ -88,6 +82,7 @@
 	u_long			ksi_flags;	/* 4 or 8 bytes (LP64) */
 	CIRCLEQ_ENTRY(ksiginfo) ksi_list;
 	struct _ksiginfo	ksi_info;
+	lwpid_t			ksi_lid;	/* 0, or directed to LWP */
 } ksiginfo_t;
 
 #define	KSI_TRAP	0x01	/* signal caused by trap */
@@ -145,9 +140,6 @@
 #define	si_value	_info._reason._rt._value
 #define	si_pid		_info._reason._child._pid
 #define	si_uid		_info._reason._child._uid
-#if defined(_NETBSD_SOURCE)
-#define	si_lid		_info._reason._lwp._lid
-#endif
 #define	si_status	_info._reason._child._status
 #define	si_utime	_info._reason._child._utime
 #define	si_stime	_info._reason._child._stime
@@ -165,15 +157,12 @@
 #define	ksi_errno	ksi_info._errno
 
 #define	ksi_value	ksi_info._reason._rt._value
-
 #define	ksi_pid		ksi_info._reason._child._pid
 #define	ksi_uid		ksi_info._reason._child._uid
 #define	ksi_status	ksi_info._reason._child._status
 #define	ksi_utime	ksi_info._reason._child._utime
 #define	ksi_stime	ksi_info._reason._child._stime
 
-#define	ksi_lid		ksi_info._reason._lwp._lid /* 0, or directed to LWP */
-
 #define	ksi_addr	ksi_info._reason._fault._addr
 #define	ksi_trap	ksi_info._reason._fault._trap
 



CVS commit: src/usr.bin/kdump

2011-04-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 14:38:19 UTC 2011

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
we don't have access to si_lid anymore.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/usr.bin/kdump/kdump.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.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.107 src/usr.bin/kdump/kdump.c:1.108
--- src/usr.bin/kdump/kdump.c:1.107	Sat Apr  9 20:05:51 2011
+++ src/usr.bin/kdump/kdump.c	Sun Apr 10 10:38:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.107 2011/04/10 00:05:51 christos Exp $	*/
+/*	$NetBSD: kdump.c,v 1.108 2011/04/10 14:38:19 christos Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = @(#)kdump.c	8.4 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: kdump.c,v 1.107 2011/04/10 00:05:51 christos Exp $);
+__RCSID($NetBSD: kdump.c,v 1.108 2011/04/10 14:38:19 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -950,9 +950,8 @@
 si-si_value.sival_ptr);
 return;
 			case SI_LWP:
-printf(: code=SI_LWP sent by pid=%d, uid=%d 
-with target lid=%d)\n, si-si_pid,
-si-si_uid, si-si_lid);
+printf(: code=SI_LWP sent by pid=%d, 
+uid=%d)\n, si-si_pid, si-si_uid);
 return;
 			default:
 code = NULL;



CVS commit: src/sys

2011-04-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 15:45:34 UTC 2011

Modified Files:
src/sys/kern: kern_descrip.c sys_descrip.c sys_generic.c sys_pipe.c
uipc_syscalls.c vfs_syscalls.c
src/sys/sys: fcntl.h filedesc.h

Log Message:
- Add O_CLOEXEC to open(2)
- Add fd_set_exclose() to encapsulate uses of FIO{,N}CLEX, O_CLOEXEC, F{G,S}ETFD
- Add a pipe1() function to allow passing flags to the fd's that pipe(2)
  opens to ease implementation of linux pipe2(2)
- Factor out fp handling code from open(2) and fhopen(2)


To generate a diff of this commit:
cvs rdiff -u -r1.211 -r1.212 src/sys/kern/kern_descrip.c
cvs rdiff -u -r1.19 -r1.20 src/sys/kern/sys_descrip.c
cvs rdiff -u -r1.125 -r1.126 src/sys/kern/sys_generic.c
cvs rdiff -u -r1.129 -r1.130 src/sys/kern/sys_pipe.c
cvs rdiff -u -r1.141 -r1.142 src/sys/kern/uipc_syscalls.c
cvs rdiff -u -r1.421 -r1.422 src/sys/kern/vfs_syscalls.c
cvs rdiff -u -r1.36 -r1.37 src/sys/sys/fcntl.h
cvs rdiff -u -r1.58 -r1.59 src/sys/sys/filedesc.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_descrip.c
diff -u src/sys/kern/kern_descrip.c:1.211 src/sys/kern/kern_descrip.c:1.212
--- src/sys/kern/kern_descrip.c:1.211	Tue Feb 15 10:54:28 2011
+++ src/sys/kern/kern_descrip.c	Sun Apr 10 11:45:33 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_descrip.c,v 1.211 2011/02/15 15:54:28 pooka Exp $	*/
+/*	$NetBSD: kern_descrip.c,v 1.212 2011/04/10 15:45:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_descrip.c,v 1.211 2011/02/15 15:54:28 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_descrip.c,v 1.212 2011/04/10 15:45:33 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1776,6 +1776,16 @@
 	return error;
 }
 
+void
+fd_set_exclose(struct lwp *l, int fd, bool exclose)
+{
+	filedesc_t *fdp = l-l_fd;
+	fdfile_t *ff = fdp-fd_dt-dt_ff[fd];
+	ff-ff_exclose = exclose;
+	if (exclose)
+		fdp-fd_exclose = true;
+}
+
 /*
  * Return descriptor owner information. If the value is positive,
  * it's process ID. If it's negative, it's process group ID and

Index: src/sys/kern/sys_descrip.c
diff -u src/sys/kern/sys_descrip.c:1.19 src/sys/kern/sys_descrip.c:1.20
--- src/sys/kern/sys_descrip.c:1.19	Fri Dec 17 20:18:48 2010
+++ src/sys/kern/sys_descrip.c	Sun Apr 10 11:45:33 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_descrip.c,v 1.19 2010/12/18 01:18:48 rmind Exp $	*/
+/*	$NetBSD: sys_descrip.c,v 1.20 2011/04/10 15:45:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sys_descrip.c,v 1.19 2010/12/18 01:18:48 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: sys_descrip.c,v 1.20 2011/04/10 15:45:33 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -315,7 +315,6 @@
 	int fd, i, tmp, error, cmd, newmin;
 	filedesc_t *fdp;
 	file_t *fp;
-	fdfile_t *ff;
 	struct flock fl;
 
 	fd = SCARG(uap, fd);
@@ -358,7 +357,6 @@
 
 	if ((fp = fd_getfile(fd)) == NULL)
 		return (EBADF);
-	ff = fdp-fd_dt-dt_ff[fd];
 
 	if ((cmd  F_FSCTL)) {
 		error = fcntl_forfs(fd, fp, cmd, SCARG(uap, arg));
@@ -380,16 +378,12 @@
 		break;
 
 	case F_GETFD:
-		*retval = ff-ff_exclose;
+		*retval = fdp-fd_dt-dt_ff[fd]-ff_exclose;
 		break;
 
 	case F_SETFD:
-		if ((long)SCARG(uap, arg)  FD_CLOEXEC) {
-			ff-ff_exclose = true;
-			fdp-fd_exclose = true;
-		} else {
-			ff-ff_exclose = false;
-		}
+		fd_set_exclose(l, fd,
+		((long)SCARG(uap, arg)  FD_CLOEXEC) != 0);
 		break;
 
 	case F_GETFL:

Index: src/sys/kern/sys_generic.c
diff -u src/sys/kern/sys_generic.c:1.125 src/sys/kern/sys_generic.c:1.126
--- src/sys/kern/sys_generic.c:1.125	Tue Jan 18 14:52:23 2011
+++ src/sys/kern/sys_generic.c	Sun Apr 10 11:45:33 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_generic.c,v 1.125 2011/01/18 19:52:23 matt Exp $	*/
+/*	$NetBSD: sys_generic.c,v 1.126 2011/04/10 15:45:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sys_generic.c,v 1.125 2011/01/18 19:52:23 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: sys_generic.c,v 1.126 2011/04/10 15:45:33 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -522,20 +522,17 @@
 	} */
 	struct file	*fp;
 	proc_t		*p;
-	struct filedesc	*fdp;
 	u_long		com;
 	int		error;
 	size_t		size, alloc_size;
 	void 		*data, *memp;
 #define	STK_PARAMS	128
 	u_long		stkbuf[STK_PARAMS/sizeof(u_long)];
-	fdfile_t	*ff;
 
 	memp = NULL;
 	alloc_size = 0;
 	error = 0;
 	p = l-l_proc;
-	fdp = p-p_fd;
 
 	if ((fp = fd_getfile(SCARG(uap, fd))) == NULL)
 		return (EBADF);
@@ -546,15 +543,10 @@
 		goto out;
 	}
 
-	ff = fdp-fd_dt-dt_ff[SCARG(uap, fd)];
 	switch (com = SCARG(uap, com)) {
 	case FIONCLEX:
-		ff-ff_exclose = false;
-		goto out;
-
 	

CVS commit: src/lib/libc/sys

2011-04-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 15:46:15 UTC 2011

Modified Files:
src/lib/libc/sys: open.2

Log Message:
Document O_CLOEXEC.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/lib/libc/sys/open.2

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

Modified files:

Index: src/lib/libc/sys/open.2
diff -u src/lib/libc/sys/open.2:1.47 src/lib/libc/sys/open.2:1.48
--- src/lib/libc/sys/open.2:1.47	Wed Sep 22 13:58:09 2010
+++ src/lib/libc/sys/open.2	Sun Apr 10 11:46:15 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: open.2,v 1.47 2010/09/22 17:58:09 wiz Exp $
+.\	$NetBSD: open.2,v 1.48 2011/04/10 15:46:15 christos Exp $
 .\
 .\ Copyright (c) 1980, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\ @(#)open.2	8.2 (Berkeley) 11/16/93
 .\
-.Dd September 22, 2010
+.Dd April 10, 2011
 .Dt OPEN 2
 .Os
 .Sh NAME
@@ -56,7 +56,7 @@
 the values listed below.
 Applications must specify exactly one of the first three values
 (file access methods):
-.Bl -tag -offset indent -width O_NONBLOCK
+.Bl -tag -offset indent -width O_DIRECTORY
 .It Dv O_RDONLY
 Open for reading only.
 .It Dv O_WRONLY
@@ -66,7 +66,7 @@
 .El
 .Pp
 Any combination of the following may be used:
-.Bl -tag -offset indent -width O_NONBLOCK
+.Bl -tag -offset indent -width O_DIRECTORY
 .It Dv O_NONBLOCK
 Do not block on open or for data to become available.
 .It Dv O_APPEND
@@ -93,6 +93,12 @@
 If last path element is a symlink, don't follow it.
 This option is provided for compatibility with other operating
 systems, but its security value is questionable.
+.It Dv O_CLOEXEC
+Set the
+.Xr close 2
+on
+.Xr exec 2
+flag.
 .It Dv O_DSYNC
 If set, write operations will be performed according to synchronized
 I/O data integrity completion:



CVS commit: src/sys/compat/linux32/arch/amd64

2011-04-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 15:47:21 UTC 2011

Modified Files:
src/sys/compat/linux32/arch/amd64: syscalls.master

Log Message:
add pipe2 and dup3


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/compat/linux32/arch/amd64/syscalls.master

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/arch/amd64/syscalls.master
diff -u src/sys/compat/linux32/arch/amd64/syscalls.master:1.57 src/sys/compat/linux32/arch/amd64/syscalls.master:1.58
--- src/sys/compat/linux32/arch/amd64/syscalls.master:1.57	Tue Nov  2 14:14:06 2010
+++ src/sys/compat/linux32/arch/amd64/syscalls.master	Sun Apr 10 11:47:21 2011
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.57 2010/11/02 18:14:06 chs Exp $
+	$NetBSD: syscalls.master,v 1.58 2011/04/10 15:47:21 christos Exp $
 
 ; NetBSD i386 COMPAT_LINUX32 system call name/number master file.
 ; (See syscalls.conf to see what it is processed into.)
@@ -513,8 +513,8 @@
 327	UNIMPL	signalfd4
 328	UNIMPL	eventfd2
 329	UNIMPL	epoll_create1
-330	UNIMPL	dup3
-331	UNIMPL	pipe2
+330	STD	{ int|linux32_sys||dup3(int from, int to, int flags); }
+331 STD	{ int|linux32_sys||pipe2(netbsd32_intp fd, int flags); }
 332	UNIMPL	inotify_init1
 333	UNIMPL	preadv
 334	UNIMPL	pwritev



CVS commit: src/sys/compat/linux32/arch/amd64

2011-04-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 15:48:01 UTC 2011

Modified Files:
src/sys/compat/linux32/arch/amd64: linux32_syscall.h
linux32_syscallargs.h linux32_syscalls.c linux32_sysent.c

Log Message:
Regen: XXX: produces errors because of rump changes!


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 \
src/sys/compat/linux32/arch/amd64/linux32_syscall.h \
src/sys/compat/linux32/arch/amd64/linux32_syscallargs.h \
src/sys/compat/linux32/arch/amd64/linux32_syscalls.c \
src/sys/compat/linux32/arch/amd64/linux32_sysent.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/arch/amd64/linux32_syscall.h
diff -u src/sys/compat/linux32/arch/amd64/linux32_syscall.h:1.60 src/sys/compat/linux32/arch/amd64/linux32_syscall.h:1.61
--- src/sys/compat/linux32/arch/amd64/linux32_syscall.h:1.60	Tue Nov  2 14:15:39 2010
+++ src/sys/compat/linux32/arch/amd64/linux32_syscall.h	Sun Apr 10 11:48:01 2011
@@ -1,10 +1,10 @@
-/* $NetBSD: linux32_syscall.h,v 1.60 2010/11/02 18:15:39 chs Exp $ */
+/* $NetBSD: linux32_syscall.h,v 1.61 2011/04/10 15:48:01 christos Exp $ */
 
 /*
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.57 2010/11/02 18:14:06 chs Exp
+ * created from	NetBSD: syscalls.master,v 1.58 2011/04/10 15:47:21 christos Exp
  */
 
 #ifndef _LINUX32_SYS_SYSCALL_H_
@@ -612,6 +612,12 @@
 /* syscall: get_robust_list ret: int args: linux32_pid_t linux32_robust_list_headpp_t linux32_sizep_t */
 #define	LINUX32_SYS_get_robust_list	312
 
+/* syscall: dup3 ret: int args: int int int */
+#define	LINUX32_SYS_dup3	330
+
+/* syscall: pipe2 ret: int args: netbsd32_intp int */
+#define	LINUX32_SYS_pipe2	331
+
 #define	LINUX32_SYS_MAXSYSCALL	338
 #define	LINUX32_SYS_NSYSENT	512
 #endif /* _LINUX32_SYS_SYSCALL_H_ */
Index: src/sys/compat/linux32/arch/amd64/linux32_syscallargs.h
diff -u src/sys/compat/linux32/arch/amd64/linux32_syscallargs.h:1.60 src/sys/compat/linux32/arch/amd64/linux32_syscallargs.h:1.61
--- src/sys/compat/linux32/arch/amd64/linux32_syscallargs.h:1.60	Tue Nov  2 14:15:39 2010
+++ src/sys/compat/linux32/arch/amd64/linux32_syscallargs.h	Sun Apr 10 11:48:01 2011
@@ -1,10 +1,10 @@
-/* $NetBSD: linux32_syscallargs.h,v 1.60 2010/11/02 18:15:39 chs Exp $ */
+/* $NetBSD: linux32_syscallargs.h,v 1.61 2011/04/10 15:48:01 christos Exp $ */
 
 /*
  * System call argument lists.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.57 2010/11/02 18:14:06 chs Exp
+ * created from	NetBSD: syscalls.master,v 1.58 2011/04/10 15:47:21 christos Exp
  */
 
 #ifndef _LINUX32_SYS_SYSCALLARGS_H_
@@ -27,7 +27,7 @@
 	}
 
 #undef check_syscall_args
-#define check_syscall_args(call) \
+#define check_syscall_args(call) /*LINTED*/ \
 	typedef char call##_check_args[sizeof (struct call##_args) \
 		= LINUX32_SYS_MAXSYSARGS * sizeof (register32_t) ? 1 : -1];
 
@@ -871,6 +871,19 @@
 };
 check_syscall_args(linux32_sys_get_robust_list)
 
+struct linux32_sys_dup3_args {
+	syscallarg(int) from;
+	syscallarg(int) to;
+	syscallarg(int) flags;
+};
+check_syscall_args(linux32_sys_dup3)
+
+struct linux32_sys_pipe2_args {
+	syscallarg(netbsd32_intp) fd;
+	syscallarg(int) flags;
+};
+check_syscall_args(linux32_sys_pipe2)
+
 /*
  * System call prototypes.
  */
@@ -1253,4 +1266,8 @@
 
 int	linux32_sys_get_robust_list(struct lwp *, const struct linux32_sys_get_robust_list_args *, register_t *);
 
+int	linux32_sys_dup3(struct lwp *, const struct linux32_sys_dup3_args *, register_t *);
+
+int	linux32_sys_pipe2(struct lwp *, const struct linux32_sys_pipe2_args *, register_t *);
+
 #endif /* _LINUX32_SYS_SYSCALLARGS_H_ */
Index: src/sys/compat/linux32/arch/amd64/linux32_syscalls.c
diff -u src/sys/compat/linux32/arch/amd64/linux32_syscalls.c:1.60 src/sys/compat/linux32/arch/amd64/linux32_syscalls.c:1.61
--- src/sys/compat/linux32/arch/amd64/linux32_syscalls.c:1.60	Tue Nov  2 14:15:39 2010
+++ src/sys/compat/linux32/arch/amd64/linux32_syscalls.c	Sun Apr 10 11:48:01 2011
@@ -1,14 +1,14 @@
-/* $NetBSD: linux32_syscalls.c,v 1.60 2010/11/02 18:15:39 chs Exp $ */
+/* $NetBSD: linux32_syscalls.c,v 1.61 2011/04/10 15:48:01 christos Exp $ */
 
 /*
  * System call names.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.57 2010/11/02 18:14:06 chs Exp
+ * created from	NetBSD: syscalls.master,v 1.58 2011/04/10 15:47:21 christos Exp
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: linux32_syscalls.c,v 1.60 2010/11/02 18:15:39 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: linux32_syscalls.c,v 1.61 2011/04/10 15:48:01 christos Exp $);
 
 #if defined(_KERNEL_OPT)
 #include sys/param.h
@@ -367,12 +367,186 @@
 	/* 327 */	#327 (unimplemented signalfd4),
 	/* 328 */	#328 (unimplemented eventfd2),
 	/* 329 */	#329 

CVS commit: src/sys/compat/linux32/common

2011-04-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 15:48:23 UTC 2011

Modified Files:
src/sys/compat/linux32/common: linux32_unistd.c

Log Message:
implement pipe2 and dup3


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/compat/linux32/common/linux32_unistd.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_unistd.c
diff -u src/sys/compat/linux32/common/linux32_unistd.c:1.34 src/sys/compat/linux32/common/linux32_unistd.c:1.35
--- src/sys/compat/linux32/common/linux32_unistd.c:1.34	Wed Nov 11 04:48:51 2009
+++ src/sys/compat/linux32/common/linux32_unistd.c	Sun Apr 10 11:48:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_unistd.c,v 1.34 2009/11/11 09:48:51 rmind Exp $ */
+/*	$NetBSD: linux32_unistd.c,v 1.35 2011/04/10 15:48:23 christos Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: linux32_unistd.c,v 1.34 2009/11/11 09:48:51 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: linux32_unistd.c,v 1.35 2011/04/10 15:48:23 christos Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -47,6 +47,7 @@
 #include sys/ucred.h
 #include sys/swap.h
 #include sys/kauth.h
+#include sys/filedesc.h
 
 #include machine/types.h
 
@@ -62,6 +63,7 @@
 #include compat/linux/common/linux_oldolduname.h
 #include compat/linux/common/linux_ipc.h
 #include compat/linux/common/linux_sem.h
+#include compat/linux/common/linux_fcntl.h
 #include compat/linux/linux_syscallargs.h
 
 #include compat/linux32/common/linux32_types.h
@@ -221,8 +223,8 @@
 	return 0;
 }
 
-int
-linux32_sys_pipe(struct lwp *l, const struct linux32_sys_pipe_args *uap, register_t *retval)
+static int
+linux32_pipe(struct lwp *l, int *fd, register_t *retval, int flags)
 {
 	/* {
 		syscallarg(netbsd32_intp) fd;
@@ -230,21 +232,79 @@
 	int error;
 	int pfds[2];
 
-	if ((error = sys_pipe(l, 0, retval)))
-		return error;
-
 	pfds[0] = (int)retval[0];
 	pfds[1] = (int)retval[1];
 
-	if ((error = copyout(pfds, SCARG_P32(uap, fd), 2 * sizeof (int))) != 0)
+	if ((error = copyout(pfds, fd, 2 * sizeof(*fd))) != 0)
 		return error;
 
+	if (flags  LINUX_O_CLOEXEC) {
+		fd_set_exclose(l, retval[0], true);
+		fd_set_exclose(l, retval[1], true);
+	}
 	retval[0] = 0;
 	retval[1] = 0;
 
 	return 0;
 }
 
+int
+linux32_sys_pipe(struct lwp *l, const struct linux32_sys_pipe_args *uap,
+register_t *retval)
+{
+	int error;
+	if ((error = pipe1(l, retval, 0)))
+		return error;
+	return linux32_pipe(l, SCARG_P32(uap, fd), retval, 0);
+}
+
+int
+linux32_sys_pipe2(struct lwp *l, const struct linux32_sys_pipe2_args *uap,
+register_t *retval)
+{
+	int flag = 0;
+	int error;
+
+	switch (SCARG(uap, flags)) {
+	case LINUX_O_CLOEXEC:
+		break;
+	case LINUX_O_NONBLOCK:
+	case LINUX_O_NONBLOCK|LINUX_O_CLOEXEC:
+		flag = O_NONBLOCK;
+		break;
+	default:
+		return EINVAL;
+	}
+
+	if ((error = pipe1(l, retval, flag)))
+		return error;
+
+	return linux32_pipe(l, SCARG_P32(uap, fd), retval, SCARG(uap, flags));
+}
+
+int
+linux32_sys_dup3(struct lwp *l, const struct linux32_sys_dup3_args *uap,
+register_t *retval)
+{
+	/* {
+		syscallarg(int) from;
+		syscallarg(int) to;
+		syscallarg(int) flags;
+	} */
+	struct sys_dup2_args ua;
+	int error;
+
+	NETBSD32TO64_UAP(from);
+	NETBSD32TO64_UAP(to);
+
+	if ((error = sys_dup2(l, ua, retval)))
+		return error;
+
+	if (SCARG(uap, flags)  LINUX_O_CLOEXEC)
+		fd_set_exclose(l, SCARG(uap, to), true);
+
+	return 0;
+}
 
 int
 linux32_sys_unlink(struct lwp *l, const struct linux32_sys_unlink_args *uap, register_t *retval)



CVS commit: src/sys/compat/linux/arch

2011-04-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 15:48:46 UTC 2011

Modified Files:
src/sys/compat/linux/arch/amd64: syscalls.master
src/sys/compat/linux/arch/i386: syscalls.master

Log Message:
add pipe2 and dup3


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/compat/linux/arch/amd64/syscalls.master
cvs rdiff -u -r1.103 -r1.104 src/sys/compat/linux/arch/i386/syscalls.master

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/arch/amd64/syscalls.master
diff -u src/sys/compat/linux/arch/amd64/syscalls.master:1.35 src/sys/compat/linux/arch/amd64/syscalls.master:1.36
--- src/sys/compat/linux/arch/amd64/syscalls.master:1.35	Tue Jul  6 21:30:33 2010
+++ src/sys/compat/linux/arch/amd64/syscalls.master	Sun Apr 10 11:48:46 2011
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.35 2010/07/07 01:30:33 chs Exp $
+	$NetBSD: syscalls.master,v 1.36 2011/04/10 15:48:46 christos Exp $
 
 ;	@(#)syscalls.master	8.1 (Berkeley) 7/19/93
 
@@ -496,8 +496,8 @@
 289	UNIMPL		signalfd4
 290	UNIMPL		eventfd2
 291	UNIMPL		epoll_create1
-292	UNIMPL		dup3
-293	UNIMPL		pipe2
+292	STD		{ int|linux_sys||dup3(int from, int to, int flags); }
+293	STD		{ int|linux_sys||pipe2(int *pfds, int flags); }
 294	UNIMPL		inotify_init1
 295	UNIMPL		preadv
 296	UNIMPL		pwritev

Index: src/sys/compat/linux/arch/i386/syscalls.master
diff -u src/sys/compat/linux/arch/i386/syscalls.master:1.103 src/sys/compat/linux/arch/i386/syscalls.master:1.104
--- src/sys/compat/linux/arch/i386/syscalls.master:1.103	Tue Jul  6 21:30:34 2010
+++ src/sys/compat/linux/arch/i386/syscalls.master	Sun Apr 10 11:48:46 2011
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.103 2010/07/07 01:30:34 chs Exp $
+	$NetBSD: syscalls.master,v 1.104 2011/04/10 15:48:46 christos Exp $
 
 ;	@(#)syscalls.master	8.1 (Berkeley) 7/19/93
 
@@ -509,8 +509,9 @@
 327	UNIMPL		signalfd4
 328	UNIMPL		eventfd2
 329	UNIMPL		epoll_create1
-330	UNIMPL		dup3
-331	UNIMPL		pipe2
+330 STD { int|linux_sys||dup3(u_int from, u_int to, \
+int flags); }
+331 STD { int|linux_sys||pipe2( int *pfds, int flags); }
 332	UNIMPL		inotify_init1
 333	UNIMPL		preadv
 334	UNIMPL		pwritev



CVS commit: src/sys/compat/linux/arch

2011-04-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 15:49:24 UTC 2011

Modified Files:
src/sys/compat/linux/arch/amd64: linux_syscall.h linux_syscallargs.h
linux_syscalls.c linux_sysent.c
src/sys/compat/linux/arch/i386: linux_syscall.h linux_syscallargs.h
linux_syscalls.c linux_sysent.c

Log Message:
Regen: Argh:
cat: rumphdr.types: No such file or directory
rm: rumphdr.types: No such file or directory
*** Error code 1


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/compat/linux/arch/amd64/linux_syscall.h \
src/sys/compat/linux/arch/amd64/linux_syscallargs.h \
src/sys/compat/linux/arch/amd64/linux_syscalls.c \
src/sys/compat/linux/arch/amd64/linux_sysent.c
cvs rdiff -u -r1.88 -r1.89 src/sys/compat/linux/arch/i386/linux_syscall.h \
src/sys/compat/linux/arch/i386/linux_syscallargs.h \
src/sys/compat/linux/arch/i386/linux_sysent.c
cvs rdiff -u -r1.89 -r1.90 src/sys/compat/linux/arch/i386/linux_syscalls.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/arch/amd64/linux_syscall.h
diff -u src/sys/compat/linux/arch/amd64/linux_syscall.h:1.38 src/sys/compat/linux/arch/amd64/linux_syscall.h:1.39
--- src/sys/compat/linux/arch/amd64/linux_syscall.h:1.38	Tue Jul  6 21:31:51 2010
+++ src/sys/compat/linux/arch/amd64/linux_syscall.h	Sun Apr 10 11:49:23 2011
@@ -1,10 +1,10 @@
-/* $NetBSD: linux_syscall.h,v 1.38 2010/07/07 01:31:51 chs Exp $ */
+/* $NetBSD: linux_syscall.h,v 1.39 2011/04/10 15:49:23 christos Exp $ */
 
 /*
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.35 2010/07/07 01:30:33 chs Exp
+ * created from	NetBSD: syscalls.master,v 1.36 2011/04/10 15:48:46 christos Exp
  */
 
 #ifndef _LINUX_SYS_SYSCALL_H_
@@ -591,6 +591,12 @@
 /* syscall: get_robust_list ret: int args: int struct linux_robust_list_head ** size_t * */
 #define	LINUX_SYS_get_robust_list	274
 
+/* syscall: dup3 ret: int args: int int int */
+#define	LINUX_SYS_dup3	292
+
+/* syscall: pipe2 ret: int args: int * int */
+#define	LINUX_SYS_pipe2	293
+
 /* syscall: nosys ret: int args: */
 #define	LINUX_SYS_nosys	300
 
Index: src/sys/compat/linux/arch/amd64/linux_syscallargs.h
diff -u src/sys/compat/linux/arch/amd64/linux_syscallargs.h:1.38 src/sys/compat/linux/arch/amd64/linux_syscallargs.h:1.39
--- src/sys/compat/linux/arch/amd64/linux_syscallargs.h:1.38	Tue Jul  6 21:31:51 2010
+++ src/sys/compat/linux/arch/amd64/linux_syscallargs.h	Sun Apr 10 11:49:23 2011
@@ -1,10 +1,10 @@
-/* $NetBSD: linux_syscallargs.h,v 1.38 2010/07/07 01:31:51 chs Exp $ */
+/* $NetBSD: linux_syscallargs.h,v 1.39 2011/04/10 15:49:23 christos Exp $ */
 
 /*
  * System call argument lists.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.35 2010/07/07 01:30:33 chs Exp
+ * created from	NetBSD: syscalls.master,v 1.36 2011/04/10 15:48:46 christos Exp
  */
 
 #ifndef _LINUX_SYS_SYSCALLARGS_H_
@@ -27,7 +27,7 @@
 	}
 
 #undef check_syscall_args
-#define check_syscall_args(call) \
+#define check_syscall_args(call) /*LINTED*/ \
 	typedef char call##_check_args[sizeof (struct call##_args) \
 		= LINUX_SYS_MAXSYSARGS * sizeof (register_t) ? 1 : -1];
 
@@ -890,6 +890,19 @@
 };
 check_syscall_args(linux_sys_get_robust_list)
 
+struct linux_sys_dup3_args {
+	syscallarg(int) from;
+	syscallarg(int) to;
+	syscallarg(int) flags;
+};
+check_syscall_args(linux_sys_dup3)
+
+struct linux_sys_pipe2_args {
+	syscallarg(int *) pfds;
+	syscallarg(int) flags;
+};
+check_syscall_args(linux_sys_pipe2)
+
 /*
  * System call prototypes.
  */
@@ -1285,6 +1298,10 @@
 
 int	linux_sys_get_robust_list(struct lwp *, const struct linux_sys_get_robust_list_args *, register_t *);
 
+int	linux_sys_dup3(struct lwp *, const struct linux_sys_dup3_args *, register_t *);
+
+int	linux_sys_pipe2(struct lwp *, const struct linux_sys_pipe2_args *, register_t *);
+
 int	linux_sys_nosys(struct lwp *, const void *, register_t *);
 
 #endif /* _LINUX_SYS_SYSCALLARGS_H_ */
Index: src/sys/compat/linux/arch/amd64/linux_syscalls.c
diff -u src/sys/compat/linux/arch/amd64/linux_syscalls.c:1.38 src/sys/compat/linux/arch/amd64/linux_syscalls.c:1.39
--- src/sys/compat/linux/arch/amd64/linux_syscalls.c:1.38	Tue Jul  6 21:31:51 2010
+++ src/sys/compat/linux/arch/amd64/linux_syscalls.c	Sun Apr 10 11:49:23 2011
@@ -1,14 +1,14 @@
-/* $NetBSD: linux_syscalls.c,v 1.38 2010/07/07 01:31:51 chs Exp $ */
+/* $NetBSD: linux_syscalls.c,v 1.39 2011/04/10 15:49:23 christos Exp $ */
 
 /*
  * System call names.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.35 2010/07/07 01:30:33 chs Exp
+ * created from	NetBSD: syscalls.master,v 1.36 2011/04/10 15:48:46 christos Exp
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: linux_syscalls.c,v 1.38 

CVS commit: src/sys/compat/linux/common

2011-04-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 15:49:56 UTC 2011

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

Log Message:
We have O_CLOEXEC now


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/compat/linux/common/linux_file.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_file.c
diff -u src/sys/compat/linux/common/linux_file.c:1.101 src/sys/compat/linux/common/linux_file.c:1.102
--- src/sys/compat/linux/common/linux_file.c:1.101	Fri Nov 19 01:44:37 2010
+++ src/sys/compat/linux/common/linux_file.c	Sun Apr 10 11:49:56 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_file.c,v 1.101 2010/11/19 06:44:37 dholland Exp $	*/
+/*	$NetBSD: linux_file.c,v 1.102 2011/04/10 15:49:56 christos Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: linux_file.c,v 1.101 2010/11/19 06:44:37 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: linux_file.c,v 1.102 2011/04/10 15:49:56 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -102,6 +102,7 @@
 	res |= cvtto_bsd_mask(lflags, LINUX_FASYNC, O_ASYNC);
 	res |= cvtto_bsd_mask(lflags, LINUX_O_APPEND, O_APPEND);
 	res |= cvtto_bsd_mask(lflags, LINUX_O_DIRECTORY, O_DIRECTORY);
+	res |= cvtto_bsd_mask(lflags, LINUX_O_CLOEXEC, O_CLOEXEC);
 
 	return res;
 }
@@ -123,6 +124,7 @@
 	res |= cvtto_linux_mask(bflags, O_ASYNC, LINUX_FASYNC);
 	res |= cvtto_linux_mask(bflags, O_APPEND, LINUX_O_APPEND);
 	res |= cvtto_linux_mask(bflags, O_DIRECTORY, LINUX_O_DIRECTORY);
+	res |= cvtto_linux_mask(bflags, O_CLOEXEC, LINUX_O_CLOEXEC);
 
 	return res;
 }



CVS commit: src/sys/compat/linux/common

2011-04-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 15:50:34 UTC 2011

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

Log Message:
- implement dup3 and pipe2
- eliminate amd64 ifdef


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/compat/linux/common/linux_pipe.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_pipe.c
diff -u src/sys/compat/linux/common/linux_pipe.c:1.63 src/sys/compat/linux/common/linux_pipe.c:1.64
--- src/sys/compat/linux/common/linux_pipe.c:1.63	Wed Jun 18 08:24:18 2008
+++ src/sys/compat/linux/common/linux_pipe.c	Sun Apr 10 11:50:34 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_pipe.c,v 1.63 2008/06/18 12:24:18 tsutsui Exp $	*/
+/*	$NetBSD: linux_pipe.c,v 1.64 2011/04/10 15:50:34 christos Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: linux_pipe.c,v 1.63 2008/06/18 12:24:18 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: linux_pipe.c,v 1.64 2011/04/10 15:50:34 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -39,6 +39,8 @@
 #include sys/mbuf.h
 #include sys/mman.h
 #include sys/mount.h
+#include sys/fcntl.h
+#include sys/filedesc.h
 
 #include sys/sched.h
 #include sys/syscallargs.h
@@ -48,6 +50,7 @@
 #include compat/linux/common/linux_signal.h
 #include compat/linux/common/linux_ipc.h
 #include compat/linux/common/linux_sem.h
+#include compat/linux/common/linux_fcntl.h
 
 #include compat/linux/linux_syscallargs.h
 
@@ -59,33 +62,90 @@
  * NetBSD passes fd[0] in retval[0], and fd[1] in retval[1].
  * Linux directly passes the pointer.
  */
+static int
+linux_pipe_return(struct lwp *l, int *pfds, register_t *retval, int flags)
+{
+	int error;
+
+	if (sizeof(*retval) != sizeof(*pfds)) {
+		/* On amd64, sizeof(register_t) != sizeof(int) */
+		int rpfds[2];
+		rpfds[0] = (int)retval[0];
+		rpfds[1] = (int)retval[1];
+
+		if ((error = copyout(rpfds, pfds, sizeof(rpfds
+			return error;
+	} else {
+		if ((error = copyout(retval, pfds, 2 * sizeof(*pfds
+			return error;
+	}
+	if (flags  LINUX_O_CLOEXEC) {
+		fd_set_exclose(l, retval[0], true);
+		fd_set_exclose(l, retval[1], true);
+	}
+	retval[0] = 0;
+	return 0;
+}
+
 int
-linux_sys_pipe(struct lwp *l, const struct linux_sys_pipe_args *uap, register_t *retval)
+linux_sys_pipe(struct lwp *l, const struct linux_sys_pipe_args *uap,
+register_t *retval)
 {
 	/* {
 		syscallarg(int *) pfds;
 	} */
 	int error;
-#ifdef __amd64__
-	int pfds[2];
-#endif
 
-	if ((error = sys_pipe(l, 0, retval)))
+	if ((error = pipe1(l, retval, 0)))
 		return error;
 
-#ifndef __amd64__
-	/* Assumes register_t is an int */
-	if ((error = copyout(retval, SCARG(uap, pfds), 2 * sizeof (int
+	return linux_pipe_return(l, SCARG(uap, pfds), retval, 0);
+}
+
+int
+linux_sys_pipe2(struct lwp *l, const struct linux_sys_pipe2_args *uap,
+register_t *retval)
+{
+	/* {
+		syscallarg(int *) pfds;
+		syscallarg(int) flags;
+	} */
+	int error;
+	int flag = 0;
+
+	switch (SCARG(uap, flags)) {
+	case LINUX_O_CLOEXEC:
+		break;
+	case LINUX_O_NONBLOCK:
+	case LINUX_O_NONBLOCK|LINUX_O_CLOEXEC:
+		flag = O_NONBLOCK;
+		break;
+	default:
+		return EINVAL;
+	}
+
+	if ((error = pipe1(l, retval, flag)))
 		return error;
-#else
-	/* On amd64, sizeof(register_t) != sizeof(int) */
-	pfds[0] = (int)retval[0];
-	pfds[1] = (int)retval[1];
 
-	if ((error = copyout(pfds, SCARG(uap, pfds), sizeof(pfds
+	return linux_pipe_return(l, SCARG(uap, pfds), retval,
+	SCARG(uap, flags));
+}
+
+int
+linux_sys_dup3(struct lwp *l, const struct linux_sys_dup3_args *uap,
+register_t *retval)
+{
+	/* {
+		syscallarg(int) from;
+		syscallarg(int) to;
+		syscallarg(int) flags;
+	} */
+	int error;
+	if ((error = sys_dup2(l, (const struct sys_dup2_args *)uap, retval)))
 		return error;
-#endif
 
-	retval[0] = 0;
+	if (SCARG(uap, flags)  LINUX_O_CLOEXEC)
+		fd_set_exclose(l, SCARG(uap, to), true);
+
 	return 0;
 }



CVS commit: src/sys/arch

2011-04-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 20:36:49 UTC 2011

Modified Files:
src/sys/arch/amd64/amd64: db_disasm.c
src/sys/arch/amd64/conf: files.amd64
src/sys/arch/amd64/include: db_machdep.h
src/sys/arch/i386/conf: files.i386
src/sys/arch/i386/include: db_machdep.h
src/sys/arch/x86/conf: files.x86
Added Files:
src/sys/arch/amd64/amd64: db_machdep.c
src/sys/arch/i386/i386: db_machdep.c
src/sys/arch/x86/include: db_machdep.h
src/sys/arch/x86/x86: db_trace.c
Removed Files:
src/sys/arch/amd64/amd64: db_trace.c
src/sys/arch/i386/i386: db_trace.c

Log Message:
Merge db_trace for x86. From: Vladimir Kirillov proger at wilab dot org dot ua


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/amd64/amd64/db_disasm.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/amd64/amd64/db_machdep.c
cvs rdiff -u -r1.18 -r0 src/sys/arch/amd64/amd64/db_trace.c
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/amd64/conf/files.amd64
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/amd64/include/db_machdep.h
cvs rdiff -u -r1.356 -r1.357 src/sys/arch/i386/conf/files.i386
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/i386/db_machdep.c
cvs rdiff -u -r1.66 -r0 src/sys/arch/i386/i386/db_trace.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/i386/include/db_machdep.h
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/x86/conf/files.x86
cvs rdiff -u -r0 -r1.1 src/sys/arch/x86/include/db_machdep.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/x86/x86/db_trace.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/amd64/amd64/db_disasm.c
diff -u src/sys/arch/amd64/amd64/db_disasm.c:1.14 src/sys/arch/amd64/amd64/db_disasm.c:1.15
--- src/sys/arch/amd64/amd64/db_disasm.c:1.14	Fri Feb 18 13:00:52 2011
+++ src/sys/arch/amd64/amd64/db_disasm.c	Sun Apr 10 16:36:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.14 2011/02/18 18:00:52 drochner Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.15 2011/04/10 20:36:49 christos Exp $	*/
 
 /* 
  * Mach Operating System
@@ -33,10 +33,9 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: db_disasm.c,v 1.14 2011/02/18 18:00:52 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: db_disasm.c,v 1.15 2011/04/10 20:36:49 christos Exp $);
 
 #ifndef _KERNEL
-#include stubs.h
 #include sys/types.h
 #include sys/time.h
 #include sys/ksyms.h

Index: src/sys/arch/amd64/conf/files.amd64
diff -u src/sys/arch/amd64/conf/files.amd64:1.71 src/sys/arch/amd64/conf/files.amd64:1.72
--- src/sys/arch/amd64/conf/files.amd64:1.71	Mon Apr  4 17:35:31 2011
+++ src/sys/arch/amd64/conf/files.amd64	Sun Apr 10 16:36:49 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: files.amd64,v 1.71 2011/04/04 21:35:31 dyoung Exp $
+#	$NetBSD: files.amd64,v 1.72 2011/04/10 20:36:49 christos Exp $
 #
 # new style config file for amd64 architecture
 #
@@ -34,9 +34,9 @@
 file	arch/amd64/amd64/cpu_in_cksum.S		(inet | inet6)  cpu_in_cksum
 file	arch/amd64/amd64/cpufunc.S
 file	arch/amd64/amd64/db_disasm.c		ddb
-file	arch/amd64/amd64/db_interface.c	ddb
+file	arch/amd64/amd64/db_interface.c		ddb
+file	arch/amd64/amd64/db_machdep.c		ddb
 file	arch/amd64/amd64/db_memrw.c		ddb | kgdb
-file	arch/amd64/amd64/db_trace.c		ddb
 file	arch/amd64/amd64/kobj_machdep.c		modular
 file	arch/amd64/amd64/kgdb_machdep.c		kgdb
 file	kern/subr_disk_mbr.c			disk

Index: src/sys/arch/amd64/include/db_machdep.h
diff -u src/sys/arch/amd64/include/db_machdep.h:1.9 src/sys/arch/amd64/include/db_machdep.h:1.10
--- src/sys/arch/amd64/include/db_machdep.h:1.9	Sat Mar 14 10:45:54 2009
+++ src/sys/arch/amd64/include/db_machdep.h	Sun Apr 10 16:36:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_machdep.h,v 1.9 2009/03/14 14:45:54 dsl Exp $	*/
+/*	$NetBSD: db_machdep.h,v 1.10 2011/04/10 20:36:49 christos Exp $	*/
 
 /* 
  * Mach Operating System
@@ -44,6 +44,13 @@
 typedef	long		db_expr_t;	/* expression - signed */
 
 typedef struct trapframe db_regs_t;
+
+struct x86_64_frame {
+	struct x86_64_frame	*f_frame;
+	long			f_retaddr;
+	long			f_arg0;
+};
+
 #ifndef MULTIPROCESSOR
 extern db_regs_t ddb_regs;	/* register state */
 #define	DDB_REGS	(ddb_regs)
@@ -125,10 +132,12 @@
 
 int kdb_trap(int, int, db_regs_t *);
 
+#ifdef _KERNEL
 /*
  * We define some of our own commands
  */
 #define DB_MACHINE_COMMANDS
+#endif
 
 #define	DB_ELF_SYMBOLS
 #define	DB_ELFSIZE	64

Index: src/sys/arch/i386/conf/files.i386
diff -u src/sys/arch/i386/conf/files.i386:1.356 src/sys/arch/i386/conf/files.i386:1.357
--- src/sys/arch/i386/conf/files.i386:1.356	Thu Feb 24 05:56:01 2011
+++ src/sys/arch/i386/conf/files.i386	Sun Apr 10 16:36:48 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i386,v 1.356 2011/02/24 10:56:01 jruoho Exp $
+#	$NetBSD: files.i386,v 1.357 2011/04/10 20:36:48 christos Exp $
 #
 # new style config file for i386 architecture
 #
@@ -67,8 +67,8 @@
 file	arch/i386/i386/db_dbgreg.S	ddb | kstack_check_dr0
 file	arch/i386/i386/db_disasm.c	ddb
 file	

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

2011-04-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 20:38:37 UTC 2011

Modified Files:
src/sys/arch/x86/include: db_machdep.h

Log Message:
something ate my /


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/include/db_machdep.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/x86/include/db_machdep.h
diff -u src/sys/arch/x86/include/db_machdep.h:1.1 src/sys/arch/x86/include/db_machdep.h:1.2
--- src/sys/arch/x86/include/db_machdep.h:1.1	Sun Apr 10 16:36:48 2011
+++ src/sys/arch/x86/include/db_machdep.h	Sun Apr 10 16:38:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_machdep.h,v 1.1 2011/04/10 20:36:48 christos Exp $	*
+/*	$NetBSD: db_machdep.h,v 1.2 2011/04/10 20:38:37 christos Exp $	*/
 
 #ifndef _X86_DB_MACHDEP_H_
 #define _X86_DB_MACHDEP_H_



CVS commit: src/usr.sbin/crash

2011-04-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 20:39:43 UTC 2011

Modified Files:
src/usr.sbin/crash: Makefile crash.c

Log Message:
- amd64 support
- fix end of file handling
From: Vladimir Kirillov proger at wilab dot org dot ua


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/crash/Makefile
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/crash/crash.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/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.6 src/usr.sbin/crash/Makefile:1.7
--- src/usr.sbin/crash/Makefile:1.6	Mon Mar 21 01:09:33 2011
+++ src/usr.sbin/crash/Makefile	Sun Apr 10 16:39:42 2011
@@ -1,24 +1,23 @@
-#	$NetBSD: Makefile,v 1.6 2011/03/21 05:09:33 joerg Exp $
+#	$NetBSD: Makefile,v 1.7 2011/04/10 20:39:42 christos Exp $
 
-PROG=	crash
-MAN=	crash.8
+PROG=		crash
+MAN=		crash.8
 RUMPKERNEL=	yes	# XXX: Avoid -mcmodel=kernel
 
-LDADD+=	-lkvm -ledit -lterminfo -T${.CURDIR}/ldscript.crash
-DPADD+=	${LIBKVM} ${LIBEDIT} ${LIBTERMINFO}
+LDADD+=	-lutil -lkvm -ledit -lterminfo -T${.CURDIR}/ldscript.crash
+DPADD+=	${LIBUTIL} ${LIBKVM} ${LIBEDIT} ${LIBTERMINFO}
 
 # some ddb kernel components need limited modifications.  for now,
 # punt if not noted as implemented here.
-.if (${MACHINE} != i386)
-
+.if !empty(${MACHINE:C/(amd64|i386)//})
 SRCS+=	unsupported.c
-
 .else
 
-S=	${.CURDIR}/../../sys
+S=		${.CURDIR}/../../sys
 
 CPPFLAGS+=	-I${.CURDIR} -I${.OBJDIR} -I${S} -fno-strict-aliasing
 CPPFLAGS+=	-DDDB_VERBOSE_HELP -DDB_MAX_LINE=1000 -D_KMEMUSER
+CPPFLAGS+=	-DDB_AOUT_SYMBOLS -UDB_MACHINE_COMMANDS
 
 # ddb files from kernel
 .PATH:	$S/ddb
@@ -27,24 +26,24 @@
 SRCS+=	db_expr.c db_lex.c db_output.c db_print.c
 SRCS+=	db_sym.c db_variables.c db_write_cmd.c
 
-# db_trace.c, db_disasm.c
-.PATH:	${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
-.for i in ${i} db_disasm db_trace
-. if (exists(${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}/${i}.c))
-SRCS+=	${i}.c
+.PATH:	${S}/arch/${MACHINE}/${MACHINE}
+SRCS+=	db_machdep.c db_disasm.c
+
+. if empty(${MACHINE:C/(amd64|i386)//})
+.PATH:	${S}/arch/x86/x86
+SRCS+=	db_trace.c
 . endif
-.endfor
 
 # crash main source
 SRCS+=	crash.c
 
 # arch.c
 .PATH:	${.CURDIR}/arch
-.if (exists(${.CURDIR}/arch/${MACHINE_ARCH}.c))
+. if (exists(${.CURDIR}/arch/${MACHINE_ARCH}.c))
 SRCS+=	${MACHINE_ARCH}.c
-.else
+. else
 SRCS+=	generic.c
-.endif
+. endif
 
 # vers.c
 SRCS+=	vers.c

Index: src/usr.sbin/crash/crash.c
diff -u src/usr.sbin/crash/crash.c:1.2 src/usr.sbin/crash/crash.c:1.3
--- src/usr.sbin/crash/crash.c:1.2	Thu Apr 16 02:52:08 2009
+++ src/usr.sbin/crash/crash.c	Sun Apr 10 16:39:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: crash.c,v 1.2 2009/04/16 06:52:08 lukem Exp $	*/
+/*	$NetBSD: crash.c,v 1.3 2011/04/10 20:39:42 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: crash.c,v 1.2 2009/04/16 06:52:08 lukem Exp $);
+__RCSID($NetBSD: crash.c,v 1.3 2011/04/10 20:39:42 christos Exp $);
 #endif /* not lint */
 
 #include ddb/ddb.h
@@ -52,18 +52,20 @@
 #include kvm.h
 #include err.h
 #include ctype.h
+#include util.h
 
 #include extern.h
 
 #define	MAXSTAB	(16 * 1024 * 1024)
 
-static kvm_t	*kd;
 db_regs_t	ddb_regs;
-History		*hist;
-HistEvent	he;
-EditLine	*elptr;
-char		imgrelease[16];
-FILE		*ofp;
+
+static kvm_t		*kd;
+static History		*hist;
+static HistEvent	he;
+static EditLine		*elptr;
+static char		imgrelease[16];
+static FILE		*ofp;
 
 static struct nlist nl[] = {
 #define	X_OSRELEASE	0
@@ -73,6 +75,18 @@
 	{ .n_name = NULL },
 };
 
+static void
+cleanup(void)
+{
+	if (ofp != stdout) {
+		(void)fflush(ofp);
+		(void)pclose(ofp);
+		ofp = stdout;
+	}
+	el_end(elptr);
+	history_end(hist);
+}
+
 void
 db_vprintf(const char *fmt, va_list ap)
 {
@@ -121,14 +135,14 @@
 db_alloc(size_t sz)
 {
 
-	return malloc(sz);
+	return emalloc(sz);
 }
 
 void *
 db_zalloc(size_t sz)
 {
 
-	return calloc(1, sz);
+	return ecalloc(1, sz);
 }
 
 void
@@ -231,9 +245,8 @@
 
 	/* Read next command. */
 	el = el_gets(elptr, cnt);
-	if (el == NULL) {
-		*lstart = '\0';
-		return 0;
+	if (el == NULL) {	/* EOF */
+		exit(EXIT_SUCCESS);
 	}
 
 	/* Save to history, and copy to caller's buffer. */
@@ -255,7 +268,7 @@
 
 	/* Open a pipe to specified command, redirect output. */
 	assert(ofp == stdout);
-	for (*pcmd++ = '\0'; isspace((int)*pcmd); pcmd++) {
+	for (*pcmd++ = '\0'; isspace((unsigned char)*pcmd); pcmd++) {
 		/* nothing */
 	}
 	errno = 0;
@@ -323,6 +336,8 @@
 	memf = _PATH_MEM;
 	ofp = stdout;
 
+	setprogname(argv[0]);
+
 	/*
 	 * Parse options.
 	 */
@@ -354,31 +369,30 @@
 		return EXIT_FAILURE;
 	}
 	fd = open(nlistf, O_RDONLY);
-	if (fd  0)  {
-		err(EXIT_FAILURE, open(%s), nlistf);
+	if (fd == -1)  {
+		err(EXIT_FAILURE, open `%s', nlistf);
 	}
-	if (fstat(fd, sb)  0) {
-		err(EXIT_FAILURE, stat(%s), nlistf);
+	if (fstat(fd, sb) == -1) {
+		

CVS commit: src/sys/ddb

2011-04-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 20:59:22 UTC 2011

Modified Files:
src/sys/ddb: db_command.c db_interface.h db_proc.c

Log Message:
Add:
usage: show proc [/a] [/p] address|pid
/a == argument is an address of any lwp
/p == argument is a pid [default]
From: Vladimir Kirillov proger at wilab dot org dot ua


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/ddb/db_command.c
cvs rdiff -u -r1.25 -r1.26 src/sys/ddb/db_interface.h
cvs rdiff -u -r1.3 -r1.4 src/sys/ddb/db_proc.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/ddb/db_command.c
diff -u src/sys/ddb/db_command.c:1.134 src/sys/ddb/db_command.c:1.135
--- src/sys/ddb/db_command.c:1.134	Mon Sep 13 04:42:04 2010
+++ src/sys/ddb/db_command.c	Sun Apr 10 16:59:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_command.c,v 1.134 2010/09/13 08:42:04 drochner Exp $	*/
+/*	$NetBSD: db_command.c,v 1.135 2011/04/10 20:59:22 christos Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2009 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: db_command.c,v 1.134 2010/09/13 08:42:04 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: db_command.c,v 1.135 2011/04/10 20:59:22 christos Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_aio.h
@@ -219,10 +219,12 @@
 #endif
 	{ DDB_ADD_CMD(pages,	db_show_all_pages,
 	0 ,List all used memory pages.,NULL,NULL) },
+	{ DDB_ADD_CMD(proc,	db_show_proc,
+	0 ,Print process information.,NULL,NULL) },
 	{ DDB_ADD_CMD(procs,	db_show_all_procs,
 	0 ,List all processes.,NULL,NULL) },
 	{ DDB_ADD_CMD(pools,	db_show_all_pools,
-	0 ,Show all poolS,NULL,NULL) },
+	0 ,Show all pools,NULL,NULL) },
 #ifdef AIO
 	/*added from all sub cmds*/
 	{ DDB_ADD_CMD(aio_jobs,	db_show_aio_jobs,	0,

Index: src/sys/ddb/db_interface.h
diff -u src/sys/ddb/db_interface.h:1.25 src/sys/ddb/db_interface.h:1.26
--- src/sys/ddb/db_interface.h:1.25	Wed Feb 18 08:31:59 2009
+++ src/sys/ddb/db_interface.h	Sun Apr 10 16:59:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.h,v 1.25 2009/02/18 13:31:59 yamt Exp $	*/
+/*	$NetBSD: db_interface.h,v 1.26 2011/04/10 20:59:22 christos Exp $	*/
 
 /*-
  * Copyright (c) 1995 The NetBSD Foundation, Inc.
@@ -46,6 +46,7 @@
 
 /* kern/kern_proc.c */
 void		db_kill_proc(db_expr_t, bool, db_expr_t, const char *);
+void		db_show_proc(db_expr_t, bool, db_expr_t, const char *);
 void		db_show_all_procs(db_expr_t, bool, db_expr_t, const char *);
 void		db_show_all_pools(db_expr_t, bool, db_expr_t, const char *);
 void		db_show_sched_qs(db_expr_t, bool, db_expr_t, const char *);

Index: src/sys/ddb/db_proc.c
diff -u src/sys/ddb/db_proc.c:1.3 src/sys/ddb/db_proc.c:1.4
--- src/sys/ddb/db_proc.c:1.3	Mon Mar  9 02:07:05 2009
+++ src/sys/ddb/db_proc.c	Sun Apr 10 16:59:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_proc.c,v 1.3 2009/03/09 06:07:05 mrg Exp $	*/
+/*	$NetBSD: db_proc.c,v 1.4 2011/04/10 20:59:22 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: db_proc.c,v 1.3 2009/03/09 06:07:05 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: db_proc.c,v 1.4 2011/04/10 20:59:22 christos Exp $);
 
 #ifndef _KERNEL
 #include stdbool.h
@@ -129,8 +129,8 @@
 	if (mode == NULL || *mode == 'm') {
 		db_printf(usage: show all procs [/a] [/l] [/n] [/w]\n);
 		db_printf(\t/a == show process address info\n);
-		db_printf(\t/l == show LWP info\n);
-		db_printf(\t/n == show normal process info [default]\n);
+		db_printf(\t/l == show LWP info [default]\n);
+		db_printf(\t/n == show normal process info\n);
 		db_printf(\t/w == show process wait/emul info\n);
 		return;
 	}
@@ -257,3 +257,86 @@
 	}
 }
 
+void
+db_show_proc(db_expr_t addr, bool haddr, db_expr_t count, const char *modif)
+{
+	static proc_t p;
+	static lwp_t l;
+	const char *mode;
+	proc_t *pp;
+	lwp_t *lp;
+	char db_nbuf[MAXCOMLEN + 1], wbuf[MAXCOMLEN + 1];
+	bool run;
+	int cpuno;
+
+	if (modif[0] == 0)
+		mode = p;			/* default == by pid */
+	else
+		mode = strchr(ap, modif[0]);
+
+	if (mode == NULL || !haddr) {
+		db_printf(usage: show proc [/a] [/p] address|pid\n);
+		db_printf(\t/a == argument is an address of any lwp\n);
+		db_printf(\t/p == argument is a pid [default]\n);
+		return;
+	}
+
+	switch (*mode) {
+	case 'a':
+		lp = (lwp_t *)addr;
+		db_printf(lwp_t %lx\n, (long)lp);
+		db_read_bytes((db_addr_t)lp, sizeof(l), (char *)l);
+		pp = l.l_proc;
+		break;
+	default:
+	case 'p':
+		pp = db_proc_find((pid_t)addr);
+		lp = NULL;
+		break;
+	}
+
+	if (pp == NULL) {
+		db_printf(bad address\n);
+		return;
+	}
+
+	db_read_bytes((db_addr_t)pp, sizeof(p), (char *)p);
+	if (lp == NULL)
+		lp = p.p_lwps.lh_first;
+
+	db_printf(%s: pid %d proc %lx vmspace/map %lx flags %x\n,
+	p.p_comm, p.p_pid, (long)pp, (long)p.p_vmspace, p.p_flag);
+
+	while (lp != NULL) {
+		

CVS commit: src/lib/librumphijack

2011-04-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 12 19:49:48 UTC 2011

Modified Files:
src/lib/librumphijack: hijack.c

Log Message:
Fix SSP builds (Vladimir Kirillov)


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/lib/librumphijack/hijack.c

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

Modified files:

Index: src/lib/librumphijack/hijack.c
diff -u src/lib/librumphijack/hijack.c:1.86 src/lib/librumphijack/hijack.c:1.87
--- src/lib/librumphijack/hijack.c:1.86	Mon Mar 14 11:15:47 2011
+++ src/lib/librumphijack/hijack.c	Tue Apr 12 15:49:48 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: hijack.c,v 1.86 2011/03/14 15:15:47 pooka Exp $	*/
+/*  $NetBSD: hijack.c,v 1.87 2011/04/12 19:49:48 christos Exp $	*/
 
 /*-
  * Copyright (c) 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: hijack.c,v 1.86 2011/03/14 15:15:47 pooka Exp $);
+__RCSID($NetBSD: hijack.c,v 1.87 2011/04/12 19:49:48 christos Exp $);
 
 #define __ssp_weak_name(fun) _hijack_ ## fun
 
@@ -1972,6 +1972,7 @@
 
 #if _FORTIFY_SOURCE  0
 #define STUB(fun) __ssp_weak_name(fun)
+ssize_t STUB(readlink)(const char * __restrict, char * __restrict, size_t);
 ssize_t _sys_readlink(const char * __restrict, char * __restrict, size_t);
 ssize_t
 STUB(readlink)(const char * __restrict path, char * __restrict buf,
@@ -1980,6 +1981,7 @@
 	return _sys_readlink(path, buf, bufsiz);
 }
 
+char *STUB(getcwd)(char *, size_t);
 char *_sys_getcwd(char *, size_t);
 char *
 STUB(getcwd)(char *buf, size_t size)
@@ -2130,7 +2132,7 @@
 	(const char *, const char *),	\
 	(target, path))
 
-PATHCALL(ssize_t, readlink, DUALCALL_READLINK,\
+PATHCALL(ssize_t, _sys_readlink, DUALCALL_READLINK,			\
 	(const char *path, char *buf, size_t bufsiz),			\
 	(const char *, char *, size_t),	\
 	(path, buf, bufsiz))



CVS commit: src/lib/libpthread

2011-04-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 12 19:52:04 UTC 2011

Modified Files:
src/lib/libpthread: pthread_cancelstub.c

Log Message:
Fix SSP builds (Vladimir Kirillov)


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/lib/libpthread/pthread_cancelstub.c

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

Modified files:

Index: src/lib/libpthread/pthread_cancelstub.c
diff -u src/lib/libpthread/pthread_cancelstub.c:1.31 src/lib/libpthread/pthread_cancelstub.c:1.32
--- src/lib/libpthread/pthread_cancelstub.c:1.31	Wed Jan 26 13:48:57 2011
+++ src/lib/libpthread/pthread_cancelstub.c	Tue Apr 12 15:52:04 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_cancelstub.c,v 1.31 2011/01/26 18:48:57 christos Exp $	*/
+/*	$NetBSD: pthread_cancelstub.c,v 1.32 2011/04/12 19:52:04 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: pthread_cancelstub.c,v 1.31 2011/01/26 18:48:57 christos Exp $);
+__RCSID($NetBSD: pthread_cancelstub.c,v 1.32 2011/04/12 19:52:04 christos Exp $);
 
 #ifndef lint
 
@@ -472,7 +472,10 @@
 
 #if _FORTIFY_SOURCE  0
 #define STUB(fun) __ssp_weak_name(fun)
+
+ssize_t STUB(readlink)(const char * __restrict, char * __restrict, size_t);
 ssize_t _sys_readlink(const char * __restrict, char * __restrict, size_t);
+
 ssize_t
 STUB(readlink)(const char * __restrict path, char * __restrict buf,
 size_t bufsiz)
@@ -480,15 +483,16 @@
 	return _sys_readlink(path, buf, bufsiz);
 }
 
+char *STUB(getcwd)(char *, size_t);
 char *_sys_getcwd(char *, size_t);
+
 char *
 STUB(getcwd)(char *buf, size_t size)
 {
 	return _sys_getcwd(buf, size);
 }
-#else
-#define STUB(fun) fun
-#endif
+
+ssize_t STUB(read)(int, void *, size_t);
 
 ssize_t
 STUB(read)(int d, void *buf, size_t nbytes)
@@ -503,6 +507,9 @@
 
 	return retval;
 }
+#else
+#define STUB(fun) fun
+#endif
 
 ssize_t
 readv(int d, const struct iovec *iov, int iovcnt)



CVS commit: src/crypto/external/bsd/heimdal

2011-04-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr 13 22:16:52 UTC 2011

Modified Files:
src/crypto/external/bsd/heimdal: heimdal2netbsd

Log Message:
no more amd, factor out more stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/crypto/external/bsd/heimdal/heimdal2netbsd

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

Modified files:

Index: src/crypto/external/bsd/heimdal/heimdal2netbsd
diff -u src/crypto/external/bsd/heimdal/heimdal2netbsd:1.1 src/crypto/external/bsd/heimdal/heimdal2netbsd:1.2
--- src/crypto/external/bsd/heimdal/heimdal2netbsd:1.1	Wed Apr 13 15:04:40 2011
+++ src/crypto/external/bsd/heimdal/heimdal2netbsd	Wed Apr 13 18:16:52 2011
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-#	$NetBSD: heimdal2netbsd,v 1.1 2011/04/13 19:04:40 elric Exp $
+#	$NetBSD: heimdal2netbsd,v 1.2 2011/04/13 22:16:52 christos Exp $
 #
 # Copyright (c) 2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -27,7 +27,7 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 # heimdal2netbsd:  convert a heimdal source tree into a
-# netbsd amd source tree, under src/crypto/external/bsd/heimdal/dist
+# netbsd heimdal source tree, under src/crypto/external/bsd/heimdal/dist
 # based on bind2netbsd by Bernd Ernesti and changes by Simon Burge
 #
 # Rough instructions for importing new heimdal release from their git
@@ -56,16 +56,18 @@
 #	- check makefiles to see if any extra sources have been added.
 #	- update distrib/sets if necessary.
 
-if [ $# -ne 2 ]; then echo heimdal2netbsd src dest; exit 1; fi
-
+prog=$(basename $0)
 r=$1
 d=$2/src/crypto/external/bsd/heimdal/dist
 
+if [ $# -ne 2 ]; then echo ${prog} src dest; exit 1; fi
+
+
 case $d in
 	/*)
 		;;
 	*)
-		d=`/bin/pwd`/$d
+		d=$(pwd)/$d
 		;;
 esac
 
@@ -73,7 +75,7 @@
 	/*)
 		;;
 	*)
-		r=`/bin/pwd`/$r
+		r=$(pwd)/$r
 		;;
 esac
 
@@ -211,26 +213,26 @@
 ### Add our NetBSD RCS Id
 find $d -type f -name '*.[chly]' -print | while read c; do
 	sed 1q  $c | grep -q '\$NetBSD' || (
-echo /*	\$NetBSD\$	*/ /tmp/amd3n$$
-echo  /tmp/amd3n$$
-cat $c   /tmp/amd3n$$
-mv /tmp/amd3n$$ $c  echo added NetBSD RCS tag to $c
+echo /*	\$NetBSD\$	*/ /tmp/${prog}3n$$
+echo  /tmp/${prog}3n$$
+cat $c   /tmp/${prog}3n$$
+mv /tmp/${prog}3n$$ $c  echo added NetBSD RCS tag to $c
 	)
 done
 
 find $d -type f -name '*.[0-9]' -print | while read m; do
 	sed 1q  $m | grep -q '\$NetBSD' || (
-echo .\\\	\$NetBSD\$ /tmp/amd2m$$
-echo .\\\ /tmp/amd2m$$
-cat $m  /tmp/amd2m$$
-mv /tmp/amd2m$$ $m  echo added NetBSD RCS tag to $m
+echo .\\\	\$NetBSD\$ /tmp/${prog}2m$$
+echo .\\\ /tmp/${prog}2m$$
+cat $m  /tmp/${prog}2m$$
+mv /tmp/${prog}2m$$ $m  echo added NetBSD RCS tag to $m
 	)
 done
 
 find $d -type f -name '*.texi' -print | while read t; do
 sed 2 s/^/@c \$NetBSD\$\\
-/  $t  /tmp/amd4t$$
-	mv /tmp/amd4t$$ $t  echo added NetBSD RCS tag to $t
+/  $t  /tmp/${prog}4t$$
+	mv /tmp/${prog}4t$$ $t  echo added NetBSD RCS tag to $t
 done
 
 echo done



CVS commit: src/sys/compat/linux/common

2011-04-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 14 00:59:06 UTC 2011

Modified Files:
src/sys/compat/linux/common: linux_file.c linux_pipe.c

Log Message:
move dup3 to a more appropriate place because pipe is special. Gotta love
linux.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/compat/linux/common/linux_file.c
cvs rdiff -u -r1.64 -r1.65 src/sys/compat/linux/common/linux_pipe.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_file.c
diff -u src/sys/compat/linux/common/linux_file.c:1.102 src/sys/compat/linux/common/linux_file.c:1.103
--- src/sys/compat/linux/common/linux_file.c:1.102	Sun Apr 10 11:49:56 2011
+++ src/sys/compat/linux/common/linux_file.c	Wed Apr 13 20:59:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_file.c,v 1.102 2011/04/10 15:49:56 christos Exp $	*/
+/*	$NetBSD: linux_file.c,v 1.103 2011/04/14 00:59:06 christos Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,13 +35,14 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: linux_file.c,v 1.102 2011/04/10 15:49:56 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: linux_file.c,v 1.103 2011/04/14 00:59:06 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
 #include sys/namei.h
 #include sys/proc.h
 #include sys/file.h
+#include sys/fcntl.h
 #include sys/stat.h
 #include sys/filedesc.h
 #include sys/ioctl.h
@@ -621,6 +622,25 @@
 	return sys_pwrite(l, pra, retval);
 }
 
+int
+linux_sys_dup3(struct lwp *l, const struct linux_sys_dup3_args *uap,
+register_t *retval)
+{
+	/* {
+		syscallarg(int) from;
+		syscallarg(int) to;
+		syscallarg(int) flags;
+	} */
+	int error;
+	if ((error = sys_dup2(l, (const struct sys_dup2_args *)uap, retval)))
+		return error;
+
+	if (SCARG(uap, flags)  LINUX_O_CLOEXEC)
+		fd_set_exclose(l, SCARG(uap, to), true);
+
+	return 0;
+}
+
 #define LINUX_NOT_SUPPORTED(fun) \
 int \
 fun(struct lwp *l, const struct fun##_args *uap, register_t *retval) \

Index: src/sys/compat/linux/common/linux_pipe.c
diff -u src/sys/compat/linux/common/linux_pipe.c:1.64 src/sys/compat/linux/common/linux_pipe.c:1.65
--- src/sys/compat/linux/common/linux_pipe.c:1.64	Sun Apr 10 11:50:34 2011
+++ src/sys/compat/linux/common/linux_pipe.c	Wed Apr 13 20:59:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_pipe.c,v 1.64 2011/04/10 15:50:34 christos Exp $	*/
+/*	$NetBSD: linux_pipe.c,v 1.65 2011/04/14 00:59:06 christos Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: linux_pipe.c,v 1.64 2011/04/10 15:50:34 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: linux_pipe.c,v 1.65 2011/04/14 00:59:06 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -130,22 +130,3 @@
 	return linux_pipe_return(l, SCARG(uap, pfds), retval,
 	SCARG(uap, flags));
 }
-
-int
-linux_sys_dup3(struct lwp *l, const struct linux_sys_dup3_args *uap,
-register_t *retval)
-{
-	/* {
-		syscallarg(int) from;
-		syscallarg(int) to;
-		syscallarg(int) flags;
-	} */
-	int error;
-	if ((error = sys_dup2(l, (const struct sys_dup2_args *)uap, retval)))
-		return error;
-
-	if (SCARG(uap, flags)  LINUX_O_CLOEXEC)
-		fd_set_exclose(l, SCARG(uap, to), true);
-
-	return 0;
-}



CVS commit: src/external/bsd/top/dist/machine

2011-04-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 15 02:05:53 UTC 2011

Modified Files:
src/external/bsd/top/dist/machine: m_netbsd.c

Log Message:
Swap the command and the thread name in the thread view and let the command
be as long as it wants. (Vladimir Kirillov)


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/external/bsd/top/dist/machine/m_netbsd.c

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/top/dist/machine/m_netbsd.c
diff -u src/external/bsd/top/dist/machine/m_netbsd.c:1.14 src/external/bsd/top/dist/machine/m_netbsd.c:1.15
--- src/external/bsd/top/dist/machine/m_netbsd.c:1.14	Mon May 31 14:14:59 2010
+++ src/external/bsd/top/dist/machine/m_netbsd.c	Thu Apr 14 22:05:53 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: m_netbsd.c,v 1.14 2010/05/31 18:14:59 rmind Exp $	*/
+/*	$NetBSD: m_netbsd.c,v 1.15 2011/04/15 02:05:53 christos Exp $	*/
 
 /*
  * top - a top users display for Unix
@@ -37,12 +37,12 @@
  *		Andrew Doran a...@netbsd.org
  *
  *
- * $Id: m_netbsd.c,v 1.14 2010/05/31 18:14:59 rmind Exp $
+ * $Id: m_netbsd.c,v 1.15 2011/04/15 02:05:53 christos Exp $
  */
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: m_netbsd.c,v 1.14 2010/05/31 18:14:59 rmind Exp $);
+__RCSID($NetBSD: m_netbsd.c,v 1.15 2011/04/15 02:05:53 christos Exp $);
 #endif
 
 #include sys/param.h
@@ -105,14 +105,14 @@
 /* 0123456   -- field to fill in starts at header+6 */
 #define PROC_UNAME_START 6
 #define Proc_format \
-	%5d %-8.8s %3d %4d%7s %5s %-8.8s%7s %5.*f%% %5.*f%% %.12s
+	%5d %-8.8s %3d %4d%7s %5s %-8.8s%7s %5.*f%% %5.*f%% %s
 
 static char Thread_header[] =
-PID   LID XPRI STATE  TIME   WCPUCPU COMMAND  NAME;
+PID   LID XPRI STATE  TIME   WCPUCPU NAME  COMMAND;
 /* 0123456   -- field to fill in starts at header+6 */
 #define THREAD_UNAME_START 12
 #define Thread_format \
-%5d %5d %-8.8s %3d %-8.8s%7s %5.2f%% %5.2f%% %-12.12s %.12s
+%5d %5d %-8.8s %3d %-8.8s%7s %5.2f%% %5.2f%% %-9.9s %s
 
 /* 
  * Process state names for the STATE column of the display.
@@ -939,8 +939,8 @@
 	format_time(cputime),
 	100.0 * weighted_cpu(l_, pct, pl),
 	100.0 * pct,
-	get_command(hp-sel, pp),
-	printable(pl-l_name));
+	printable(pl-l_name),
+	get_command(hp-sel, pp));
 
 	/* return the result */
 	return(fmt);



CVS commit: src/sbin/sysctl

2011-04-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 16 01:15:55 UTC 2011

Modified Files:
src/sbin/sysctl: sysctl.c

Log Message:
PR/44864: Paul Ripke: Compile regular expressions on demand and only once.


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sbin/sysctl/sysctl.c

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

Modified files:

Index: src/sbin/sysctl/sysctl.c
diff -u src/sbin/sysctl/sysctl.c:1.133 src/sbin/sysctl/sysctl.c:1.134
--- src/sbin/sysctl/sysctl.c:1.133	Mon Dec 13 12:47:40 2010
+++ src/sbin/sysctl/sysctl.c	Fri Apr 15 21:15:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysctl.c,v 1.133 2010/12/13 17:47:40 pooka Exp $ */
+/*	$NetBSD: sysctl.c,v 1.134 2011/04/16 01:15:54 christos Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
 #if 0
 static char sccsid[] = @(#)sysctl.c	8.1 (Berkeley) 6/6/93;
 #else
-__RCSID($NetBSD: sysctl.c,v 1.133 2010/12/13 17:47:40 pooka Exp $);
+__RCSID($NetBSD: sysctl.c,v 1.134 2011/04/16 01:15:54 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -123,10 +123,12 @@
 /*
  * generic routines
  */
-static const struct handlespec *findhandler(const char *, int);
+static const struct handlespec *findhandler(const char *, int, regex_t *,
+size_t *);
 static void canonicalize(const char *, char *);
 static void purge_tree(struct sysctlnode *);
-static void print_tree(int *, u_int, struct sysctlnode *, u_int, int);
+static void print_tree(int *, u_int, struct sysctlnode *, u_int, int, regex_t *,
+size_t *);
 static void write_number(int *, u_int, struct sysctlnode *, char *);
 static void write_string(int *, u_int, struct sysctlnode *, char *);
 static void display_number(const struct sysctlnode *, const char *,
@@ -137,7 +139,7 @@
 			   const void *, size_t, int);
 static void hex_dump(const unsigned char *, size_t);
 static void usage(void);
-static void parse(char *);
+static void parse(char *, regex_t *, size_t *);
 static void parse_create(char *);
 static void parse_destroy(char *);
 static void parse_describe(char *);
@@ -270,7 +272,10 @@
 {
 	int name[CTL_MAXNAME];
 	int ch;
+	size_t lastcompiled = 0;
+	regex_t *re;
 
+	setprogname(argv[0]);
 	while ((ch = getopt(argc, argv, Aabdef:Mnqrwx)) != -1) {
 		switch (ch) {
 		case 'A':
@@ -334,8 +339,12 @@
 		warnfp = stdout;
 	stale = req = 0;
 
+	if ((re = malloc(sizeof(*re) * __arraycount(handlers))) == NULL)
+		err(1, malloc regex);
+
 	if (aflag) {
-		print_tree(name[0], 0, NULL, CTLTYPE_NODE, 1);
+		print_tree(name[0], 0, NULL, CTLTYPE_NODE, 1,
+		re, lastcompiled);
 		/* if (argc == 0) */
 		return (0);
 	}
@@ -352,7 +361,7 @@
 			while ((l = fparseln(fp, NULL, nr, NULL, 0)) != NULL)
 			{
 if (*l) {
-	parse(l);
+	parse(l, re, lastcompiled);
 	free(l);
 }
 			}
@@ -365,7 +374,7 @@
 		usage();
 
 	while (argc--  0)
-		parse(*argv++);
+		parse(*argv++, re, lastcompiled);
 
 	return errs ? 1 : 0;
 }
@@ -377,38 +386,38 @@
  * 
  */
 static const struct handlespec *
-findhandler(const char *s, int w)
+findhandler(const char *s, int w, regex_t *re, size_t *lastcompiled)
 {
 	const struct handlespec *p;
-	regex_t re;
-	int i, j, l;
+	size_t i, l;
+	int j;
 	char eb[64];
-	regmatch_t match[1];
+	regmatch_t match;
 
 	p = handlers[0];
 	l = strlen(s);
 	for (i = 0; p[i].ps_re != NULL; i++) {
-		j = regcomp(re, p[i].ps_re, REG_EXTENDED);
-		if (j != 0) {
-			regerror(j, re, eb, sizeof(eb));
-			errx(1, regcomp: %s: %s, p[i].ps_re, eb);
+		if (i = *lastcompiled) {
+			j = regcomp(re[i], p[i].ps_re, REG_EXTENDED);
+			if (j != 0) {
+regerror(j, re[i], eb, sizeof(eb));
+errx(1, regcomp: %s: %s, p[i].ps_re, eb);
+			}
+			*lastcompiled = i + 1;
 		}
-		j = regexec(re, s, 1, match, 0);
+		j = regexec(re[i], s, 1, match, 0);
 		if (j == 0) {
-			if (match[0].rm_so == 0  match[0].rm_eo == l 
-			(w ? p[i].ps_w : p[i].ps_p) != NULL) {
-regfree(re);
-return (p[i]);
-			}
+			if (match.rm_so == 0  match.rm_eo == (int)l 
+			(w ? p[i].ps_w : p[i].ps_p) != NULL)
+return p[i];
 		}
 		else if (j != REG_NOMATCH) {
-			regerror(j, re, eb, sizeof(eb));
+			regerror(j, re[i], eb, sizeof(eb));
 			errx(1, regexec: %s: %s, p[i].ps_re, eb);
 		}
-		regfree(re);
 	}
 
-	return (NULL);
+	return NULL;
 }
 
 /*
@@ -552,7 +561,7 @@
  */
 static void
 print_tree(int *name, u_int namelen, struct sysctlnode *pnode, u_int type,
-	   int add)
+   int add, regex_t *re, size_t *lastcompiled)
 {
 	struct sysctlnode *node;
 	int rc;
@@ -651,7 +660,7 @@
 	}
 
 	canonicalize(gsname, canonname);
-	p = findhandler(canonname, 0);
+	p = findhandler(canonname, 0, re, lastcompiled);
 	if (type != CTLTYPE_NODE  p != NULL) {
 		(*p-ps_p)(gsname, gdname, NULL, name, namelen, pnode, type,
 			   __UNCONST(p-ps_d));
@@ -704,7 +713,7 @@
 	continue;
 print_tree(name, namelen + 1, node[ni],
 	   

CVS commit: src/etc/mtree

2011-04-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 16 17:16:13 UTC 2011

Modified Files:
src/etc/mtree: NetBSD.dist.base

Log Message:
sort and add x86


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/etc/mtree/NetBSD.dist.base

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

Modified files:

Index: src/etc/mtree/NetBSD.dist.base
diff -u src/etc/mtree/NetBSD.dist.base:1.82 src/etc/mtree/NetBSD.dist.base:1.83
--- src/etc/mtree/NetBSD.dist.base:1.82	Fri Apr 15 15:31:07 2011
+++ src/etc/mtree/NetBSD.dist.base	Sat Apr 16 13:16:12 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.base,v 1.82 2011/04/15 19:31:07 joerg Exp $
+#	$NetBSD: NetBSD.dist.base,v 1.83 2011/04/16 17:16:12 christos Exp $
 #	@(#)4.4BSD.dist	8.1 (Berkeley) 6/13/93
 
 # Do not customize this file as it may be overwritten on upgrades.
@@ -854,6 +854,7 @@
 ./usr/share/man/man8/acorn32
 ./usr/share/man/man8/algor
 ./usr/share/man/man8/alpha
+./usr/share/man/man8/amd64
 ./usr/share/man/man8/amiga
 ./usr/share/man/man8/arc
 ./usr/share/man/man8/atari
@@ -898,7 +899,7 @@
 ./usr/share/man/man8/sun3
 ./usr/share/man/man8/vax
 ./usr/share/man/man8/x68k
-./usr/share/man/man8/amd64
+./usr/share/man/man8/x86
 ./usr/share/man/man9
 ./usr/share/man/man9/acorn26
 ./usr/share/man/man9/alpha



CVS commit: src/share/mk

2011-04-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 16 21:41:25 UTC 2011

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Simplify and correct (previous did not work for !defined(DESTDIR)


To generate a diff of this commit:
cvs rdiff -u -r1.656 -r1.657 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.656 src/share/mk/bsd.own.mk:1.657
--- src/share/mk/bsd.own.mk:1.656	Fri Apr 15 14:05:45 2011
+++ src/share/mk/bsd.own.mk	Sat Apr 16 17:41:24 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.656 2011/04/15 18:05:45 elric Exp $
+#	$NetBSD: bsd.own.mk,v 1.657 2011/04/16 21:41:24 christos Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -207,8 +207,10 @@
 OBJC=		false
 .endif
 
-CPPFLAGS+=	${!defined(HOSTPROG)  !defined(HOSTLIB)  defined(DESTDIR) :? --sysroot=${DESTDIR} :}
-LDFLAGS+=	${!defined(HOSTPROG)  !defined(HOSTLIB)  defined(DESTDIR) :? --sysroot=${DESTDIR} :}
+.if !defined(HOSTPROG)  !defined(HOSTLIB)  defined(DESTDIR)
+CPPFLAGGS+=	--sysroot=${DESTDIR}
+LDFLAGS+=	--sysroot=${DESTDIR}
+.endif
 .endif	# EXTERNAL_TOOLCHAIN		# }
 
 HOST_MKDEP=	${TOOLDIR}/bin/${_TOOL_PREFIX}host-mkdep



CVS commit: src/distrib/sets/lists/base

2011-04-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 16 22:00:34 UTC 2011

Modified Files:
src/distrib/sets/lists/base: mi

Log Message:
add {man,cat,html}8/x86


To generate a diff of this commit:
cvs rdiff -u -r1.931 -r1.932 src/distrib/sets/lists/base/mi

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/base/mi
diff -u src/distrib/sets/lists/base/mi:1.931 src/distrib/sets/lists/base/mi:1.932
--- src/distrib/sets/lists/base/mi:1.931	Fri Apr 15 15:31:06 2011
+++ src/distrib/sets/lists/base/mi	Sat Apr 16 18:00:34 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.931 2011/04/15 19:31:06 joerg Exp $
+# $NetBSD: mi,v 1.932 2011/04/16 22:00:34 christos Exp $
 #
 # Note:	Don't delete entries from here - mark them as obsolete instead,
 #	unless otherwise stated below.
@@ -3412,6 +3412,7 @@
 ./usr/share/man/cat8/vax			base-man-share
 ./usr/share/man/cat8/walnut			base-obsolete		obsolete
 ./usr/share/man/cat8/x68k			base-man-share
+./usr/share/man/cat8/x86			base-man-share
 ./usr/share/man/cat8/x86_64			base-obsolete		obsolete
 ./usr/share/man/cat9base-man-share
 ./usr/share/man/cat9/acorn26			base-man-share
@@ -3536,6 +3537,7 @@
 ./usr/share/man/html8/vax			base-man-share
 ./usr/share/man/html8/walnut			base-obsolete		obsolete
 ./usr/share/man/html8/x68k			base-man-share
+./usr/share/man/html8/x86			base-man-share
 ./usr/share/man/html8/x86_64			base-obsolete		obsolete
 ./usr/share/man/html9base-man-share
 ./usr/share/man/html9/acorn26			base-man-share
@@ -3663,6 +3665,7 @@
 ./usr/share/man/man8/vax			base-man-share
 ./usr/share/man/man8/walnut			base-obsolete		obsolete
 ./usr/share/man/man8/x68k			base-man-share
+./usr/share/man/man8/x86			base-man-share
 ./usr/share/man/man8/x86_64			base-obsolete		obsolete
 ./usr/share/man/man9base-man-share
 ./usr/share/man/man9/acorn26			base-man-share



CVS commit: src/share/mk

2011-04-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 16 22:45:23 UTC 2011

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Need --sysroot=/ otherwise ld does not find crt0.o and friends.


To generate a diff of this commit:
cvs rdiff -u -r1.657 -r1.658 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.657 src/share/mk/bsd.own.mk:1.658
--- src/share/mk/bsd.own.mk:1.657	Sat Apr 16 17:41:24 2011
+++ src/share/mk/bsd.own.mk	Sat Apr 16 18:45:23 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.657 2011/04/16 21:41:24 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.658 2011/04/16 22:45:23 christos Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -210,6 +210,9 @@
 .if !defined(HOSTPROG)  !defined(HOSTLIB)  defined(DESTDIR)
 CPPFLAGGS+=	--sysroot=${DESTDIR}
 LDFLAGS+=	--sysroot=${DESTDIR}
+.else
+CPPFLAGGS+=	--sysroot=/
+LDFLAGS+=	--sysroot=/
 .endif
 .endif	# EXTERNAL_TOOLCHAIN		# }
 



CVS commit: src/lib/libm/man

2011-04-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 16 23:58:01 UTC 2011

Modified Files:
src/lib/libm/man: nextafter.3

Log Message:
Fix markup


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/man/nextafter.3

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

Modified files:

Index: src/lib/libm/man/nextafter.3
diff -u src/lib/libm/man/nextafter.3:1.1 src/lib/libm/man/nextafter.3:1.2
--- src/lib/libm/man/nextafter.3:1.1	Tue Apr 12 03:29:50 2011
+++ src/lib/libm/man/nextafter.3	Sat Apr 16 19:58:01 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: nextafter.3,v 1.1 2011/04/12 07:29:50 jruoho Exp $
+.\ $NetBSD: nextafter.3,v 1.2 2011/04/16 23:58:01 christos Exp $
 .\
 .\ Copyright (c) 2011 Jukka Ruohonen jruoho...@iki.fi
 .\ All rights reserved.
@@ -93,6 +93,7 @@
 .Fa x
 equals
 .Fa y .
+.El
 .Sh RETURN VALUES
 Upon successful completion, the described functions return
 the next representable floating-point value as described above.
@@ -100,10 +101,10 @@
 .Fa x
 is finite but an overflow would occur,
 a range error follows and the functions return
-.Dv \*(Pm\* HUGE_VAL ,
-.Dv  \*(Pm\* HUGE_VALF ,
+.Dv \*(Pm\*HHUGE_VAL ,
+.Dv  \*(Pm\*HHUGE_VALF ,
 or
-.Dv  \*(Pm\* HUGE_VALL
+.Dv  \*(Pm\*HHUGE_VALL
 with the same sign as
 .Fa x .
 When either



CVS commit: src/share/mk

2011-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 17 15:03:37 UTC 2011

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Revert previous, breaks builds completely (cd /usr/src/bin/test  make clean 
make)


To generate a diff of this commit:
cvs rdiff -u -r1.660 -r1.661 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.660 src/share/mk/bsd.own.mk:1.661
--- src/share/mk/bsd.own.mk:1.660	Sun Apr 17 08:54:22 2011
+++ src/share/mk/bsd.own.mk	Sun Apr 17 11:03:37 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.660 2011/04/17 12:54:22 tron Exp $
+#	$NetBSD: bsd.own.mk,v 1.661 2011/04/17 15:03:37 christos Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -210,6 +210,9 @@
 .if !defined(HOSTPROG)  !defined(HOSTLIB)  defined(DESTDIR)
 CPPFLAGS+=	--sysroot=${DESTDIR}
 LDFLAGS+=	--sysroot=${DESTDIR}
+.else
+CPPFLAGS+=	--sysroot=/
+LDFLAGS+=	--sysroot=/
 .endif
 .endif	# EXTERNAL_TOOLCHAIN		# }
 



CVS commit: src/usr.bin/mkdep

2011-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 17 22:35:22 UTC 2011

Modified Files:
src/usr.bin/mkdep: mkdep.c

Log Message:
Recognize --sysroot but don't document it or do anything about it for now.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/usr.bin/mkdep/mkdep.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.bin/mkdep/mkdep.c
diff -u src/usr.bin/mkdep/mkdep.c:1.35 src/usr.bin/mkdep/mkdep.c:1.36
--- src/usr.bin/mkdep/mkdep.c:1.35	Wed May 26 14:07:34 2010
+++ src/usr.bin/mkdep/mkdep.c	Sun Apr 17 18:35:22 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: mkdep.c,v 1.35 2010/05/26 18:07:34 christos Exp $ */
+/* $NetBSD: mkdep.c,v 1.36 2011/04/17 22:35:22 christos Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 #if !defined(lint)
 __COPYRIGHT(@(#) Copyright (c) 1999 The NetBSD Foundation, Inc.\
  All rights reserved.);
-__RCSID($NetBSD: mkdep.c,v 1.35 2010/05/26 18:07:34 christos Exp $);
+__RCSID($NetBSD: mkdep.c,v 1.36 2011/04/17 22:35:22 christos Exp $);
 #endif /* not lint */
 
 #include sys/mman.h
@@ -46,6 +46,7 @@
 #include ctype.h
 #include err.h
 #include fcntl.h
+#include getopt.h
 #include locale.h
 #include paths.h
 #include stdio.h
@@ -183,6 +184,11 @@
 	return fbuf;
 }
 
+static struct option longopt[] = {
+	{ sysroot, 1, NULL, 'R' },
+	{ NULL, 0, NULL, '\0' },
+};
+
 int
 main(int argc, char **argv)
 {
@@ -214,7 +220,7 @@
 	opterr = 0;	/* stop getopt() bleating about errors. */
 	for (;;) {
 		ok_ind = optind;
-		ch = getopt(argc, argv, aDdf:opqs:);
+		ch = getopt_long(argc, argv, aDdf:opqRs:, longopt, NULL);
 		switch (ch) {
 		case -1:
 			ok_ind = optind;
@@ -242,6 +248,9 @@
 		case 'q':	/* Quiet */
 			qflag = 1;
 			continue;
+		case 'R':
+			/* sysroot = optarg */
+			continue;
 		case 's':	/* Suffix list */
 			suffixes = optarg;
 			continue;



CVS commit: src/lib/libc/db

2011-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 17 23:12:38 UTC 2011

Modified Files:
src/lib/libc/db/btree: bt_open.c
src/lib/libc/db/hash: hash_page.c

Log Message:
Correct check for snprintf() overflow via Maksymilian Arciemowicz from FreeBSD.
(the bt one was ok, but set errno and make it the same for consistency).
[to be pulled up]


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/lib/libc/db/btree/bt_open.c
cvs rdiff -u -r1.23 -r1.24 src/lib/libc/db/hash/hash_page.c

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

Modified files:

Index: src/lib/libc/db/btree/bt_open.c
diff -u src/lib/libc/db/btree/bt_open.c:1.24 src/lib/libc/db/btree/bt_open.c:1.25
--- src/lib/libc/db/btree/bt_open.c:1.24	Thu Sep 11 08:58:00 2008
+++ src/lib/libc/db/btree/bt_open.c	Sun Apr 17 19:12:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bt_open.c,v 1.24 2008/09/11 12:58:00 joerg Exp $	*/
+/*	$NetBSD: bt_open.c,v 1.25 2011/04/17 23:12:38 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -37,7 +37,7 @@
 #endif
 
 #include sys/cdefs.h
-__RCSID($NetBSD: bt_open.c,v 1.24 2008/09/11 12:58:00 joerg Exp $);
+__RCSID($NetBSD: bt_open.c,v 1.25 2011/04/17 23:12:38 christos Exp $);
 
 /*
  * Implementation of btree access method for 4.4BSD.
@@ -391,7 +391,7 @@
 tmp(void)
 {
 	sigset_t set, oset;
-	size_t len;
+	int len;
 	int fd;
 	char *envtmp;
 	char path[PATH_MAX];
@@ -403,8 +403,10 @@
 
 	len = snprintf(path,
 	sizeof(path), %s/bt.XX, envtmp ? envtmp : _PATH_TMP);
-	if (len = sizeof(path))
+	if (len  0 || (size_t)len = sizeof(path)) {
+		errno = ENAMETOOLONG;
 		return -1;
+	}
 	
 	(void)sigfillset(set);
 	(void)sigprocmask(SIG_BLOCK, set, oset);

Index: src/lib/libc/db/hash/hash_page.c
diff -u src/lib/libc/db/hash/hash_page.c:1.23 src/lib/libc/db/hash/hash_page.c:1.24
--- src/lib/libc/db/hash/hash_page.c:1.23	Thu Sep 11 08:58:00 2008
+++ src/lib/libc/db/hash/hash_page.c	Sun Apr 17 19:12:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: hash_page.c,v 1.23 2008/09/11 12:58:00 joerg Exp $	*/
+/*	$NetBSD: hash_page.c,v 1.24 2011/04/17 23:12:38 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -37,7 +37,7 @@
 #endif
 
 #include sys/cdefs.h
-__RCSID($NetBSD: hash_page.c,v 1.23 2008/09/11 12:58:00 joerg Exp $);
+__RCSID($NetBSD: hash_page.c,v 1.24 2011/04/17 23:12:38 christos Exp $);
 
 /*
  * PACKAGE:  hashing
@@ -869,15 +869,19 @@
 	sigset_t set, oset;
 	char *envtmp;
 	char namestr[PATH_MAX];
+	int len;
 
 	if (issetugid())
 		envtmp = NULL;
 	else
 		envtmp = getenv(TMPDIR);
 
-	if (-1 == snprintf(namestr, sizeof(namestr), %s/_hashXX,
-	envtmp ? envtmp : _PATH_TMP))
+	len = snprintf(namestr, sizeof(namestr), %s/_hashXX,
+	envtmp ? envtmp : _PATH_TMP);
+	if (len  0 || (size_t)len = sizeof(namestr)) {
+		errno = ENAMETOOLONG;
 		return -1;
+	}
 
 	/* Block signals; make sure file goes away at process exit. */
 	(void)sigfillset(set);



CVS commit: src/external/historical/nawk/dist

2011-04-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 18 15:23:28 UTC 2011

Modified Files:
src/external/historical/nawk/dist: main.c run.c

Log Message:
PR/44876: Aleksey Cheusov: awk: incorrect return value of function srand()
Make it return the value of the previous random seed as the standard mandates.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/historical/nawk/dist/main.c
cvs rdiff -u -r1.2 -r1.3 src/external/historical/nawk/dist/run.c

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

Modified files:

Index: src/external/historical/nawk/dist/main.c
diff -u src/external/historical/nawk/dist/main.c:1.4 src/external/historical/nawk/dist/main.c:1.5
--- src/external/historical/nawk/dist/main.c:1.4	Mon Oct 18 11:58:05 2010
+++ src/external/historical/nawk/dist/main.c	Mon Apr 18 11:23:28 2011
@@ -42,6 +42,7 @@
 extern	int	nfields;
 
 int	dbg	= 0;
+unsigned int srand_seed;
 char	*cmdname;	/* gets argv[0] for error messages */
 extern	FILE	*yyin;	/* lex input file */
 char	*lexprog;	/* points to program argument if it exists */
@@ -122,6 +123,10 @@
 #else
 	(void)signal(SIGFPE, fpecatch);
 #endif
+	/* Set and keep track of the random seed */
+	srand_seed = 1;
+	srand(srand_seed);
+
 	yyin = NULL;
 	symtab = makesymtab(NSYMTAB/NSYMTAB);
 	while (argc  1  argv[1][0] == '-'  argv[1][1] != '\0') {

Index: src/external/historical/nawk/dist/run.c
diff -u src/external/historical/nawk/dist/run.c:1.2 src/external/historical/nawk/dist/run.c:1.3
--- src/external/historical/nawk/dist/run.c:1.2	Thu Aug 26 10:55:20 2010
+++ src/external/historical/nawk/dist/run.c	Mon Apr 18 11:23:28 2011
@@ -74,6 +74,7 @@
 
 jmp_buf env;
 extern	int	pairstack[];
+extern	unsigned int srand_seed;
 
 Node	*winner = NULL;	/* root of parse tree */
 Cell	*tmps;		/* free temporary cells for execution */
@@ -1546,6 +1547,7 @@
 	Cell *x, *y;
 	Awkfloat u;
 	int t, sz;
+	unsigned int tmp;
 	char *buf, *fmt;
 	Node *nextarg;
 	FILE *fp;
@@ -1598,7 +1600,9 @@
 			u = time((time_t *)0);
 		else
 			u = getfval(x);
-		srand((unsigned int) u);
+		srand(tmp = (unsigned int) u);
+		u = srand_seed;
+		srand_seed = tmp;
 		break;
 	case FTOUPPER:
 	case FTOLOWER:



CVS commit: src/lib/libc/sys

2011-04-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr 20 19:57:58 UTC 2011

Modified Files:
src/lib/libc/sys: open.2

Log Message:
sync with reality (prototype of open is varyadic)


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/lib/libc/sys/open.2

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

Modified files:

Index: src/lib/libc/sys/open.2
diff -u src/lib/libc/sys/open.2:1.49 src/lib/libc/sys/open.2:1.50
--- src/lib/libc/sys/open.2:1.49	Sun Apr 10 20:21:45 2011
+++ src/lib/libc/sys/open.2	Wed Apr 20 15:57:58 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: open.2,v 1.49 2011/04/11 00:21:45 wiz Exp $
+.\	$NetBSD: open.2,v 1.50 2011/04/20 19:57:58 christos Exp $
 .\
 .\ Copyright (c) 1980, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\ @(#)open.2	8.2 (Berkeley) 11/16/93
 .\
-.Dd April 10, 2011
+.Dd April 20, 2011
 .Dt OPEN 2
 .Os
 .Sh NAME
@@ -40,7 +40,7 @@
 .Sh SYNOPSIS
 .In fcntl.h
 .Ft int
-.Fn open const char *path int flags mode_t mode
+.Fn open const char *path int flags ...
 .Sh DESCRIPTION
 The file name specified by
 .Fa path
@@ -72,10 +72,10 @@
 .It Dv O_APPEND
 Append to the file on each write.
 .It Dv O_CREAT
-Create the file if it does not exist, in which case the file is
-created with mode
-.Ar mode
-as described in
+Create the file if it does not exist.
+The third argument of type
+.Ft mode_t
+is used to compute the mode bits of the file as described in
 .Xr chmod 2
 and modified by the process' umask value (see
 .Xr umask 2 ) .



CVS commit: src/sys/dev/pci

2011-04-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr 20 20:15:03 UTC 2011

Modified Files:
src/sys/dev/pci: if_lii.c

Log Message:
PR/41258: Elias Benali: Try to get the ethernet address from the BIOS before
failing.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/if_lii.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/pci/if_lii.c
diff -u src/sys/dev/pci/if_lii.c:1.9 src/sys/dev/pci/if_lii.c:1.10
--- src/sys/dev/pci/if_lii.c:1.9	Mon Apr  5 03:20:26 2010
+++ src/sys/dev/pci/if_lii.c	Wed Apr 20 16:15:03 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_lii.c,v 1.9 2010/04/05 07:20:26 joerg Exp $	*/
+/*	$NetBSD: if_lii.c,v 1.10 2011/04/20 20:15:03 christos Exp $	*/
 
 /*
  *  Copyright (c) 2008 The NetBSD Foundation.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_lii.c,v 1.9 2010/04/05 07:20:26 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_lii.c,v 1.10 2011/04/20 20:15:03 christos Exp $);
 
 
 #include sys/param.h
@@ -551,17 +551,18 @@
 	}
 
 	if (found  2) {
-		aprint_error_dev(sc-sc_dev, error reading MAC address\n);
-		return 1;
-	}
-
-	addr0 = htole32(addr0);
-	addr1 = htole32(addr1);
-
-	if ((addr0 == 0xff  (addr1  0x) == 0x) ||
-	(addr0 == 0  (addr1  0x) == 0)) {
+		/* Make sure we try the BIOS method before giving up */
 		addr0 = htole32(AT_READ_4(sc, ATL2_MAC_ADDR_0));
 		addr1 = htole32(AT_READ_4(sc, ATL2_MAC_ADDR_1));
+		if ((addr0 == 0xff  (addr1  0x) == 0x) ||
+		(addr0 == 0  (addr1  0x) == 0)) {
+			aprint_error_dev(sc-sc_dev,
+			error reading MAC address\n);
+			return 1;
+		}
+	} else {
+		addr0 = htole32(addr0);
+		addr1 = htole32(addr1);
 	}
 
 	ea[0] = (addr1  0xff00)  8;



CVS commit: src/crypto/external/bsd/heimdal/dist/kadmin

2011-04-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 21 17:56:24 UTC 2011

Modified Files:
src/crypto/external/bsd/heimdal/dist/kadmin: util.c

Log Message:
Don't compare a pointer  0; this is obviously a missed * here.
While here, remove shadow variable warnings.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/crypto/external/bsd/heimdal/dist/kadmin/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/crypto/external/bsd/heimdal/dist/kadmin/util.c
diff -u src/crypto/external/bsd/heimdal/dist/kadmin/util.c:1.1.1.1 src/crypto/external/bsd/heimdal/dist/kadmin/util.c:1.2
--- src/crypto/external/bsd/heimdal/dist/kadmin/util.c:1.1.1.1	Wed Apr 13 14:14:35 2011
+++ src/crypto/external/bsd/heimdal/dist/kadmin/util.c	Thu Apr 21 13:56:24 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.1.1.1 2011/04/13 18:14:35 elric Exp $	*/
+/*	$NetBSD: util.c,v 1.2 2011/04/21 17:56:24 christos Exp $	*/
 
 /*
  * Copyright (c) 1997 - 2006 Kungliga Tekniska Högskolan
@@ -67,7 +67,7 @@
 { disallow-tgt-based,	KRB5_KDB_DISALLOW_TGT_BASED },
 { disallow-forwardable,	KRB5_KDB_DISALLOW_FORWARDABLE },
 { disallow-postdated,	KRB5_KDB_DISALLOW_POSTDATED },
-{ NULL }
+{ NULL, 0 }
 };
 
 /*
@@ -190,7 +190,7 @@
 if (str[0] == '+') {
 	str++;
 	*t = parse_time(str, month);
-	if (t  0)
+	if (*t  0)
 	return -1;
 	*t += time(NULL);
 	return 0;
@@ -432,7 +432,7 @@
  */
 
 int
-set_entry(krb5_context context,
+set_entry(krb5_context contextp,
 	  kadm5_principal_ent_t ent,
 	  int *mask,
 	  const char *max_ticket_life,
@@ -444,14 +444,14 @@
 if (max_ticket_life != NULL) {
 	if (parse_deltat (max_ticket_life, ent-max_life,
 			  mask, KADM5_MAX_LIFE)) {
-	krb5_warnx (context, unable to parse `%s', max_ticket_life);
+	krb5_warnx (contextp, unable to parse `%s', max_ticket_life);
 	return 1;
 	}
 }
 if (max_renewable_life != NULL) {
 	if (parse_deltat (max_renewable_life, ent-max_renewable_life,
 			  mask, KADM5_MAX_RLIFE)) {
-	krb5_warnx (context, unable to parse `%s', max_renewable_life);
+	krb5_warnx (contextp, unable to parse `%s', max_renewable_life);
 	return 1;
 	}
 }
@@ -459,21 +459,21 @@
 if (expiration) {
 	if (parse_timet (expiration, ent-princ_expire_time,
 			mask, KADM5_PRINC_EXPIRE_TIME)) {
-	krb5_warnx (context, unable to parse `%s', expiration);
+	krb5_warnx (contextp, unable to parse `%s', expiration);
 	return 1;
 	}
 }
 if (pw_expiration) {
 	if (parse_timet (pw_expiration, ent-pw_expiration,
 			 mask, KADM5_PW_EXPIRATION)) {
-	krb5_warnx (context, unable to parse `%s', pw_expiration);
+	krb5_warnx (contextp, unable to parse `%s', pw_expiration);
 	return 1;
 	}
 }
 if (attributes != NULL) {
 	if (parse_attributes (attributes, ent-attributes,
 			  mask, KADM5_ATTRIBUTES)) {
-	krb5_warnx (context, unable to parse `%s', attributes);
+	krb5_warnx (contextp, unable to parse `%s', attributes);
 	return 1;
 	}
 }



CVS commit: src/crypto/external/bsd/heimdal/dist/kadmin

2011-04-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 21 17:58:56 UTC 2011

Modified Files:
src/crypto/external/bsd/heimdal/dist/kadmin: get.c

Log Message:
Fix signed/unsigned warnings. Discover bug where  0 case cannot happen,
and change it to = 0 as intended.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/crypto/external/bsd/heimdal/dist/kadmin/get.c

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

Modified files:

Index: src/crypto/external/bsd/heimdal/dist/kadmin/get.c
diff -u src/crypto/external/bsd/heimdal/dist/kadmin/get.c:1.1.1.1 src/crypto/external/bsd/heimdal/dist/kadmin/get.c:1.2
--- src/crypto/external/bsd/heimdal/dist/kadmin/get.c:1.1.1.1	Wed Apr 13 14:14:35 2011
+++ src/crypto/external/bsd/heimdal/dist/kadmin/get.c	Thu Apr 21 13:58:56 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: get.c,v 1.1.1.1 2011/04/13 18:14:35 elric Exp $	*/
+/*	$NetBSD: get.c,v 1.2 2011/04/21 17:58:56 christos Exp $	*/
 
 /*
  * Copyright (c) 1997-2006 Kungliga Tekniska Högskolan
@@ -66,7 +66,7 @@
 { password, KADM5_TL_DATA, KRB5_TL_PASSWORD, KADM5_KEY_DATA, Password, Password, 0 },
 { pkinit-acl, KADM5_TL_DATA, KRB5_TL_PKINIT_ACL, 0, PK-INIT ACL, PK-INIT ACL, 0 },
 { aliases, KADM5_TL_DATA, KRB5_TL_ALIASES, 0, Aliases, Aliases, 0 },
-{ NULL }
+{ .fieldname = NULL }
 };
 
 struct field_info {
@@ -112,9 +112,9 @@
 static int
 cmp_salt (const krb5_salt *salt, const krb5_key_data *k)
 {
-if (salt-salttype != k-key_data_type[1])
+if (salt-salttype != (size_t)k-key_data_type[1])
 	return 1;
-if (salt-saltvalue.length != k-key_data_length[1])
+if (salt-saltvalue.length != (size_t)k-key_data_length[1])
 	return 1;
 return memcmp (salt-saltvalue.data, k-key_data_contents[1],
 		   salt-saltvalue.length);
@@ -247,7 +247,7 @@
 	krb5_tl_data *tl;
 
 	for (tl = princ-tl_data; tl != NULL; tl = tl-tl_data_next)
-	if (tl-tl_data_type == subfield)
+	if ((unsigned)tl-tl_data_type == subfield)
 		break;
 	if (tl == NULL) {
 	strlcpy(buf, , buf_len);
@@ -263,7 +263,8 @@
 	case KRB5_TL_PKINIT_ACL: {
 	HDB_Ext_PKINIT_acl acl;
 	size_t size;
-	int i, ret;
+	int ret;
+	size_t i;
 
 	ret = decode_HDB_Ext_PKINIT_acl(tl-tl_data_contents,
 	tl-tl_data_length,
@@ -295,7 +296,8 @@
 	case KRB5_TL_ALIASES: {
 	HDB_Ext_Aliases alias;
 	size_t size;
-	int i, ret;
+	int ret;
+	size_t i;
 
 	ret = decode_HDB_Ext_Aliases(tl-tl_data_contents,
 	 tl-tl_data_length,
@@ -311,7 +313,7 @@
 		ret = krb5_unparse_name(context, alias.aliases.val[i], p);
 		if (ret)
 		break;
-		if (i  0)
+		if (i  0)
 		strlcat(buf,  , buf_len);
 		strlcat(buf, p, buf_len);
 		free(p);



CVS commit: src/lib/libutil

2011-04-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 24 01:56:44 UTC 2011

Modified Files:
src/lib/libutil: passwd.c

Log Message:
fix freudian slip


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/lib/libutil/passwd.c

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

Modified files:

Index: src/lib/libutil/passwd.c
diff -u src/lib/libutil/passwd.c:1.50 src/lib/libutil/passwd.c:1.51
--- src/lib/libutil/passwd.c:1.50	Wed Aug 18 04:32:02 2010
+++ src/lib/libutil/passwd.c	Sat Apr 23 21:56:44 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: passwd.c,v 1.50 2010/08/18 08:32:02 christos Exp $	*/
+/*	$NetBSD: passwd.c,v 1.51 2011/04/24 01:56:44 christos Exp $	*/
 
 /*
  * Copyright (c) 1987, 1993, 1994, 1995
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: passwd.c,v 1.50 2010/08/18 08:32:02 christos Exp $);
+__RCSID($NetBSD: passwd.c,v 1.51 2011/04/24 01:56:44 christos Exp $);
 #endif /* LIBC_SCCS and not lint */
 
 #include sys/types.h
@@ -172,7 +172,7 @@
 	}
 	if (WIFEXITED(pstat)) {
 		if (WEXITSTATUS(pstat) != 0) {
-			warnx(pwd_mkdb exited with static %d,
+			warnx(pwd_mkdb exited with status %d,
 			WEXITSTATUS(pstat));
 			return -1;
 		}



CVS commit: src/lib/libpam/modules/pam_ksu

2011-04-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 25 22:01:04 UTC 2011

Modified Files:
src/lib/libpam/modules/pam_ksu: pam_ksu.c

Log Message:
- make log_krb5 varyadic and merge the last error message.
- check for NULL context.
- print a more meaningful error when things go south


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libpam/modules/pam_ksu/pam_ksu.c

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

Modified files:

Index: src/lib/libpam/modules/pam_ksu/pam_ksu.c
diff -u src/lib/libpam/modules/pam_ksu/pam_ksu.c:1.4 src/lib/libpam/modules/pam_ksu/pam_ksu.c:1.5
--- src/lib/libpam/modules/pam_ksu/pam_ksu.c:1.4	Sun Apr 24 14:53:55 2011
+++ src/lib/libpam/modules/pam_ksu/pam_ksu.c	Mon Apr 25 18:01:04 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pam_ksu.c,v 1.4 2011/04/24 18:53:55 elric Exp $	*/
+/*	$NetBSD: pam_ksu.c,v 1.5 2011/04/25 22:01:04 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002 Jacques A. Vidrine nec...@freebsd.org
@@ -29,7 +29,7 @@
 #ifdef __FreeBSD__
 __FBSDID($FreeBSD: src/lib/libpam/modules/pam_ksu/pam_ksu.c,v 1.5 2004/02/10 10:13:21 des Exp $);
 #else
-__RCSID($NetBSD: pam_ksu.c,v 1.4 2011/04/24 18:53:55 elric Exp $);
+__RCSID($NetBSD: pam_ksu.c,v 1.5 2011/04/25 22:01:04 christos Exp $);
 #endif
 
 #include sys/param.h
@@ -51,7 +51,8 @@
 
 #define PASSWORD_PROMPT	%s's password:
 
-static void	log_krb5(krb5_context, const char *, krb5_error_code);
+static void	log_krb5(krb5_context, krb5_error_code, const char *, ...)
+__printflike(3, 4);
 static long	get_su_principal(krb5_context, const char *, const char *,
 		char **, krb5_principal *);
 static int	auth_krb5(pam_handle_t *, krb5_context, const char *,
@@ -79,7 +80,7 @@
 	PAM_LOG(Got ruser: %s, (const char *)ruser);
 	rv = krb5_init_context(context);
 	if (rv != 0) {
-		log_krb5(context, krb5_init_context failed: %s, rv);
+		log_krb5(context, rv, krb5_init_context failed);
 		return (PAM_SERVICE_ERR);
 	}
 	rv = get_su_principal(context, user, ruser, su_principal_name, su_principal);
@@ -129,7 +130,7 @@
 
 	rv = krb5_get_init_creds_opt_alloc(context, gic_opt);
 	if (rv != 0) {
-		log_krb5(context, krb5_get_init_creds_opt_alloc: %s, rv);
+		log_krb5(context, rv, krb5_get_init_creds_opt_alloc);
 		return (PAM_SERVICE_ERR);
 	}
 	krb5_verify_init_creds_opt_init(vic_opt);
@@ -147,7 +148,7 @@
 	rv = krb5_get_init_creds_password(context, creds, su_principal,
 	pass, NULL, NULL, 0, NULL, gic_opt);
 	if (rv != 0) {
-		log_krb5(context, krb5_get_init_creds_password: %s, rv);
+		log_krb5(context, rv, krb5_get_init_creds_password);
 		return (PAM_AUTH_ERR);
 	}
 	krb5_verify_init_creds_opt_set_ap_req_nofail(vic_opt, 1);
@@ -155,24 +156,33 @@
 	vic_opt);
 	krb5_free_cred_contents(context, creds);
 	if (rv != 0) {
-		log_krb5(context, krb5_verify_init_creds: %s, rv);
+		log_krb5(context, rv, krb5_verify_init_creds);
 		return (PAM_AUTH_ERR);
 	}
 	return (PAM_SUCCESS);
 }
 
 static void
-log_krb5(krb5_context ctx, const char *fmt, krb5_error_code err)
+log_krb5(krb5_context ctx, krb5_error_code err, const char *fmt, ...)
 {
-	const char	*errtxt;
+	char b1[1024], b2[1024];
+	const char *errtxt;
+	va_list ap;
  
-errtxt = krb5_get_error_message(ctx, err);
+	va_start(ap, fmt);
+	vsnprintf(b1, sizeof(b1), fmt, ap);
+	va_end(ap);
+	if (ctx)
+		errtxt = krb5_get_error_message(ctx, err);
+	else
+		errtxt = NULL;
 	if (errtxt != NULL) {
-		PAM_LOG(fmt, errtxt);
 		krb5_free_error_message(ctx, errtxt);
+		snprintf(b2, sizeof(b2), %s (%s), b1, errtxt);
 	} else {
-		PAM_LOG(fmt, unknown);
+		snprintf(b2, sizeof(b1), %s (unknown %d), b1, (int)err);
 	}
+	PAM_LOG(b2);
 }
 
 /* Determine the target principal given the current user and the target user.
@@ -199,7 +209,6 @@
 	char		*principal_name, *ccname, *p;
 	long		 rv;
 	uid_t		 euid, ruid;
-	const char	*errtxt;
 
 	*su_principal = NULL;
 	default_principal = NULL;
@@ -244,7 +253,7 @@
 	rv = krb5_unparse_name(context, default_principal, principal_name);
 	krb5_free_principal(context, default_principal);
 	if (rv != 0) {
-		log_krb5(context, krb5_unparse_name: %s, rv);
+		log_krb5(context, rv, krb5_unparse_name);
 		return (rv);
 	}
 	PAM_LOG(Default principal name: %s, principal_name);
@@ -266,16 +275,8 @@
 		return (errno);
 	rv = krb5_parse_name(context, *su_principal_name, default_principal);
 	if (rv != 0) {
-		errtxt = krb5_get_error_message(context, rv);
-		if (errtxt != NULL) {
-			PAM_LOG(krb5_parse_name `%s': %s, *su_principal_name,
-			errtxt);
-			krb5_free_error_message(context, errtxt);
-		} else {
-			PAM_LOG(krb5_parse_name `%s': %ld, *su_principal_name,
-			rv);
-		}
-		free(*su_principal_name);
+		log_krb5(context, rv, krb5_parse_name `%s',
+		*su_principal_name);
 		return (rv);
 	}
 	PAM_LOG(Target principal name: %s, *su_principal_name);



CVS commit: src/lib/libpam/modules/pam_ksu

2011-04-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 25 22:03:20 UTC 2011

Modified Files:
src/lib/libpam/modules/pam_ksu: pam_ksu.c

Log Message:
fix pasto (of no consequence)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libpam/modules/pam_ksu/pam_ksu.c

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

Modified files:

Index: src/lib/libpam/modules/pam_ksu/pam_ksu.c
diff -u src/lib/libpam/modules/pam_ksu/pam_ksu.c:1.5 src/lib/libpam/modules/pam_ksu/pam_ksu.c:1.6
--- src/lib/libpam/modules/pam_ksu/pam_ksu.c:1.5	Mon Apr 25 18:01:04 2011
+++ src/lib/libpam/modules/pam_ksu/pam_ksu.c	Mon Apr 25 18:03:20 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pam_ksu.c,v 1.5 2011/04/25 22:01:04 christos Exp $	*/
+/*	$NetBSD: pam_ksu.c,v 1.6 2011/04/25 22:03:20 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002 Jacques A. Vidrine nec...@freebsd.org
@@ -29,7 +29,7 @@
 #ifdef __FreeBSD__
 __FBSDID($FreeBSD: src/lib/libpam/modules/pam_ksu/pam_ksu.c,v 1.5 2004/02/10 10:13:21 des Exp $);
 #else
-__RCSID($NetBSD: pam_ksu.c,v 1.5 2011/04/25 22:01:04 christos Exp $);
+__RCSID($NetBSD: pam_ksu.c,v 1.6 2011/04/25 22:03:20 christos Exp $);
 #endif
 
 #include sys/param.h
@@ -180,7 +180,7 @@
 		krb5_free_error_message(ctx, errtxt);
 		snprintf(b2, sizeof(b2), %s (%s), b1, errtxt);
 	} else {
-		snprintf(b2, sizeof(b1), %s (unknown %d), b1, (int)err);
+		snprintf(b2, sizeof(b2), %s (unknown %d), b1, (int)err);
 	}
 	PAM_LOG(b2);
 }



CVS commit: src/lib/libpam/modules/pam_krb5

2011-04-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 25 22:22:25 UTC 2011

Modified Files:
src/lib/libpam/modules/pam_krb5: pam_krb5.c

Log Message:
- make log_krb5 varyadic
- centralize error handling to one function
- check for NULL context


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/lib/libpam/modules/pam_krb5/pam_krb5.c

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

Modified files:

Index: src/lib/libpam/modules/pam_krb5/pam_krb5.c
diff -u src/lib/libpam/modules/pam_krb5/pam_krb5.c:1.24 src/lib/libpam/modules/pam_krb5/pam_krb5.c:1.25
--- src/lib/libpam/modules/pam_krb5/pam_krb5.c:1.24	Sun Apr 24 14:48:04 2011
+++ src/lib/libpam/modules/pam_krb5/pam_krb5.c	Mon Apr 25 18:22:25 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pam_krb5.c,v 1.24 2011/04/24 18:48:04 elric Exp $	*/
+/*	$NetBSD: pam_krb5.c,v 1.25 2011/04/25 22:22:25 christos Exp $	*/
 
 /*-
  * This pam_krb5 module contains code that is:
@@ -53,7 +53,7 @@
 #ifdef __FreeBSD__
 __FBSDID($FreeBSD: src/lib/libpam/modules/pam_krb5/pam_krb5.c,v 1.22 2005/01/24 16:49:50 rwatson Exp $);
 #else
-__RCSID($NetBSD: pam_krb5.c,v 1.24 2011/04/24 18:48:04 elric Exp $);
+__RCSID($NetBSD: pam_krb5.c,v 1.25 2011/04/25 22:22:25 christos Exp $);
 #endif
 
 #include sys/types.h
@@ -83,7 +83,8 @@
 #define	COMPAT_HEIMDAL
 /* #define	COMPAT_MIT */
 
-static void	log_krb5(krb5_context, const char *, krb5_error_code);
+static void	log_krb5(krb5_context, krb5_error_code, struct syslog_data *,
+const char *, ...) __printflike(4, 5);
 static int	verify_krb_v5_tgt(krb5_context, krb5_ccache, char *, int);
 static void	cleanup_cache(pam_handle_t *, void *, int);
 static const	char *compat_princ_component(krb5_context, krb5_principal, int);
@@ -201,7 +202,7 @@
 	krbret = krb5_parse_name(pam_context, principal, princ);
 	free(principal);
 	if (krbret != 0) {
-		log_krb5(pam_context, Error krb5_parse_name(): %s, krbret);
+		log_krb5(pam_context, krbret, NULL, krb5_parse_name);
 		PAM_VERBOSE_ERROR(Kerberos 5 error);
 		retval = PAM_SERVICE_ERR;
 		goto cleanup3;
@@ -212,7 +213,7 @@
 	/* Now convert the principal name into something human readable */
 	krbret = krb5_unparse_name(pam_context, princ, princ_name);
 	if (krbret != 0) {
-		log_krb5(pam_context, Error krb5_unparse_name(): %s, krbret);
+		log_krb5(pam_context, krbret, NULL, krb5_unparse_name);
 		PAM_VERBOSE_ERROR(Kerberos 5 error);
 		retval = PAM_SERVICE_ERR;
 		goto cleanup2;
@@ -236,8 +237,8 @@
 		sizeof(luser), luser);
 		if (krbret != 0) {
 			PAM_VERBOSE_ERROR(Kerberos 5 error);
-			log_krb5(pam_context,
-			Error krb5_aname_to_localname(): %s, krbret);
+			log_krb5(pam_context, krbret, NULL,
+			krb5_aname_to_localname);
 			retval = PAM_USER_UNKNOWN;
 			goto cleanup2;
 		}
@@ -263,8 +264,8 @@
 	pass, NULL, pamh, 0, NULL, opts);
 	if (krbret != 0) {
 		PAM_VERBOSE_ERROR(Kerberos 5 error);
-		log_krb5(pam_context,
-		Error krb5_get_init_creds_password(): %s, krbret);
+		log_krb5(pam_context, krbret, NULL,
+		krb5_get_init_creds_password);
 		retval = PAM_AUTH_ERR;
 		goto cleanup2;
 	}
@@ -275,21 +276,21 @@
 	krbret = krb5_cc_new_unique(pam_context, MEMORY, NULL, ccache);
 	if (krbret != 0) {
 		PAM_VERBOSE_ERROR(Kerberos 5 error);
-		log_krb5(pam_context, Error krb5_cc_gen_new(): %s, krbret);
+		log_krb5(pam_context, krbret, NULL, krb5_cc_gen_new);
 		retval = PAM_SERVICE_ERR;
 		goto cleanup;
 	}
 	krbret = krb5_cc_initialize(pam_context, ccache, princ);
 	if (krbret != 0) {
 		PAM_VERBOSE_ERROR(Kerberos 5 error);
-		log_krb5(pam_context, Error krb5_cc_initialize(): %s, krbret);
+		log_krb5(pam_context, krbret, NULL, krb5_cc_initialize);
 		retval = PAM_SERVICE_ERR;
 		goto cleanup;
 	}
 	krbret = krb5_cc_store_cred(pam_context, ccache, creds);
 	if (krbret != 0) {
 		PAM_VERBOSE_ERROR(Kerberos 5 error);
-		log_krb5(pam_context, Error krb5_cc_store_cred(): %s, krbret);
+		log_krb5(pam_context, krbret, NULL, krb5_cc_store_cred);
 		krb5_cc_destroy(pam_context, ccache);
 		retval = PAM_SERVICE_ERR;
 		goto cleanup;
@@ -382,7 +383,6 @@
 	const void *cache_data;
 	char *cache_name_buf = NULL, *p, *cache_name_buf2 = NULL;
 	char pwbuf[1024];
-	const char *errtxt;
 
 	uid_t euid;
 	gid_t egid;
@@ -427,15 +427,8 @@
 	}
 	krbret = krb5_cc_resolve(pam_context, cache_data, ccache_temp);
 	if (krbret != 0) {
-		errtxt = krb5_get_error_message(pam_context, krbret);
-		if (errtxt != NULL) {
-			PAM_LOG(Error krb5_cc_resolve(\%s\): %s,
-			(const char *)cache_data, errtxt);
-			krb5_free_error_message(pam_context, errtxt);
-		} else {
-			PAM_LOG(Error krb5_cc_resolve(\%s\): %d,
-			(const char *)cache_data, krbret);
-		}
+		log_krb5(pam_context, krbret, NULL, krb5_cc_resolve(\%s\),
+		(const char *)cache_data);
 		retval = PAM_SERVICE_ERR;
 		goto cleanup3;
 	}
@@ -514,21 +507,20 @@
 	/* Initialize the new ccache */
 	krbret = krb5_cc_get_principal(pam_context, ccache_temp, princ);
 	

CVS commit: src/usr.sbin/crash

2011-04-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 30 16:57:59 UTC 2011

Modified Files:
src/usr.sbin/crash: Makefile
Added Files:
src/usr.sbin/crash/arch: x86.c
Removed Files:
src/usr.sbin/crash/arch: i386.c

Log Message:
Share the amd64 and i386 files.
XXX: Is there a better way to get the cpu family?


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/crash/Makefile
cvs rdiff -u -r1.1 -r0 src/usr.sbin/crash/arch/i386.c
cvs rdiff -u -r0 -r1.1 src/usr.sbin/crash/arch/x86.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/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.10 src/usr.sbin/crash/Makefile:1.11
--- src/usr.sbin/crash/Makefile:1.10	Thu Apr 14 04:21:06 2011
+++ src/usr.sbin/crash/Makefile	Sat Apr 30 12:57:58 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2011/04/14 08:21:06 mrg Exp $
+#	$NetBSD: Makefile,v 1.11 2011/04/30 16:57:58 christos Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -37,9 +37,12 @@
 
 . if${MACHINE} == amd64 \
  || ${MACHINE} == i386
+MACHINE_FAMILY = x86
 .PATH:	${S}/arch/x86/x86
 SRCS+=	db_trace.c
 SRCS+=	db_machdep.c
+. else
+MACHINE_FAMILY = ${MACHINE}
 . endif
 
 . if ${MACHINE} == sparc64
@@ -51,8 +54,8 @@
 
 # arch.c
 .PATH:	${.CURDIR}/arch
-. if (exists(${.CURDIR}/arch/${MACHINE_ARCH}.c))
-SRCS+=	${MACHINE_ARCH}.c
+. if (exists(${.CURDIR}/arch/${MACHINE_FAMILY}.c))
+SRCS+=	${MACHINE_FAMILY}.c
 . else
 SRCS+=	generic.c
 . endif

Added files:

Index: src/usr.sbin/crash/arch/x86.c
diff -u /dev/null src/usr.sbin/crash/arch/x86.c:1.1
--- /dev/null	Sat Apr 30 12:57:59 2011
+++ src/usr.sbin/crash/arch/x86.c	Sat Apr 30 12:57:58 2011
@@ -0,0 +1,73 @@
+/*	$NetBSD: x86.c,v 1.1 2011/04/30 16:57:58 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
+ * 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
+#ifndef lint
+__RCSID($NetBSD: x86.c,v 1.1 2011/04/30 16:57:58 christos Exp $);
+#endif /* not lint */
+
+#include ddb/ddb.h
+
+#include kvm.h
+#include nlist.h
+#include err.h
+#include stdlib.h
+
+#include machine/frame.h
+#include machine/pcb.h
+#include x86/db_machdep.h
+
+#include extern.h
+
+static struct nlist nl[] = {
+	{ .n_name = _dumppcb },
+	{ .n_name = NULL },
+};
+
+struct pcb	pcb;
+
+void
+db_mach_init(kvm_t *kd)
+{
+
+	if (kvm_nlist(kd, nl) == -1) {
+		errx(EXIT_FAILURE, kvm_nlist: %s, kvm_geterr(kd));
+	}
+	if ((size_t)kvm_read(kd, nl[0].n_value, pcb, sizeof(pcb)) !=
+	sizeof(pcb)) {
+		errx(EXIT_FAILURE, cannot read dumppcb: %s, kvm_geterr(kd));
+	}
+ddb_regs.tf_sp = pcb.pcb_sp;
+ddb_regs.tf_bp = pcb.pcb_bp;
+if (ddb_regs.tf_bp != 0  ddb_regs.tf_sp != 0) {
+	printf(Backtrace from time of crash is available.\n);
+	}
+}



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

2011-04-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 30 16:58:35 UTC 2011

Modified Files:
src/sys/arch/x86/include: db_machdep.h

Log Message:
add a define for pcb_sp


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/include/db_machdep.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/x86/include/db_machdep.h
diff -u src/sys/arch/x86/include/db_machdep.h:1.2 src/sys/arch/x86/include/db_machdep.h:1.3
--- src/sys/arch/x86/include/db_machdep.h:1.2	Sun Apr 10 16:38:37 2011
+++ src/sys/arch/x86/include/db_machdep.h	Sat Apr 30 12:58:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_machdep.h,v 1.2 2011/04/10 20:38:37 christos Exp $	*/
+/*	$NetBSD: db_machdep.h,v 1.3 2011/04/30 16:58:35 christos Exp $	*/
 
 #ifndef _X86_DB_MACHDEP_H_
 #define _X86_DB_MACHDEP_H_
@@ -21,12 +21,14 @@
 #define	tf_ip		tf_rip
 #define	tf_bp		tf_rbp
 #define	pcb_bp		pcb_rbp
+#define	pcb_sp		pcb_rsp
 #define	x86_frame	x86_64_frame
 #else
 #define	tf_sp		tf_esp
 #define	tf_ip		tf_eip
 #define	tf_bp		tf_ebp
 #define	pcb_bp		pcb_ebp
+#define	pcb_sp		pcb_esp
 #define	x86_frame	i386_frame
 #endif
 



  1   2   3   4   5   6   7   8   9   10   >