CVS commit: src/crypto/external/bsd/netpgp/dist/src

2012-11-28 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Nov 28 09:23:15 UTC 2012

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/librsa: libnetpgprsa.3
src/crypto/external/bsd/netpgp/dist/src/libverify: libnetpgpverify.3

Log Message:
Remove trailing whitespace, sort SEE ALSO, comment out reference
to non-existing libbz2(3).

XXX: bn(3) references correct? (man page doesn't exist in NetBSD)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/crypto/external/bsd/netpgp/dist/src/librsa/libnetpgprsa.3
cvs rdiff -u -r1.2 -r1.3 \
src/crypto/external/bsd/netpgp/dist/src/libverify/libnetpgpverify.3

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/netpgp/dist/src/librsa/libnetpgprsa.3
diff -u src/crypto/external/bsd/netpgp/dist/src/librsa/libnetpgprsa.3:1.2 src/crypto/external/bsd/netpgp/dist/src/librsa/libnetpgprsa.3:1.3
--- src/crypto/external/bsd/netpgp/dist/src/librsa/libnetpgprsa.3:1.2	Tue Nov 20 05:26:25 2012
+++ src/crypto/external/bsd/netpgp/dist/src/librsa/libnetpgprsa.3	Wed Nov 28 09:23:14 2012
@@ -1,4 +1,4 @@
-.\ $NetBSD: libnetpgprsa.3,v 1.2 2012/11/20 05:26:25 agc Exp $
+.\ $NetBSD: libnetpgprsa.3,v 1.3 2012/11/28 09:23:14 wiz Exp $
 .\
 .\ Copyright (c) 2012 Alistair Crooks a...@netbsd.org
 .\ All rights reserved.
@@ -101,9 +101,8 @@ encryption and decryption, and DSA signi
 RSA and DSA verification are provided by the
 .Xr libnetpgpverify 3
 library.
-.Pp
 .Sh SEE ALSO
-.Xr libnetpgpbn 3
+.Xr libnetpgpbn 3 ,
 .Xr libnetpgpverify 3
 .Sh HISTORY
 The

Index: src/crypto/external/bsd/netpgp/dist/src/libverify/libnetpgpverify.3
diff -u src/crypto/external/bsd/netpgp/dist/src/libverify/libnetpgpverify.3:1.2 src/crypto/external/bsd/netpgp/dist/src/libverify/libnetpgpverify.3:1.3
--- src/crypto/external/bsd/netpgp/dist/src/libverify/libnetpgpverify.3:1.2	Tue Nov 20 05:26:26 2012
+++ src/crypto/external/bsd/netpgp/dist/src/libverify/libnetpgpverify.3	Wed Nov 28 09:23:15 2012
@@ -1,4 +1,4 @@
-.\ $NetBSD: libnetpgpverify.3,v 1.2 2012/11/20 05:26:26 agc Exp $
+.\ $NetBSD: libnetpgpverify.3,v 1.3 2012/11/28 09:23:15 wiz Exp $
 .\
 .\ Copyright (c) 2012 Alistair Crooks a...@netbsd.org
 .\ All rights reserved.
@@ -70,7 +70,7 @@ using
 to read the public keys of trusted identities,
 and to read files or memory which has already been signed.
 The
-.Fn pgpv_verify 
+.Fn pgpv_verify
 function is used to verify the signature, either on data, or on memory.
 To signal to
 .Fn pgpv_verify
@@ -124,8 +124,8 @@ This is handled automatically by
 .Nm
 .Sh SEE ALSO
 .Xr bn 3 ,
-.Xr zlib 3 ,
-.Xr bzlib2 3
+.\ .Xr bzlib2 3 ,
+.Xr zlib 3
 .Sh STANDARDS
 The
 .Nm



CVS commit: src/share/man/man4/man4.amiga

2012-11-28 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Nov 28 09:29:48 UTC 2012

Modified Files:
src/share/man/man4/man4.amiga: clockport.4

Log Message:
Bump date for previous, remove duplicate word.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/share/man/man4/man4.amiga/clockport.4

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

Modified files:

Index: src/share/man/man4/man4.amiga/clockport.4
diff -u src/share/man/man4/man4.amiga/clockport.4:1.6 src/share/man/man4/man4.amiga/clockport.4:1.7
--- src/share/man/man4/man4.amiga/clockport.4:1.6	Mon Nov 26 00:38:15 2012
+++ src/share/man/man4/man4.amiga/clockport.4	Wed Nov 28 09:29:47 2012
@@ -1,4 +1,4 @@
-.\ $NetBSD: clockport.4,v 1.6 2012/11/26 00:38:15 rkujawa Exp $
+.\ $NetBSD: clockport.4,v 1.7 2012/11/28 09:29:47 wiz Exp $
 .\
 .\ Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd May 15, 2012
+.Dd November 26, 2012
 .Dt CLOCKPORT 4 amiga
 .Os
 .Sh NAME
@@ -52,7 +52,7 @@ Individual Computers SilverSurfer 16C550
 .Sh CODE REFERENCES
 The
 .Nm
-interface is implemented within the the
+interface is implemented within the
 .Pa sys/arch/amiga/clockport
 directory.
 .Sh SEE ALSO



CVS commit: src/share/man/man4/man4.amiga

2012-11-28 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Nov 28 09:31:15 UTC 2012

Modified Files:
src/share/man/man4/man4.amiga: z3rambd.4

Log Message:
Add some articles. Remove trailing whitespace. Fix a typo.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man4/man4.amiga/z3rambd.4

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

Modified files:

Index: src/share/man/man4/man4.amiga/z3rambd.4
diff -u src/share/man/man4/man4.amiga/z3rambd.4:1.2 src/share/man/man4/man4.amiga/z3rambd.4:1.3
--- src/share/man/man4/man4.amiga/z3rambd.4:1.2	Mon Nov 26 23:02:53 2012
+++ src/share/man/man4/man4.amiga/z3rambd.4	Wed Nov 28 09:31:15 2012
@@ -1,4 +1,4 @@
-.\ $NetBSD: z3rambd.4,v 1.2 2012/11/26 23:02:53 rkujawa Exp $
+.\ $NetBSD: z3rambd.4,v 1.3 2012/11/28 09:31:15 wiz Exp $
 .\
 .\ Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -31,7 +31,7 @@
 .Dt Z3RAMBD 4 amiga
 .Os
 .Sh NAME
-.Nm z3rambd 
+.Nm z3rambd
 .Nd Zorro III RAM block device driver
 .Sh SYNOPSIS
 .Cd z3rambd* at zbus0
@@ -67,15 +67,15 @@ driver was written by
 .An Radoslaw Kujawa
 .Aq radoslaw.kuj...@gmail.com .
 .Sh CAVEATS
-Currently it is up to user to ensure that given memory board is not used by
-the kernel as normal RAM.
-It is usually safe to pass
+Currently it is up to the user to ensure that given memory board
+is not used by the kernel as normal RAM.
+It is usually safe to pass the
 .Ic -n0
 and
 .Ic -p
 parameters to boot loader.
 .Pp
-If the kernel is compiled wihtout
+If the kernel is compiled without the
 .Nm
 driver, it is possible to use Zorro III
 memory boards as normal RAM in some configurations.



CVS commit: src/doc

2012-11-28 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Nov 28 09:43:16 UTC 2012

Modified Files:
src/doc: 3RDPARTY

Log Message:
binutils-2.23.1 out.


To generate a diff of this commit:
cvs rdiff -u -r1.982 -r1.983 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.982 src/doc/3RDPARTY:1.983
--- src/doc/3RDPARTY:1.982	Tue Nov 13 11:03:31 2012
+++ src/doc/3RDPARTY	Wed Nov 28 09:43:16 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.982 2012/11/13 11:03:31 apb Exp $
+#	$NetBSD: 3RDPARTY,v 1.983 2012/11/28 09:43:16 wiz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -154,7 +154,7 @@ Todo[5]: Reconcile the doc directory.
 
 Package:	binutils
 Version:	2.21.1a
-Current Vers:	2.22
+Current Vers:	2.23.1
 Maintainer:	FSF
 Archive Site:	ftp://ftp.gnu.org/gnu/binutils/
 Home Page:	http://www.gnu.org/software/binutils/



CVS commit: src/usr.sbin/user

2012-11-28 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Wed Nov 28 11:20:58 UTC 2012

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

Log Message:
Google Code In bug fix by Philip Hayes, fixes bin/41049


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/usr.sbin/user/user.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/user/user.c
diff -u src/usr.sbin/user/user.c:1.129 src/usr.sbin/user/user.c:1.130
--- src/usr.sbin/user/user.c:1.129	Thu Dec  1 00:34:05 2011
+++ src/usr.sbin/user/user.c	Wed Nov 28 11:20:58 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: user.c,v 1.129 2011/12/01 00:34:05 dholland Exp $ */
+/* $NetBSD: user.c,v 1.130 2012/11/28 11:20:58 blymn Exp $ */
 
 /*
  * Copyright (c) 1999 Alistair G. Crooks.  All rights reserved.
@@ -33,7 +33,7 @@
 #ifndef lint
 __COPYRIGHT(@(#) Copyright (c) 1999\
  The NetBSD Foundation, Inc.  All rights reserved.);
-__RCSID($NetBSD: user.c,v 1.129 2011/12/01 00:34:05 dholland Exp $);
+__RCSID($NetBSD: user.c,v 1.130 2012/11/28 11:20:58 blymn Exp $);
 #endif
 
 #include sys/types.h
@@ -1579,6 +1579,12 @@ moduser(char *login_name, char *newlogin
 	login_name, up-u_uid);
 }
 pwp-pw_gid = pwp-pw_uid;
+if (!creategid(newlogin, pwp-pw_uid, )) {
+	errx(EXIT_FAILURE, 
+	Could not create group %s 
+	with uid %d, newlogin, 
+	up-u_uid);
+}
 			} else if ((grp = getgrnam(up-u_primgrp)) != NULL) {
 pwp-pw_gid = grp-gr_gid;
 			} else if (is_number(up-u_primgrp) 



CVS commit: src/usr.sbin/user

2012-11-28 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Wed Nov 28 11:31:27 UTC 2012

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

Log Message:
Fix error message when trying to add a group using -g =uid that
that already exists, the old version printed the wrong GID.


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/usr.sbin/user/user.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/user/user.c
diff -u src/usr.sbin/user/user.c:1.130 src/usr.sbin/user/user.c:1.131
--- src/usr.sbin/user/user.c:1.130	Wed Nov 28 11:20:58 2012
+++ src/usr.sbin/user/user.c	Wed Nov 28 11:31:27 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: user.c,v 1.130 2012/11/28 11:20:58 blymn Exp $ */
+/* $NetBSD: user.c,v 1.131 2012/11/28 11:31:27 blymn Exp $ */
 
 /*
  * Copyright (c) 1999 Alistair G. Crooks.  All rights reserved.
@@ -33,7 +33,7 @@
 #ifndef lint
 __COPYRIGHT(@(#) Copyright (c) 1999\
  The NetBSD Foundation, Inc.  All rights reserved.);
-__RCSID($NetBSD: user.c,v 1.130 2012/11/28 11:20:58 blymn Exp $);
+__RCSID($NetBSD: user.c,v 1.131 2012/11/28 11:31:27 blymn Exp $);
 #endif
 
 #include sys/types.h
@@ -1576,7 +1576,7 @@ moduser(char *login_name, char *newlogin
 	errx(EXIT_FAILURE,
 	Can't modify user `%s': 
 	gid %d is already in use,
-	login_name, up-u_uid);
+	login_name, pwp-pw_uid);
 }
 pwp-pw_gid = pwp-pw_uid;
 if (!creategid(newlogin, pwp-pw_uid, )) {



CVS commit: src/sys/fs/smbfs

2012-11-28 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Wed Nov 28 13:34:24 UTC 2012

Modified Files:
src/sys/fs/smbfs: smbfs_node.c smbfs_node.h smbfs_vnops.c

Log Message:
Various fixes for smbfs:

- Implement NGONE to fix caching issue described in PR kern/25070.
  Mostly taken from FreeBSD r125637.

- Revert revision 1.70 of smbfs_vnops.c to fix setattr to opened
  direcotry.  In case of SMB_CAP_NT_SMBS, NOPEN is set after
  smbfs_smb_ntcreatex() call.  If NOPEN is set in front, it will
  immediately return by condition at do_open label.

- In smbfs_close(), call smbfs_smb_close() and drop NOPEN bit in
  the case of direcotry.  Otherwise smbfs_rmdir() fails when the
  directory was opened.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/fs/smbfs/smbfs_node.c
cvs rdiff -u -r1.12 -r1.13 src/sys/fs/smbfs/smbfs_node.h
cvs rdiff -u -r1.82 -r1.83 src/sys/fs/smbfs/smbfs_vnops.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/fs/smbfs/smbfs_node.c
diff -u src/sys/fs/smbfs/smbfs_node.c:1.47 src/sys/fs/smbfs/smbfs_node.c:1.48
--- src/sys/fs/smbfs/smbfs_node.c:1.47	Sun Jun 12 03:35:54 2011
+++ src/sys/fs/smbfs/smbfs_node.c	Wed Nov 28 13:34:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: smbfs_node.c,v 1.47 2011/06/12 03:35:54 rmind Exp $	*/
+/*	$NetBSD: smbfs_node.c,v 1.48 2012/11/28 13:34:24 nakayama Exp $	*/
 
 /*
  * Copyright (c) 2000-2001 Boris Popov
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: smbfs_node.c,v 1.47 2011/06/12 03:35:54 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: smbfs_node.c,v 1.48 2012/11/28 13:34:24 nakayama Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -96,6 +96,7 @@ static int
 smbfs_node_alloc(struct mount *mp, struct vnode *dvp,
 	const char *name, int nmlen, struct smbfattr *fap, struct vnode **vpp)
 {
+	struct vattr vattr;
 	struct smbmount *smp = VFSTOSMBFS(mp);
 	struct smbnode_hashhead *nhpp;
 	struct smbnode *np, *np2, *dnp;
@@ -139,6 +140,20 @@ retry:
 		mutex_exit(smp-sm_hashlock);
 		if (vget(vp, LK_EXCLUSIVE) != 0)
 			goto retry;
+		/* Force cached attributes to be refreshed if stale. */
+		(void)VOP_GETATTR(vp, vattr, curlwp-l_cred);
+		/*
+		 * If the file type on the server is inconsistent with
+		 * what it was when we created the vnode, kill the
+		 * bogus vnode now and fall through to the code below
+		 * to create a new one with the right type.
+		 */
+		if ((vp-v_type == VDIR  (np-n_dosattr  SMB_FA_DIR) == 0) ||
+		(vp-v_type == VREG  (np-n_dosattr  SMB_FA_DIR) != 0)) {
+			vput(vp);
+			vgone(vp);
+			break;
+		}
 		*vpp = vp;
 		return (0);
 	}
@@ -307,10 +322,9 @@ smbfs_inactive(void *v)
 		np-n_flag = ~NOPEN;
 		smbfs_attr_cacheremove(vp);
 	}
+	*ap-a_recycle = ((np-n_flag  NGONE) != 0);
 	VOP_UNLOCK(vp);
 
-	*ap-a_recycle = false; /* XXX: should set the value properly */
-
 	return (0);
 }
 /*

Index: src/sys/fs/smbfs/smbfs_node.h
diff -u src/sys/fs/smbfs/smbfs_node.h:1.12 src/sys/fs/smbfs/smbfs_node.h:1.13
--- src/sys/fs/smbfs/smbfs_node.h:1.12	Thu Nov  2 17:34:21 2006
+++ src/sys/fs/smbfs/smbfs_node.h	Wed Nov 28 13:34:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: smbfs_node.h,v 1.12 2006/11/02 17:34:21 jmmv Exp $	*/
+/*	$NetBSD: smbfs_node.h,v 1.13 2012/11/28 13:34:24 nakayama Exp $	*/
 
 /*
  * Copyright (c) 2000-2001, Boris Popov
@@ -48,6 +48,7 @@
 /*efine	NNEW			0x0008*//* smb/vnode has been allocated */
 #define	NREFPARENT		0x0010	/* node holds parent from recycling */
 #define	NOPEN			0x2000	/* file is open */
+#define	NGONE			0x4000	/* file has been removed/renamed */
 
 #define SMBFS_ATTRTIMO		5	/* Attribute cache timeout in sec */
 

Index: src/sys/fs/smbfs/smbfs_vnops.c
diff -u src/sys/fs/smbfs/smbfs_vnops.c:1.82 src/sys/fs/smbfs/smbfs_vnops.c:1.83
--- src/sys/fs/smbfs/smbfs_vnops.c:1.82	Mon Nov  5 17:27:38 2012
+++ src/sys/fs/smbfs/smbfs_vnops.c	Wed Nov 28 13:34:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: smbfs_vnops.c,v 1.82 2012/11/05 17:27:38 dholland Exp $	*/
+/*	$NetBSD: smbfs_vnops.c,v 1.83 2012/11/28 13:34:24 nakayama Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: smbfs_vnops.c,v 1.82 2012/11/05 17:27:38 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: smbfs_vnops.c,v 1.83 2012/11/28 13:34:24 nakayama Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -252,9 +252,10 @@ smbfs_open(void *v)
 		return EACCES;
 	}
 	if (vp-v_type == VDIR) {
-		np-n_flag |= NOPEN;
-		if ((sv_caps  SMB_CAP_NT_SMBS) == 0)
+		if ((sv_caps  SMB_CAP_NT_SMBS) == 0) {
+			np-n_flag |= NOPEN;
 			return 0;
+		}
 		goto do_open;	/* skip 'modified' check */
 	}
 
@@ -339,13 +340,22 @@ smbfs_close(void *v)
 	 * Ideally, the lookup routines should handle such case, and
 	 * the context would be removed only in smbfs_inactive().
 	 */
-	if (vp-v_type == VDIR  (np-n_flag  NOPEN) != 0 
-	np-n_dirseq != NULL) {
+	if (vp-v_type == VDIR 

CVS commit: src/sys/arch/xen/xenbus

2012-11-28 Thread Roger Pau Monne
Module Name:src
Committed By:   royger
Date:   Wed Nov 28 16:26:59 UTC 2012

Modified Files:
src/sys/arch/xen/xenbus: xenbus_xs.c

Log Message:
xen: prevent adding duplicate xenwatches

When a xenstore watch triggers, the event is processed on process_msg
and if a valid handle it's found the handler is queued for execution
on the pending xen watches queue (watch_events).

This may present a problem if we trigger a xenwatch several times and
then disconnect the device. If several xenwatch events are added to
the watch_events queue and the device is disconnected afterwards, the
first processed xenwatch event will disconnect the device, remove the
watch and free all resources. This triggers a panic if there are
pending xenwatch events for that device already queued in the local
queue of the function xenwatch_thread, since when the next watch that
has the same handler tries to execute we get a panic due to the fact
that the device is already disconnected and all resources had been
freed:

xenbus_watch: 0xab7cd1d0
xbw_callback: 0x80755dd4
otherend_changed: backend/vif/1/0
backend/vif/1/0/state 6
backend/vif/1/0 - Closed
backend/vif/1/0 - backend_device, b_detach: 0x8075a2bf
xenbus_watch: 0xab7cd1d0
xbw_callback: 0xfc5ec02183e547a8
fatal protection fault in supervisor mode
trap type 4 code 0 rip 80756596 cs e030 rflags 10246 cr2
7f7ff7b4c020 ilevel 0 rsp a000e6d82c50
curlwp 0xaa72d580 pid 0 lid 36 lowest kstack
0xa000e6d7f000
kernel: protection fault trap, code=0
Stopped in pid 0.36 (system) at netbsd:xenwatch_thread+0xc7:call
*10(%rax
)
xenwatch_thread() at netbsd:xenwatch_thread+0xc7
ds  f
es  5987
fs  2c40
gs  1460
rdi ab7cd1d0
rsi aa5477f0
rbp a000e6d82c70
rbx ab7c14c0
rdx 2
rcx f
rax ab7cd1d0
r8  78
r9  ffef
r10 deadbeef
r11 1
r12 a000e6d82c50
r13 aa72d580
r14 aa72d580
r15 0
rip 80756596xenwatch_thread+0xc7
cs  e030
rflags  10246
rsp a000e6d82c50
ss  e02b
netbsd:xenwatch_thread+0xc7:call*10(%rax)


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/xen/xenbus/xenbus_xs.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/xen/xenbus/xenbus_xs.c
diff -u src/sys/arch/xen/xenbus/xenbus_xs.c:1.22 src/sys/arch/xen/xenbus/xenbus_xs.c:1.23
--- src/sys/arch/xen/xenbus/xenbus_xs.c:1.22	Wed Jul 27 23:11:23 2011
+++ src/sys/arch/xen/xenbus/xenbus_xs.c	Wed Nov 28 16:26:59 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_xs.c,v 1.22 2011/07/27 23:11:23 matt Exp $ */
+/* $NetBSD: xenbus_xs.c,v 1.23 2012/11/28 16:26:59 royger Exp $ */
 /**
  * xenbus_xs.c
  *
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xenbus_xs.c,v 1.22 2011/07/27 23:11:23 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: xenbus_xs.c,v 1.23 2012/11/28 16:26:59 royger Exp $);
 
 #if 0
 #define DPRINTK(fmt, args...) \
@@ -751,7 +751,7 @@ xenwatch_thread(void *unused)
 static int
 process_msg(void)
 {
-	struct xs_stored_msg *msg;
+	struct xs_stored_msg *msg, *s_msg;
 	char *body;
 	int err;
 
@@ -782,7 +782,7 @@ process_msg(void)
 	body[msg-hdr.len] = '\0';
 
 	if (msg-hdr.type == XS_WATCH_EVENT) {
-		bool found;
+		bool found, repeated;
 
 		DPRINTK(process_msg: XS_WATCH_EVENT);
 		msg-u.watch.vec = split(body, msg-hdr.len,
@@ -796,14 +796,24 @@ process_msg(void)
 		msg-u.watch.handle = find_watch(
 		msg-u.watch.vec[XS_WATCH_TOKEN]);
 		found = (msg-u.watch.handle != NULL);
+		repeated = false;
 		if (found) {
 			mutex_enter(watch_events_lock);
-			SIMPLEQ_INSERT_TAIL(watch_events, msg, msg_next);
-			cv_broadcast(watch_cv);
+			/* Don't add duplicate events to the queue of pending watches */
+			SIMPLEQ_FOREACH(s_msg, watch_events, msg_next) {
+if (s_msg-u.watch.handle == msg-u.watch.handle) {
+	repeated = true;
+	break;
+}
+			}
+			if (!repeated) {
+SIMPLEQ_INSERT_TAIL(watch_events, msg, msg_next);
+cv_broadcast(watch_cv);
+			}
 			mutex_exit(watch_events_lock);
 		}
 		mutex_exit(watches_lock);
-		if (!found) {
+		if (!found || repeated) {
 			free(msg-u.watch.vec, M_DEVBUF);
 			free(msg, M_DEVBUF);
 		}



CVS commit: [netbsd-6] src

2012-11-28 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Nov 28 21:35:01 UTC 2012

Modified Files:
src/distrib/sets/lists/base [netbsd-6]: mi
src/distrib/sets/lists/comp [netbsd-6]: mi
src/distrib/sets/lists/man [netbsd-6]: mi
src/usr.bin [netbsd-6]: Makefile
Added Files:
src/usr.bin/flock [netbsd-6]: Makefile flock.1 flock.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #719):
distrib/sets/lists/base/mi: revision 1.1011
usr.bin/flock/Makefile: revision 1.1
usr.bin/flock/flock.1: revision 1.1
distrib/sets/lists/man/mi: revision 1.1404
usr.bin/flock/flock.c: revision 1.1
distrib/sets/lists/comp/mi: revision 1.1786
usr.bin/Makefile: revision 1.211
add flock(1)
Add an flock program inspired by the linux one with the same name.


To generate a diff of this commit:
cvs rdiff -u -r1.984.2.11 -r1.984.2.12 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.1738.2.12 -r1.1738.2.13 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.1379.2.7 -r1.1379.2.8 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.207 -r1.207.2.1 src/usr.bin/Makefile
cvs rdiff -u -r0 -r1.1.4.2 src/usr.bin/flock/Makefile
cvs rdiff -u -r0 -r1.8.4.2 src/usr.bin/flock/flock.1
cvs rdiff -u -r0 -r1.6.4.2 src/usr.bin/flock/flock.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/mi
diff -u src/distrib/sets/lists/base/mi:1.984.2.11 src/distrib/sets/lists/base/mi:1.984.2.12
--- src/distrib/sets/lists/base/mi:1.984.2.11	Sun Nov 18 22:38:30 2012
+++ src/distrib/sets/lists/base/mi	Wed Nov 28 21:34:30 2012
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.984.2.11 2012/11/18 22:38:30 riz Exp $
+# $NetBSD: mi,v 1.984.2.12 2012/11/28 21:34:30 riz Exp $
 #
 # Note:	Don't delete entries from here - mark them as obsolete instead,
 #	unless otherwise stated below.
@@ -455,6 +455,7 @@
 ./usr/bin/fincorebase-util-bin
 ./usr/bin/find	base-util-bin
 ./usr/bin/fingerbase-util-bin
+./usr/bin/flock	base-util-bin
 ./usr/bin/fmt	base-util-bin
 ./usr/bin/fold	base-util-bin
 ./usr/bin/from	base-mail-bin

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1738.2.12 src/distrib/sets/lists/comp/mi:1.1738.2.13
--- src/distrib/sets/lists/comp/mi:1.1738.2.12	Tue Nov 20 22:33:37 2012
+++ src/distrib/sets/lists/comp/mi	Wed Nov 28 21:34:43 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1738.2.12 2012/11/20 22:33:37 riz Exp $
+#	$NetBSD: mi,v 1.1738.2.13 2012/11/28 21:34:43 riz Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -3599,6 +3599,7 @@
 ./usr/libdata/debug/usr/bin/fincore.debug	comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/find.debug		comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/finger.debug	comp-util-debug		debug
+./usr/libdata/debug/usr/bin/flock.debug		comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/fmt.debug		comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/fold.debug		comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/fort77.debug	comp-fortran-debug	gcc=3,gcccmds,debug

Index: src/distrib/sets/lists/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1379.2.7 src/distrib/sets/lists/man/mi:1.1379.2.8
--- src/distrib/sets/lists/man/mi:1.1379.2.7	Fri Jun 15 08:48:47 2012
+++ src/distrib/sets/lists/man/mi	Wed Nov 28 21:34:37 2012
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1379.2.7 2012/06/15 08:48:47 sborrill Exp $
+# $NetBSD: mi,v 1.1379.2.8 2012/11/28 21:34:37 riz Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -159,6 +159,7 @@
 ./usr/share/man/cat1/fincore.0			man-util-catman		.cat
 ./usr/share/man/cat1/find.0			man-util-catman		.cat
 ./usr/share/man/cat1/finger.0			man-util-catman		.cat
+./usr/share/man/cat1/flock.0			man-util-catman		.cat
 ./usr/share/man/cat1/fmt.0			man-util-catman		.cat
 ./usr/share/man/cat1/fold.0			man-util-catman		.cat
 ./usr/share/man/cat1/foreach.0			man-util-catman		.cat
@@ -3111,6 +3112,7 @@
 ./usr/share/man/html1/fincore.html		man-util-htmlman	html
 ./usr/share/man/html1/find.html			man-util-htmlman	html
 ./usr/share/man/html1/finger.html		man-util-htmlman	html
+./usr/share/man/html1/flock.html		man-util-htmlman	html
 ./usr/share/man/html1/fmt.html			man-util-htmlman	html
 ./usr/share/man/html1/fold.html			man-util-htmlman	html
 ./usr/share/man/html1/foreach.html		man-util-htmlman	html
@@ -5680,6 +5682,7 @@
 ./usr/share/man/man1/fincore.1			man-util-man		.man
 ./usr/share/man/man1/find.1			man-util-man		.man
 ./usr/share/man/man1/finger.1			man-util-man		.man
+./usr/share/man/man1/flock.1			man-util-man		.man
 ./usr/share/man/man1/fmt.1			man-util-man		.man
 ./usr/share/man/man1/fold.1			man-util-man		.man
 ./usr/share/man/man1/foreach.1			man-util-man		.man

Index: src/usr.bin/Makefile
diff -u src/usr.bin/Makefile:1.207 src/usr.bin/Makefile:1.207.2.1
--- src/usr.bin/Makefile:1.207	Tue Feb 

CVS commit: [netbsd-6] src

2012-11-28 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Nov 28 21:38:13 UTC 2012

Modified Files:
src/lib/libc/gen [netbsd-6]: sysconf.3 sysconf.c
src/sys/sys [netbsd-6]: unistd.h

Log Message:
Pull up following revision(s) (requested by christos in ticket #720):
sys/sys/unistd.h: revision 1.54
lib/libc/gen/sysconf.3: revision 1.41
lib/libc/gen/sysconf.c: revision 1.35
add _SC_PHYS_PAGES
Add _SC_PHYS_PAGES
Add _SC_PHYS_PAGES


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.40.4.1 src/lib/libc/gen/sysconf.3
cvs rdiff -u -r1.33.22.1 -r1.33.22.2 src/lib/libc/gen/sysconf.c
cvs rdiff -u -r1.52.18.1 -r1.52.18.2 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/lib/libc/gen/sysconf.3
diff -u src/lib/libc/gen/sysconf.3:1.40 src/lib/libc/gen/sysconf.3:1.40.4.1
--- src/lib/libc/gen/sysconf.3:1.40	Tue Aug 23 17:28:34 2011
+++ src/lib/libc/gen/sysconf.3	Wed Nov 28 21:38:12 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: sysconf.3,v 1.40 2011/08/23 17:28:34 jmcneill Exp $
+.\	$NetBSD: sysconf.3,v 1.40.4.1 2012/11/28 21:38:12 riz Exp $
 .\
 .\ Copyright (c) 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\	@(#)sysconf.3	8.3 (Berkeley) 4/19/94
 .\
-.Dd August 23, 2011
+.Dd November 2, 2012
 .Dt SYSCONF 3
 .Os
 .Sh NAME
@@ -282,6 +282,10 @@ and
 The number of processors configured.
 .It Li _SC_NPROCESSORS_ONLN
 The number of processors online (capable of running processes).
+.It Li _SC_PHYS_PAGES
+The amount of physical memory on the system in 
+.Li _SC_PAGESIZE
+bytes.
 .El
 .Sh RETURN VALUES
 If the call to

Index: src/lib/libc/gen/sysconf.c
diff -u src/lib/libc/gen/sysconf.c:1.33.22.1 src/lib/libc/gen/sysconf.c:1.33.22.2
--- src/lib/libc/gen/sysconf.c:1.33.22.1	Thu Aug  9 06:49:23 2012
+++ src/lib/libc/gen/sysconf.c	Wed Nov 28 21:38:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysconf.c,v 1.33.22.1 2012/08/09 06:49:23 jdc Exp $	*/
+/*	$NetBSD: sysconf.c,v 1.33.22.2 2012/11/28 21:38:13 riz Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = @(#)sysconf.c	8.2 (Berkeley) 3/20/94;
 #else
-__RCSID($NetBSD: sysconf.c,v 1.33.22.1 2012/08/09 06:49:23 jdc Exp $);
+__RCSID($NetBSD: sysconf.c,v 1.33.22.2 2012/11/28 21:38:13 riz Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -75,6 +75,7 @@ sysconf(int name)
 {
 	struct rlimit rl;
 	size_t len;
+	uint64_t mem;
 	int mib[CTL_MAXNAME], value;
 	unsigned int mib_len;
 	struct clockinfo tmpclock;
@@ -367,6 +368,14 @@ yesno:		if (sysctl(mib, mib_len, value,
 		mib[1] = HW_NCPUONLINE;
 		break;
 
+/* Linux/Solaris */
+	case _SC_PHYS_PAGES:
+		len = sizeof(mem);
+		mib[0] = CTL_HW;
+		mib[1] = HW_PHYSMEM64;
+		return sysctl(mib, 2, mem, len, NULL, 0) == -1 ? -1 : 
+		(long)(mem / _getpagesize()); 
+
 /* Native */
 	case _SC_SCHED_RT_TS:
 		if (sysctlgetmibinfo(kern.sched.rtts, mib[0], mib_len,

Index: src/sys/sys/unistd.h
diff -u src/sys/sys/unistd.h:1.52.18.1 src/sys/sys/unistd.h:1.52.18.2
--- src/sys/sys/unistd.h:1.52.18.1	Thu Aug  9 06:49:23 2012
+++ src/sys/sys/unistd.h	Wed Nov 28 21:38:12 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: unistd.h,v 1.52.18.1 2012/08/09 06:49:23 jdc Exp $	*/
+/*	$NetBSD: unistd.h,v 1.52.18.2 2012/11/28 21:38:12 riz Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -306,6 +306,9 @@
 /* This is implemented */
 #define	_SC_SPAWN			86
 
+/* Extensions found in Solaris and Linux. */
+#define	_SC_PHYS_PAGES		121
+
 #ifdef _NETBSD_SOURCE
 /* Commonly provided sysconf() extensions */
 #define	_SC_NPROCESSORS_CONF	1001



CVS commit: src/common/lib/libc/arch/sparc/atomic

2012-11-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 28 21:39:59 UTC 2012

Modified Files:
src/common/lib/libc/arch/sparc/atomic: Makefile.inc
Added Files:
src/common/lib/libc/arch/sparc/atomic: atomic_cas_up.S

Log Message:
Provide an assembler version of _atomic_cas_up for sparc - the C code
does not compile to something usable in a RAS. See PR 38482.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/common/lib/libc/arch/sparc/atomic/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S

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/libc/arch/sparc/atomic/Makefile.inc
diff -u src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.14 src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.15
--- src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.14	Fri Mar 13 19:16:46 2009
+++ src/common/lib/libc/arch/sparc/atomic/Makefile.inc	Wed Nov 28 21:39:59 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.14 2009/03/13 19:16:46 abs Exp $
+#	$NetBSD: Makefile.inc,v 1.15 2012/11/28 21:39:59 martin Exp $
 
 .include bsd.own.mk
 
@@ -29,7 +29,8 @@ SRCS+=	atomic_cas.S
 .  endif
 
 .  if (${LIB} == c || ${LIB} == pthread)
-SRCS+=	atomic_init_testset.c
+CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_UP
+SRCS+=	atomic_init_testset.c atomic_cas_up.S
 .  endif
 
 . endif

Added files:

Index: src/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S
diff -u /dev/null src/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S:1.1
--- /dev/null	Wed Nov 28 21:39:59 2012
+++ src/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S	Wed Nov 28 21:39:59 2012
@@ -0,0 +1,45 @@
+/*	$NetBSD: atomic_cas_up.S,v 1.1 2012/11/28 21:39:59 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2012 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.
+ */
+
+#include sys/ras.h
+#include atomic_op_asm.h
+
+	.text
+
+ENTRY(_atomic_cas_up)
+	.hidden	_C_LABEL(_atomic_cas_up)
+RAS_START_ASM_HIDDEN(_atomic_cas)
+	ld	[%o0], %o3			! get old value
+	cmp	%o1, %o3			! old == new?
+	beq,a	1f! yes, do the store
+	 st	%o2, [%o0]			! (in the delay slot)
+RAS_END_ASM_HIDDEN(_atomic_cas)
+1:
+	retl
+	 mov	%o3, %o0			! return old value
+



CVS commit: [netbsd-6] src

2012-11-28 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Nov 28 21:41:02 UTC 2012

Modified Files:
src/include [netbsd-6]: resolv.h
src/sys/netinet [netbsd-6]: ip.h

Log Message:
Pull up following revision(s) (requested by christos in ticket #721):
include/resolv.h: revision 1.40
sys/netinet/ip.h: revision 1.33
sys/netinet/ip.h: revision 1.34
fix typo
make this standalone, like every others (except OpenBSD)
add netinet/in.h because it is needed for sockaddr_in.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.38.10.1 src/include/resolv.h
cvs rdiff -u -r1.32 -r1.32.8.1 src/sys/netinet/ip.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/resolv.h
diff -u src/include/resolv.h:1.38 src/include/resolv.h:1.38.10.1
--- src/include/resolv.h:1.38	Sat Oct 24 17:23:34 2009
+++ src/include/resolv.h	Wed Nov 28 21:41:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: resolv.h,v 1.38 2009/10/24 17:23:34 christos Exp $	*/
+/*	$NetBSD: resolv.h,v 1.38.10.1 2012/11/28 21:41:01 riz Exp $	*/
 
 /*
  * Portions Copyright (C) 2004, 2005, 2008, 2009  Internet Systems Consortium, Inc. (ISC)
@@ -63,6 +63,7 @@
 #include sys/cdefs.h
 #include sys/socket.h
 #include stdio.h
+#include netinet/in.h
 #include arpa/nameser.h
 
 /*%

Index: src/sys/netinet/ip.h
diff -u src/sys/netinet/ip.h:1.32 src/sys/netinet/ip.h:1.32.8.1
--- src/sys/netinet/ip.h:1.32	Sun Jul 24 18:06:08 2011
+++ src/sys/netinet/ip.h	Wed Nov 28 21:41:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip.h,v 1.32 2011/07/24 18:06:08 christos Exp $	*/
+/*	$NetBSD: ip.h,v 1.32.8.1 2012/11/28 21:41:01 riz Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -34,6 +34,7 @@
 #ifndef _NETINET_IP_H_
 #define _NETINET_IP_H_
 
+#include netinet/in_systm.h	/* for n_time */
 /*
  * Definitions for internet protocol version 4.
  * Per RFC 791, September 1981.



CVS commit: [netbsd-6] src/doc

2012-11-28 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Nov 28 21:41:40 UTC 2012

Modified Files:
src/doc [netbsd-6]: CHANGES-6.1

Log Message:
Tickets 719-721


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.45 -r1.1.2.46 src/doc/CHANGES-6.1

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-6.1
diff -u src/doc/CHANGES-6.1:1.1.2.45 src/doc/CHANGES-6.1:1.1.2.46
--- src/doc/CHANGES-6.1:1.1.2.45	Mon Nov 26 17:40:28 2012
+++ src/doc/CHANGES-6.1	Wed Nov 28 21:41:38 2012
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.1,v 1.1.2.45 2012/11/26 17:40:28 riz Exp $
+# $NetBSD: CHANGES-6.1,v 1.1.2.46 2012/11/28 21:41:38 riz Exp $
 
 A complete list of changes from the 6.0 release until the 6.1 release:
 
@@ -916,7 +916,7 @@ sys/dev/usb/if_urndis.c1.4
 
 lib/libc/arch/arm/sys/__aeabi_read_tp.S		1.3
 
-	Add $NetBSD: CHANGES-6.1,v 1.1.2.45 2012/11/26 17:40:28 riz Exp $ tag.  Use ip to save r1 instead of the stack.
+	Add $NetBSD: CHANGES-6.1,v 1.1.2.46 2012/11/28 21:41:38 riz Exp $ tag.  Use ip to save r1 instead of the stack.
 	[matt, ticket #701]
 
 sys/net/npf/npf.c1.14
@@ -7027,3 +7027,27 @@ usr.sbin/npf/npfctl/npfctl.h			1.22 via 
 	Various NPF fixes to bring it up-to-date.
 	[rmind, ticket #718]
 
+distrib/sets/lists/base/mi			1.1011
+distrib/sets/lists/comp/mi			1.1786
+distrib/sets/lists/man/mi			1.1404
+usr.bin/Makefile1.211
+usr.bin/flock/Makefile1.1
+usr.bin/flock/flock.11.1-1.8
+usr.bin/flock/flock.c1.1-1.6
+
+	Add flock(1), inspired by the Linux program of the same name.
+	[christos, ticket #719]
+
+lib/libc/gen/sysconf.31.41
+lib/libc/gen/sysconf.c1.35
+sys/sys/unistd.h1.54
+
+	Add _SC_PHYS_PAGES.
+	[christos, ticket #720]
+
+include/resolv.h1.40
+sys/netinet/ip.h1.33-1.34
+
+	Make some include files idempotent.
+	[christos, ticket #721]
+



CVS commit: [matt-nb6-plus] src/sys/dev/pci

2012-11-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Nov 28 22:31:49 UTC 2012

Modified Files:
src/sys/dev/pci [matt-nb6-plus]: pcireg.h

Log Message:
Add LCSR definitions and NVM storage subclass.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.73.10.1 src/sys/dev/pci/pcireg.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/pci/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.73 src/sys/dev/pci/pcireg.h:1.73.10.1
--- src/sys/dev/pci/pcireg.h:1.73	Wed Aug 17 00:59:47 2011
+++ src/sys/dev/pci/pcireg.h	Wed Nov 28 22:31:47 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.73 2011/08/17 00:59:47 dyoung Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.73.10.1 2012/11/28 22:31:47 matt Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -179,6 +179,7 @@ typedef u_int8_t pci_revision_t;
 #define	PCI_SUBCLASS_MASS_STORAGE_ATA		0x05
 #define	PCI_SUBCLASS_MASS_STORAGE_SATA		0x06
 #define	PCI_SUBCLASS_MASS_STORAGE_SAS		0x07
+#define	PCI_SUBCLASS_MASS_STORAGE_NVM		0x08
 #define	PCI_SUBCLASS_MASS_STORAGE_MISC		0x80
 
 /* 0x02 network subclasses */
@@ -656,6 +657,17 @@ struct pci_msix_table_entry {
 #define PCI_PCIE_LCSR		0x10	/* Link Control  Status Register */
 #define PCI_PCIE_LCSR_ASPM_L0S	__BIT(0)
 #define PCI_PCIE_LCSR_ASPM_L1	__BIT(1)
+#define PCI_PCIE_LCSR_RCB	__BIT(3)
+#define PCI_PCIE_LCSR_LINK_DIS	__BIT(4)
+#define PCI_PCIE_LCSR_RETRAIN	__BIT(5)
+#define PCI_PCIE_LCSR_COMCLKCFG	__BIT(6)
+#define PCI_PCIE_LCSR_EXTNDSYNC	__BIT(7)
+#define PCI_PCIE_LCSR_ENCLKPM	__BIT(8)
+#define	PCI_PCIE_LCSR_LINKSPEED	__BITS(19,16)
+#define	PCI_PCIE_LCSR_NLW	__BITS(25,20)
+#define	PCI_PCIE_LCSR_LINKTRAIN	__BIT(27)
+#define	PCI_PCIE_LCSR_SLOTCLKCFG __BIT(28)
+#define	PCI_PCIE_LCSR_DLACTIVE	__BIT(29)
 #define PCI_PCIE_SLCAP		0x14	/* Slot Capabilities Register */
 #define PCI_PCIE_SLCAP_ABP	__BIT(0)	/* Attention Button Present */
 #define PCI_PCIE_SLCAP_PCP	__BIT(1)	/* Power Controller Present */



CVS commit: [matt-nb6-plus] src/sys/arch/arm/include

2012-11-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Nov 28 22:45:22 UTC 2012

Modified Files:
src/sys/arch/arm/include [matt-nb6-plus]: lock.h types.h

Log Message:
Make __swp for the kernel return unsigned char and restore __cpu_simple_lock_t
(match what -HEAD has).


To generate a diff of this commit:
cvs rdiff -u -r1.17.42.1 -r1.17.42.2 src/sys/arch/arm/include/lock.h
cvs rdiff -u -r1.21.8.1 -r1.21.8.2 src/sys/arch/arm/include/types.h

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

Modified files:

Index: src/sys/arch/arm/include/lock.h
diff -u src/sys/arch/arm/include/lock.h:1.17.42.1 src/sys/arch/arm/include/lock.h:1.17.42.2
--- src/sys/arch/arm/include/lock.h:1.17.42.1	Wed Nov 28 22:40:29 2012
+++ src/sys/arch/arm/include/lock.h	Wed Nov 28 22:45:21 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock.h,v 1.17.42.1 2012/11/28 22:40:29 matt Exp $	*/
+/*	$NetBSD: lock.h,v 1.17.42.2 2012/11/28 22:45:21 matt Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@ __cpu_simple_lock_set(__cpu_simple_lock_
 #endif
 
 #if defined(_KERNEL)
-static __inline __cpu_simple_lock_t
+static __inline unsigned char
 __swp(__cpu_simple_lock_t __val, volatile __cpu_simple_lock_t *__ptr)
 {
 #ifdef _ARM_ARCH_6

Index: src/sys/arch/arm/include/types.h
diff -u src/sys/arch/arm/include/types.h:1.21.8.1 src/sys/arch/arm/include/types.h:1.21.8.2
--- src/sys/arch/arm/include/types.h:1.21.8.1	Wed Nov 28 22:40:30 2012
+++ src/sys/arch/arm/include/types.h	Wed Nov 28 22:45:22 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.21.8.1 2012/11/28 22:40:30 matt Exp $	*/
+/*	$NetBSD: types.h,v 1.21.8.2 2012/11/28 22:45:22 matt Exp $	*/
 
 /*
  * Copyright (c) 1990 The Regents of the University of California.
@@ -73,17 +73,9 @@ typedef unsigned long	pmc_ctr_t;
  * to user-space, we don't want ABI breakage there.
  */
 #if defined(_KERNEL)
-typedef 
-#if __GNUC_PREREQ__(4,5)
-	volatile
-#endif
-	unsigned char	__cpu_simple_lock_t;
+typedef volatile unsigned char	__cpu_simple_lock_t;
 #else
-typedef
-#if __GNUC_PREREQ__(4,5)
-	volatile
-#endif
-	int		__cpu_simple_lock_t;
+typedef volatile int		__cpu_simple_lock_t;
 #endif /* _KERNEL */
 
 #define	__SIMPLELOCK_LOCKED	1



CVS commit: src/sys/arch/arm/cortex

2012-11-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Nov 28 22:48:14 UTC 2012

Modified Files:
src/sys/arch/arm/cortex: a9_mpsubr.S pl310.c

Log Message:
Make these compile with gcc4.1 and binutils 2.16


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/cortex/a9_mpsubr.S
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/cortex/pl310.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/arm/cortex/a9_mpsubr.S
diff -u src/sys/arch/arm/cortex/a9_mpsubr.S:1.3 src/sys/arch/arm/cortex/a9_mpsubr.S:1.4
--- src/sys/arch/arm/cortex/a9_mpsubr.S:1.3	Wed Sep  5 00:21:30 2012
+++ src/sys/arch/arm/cortex/a9_mpsubr.S	Wed Nov 28 22:48:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: a9_mpsubr.S,v 1.3 2012/09/05 00:21:30 matt Exp $	*/
+/*	$NetBSD: a9_mpsubr.S,v 1.4 2012/11/28 22:48:13 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -302,10 +302,10 @@ a9_start:
 	 * Step 4b, set ACTLR.SMP=1 (and ACTRL.FX=1)
 	 */
 	mrc	p15, 0, r0, c1, c0, 1		@ read aux ctl
-	orr	r0, #CORTEXA9_AUXCTL_SMP	@ enable SMP
+	orr	r0, r0, #CORTEXA9_AUXCTL_SMP	@ enable SMP
 	mcr	p15, 0, r0, c1, c0, 1		@ write aux ctl
 	isb
-	orr	r0, #CORTEXA9_AUXCTL_FW		@ enable cache/tlb/coherency
+	orr	r0, r0, #CORTEXA9_AUXCTL_FW	@ enable cache/tlb/coherency
 	mcr	p15, 0, r0, c1, c0, 1		@ write aux ctl
 	isb
 

Index: src/sys/arch/arm/cortex/pl310.c
diff -u src/sys/arch/arm/cortex/pl310.c:1.8 src/sys/arch/arm/cortex/pl310.c:1.9
--- src/sys/arch/arm/cortex/pl310.c:1.8	Thu Nov  1 20:17:44 2012
+++ src/sys/arch/arm/cortex/pl310.c	Wed Nov 28 22:48:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pl310.c,v 1.8 2012/11/01 20:17:44 matt Exp $	*/
+/*	$NetBSD: pl310.c,v 1.9 2012/11/28 22:48:13 matt Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pl310.c,v 1.8 2012/11/01 20:17:44 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: pl310.c,v 1.9 2012/11/28 22:48:13 matt Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -67,8 +67,8 @@ __CTASSERT(offsetof(struct arml2cc_softc
 CFATTACH_DECL_NEW(arml2cc, sizeof(struct arml2cc_softc),
 arml2cc_match, arml2cc_attach, NULL, NULL);
 
-static void arml2cc_disable(struct arml2cc_softc *);
-static void arml2cc_enable(struct arml2cc_softc *);
+static inline void arml2cc_disable(struct arml2cc_softc *);
+static inline void arml2cc_enable(struct arml2cc_softc *);
 static void arml2cc_sdcache_wb_range(vaddr_t, paddr_t, psize_t);
 static void arml2cc_sdcache_inv_range(vaddr_t, paddr_t, psize_t);
 static void arml2cc_sdcache_wbinv_range(vaddr_t, paddr_t, psize_t);



CVS commit: [matt-nb6-plus] src/sys/sys

2012-11-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Nov 28 22:52:53 UTC 2012

Modified Files:
src/sys/sys [matt-nb6-plus]: lwp.h

Log Message:
Pulled from HEAD:
Don't give a boost to system threads.


To generate a diff of this commit:
cvs rdiff -u -r1.159.2.1.2.1 -r1.159.2.1.2.2 src/sys/sys/lwp.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/lwp.h
diff -u src/sys/sys/lwp.h:1.159.2.1.2.1 src/sys/sys/lwp.h:1.159.2.1.2.2
--- src/sys/sys/lwp.h:1.159.2.1.2.1	Thu Nov  1 16:45:04 2012
+++ src/sys/sys/lwp.h	Wed Nov 28 22:52:52 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: lwp.h,v 1.159.2.1.2.1 2012/11/01 16:45:04 matt Exp $	*/
+/*	$NetBSD: lwp.h,v 1.159.2.1.2.2 2012/11/28 22:52:52 matt Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010
@@ -416,7 +416,7 @@ lwp_eprio(lwp_t *l)
 	pri_t pri;
 
 	pri = l-l_priority;
-	if (l-l_kpriority  pri  PRI_KERNEL)
+	if ((l-l_flag  LW_SYSTEM) == 0  l-l_kpriority  pri  PRI_KERNEL)
 		pri = (pri  1) + l-l_kpribase;
 	return MAX(l-l_inheritedprio, pri);
 }



CVS commit: [matt-nb6-plus] src/sys

2012-11-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Nov 28 22:59:09 UTC 2012

Modified Files:
src/sys/kern [matt-nb6-plus]: kern_kthread.c
src/sys/uvm [matt-nb6-plus]: uvm_extern.h uvm_glue.c

Log Message:
Pull from HEAD:
Add a __HAVE_CPU_UAREA_IDLELWP hook so that the MD code can allocate
special UAREAs for idle lwp's.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.38.10.1 src/sys/kern/kern_kthread.c
cvs rdiff -u -r1.181.2.1 -r1.181.2.1.2.1 src/sys/uvm/uvm_extern.h
cvs rdiff -u -r1.156.2.3 -r1.156.2.3.2.1 src/sys/uvm/uvm_glue.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/kern_kthread.c
diff -u src/sys/kern/kern_kthread.c:1.38 src/sys/kern/kern_kthread.c:1.38.10.1
--- src/sys/kern/kern_kthread.c:1.38	Tue Nov  1 15:39:37 2011
+++ src/sys/kern/kern_kthread.c	Wed Nov 28 22:59:09 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_kthread.c,v 1.38 2011/11/01 15:39:37 jym Exp $	*/
+/*	$NetBSD: kern_kthread.c,v 1.38.10.1 2012/11/28 22:59:09 matt Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_kthread.c,v 1.38 2011/11/01 15:39:37 jym Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_kthread.c,v 1.38.10.1 2012/11/28 22:59:09 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -70,7 +70,8 @@ kthread_create(pri_t pri, int flag, stru
 
 	KASSERT((flag  KTHREAD_INTR) == 0 || (flag  KTHREAD_MPSAFE) != 0);
 
-	uaddr = uvm_uarea_system_alloc();
+	uaddr = uvm_uarea_system_alloc(
+	   (flag  (KTHREAD_INTR|KTHREAD_IDLE)) == KTHREAD_IDLE ? ci : NULL);
 	if (uaddr == 0) {
 		return ENOMEM;
 	}

Index: src/sys/uvm/uvm_extern.h
diff -u src/sys/uvm/uvm_extern.h:1.181.2.1 src/sys/uvm/uvm_extern.h:1.181.2.1.2.1
--- src/sys/uvm/uvm_extern.h:1.181.2.1	Thu Apr 12 17:05:37 2012
+++ src/sys/uvm/uvm_extern.h	Wed Nov 28 22:59:09 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_extern.h,v 1.181.2.1 2012/04/12 17:05:37 riz Exp $	*/
+/*	$NetBSD: uvm_extern.h,v 1.181.2.1.2.1 2012/11/28 22:59:09 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -611,7 +611,7 @@ bool			uvm_kernacc(void *, size_t, vm_pr
 __dead void		uvm_scheduler(void);
 vaddr_t			uvm_uarea_alloc(void);
 void			uvm_uarea_free(vaddr_t);
-vaddr_t			uvm_uarea_system_alloc(void);
+vaddr_t			uvm_uarea_system_alloc(struct cpu_info *);
 void			uvm_uarea_system_free(vaddr_t);
 vaddr_t			uvm_lwp_getuarea(lwp_t *);
 void			uvm_lwp_setuarea(lwp_t *, vaddr_t);

Index: src/sys/uvm/uvm_glue.c
diff -u src/sys/uvm/uvm_glue.c:1.156.2.3 src/sys/uvm/uvm_glue.c:1.156.2.3.2.1
--- src/sys/uvm/uvm_glue.c:1.156.2.3	Thu Apr 12 17:05:37 2012
+++ src/sys/uvm/uvm_glue.c	Wed Nov 28 22:59:09 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_glue.c,v 1.156.2.3 2012/04/12 17:05:37 riz Exp $	*/
+/*	$NetBSD: uvm_glue.c,v 1.156.2.3.2.1 2012/11/28 22:59:09 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_glue.c,v 1.156.2.3 2012/04/12 17:05:37 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_glue.c,v 1.156.2.3.2.1 2012/11/28 22:59:09 matt Exp $);
 
 #include opt_kgdb.h
 #include opt_kstack.h
@@ -366,8 +366,12 @@ uvm_uarea_alloc(void)
 }
 
 vaddr_t
-uvm_uarea_system_alloc(void)
+uvm_uarea_system_alloc(struct cpu_info *ci)
 {
+#ifdef __HAVE_CPU_UAREA_ALLOC_IDLELWP
+	if (__predict_false(ci != NULL))
+		return cpu_uarea_alloc_idlelwp(ci);
+#endif
 
 	return (vaddr_t)pool_cache_get(uvm_uarea_system_cache, PR_WAITOK);
 }



CVS commit: [netbsd-6] src/lib/libpthread

2012-11-28 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Nov 28 23:47:38 UTC 2012

Modified Files:
src/lib/libpthread [netbsd-6]: pthread.h pthread_cond.c
pthread_condattr.3

Log Message:
Pull up following revision(s) (requested by christos in ticket #722):
lib/libpthread/pthread_cond.c: revision 1.58
lib/libpthread/pthread_condattr.3: revision 1.8
lib/libpthread/pthread.h: revision 1.35
add pthread_condattr_setclock(3)


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.34.8.1 src/lib/libpthread/pthread.h
cvs rdiff -u -r1.56 -r1.56.8.1 src/lib/libpthread/pthread_cond.c
cvs rdiff -u -r1.7 -r1.7.8.1 src/lib/libpthread/pthread_condattr.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/libpthread/pthread.h
diff -u src/lib/libpthread/pthread.h:1.34 src/lib/libpthread/pthread.h:1.34.8.1
--- src/lib/libpthread/pthread.h:1.34	Fri Aug  6 05:25:02 2010
+++ src/lib/libpthread/pthread.h	Wed Nov 28 23:47:38 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.h,v 1.34 2010/08/06 05:25:02 christos Exp $	*/
+/*	$NetBSD: pthread.h,v 1.34.8.1 2012/11/28 23:47:38 riz Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -112,6 +112,9 @@ int	pthread_cond_timedwait(pthread_cond_
 int	pthread_cond_signal(pthread_cond_t *);
 int	pthread_cond_broadcast(pthread_cond_t *);
 int	pthread_condattr_init(pthread_condattr_t *);
+#if defined(_NETBSD_SOURCE)
+int pthread_condattr_setclock(pthread_condattr_t *, clockid_t);
+#endif
 int	pthread_condattr_destroy(pthread_condattr_t *);
 
 int	pthread_once(pthread_once_t *, void (*)(void));

Index: src/lib/libpthread/pthread_cond.c
diff -u src/lib/libpthread/pthread_cond.c:1.56 src/lib/libpthread/pthread_cond.c:1.56.8.1
--- src/lib/libpthread/pthread_cond.c:1.56	Tue Nov  2 20:49:47 2010
+++ src/lib/libpthread/pthread_cond.c	Wed Nov 28 23:47:37 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_cond.c,v 1.56 2010/11/02 20:49:47 skrll Exp $	*/
+/*	$NetBSD: pthread_cond.c,v 1.56.8.1 2012/11/28 23:47:37 riz Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -46,11 +46,12 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: pthread_cond.c,v 1.56 2010/11/02 20:49:47 skrll Exp $);
+__RCSID($NetBSD: pthread_cond.c,v 1.56.8.1 2012/11/28 23:47:37 riz Exp $);
 
 #include errno.h
 #include sys/time.h
 #include sys/types.h
+#include stdlib.h
 
 #include pthread.h
 #include pthread_int.h
@@ -60,7 +61,7 @@ int	_sys___nanosleep50(const struct time
 extern int pthread__started;
 
 static int pthread_cond_wait_nothread(pthread_t, pthread_mutex_t *,
-const struct timespec *);
+pthread_cond_t *, const struct timespec *);
 
 int	_pthread_cond_has_waiters_np(pthread_cond_t *);
 
@@ -84,6 +85,14 @@ pthread_cond_init(pthread_cond_t *cond, 
 	pthread_lockinit(cond-ptc_lock);
 	PTQ_INIT(cond-ptc_waiters);
 	cond-ptc_mutex = NULL;
+	if (attr  attr-ptca_private) {
+		cond-ptc_private = malloc(sizeof(clockid_t));
+		if (cond-ptc_private == NULL)
+			return errno;
+		*(clockid_t *)cond-ptc_private =
+		*(clockid_t *)attr-ptca_private;
+	} else
+		cond-ptc_private = NULL;
 
 	return 0;
 }
@@ -99,6 +108,7 @@ pthread_cond_destroy(pthread_cond_t *con
 	cond-ptc_mutex == NULL);
 
 	cond-ptc_magic = _PT_COND_DEAD;
+	free(cond-ptc_private);
 
 	return 0;
 }
@@ -127,7 +137,7 @@ pthread_cond_timedwait(pthread_cond_t *c
 
 	/* Just hang out for a while if threads aren't running yet. */
 	if (__predict_false(pthread__started == 0)) {
-		return pthread_cond_wait_nothread(self, mutex, abstime);
+		return pthread_cond_wait_nothread(self, mutex, cond, abstime);
 	}
 	if (__predict_false(self-pt_cancel)) {
 		pthread__cancelled();
@@ -318,11 +328,29 @@ pthread_condattr_init(pthread_condattr_t
 {
 
 	attr-ptca_magic = _PT_CONDATTR_MAGIC;
+	attr-ptca_private = NULL;
 
 	return 0;
 }
 
 int
+pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clck)
+{
+	switch (clck) {
+	case CLOCK_MONOTONIC:
+	case CLOCK_REALTIME:
+		if (attr-ptca_private == NULL)
+			attr-ptca_private = malloc(sizeof(clockid_t));
+		if (attr-ptca_private == NULL)
+			return errno;
+		*(clockid_t *)attr-ptca_private = clck;
+		return 0;
+	default:
+		return EINVAL;
+	}
+}
+
+int
 pthread_condattr_destroy(pthread_condattr_t *attr)
 {
 
@@ -330,6 +358,7 @@ pthread_condattr_destroy(pthread_condatt
 	attr-ptca_magic == _PT_CONDATTR_MAGIC);
 
 	attr-ptca_magic = _PT_CONDATTR_DEAD;
+	free(attr-ptca_private);
 
 	return 0;
 }
@@ -337,7 +366,7 @@ pthread_condattr_destroy(pthread_condatt
 /* Utility routine to hang out for a while if threads haven't started yet. */
 static int
 pthread_cond_wait_nothread(pthread_t self, pthread_mutex_t *mutex,
-const struct timespec *abstime)
+pthread_cond_t *cond, const struct timespec *abstime)
 {
 	struct timespec now, diff;
 	int retval;
@@ -346,7 +375,9 @@ pthread_cond_wait_nothread(pthread_t sel
 		diff.tv_sec = 

CVS commit: [netbsd-6] src/lib/libc/stdio

2012-11-28 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Nov 28 23:50:57 UTC 2012

Modified Files:
src/lib/libc/stdio [netbsd-6]: flags.c fopen.3

Log Message:
Pull up following revision(s) (requested by christos in ticket #723):
lib/libc/stdio/flags.c: revision 1.17
lib/libc/stdio/fopen.3: revision 1.29
Add 'x' to the mode bits to specify O_EXCL, like glibc.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.4.1 src/lib/libc/stdio/flags.c
cvs rdiff -u -r1.27 -r1.27.4.1 src/lib/libc/stdio/fopen.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/libc/stdio/flags.c
diff -u src/lib/libc/stdio/flags.c:1.15 src/lib/libc/stdio/flags.c:1.15.4.1
--- src/lib/libc/stdio/flags.c:1.15	Sun Jun 26 16:42:41 2011
+++ src/lib/libc/stdio/flags.c	Wed Nov 28 23:50:57 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: flags.c,v 1.15 2011/06/26 16:42:41 christos Exp $	*/
+/*	$NetBSD: flags.c,v 1.15.4.1 2012/11/28 23:50:57 riz Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = @(#)flags.c	8.1 (Berkeley) 6/4/93;
 #else
-__RCSID($NetBSD: flags.c,v 1.15 2011/06/26 16:42:41 christos Exp $);
+__RCSID($NetBSD: flags.c,v 1.15.4.1 2012/11/28 23:50:57 riz Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -90,6 +90,7 @@ __sflags(const char *mode, int *optr)
 	 * [rwa]\+ or [rwa]b\+ means read and write 
 	 * f means open only plain files,
 	 * e means set close on exec.
+	 * x means exclusive open.
 	 */
 	for (; *mode; mode++)
 		switch (*mode) {
@@ -103,6 +104,9 @@ __sflags(const char *mode, int *optr)
 		case 'e':
 			o |= O_CLOEXEC;
 			break;
+		case 'x':
+			o |= O_EXCL;
+			break;
 		case 'b':
 			break;
 		default:	/* We could produce a warning here */

Index: src/lib/libc/stdio/fopen.3
diff -u src/lib/libc/stdio/fopen.3:1.27 src/lib/libc/stdio/fopen.3:1.27.4.1
--- src/lib/libc/stdio/fopen.3:1.27	Mon Jul 18 05:17:16 2011
+++ src/lib/libc/stdio/fopen.3	Wed Nov 28 23:50:57 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: fopen.3,v 1.27 2011/07/18 05:17:16 jruoho Exp $
+.\	$NetBSD: fopen.3,v 1.27.4.1 2012/11/28 23:50:57 riz Exp $
 .\
 .\ Copyright (c) 1990, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -33,7 +33,7 @@
 .\
 .\ @(#)fopen.3	8.1 (Berkeley) 6/4/93
 .\
-.Dd July 18, 2011
+.Dd November 14, 2012
 .Dt FOPEN 3
 .Os
 .Sh NAME
@@ -118,6 +118,12 @@ will fail.
 This is a non
 .St -ansiC
 extension.
+.It Sq x
+The letter
+.Sq x
+in the mode turns on exclusive open mode to the file (
+.Dv O_EXCL )
+which means that the file will not be created if it already exists.
 .El
 .Pp
 Any created files will have mode



CVS commit: [netbsd-6] src/lib/libpthread

2012-11-28 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Nov 28 23:58:36 UTC 2012

Modified Files:
src/lib/libpthread [netbsd-6]: pthread_int.h pthread_specific.c
pthread_tsd.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #724):
lib/libpthread/pthread_specific.c: revision 1.24
lib/libpthread/pthread_tsd.c: revision 1.10
lib/libpthread/pthread_tsd.c: revision 1.9
lib/libpthread/pthread_int.h: revision 1.88
Replace the simple implementation of pthread_key_{create,destroy}
and pthread_{g,s}etspecific functions, to one that invalidates
values of keys in other threads when pthread_key_delete() is called.
This fixes chromium, which expects pthread_key_delete() to do
cleanup in all threads.
Don't call the destructor in pthread_key_delete() following the standard.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.82.2.1 src/lib/libpthread/pthread_int.h
cvs rdiff -u -r1.21 -r1.21.22.1 src/lib/libpthread/pthread_specific.c
cvs rdiff -u -r1.7 -r1.7.24.1 src/lib/libpthread/pthread_tsd.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_int.h
diff -u src/lib/libpthread/pthread_int.h:1.82 src/lib/libpthread/pthread_int.h:1.82.2.1
--- src/lib/libpthread/pthread_int.h:1.82	Tue Jan 17 20:34:57 2012
+++ src/lib/libpthread/pthread_int.h	Wed Nov 28 23:58:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_int.h,v 1.82 2012/01/17 20:34:57 joerg Exp $	*/
+/*	$NetBSD: pthread_int.h,v 1.82.2.1 2012/11/28 23:58:35 riz Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -145,7 +145,10 @@ struct	__pthread_st {
 
 	/* Thread-specific data.  Large so it sits close to the end. */
 	int		pt_havespecific;
-	void		*pt_specific[PTHREAD_KEYS_MAX];
+	struct pt_specific {
+		void *pts_value;
+		PTQ_ENTRY(pt_specific) pts_next;
+	} pt_specific[PTHREAD_KEYS_MAX];
 
 	/*
 	 * Context for thread creation.  At the end as it's cached
@@ -294,6 +297,7 @@ char	*pthread__getenv(const char *) PTHR
 __dead void	pthread__cancelled(void) PTHREAD_HIDE;
 void	pthread__mutex_deferwake(pthread_t, pthread_mutex_t *) PTHREAD_HIDE;
 int	pthread__checkpri(int) PTHREAD_HIDE;
+int	pthread__add_specific(pthread_t, pthread_key_t, const void *) PTHREAD_HIDE;
 
 #ifndef pthread__smt_pause
 #define	pthread__smt_pause()	/* nothing */

Index: src/lib/libpthread/pthread_specific.c
diff -u src/lib/libpthread/pthread_specific.c:1.21 src/lib/libpthread/pthread_specific.c:1.21.22.1
--- src/lib/libpthread/pthread_specific.c:1.21	Mon Jun 23 10:38:39 2008
+++ src/lib/libpthread/pthread_specific.c	Wed Nov 28 23:58:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_specific.c,v 1.21 2008/06/23 10:38:39 ad Exp $	*/
+/*	$NetBSD: pthread_specific.c,v 1.21.22.1 2012/11/28 23:58:35 riz Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: pthread_specific.c,v 1.21 2008/06/23 10:38:39 ad Exp $);
+__RCSID($NetBSD: pthread_specific.c,v 1.21.22.1 2012/11/28 23:58:35 riz Exp $);
 
 /* Functions and structures dealing with thread-specific data */
 
@@ -55,18 +55,14 @@ pthread_setspecific(pthread_key_t key, c
 	 * and return it from functions that are const void *, without
 	 * generating a warning. 
 	 */
-	/*LINTED const cast*/
-	self-pt_specific[key] = (void *) value;
-	self-pt_havespecific = 1;
-
-	return 0;
+	return pthread__add_specific(self, key, value);
 }
 
 void *
 pthread_getspecific(pthread_key_t key)
 {
 
-	return pthread__self()-pt_specific[key];
+	return pthread__self()-pt_specific[key].pts_value;
 }
 
 unsigned int

Index: src/lib/libpthread/pthread_tsd.c
diff -u src/lib/libpthread/pthread_tsd.c:1.7 src/lib/libpthread/pthread_tsd.c:1.7.24.1
--- src/lib/libpthread/pthread_tsd.c:1.7	Mon Apr 28 20:23:01 2008
+++ src/lib/libpthread/pthread_tsd.c	Wed Nov 28 23:58:35 2012
@@ -1,11 +1,11 @@
-/*	$NetBSD: pthread_tsd.c,v 1.7 2008/04/28 20:23:01 martin Exp $	*/
+/*	$NetBSD: pthread_tsd.c,v 1.7.24.1 2012/11/28 23:58:35 riz Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
- * by Nathan J. Williams, and by Andrew Doran.
+ * by Nathan J. Williams, by Andrew Doran, and by Christos Zoulas.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: pthread_tsd.c,v 1.7 2008/04/28 20:23:01 martin Exp $);
+__RCSID($NetBSD: pthread_tsd.c,v 1.7.24.1 2012/11/28 23:58:35 riz Exp $);
 
 /* Functions and structures dealing with thread-specific data */
 #include errno.h
@@ -38,14 +38,23 @@ __RCSID($NetBSD: pthread_tsd.c,v 1.7 20
 #include pthread.h
 #include pthread_int.h
 
+
 static pthread_mutex_t 

CVS commit: [netbsd-6] src/doc

2012-11-28 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Nov 29 00:00:03 UTC 2012

Modified Files:
src/doc [netbsd-6]: CHANGES-6.1

Log Message:
Tickets 722-724


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.46 -r1.1.2.47 src/doc/CHANGES-6.1

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-6.1
diff -u src/doc/CHANGES-6.1:1.1.2.46 src/doc/CHANGES-6.1:1.1.2.47
--- src/doc/CHANGES-6.1:1.1.2.46	Wed Nov 28 21:41:38 2012
+++ src/doc/CHANGES-6.1	Thu Nov 29 00:00:02 2012
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.1,v 1.1.2.46 2012/11/28 21:41:38 riz Exp $
+# $NetBSD: CHANGES-6.1,v 1.1.2.47 2012/11/29 00:00:02 riz Exp $
 
 A complete list of changes from the 6.0 release until the 6.1 release:
 
@@ -916,7 +916,7 @@ sys/dev/usb/if_urndis.c1.4
 
 lib/libc/arch/arm/sys/__aeabi_read_tp.S		1.3
 
-	Add $NetBSD: CHANGES-6.1,v 1.1.2.46 2012/11/28 21:41:38 riz Exp $ tag.  Use ip to save r1 instead of the stack.
+	Add $NetBSD: CHANGES-6.1,v 1.1.2.47 2012/11/29 00:00:02 riz Exp $ tag.  Use ip to save r1 instead of the stack.
 	[matt, ticket #701]
 
 sys/net/npf/npf.c1.14
@@ -7051,3 +7051,25 @@ sys/netinet/ip.h1.33-1.34
 	Make some include files idempotent.
 	[christos, ticket #721]
 
+lib/libpthread/pthread.h			1.35
+lib/libpthread/pthread_cond.c			1.58
+lib/libpthread/pthread_condattr.3		1.8
+
+	Add pthread_condattr_setclock(3) function.
+	[christos, ticket #722]
+
+lib/libc/stdio/flags.c1.17
+lib/libc/stdio/fopen.31.29
+
+	Add 'x' to the mode bits of fopen() to specify O_EXCL, like glibc.
+	[christos, ticket #723]
+
+lib/libpthread/pthread_int.h			1.88
+lib/libpthread/pthread_specific.c		1.24
+lib/libpthread/pthread_tsd.c			1.8-1.10
+
+	Replace the simple implementation of pthread_key_{create,destroy}
+	and pthread_{g,s}etspecific functions with one that invalidates
+	values of keys in other threads when pthread_key_delete() is called.
+	[christos, ticket #724]
+



CVS commit: [netbsd-6-0] src/sys

2012-11-28 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Nov 29 00:02:22 UTC 2012

Modified Files:
src/sys/fs/smbfs [netbsd-6-0]: smbfs_smb.c
src/sys/netsmb [netbsd-6-0]: smb_smb.c

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #725):
sys/fs/smbfs/smbfs_smb.c: revision 1.43
sys/netsmb/smb_smb.c: revision 1.33
- fix endian cofusion around FID, which is used as is, so no need
  to do byte swapping.
- put right value to ByteCount of SMB_COM_NT_CREATE_ANDX request.
The fix makes smbfs actually works on big-endian port.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.42.14.1 src/sys/fs/smbfs/smbfs_smb.c
cvs rdiff -u -r1.32 -r1.32.24.1 src/sys/netsmb/smb_smb.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/fs/smbfs/smbfs_smb.c
diff -u src/sys/fs/smbfs/smbfs_smb.c:1.42 src/sys/fs/smbfs/smbfs_smb.c:1.42.14.1
--- src/sys/fs/smbfs/smbfs_smb.c:1.42	Tue Sep 27 02:05:10 2011
+++ src/sys/fs/smbfs/smbfs_smb.c	Thu Nov 29 00:02:22 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: smbfs_smb.c,v 1.42 2011/09/27 02:05:10 christos Exp $	*/
+/*	$NetBSD: smbfs_smb.c,v 1.42.14.1 2012/11/29 00:02:22 riz Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: smbfs_smb.c,v 1.42 2011/09/27 02:05:10 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: smbfs_smb.c,v 1.42.14.1 2012/11/29 00:02:22 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -689,7 +689,7 @@ smbfs_smb_create(struct smbnode *dnp, co
 			smb_rq_getreply(rqp, mdp);
 			md_get_uint8(mdp, wc);
 			if (wc == 1)
-md_get_uint16le(mdp, fid);
+md_get_uint16(mdp, fid);
 			else
 error = EBADRPC;
 		}
@@ -1422,8 +1422,6 @@ smbfs_smb_ntcreatex(struct smbnode *np, 
 	mb_put_uint8(mbp, 0);		/* Security tracking mode flags */
 	smb_rq_wend(rqp);
 	smb_rq_bstart(rqp);
-	smb_rq_bend(rqp);
-	mbp-mb_count = 0;
 
 	error = smbfs_fullpath(mbp, SSTOVC(ssp), np, NULL, 0);
 	if (error)
@@ -1435,6 +1433,7 @@ smbfs_smb_ntcreatex(struct smbnode *np, 
 	flen = mbp-mb_count;
 	SMBRQ_PUTLE16(nmlen, flen);
 
+	smb_rq_bend(rqp);
 	error = smb_rq_simple(rqp);
 	if (error)
 		goto bad;

Index: src/sys/netsmb/smb_smb.c
diff -u src/sys/netsmb/smb_smb.c:1.32 src/sys/netsmb/smb_smb.c:1.32.24.1
--- src/sys/netsmb/smb_smb.c:1.32	Sun Oct 18 23:20:31 2009
+++ src/sys/netsmb/smb_smb.c	Thu Nov 29 00:02:22 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: smb_smb.c,v 1.32 2009/10/18 23:20:31 tron Exp $	*/
+/*	$NetBSD: smb_smb.c,v 1.32.24.1 2012/11/29 00:02:22 riz Exp $	*/
 
 /*
  * Copyright (c) 2000-2001 Boris Popov
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: smb_smb.c,v 1.32 2009/10/18 23:20:31 tron Exp $);
+__KERNEL_RCSID(0, $NetBSD: smb_smb.c,v 1.32.24.1 2012/11/29 00:02:22 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -175,7 +175,7 @@ smb_smb_negotiate(struct smb_vc *vcp, st
 	SMBERROR((Unexpected length of security blob (%d)\n, sblen));
 	break;
 }
-error = md_get_uint16(mdp, bc);
+error = md_get_uint16le(mdp, bc);
 if (error)
 	break;
 if (sp-sv_caps  SMB_CAP_EXT_SECURITY)
@@ -210,7 +210,7 @@ smb_smb_negotiate(struct smb_vc *vcp, st
 if (swlen  SMB_MAXCHALLENGELEN)
 	break;
 md_get_uint16(mdp, NULL);	/* mbz */
-if (md_get_uint16(mdp, bc) != 0)
+if (md_get_uint16le(mdp, bc) != 0)
 	break;
 if (bc  swlen)
 	break;



CVS commit: [netbsd-6-0] src/doc

2012-11-28 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Nov 29 00:04:02 UTC 2012

Modified Files:
src/doc [netbsd-6-0]: CHANGES-6.0.1

Log Message:
Remove duplicate entries for ticket 706.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.23 -r1.1.2.24 src/doc/CHANGES-6.0.1

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-6.0.1
diff -u src/doc/CHANGES-6.0.1:1.1.2.23 src/doc/CHANGES-6.0.1:1.1.2.24
--- src/doc/CHANGES-6.0.1:1.1.2.23	Sun Nov 25 10:13:52 2012
+++ src/doc/CHANGES-6.0.1	Thu Nov 29 00:04:02 2012
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0.1,v 1.1.2.23 2012/11/25 10:13:52 jdc Exp $
+# $NetBSD: CHANGES-6.0.1,v 1.1.2.24 2012/11/29 00:04:02 riz Exp $
 
 A complete list of changes from the NetBSD 6.0 release to the NetBSD 6.0.1
 release:
@@ -224,10 +224,3 @@ distrib/utils/sysinst/disks.c			1.127
 	install-image on a USB stick.  PR#47195.
 	[tsutsui, ticket #706]
 
-distrib/utils/sysinst/disks.c			1.127
-	Don't show a disk which is mounted as root partition in the
-	Available disks list during sysinst procedure to prevent
-	users from shooting their foot in case of installation using
-	install-image on a USB stick.  PR#47195.
-	[tsutsui, ticket #706]
-



CVS commit: [netbsd-6-0] src/doc

2012-11-28 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Nov 29 00:04:19 UTC 2012

Modified Files:
src/doc [netbsd-6-0]: CHANGES-6.0.1

Log Message:
Ticket 725.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.24 -r1.1.2.25 src/doc/CHANGES-6.0.1

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-6.0.1
diff -u src/doc/CHANGES-6.0.1:1.1.2.24 src/doc/CHANGES-6.0.1:1.1.2.25
--- src/doc/CHANGES-6.0.1:1.1.2.24	Thu Nov 29 00:04:02 2012
+++ src/doc/CHANGES-6.0.1	Thu Nov 29 00:04:19 2012
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0.1,v 1.1.2.24 2012/11/29 00:04:02 riz Exp $
+# $NetBSD: CHANGES-6.0.1,v 1.1.2.25 2012/11/29 00:04:19 riz Exp $
 
 A complete list of changes from the NetBSD 6.0 release to the NetBSD 6.0.1
 release:
@@ -224,3 +224,9 @@ distrib/utils/sysinst/disks.c			1.127
 	install-image on a USB stick.  PR#47195.
 	[tsutsui, ticket #706]
 
+sys/fs/smbfs/smbfs_smb.c			1.43
+sys/netsmb/smb_smb.c1.33
+
+	Make smbfs actually works on big-endian ports.
+	[nakayama, ticket #725]
+



CVS commit: [netbsd-6] src/sys

2012-11-28 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Nov 29 00:04:37 UTC 2012

Modified Files:
src/sys/fs/smbfs [netbsd-6]: smbfs_smb.c
src/sys/netsmb [netbsd-6]: smb_smb.c

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #725):
sys/fs/smbfs/smbfs_smb.c: revision 1.43
sys/netsmb/smb_smb.c: revision 1.33
- fix endian cofusion around FID, which is used as is, so no need
  to do byte swapping.
- put right value to ByteCount of SMB_COM_NT_CREATE_ANDX request.
The fix makes smbfs actually works on big-endian port.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.42.8.1 src/sys/fs/smbfs/smbfs_smb.c
cvs rdiff -u -r1.32 -r1.32.18.1 src/sys/netsmb/smb_smb.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/fs/smbfs/smbfs_smb.c
diff -u src/sys/fs/smbfs/smbfs_smb.c:1.42 src/sys/fs/smbfs/smbfs_smb.c:1.42.8.1
--- src/sys/fs/smbfs/smbfs_smb.c:1.42	Tue Sep 27 02:05:10 2011
+++ src/sys/fs/smbfs/smbfs_smb.c	Thu Nov 29 00:04:37 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: smbfs_smb.c,v 1.42 2011/09/27 02:05:10 christos Exp $	*/
+/*	$NetBSD: smbfs_smb.c,v 1.42.8.1 2012/11/29 00:04:37 riz Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: smbfs_smb.c,v 1.42 2011/09/27 02:05:10 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: smbfs_smb.c,v 1.42.8.1 2012/11/29 00:04:37 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -689,7 +689,7 @@ smbfs_smb_create(struct smbnode *dnp, co
 			smb_rq_getreply(rqp, mdp);
 			md_get_uint8(mdp, wc);
 			if (wc == 1)
-md_get_uint16le(mdp, fid);
+md_get_uint16(mdp, fid);
 			else
 error = EBADRPC;
 		}
@@ -1422,8 +1422,6 @@ smbfs_smb_ntcreatex(struct smbnode *np, 
 	mb_put_uint8(mbp, 0);		/* Security tracking mode flags */
 	smb_rq_wend(rqp);
 	smb_rq_bstart(rqp);
-	smb_rq_bend(rqp);
-	mbp-mb_count = 0;
 
 	error = smbfs_fullpath(mbp, SSTOVC(ssp), np, NULL, 0);
 	if (error)
@@ -1435,6 +1433,7 @@ smbfs_smb_ntcreatex(struct smbnode *np, 
 	flen = mbp-mb_count;
 	SMBRQ_PUTLE16(nmlen, flen);
 
+	smb_rq_bend(rqp);
 	error = smb_rq_simple(rqp);
 	if (error)
 		goto bad;

Index: src/sys/netsmb/smb_smb.c
diff -u src/sys/netsmb/smb_smb.c:1.32 src/sys/netsmb/smb_smb.c:1.32.18.1
--- src/sys/netsmb/smb_smb.c:1.32	Sun Oct 18 23:20:31 2009
+++ src/sys/netsmb/smb_smb.c	Thu Nov 29 00:04:37 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: smb_smb.c,v 1.32 2009/10/18 23:20:31 tron Exp $	*/
+/*	$NetBSD: smb_smb.c,v 1.32.18.1 2012/11/29 00:04:37 riz Exp $	*/
 
 /*
  * Copyright (c) 2000-2001 Boris Popov
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: smb_smb.c,v 1.32 2009/10/18 23:20:31 tron Exp $);
+__KERNEL_RCSID(0, $NetBSD: smb_smb.c,v 1.32.18.1 2012/11/29 00:04:37 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -175,7 +175,7 @@ smb_smb_negotiate(struct smb_vc *vcp, st
 	SMBERROR((Unexpected length of security blob (%d)\n, sblen));
 	break;
 }
-error = md_get_uint16(mdp, bc);
+error = md_get_uint16le(mdp, bc);
 if (error)
 	break;
 if (sp-sv_caps  SMB_CAP_EXT_SECURITY)
@@ -210,7 +210,7 @@ smb_smb_negotiate(struct smb_vc *vcp, st
 if (swlen  SMB_MAXCHALLENGELEN)
 	break;
 md_get_uint16(mdp, NULL);	/* mbz */
-if (md_get_uint16(mdp, bc) != 0)
+if (md_get_uint16le(mdp, bc) != 0)
 	break;
 if (bc  swlen)
 	break;



CVS commit: [netbsd-6] src

2012-11-28 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Nov 29 00:09:49 UTC 2012

Modified Files:
src/distrib/sets/lists/base [netbsd-6]: mi
src/distrib/sets/lists/comp [netbsd-6]: mi
src/etc/rc.d [netbsd-6]: npf
src/usr.sbin/npf/npfctl [netbsd-6]: Makefile

Log Message:
Pull up following revision(s) (requested by rmind in ticket #726):
etc/rc.d/npf: revision 1.3
distrib/sets/lists/base/mi: revision 1.1010
usr.sbin/npf/npfctl/Makefile: revision 1.9
distrib/sets/lists/comp/mi: revision 1.1785
put in /sbin
catch up with npfctl moving to /sbin.
untested, but i guess so was the move itself ;)
mv npfctl from /usr/sbin to /sbin so it is available before /usr is mounted.


To generate a diff of this commit:
cvs rdiff -u -r1.984.2.12 -r1.984.2.13 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.1738.2.13 -r1.1738.2.14 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.2 -r1.2.6.1 src/etc/rc.d/npf
cvs rdiff -u -r1.5.2.3 -r1.5.2.4 src/usr.sbin/npf/npfctl/Makefile

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.984.2.12 src/distrib/sets/lists/base/mi:1.984.2.13
--- src/distrib/sets/lists/base/mi:1.984.2.12	Wed Nov 28 21:34:30 2012
+++ src/distrib/sets/lists/base/mi	Thu Nov 29 00:09:44 2012
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.984.2.12 2012/11/28 21:34:30 riz Exp $
+# $NetBSD: mi,v 1.984.2.13 2012/11/29 00:09:44 riz Exp $
 #
 # Note:	Don't delete entries from here - mark them as obsolete instead,
 #	unless otherwise stated below.
@@ -315,6 +315,7 @@
 ./sbin/nfsd	base-obsolete		obsolete
 ./sbin/nfsiod	base-obsolete		obsolete
 ./sbin/nologin	base-sysutil-root
+./sbin/npfctl	base-npf-bin		npf
 ./sbin/pfctl	base-pf-root		pf
 ./sbin/pflogd	base-pf-root		pf
 ./sbin/pfs		base-pf-root		pf
@@ -1344,7 +1345,7 @@
 ./usr/sbin/netgroup_mkdb			base-nis-bin
 ./usr/sbin/nfsd	base-nfsserver-bin
 ./usr/sbin/nfsiodbase-obsolete		obsolete
-./usr/sbin/npfctlbase-npf-bin		npf
+./usr/sbin/npfctlbase-obsolete		obsolete
 ./usr/sbin/nsec3hashbase-bind-bin
 ./usr/sbin/nslookupbase-obsolete		obsolete
 ./usr/sbin/nsquerybase-obsolete		obsolete

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1738.2.13 src/distrib/sets/lists/comp/mi:1.1738.2.14
--- src/distrib/sets/lists/comp/mi:1.1738.2.13	Wed Nov 28 21:34:43 2012
+++ src/distrib/sets/lists/comp/mi	Thu Nov 29 00:09:46 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1738.2.13 2012/11/28 21:34:43 riz Exp $
+#	$NetBSD: mi,v 1.1738.2.14 2012/11/29 00:09:46 riz Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -3472,6 +3472,7 @@
 ./usr/libdata/debug/sbin/newfs_sysvbfs.debug	comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/newfs_udf.debug	comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/newfs_v7fs.debug	comp-sysutil-debug	debug
+./usr/libdata/debug/sbin/npfctl.debug		comp-npf-debug		npf,debug
 ./usr/libdata/debug/sbin/pfctl.debug		comp-pf-debug		pf,debug
 ./usr/libdata/debug/sbin/pflogd.debug		comp-pf-debug		pf,debug
 ./usr/libdata/debug/sbin/pfs.debug		comp-pf-debug		pf,debug
@@ -4202,7 +4203,7 @@
 ./usr/libdata/debug/usr/sbin/ndp.debug		comp-netutil-debug	inet6,debug
 ./usr/libdata/debug/usr/sbin/netgroup_mkdb.debug	comp-nis-debug		debug
 ./usr/libdata/debug/usr/sbin/nfsd.debug		comp-nfsserver-debug	debug
-./usr/libdata/debug/usr/sbin/npfctl.debug	comp-npf-debug		npf,debug
+./usr/libdata/debug/usr/sbin/npfctl.debug	comp-obsolete		obsolete
 ./usr/libdata/debug/usr/sbin/nsec3hash.debug	comp-bind-debug		debug
 ./usr/libdata/debug/usr/sbin/ntp-keygen.debug	comp-ntp-debug		crypto,debug
 ./usr/libdata/debug/usr/sbin/ntpd.debug		comp-ntp-debug		debug

Index: src/etc/rc.d/npf
diff -u src/etc/rc.d/npf:1.2 src/etc/rc.d/npf:1.2.6.1
--- src/etc/rc.d/npf:1.2	Mon Mar  7 23:21:13 2011
+++ src/etc/rc.d/npf	Thu Nov 29 00:09:44 2012
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: npf,v 1.2 2011/03/07 23:21:13 jmcneill Exp $
+# $NetBSD: npf,v 1.2.6.1 2012/11/29 00:09:44 riz Exp $
 #
 # Public Domain.
 #
@@ -35,22 +35,22 @@ npf_start()
 {
 	echo Enabling NPF.
 	npf_cfg_check
-	/usr/sbin/npfctl reload
-	/usr/sbin/npfctl start
+	/sbin/npfctl reload
+	/sbin/npfctl start
 }
 
 npf_stop()
 {
 	echo Disabling NPF.
-	/usr/sbin/npfctl stop
-	/usr/sbin/npfctl flush
+	/sbin/npfctl stop
+	/sbin/npfctl flush
 }
 
 npf_reload()
 {
 	echo Reloading NPF ruleset.
 	npf_cfg_check
-	/usr/sbin/npfctl reload
+	/sbin/npfctl reload
 }
 
 npf_status()

Index: src/usr.sbin/npf/npfctl/Makefile
diff -u src/usr.sbin/npf/npfctl/Makefile:1.5.2.3 src/usr.sbin/npf/npfctl/Makefile:1.5.2.4
--- src/usr.sbin/npf/npfctl/Makefile:1.5.2.3	Sun Nov 18 22:38:28 2012
+++ src/usr.sbin/npf/npfctl/Makefile	Thu Nov 29 00:09:46 2012
@@ -1,5 +1,6 @@
-# $NetBSD: Makefile,v 1.5.2.3 2012/11/18 22:38:28 riz Exp $
+# $NetBSD: Makefile,v 

CVS commit: [netbsd-6] src/sys/arch/amigappc/conf

2012-11-28 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Nov 29 00:11:26 UTC 2012

Modified Files:
src/sys/arch/amigappc/conf [netbsd-6]: files.amigappc

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #727):
sys/arch/amigappc/conf/files.amigappc: revision 1.26
Fix fallout from recent ed driver replacement. Makes amigappc build again.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.2.1 src/sys/arch/amigappc/conf/files.amigappc

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/amigappc/conf/files.amigappc
diff -u src/sys/arch/amigappc/conf/files.amigappc:1.25 src/sys/arch/amigappc/conf/files.amigappc:1.25.2.1
--- src/sys/arch/amigappc/conf/files.amigappc:1.25	Wed Feb 15 12:11:43 2012
+++ src/sys/arch/amigappc/conf/files.amigappc	Thu Nov 29 00:11:26 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files.amigappc,v 1.25 2012/02/15 12:11:43 phx Exp $
+#	$NetBSD: files.amigappc,v 1.25.2.1 2012/11/29 00:11:26 riz Exp $
 
 # maxpartitions must be first item in files.${ARCH}.newconf
 maxpartitions 16			# NOTE THAT AMIGA IS SPECIAL!
@@ -229,8 +229,8 @@ file	arch/amiga/dev/if_ne_zbus.c	ne_zbus
 
 # Hydra ethernet card
 device	ed: ifnet, ether, arp
-attach	ed at zbus with ed_zbus
-file	arch/amiga/dev/if_ed.c		ed_zbus needs-flag
+attach	ed at zbus with ed_zbus: dp8390nic
+file	arch/amiga/dev/if_ed_zbus.c	ed_zbus needs-flag
 
 # C=/Ameristar A2060 / 560
 attach	bah at zbus with bah_zbus



CVS commit: [netbsd-6] src/doc

2012-11-28 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Nov 29 00:12:20 UTC 2012

Modified Files:
src/doc [netbsd-6]: CHANGES-6.1

Log Message:
Tickets 725-727


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.47 -r1.1.2.48 src/doc/CHANGES-6.1

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-6.1
diff -u src/doc/CHANGES-6.1:1.1.2.47 src/doc/CHANGES-6.1:1.1.2.48
--- src/doc/CHANGES-6.1:1.1.2.47	Thu Nov 29 00:00:02 2012
+++ src/doc/CHANGES-6.1	Thu Nov 29 00:12:19 2012
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.1,v 1.1.2.47 2012/11/29 00:00:02 riz Exp $
+# $NetBSD: CHANGES-6.1,v 1.1.2.48 2012/11/29 00:12:19 riz Exp $
 
 A complete list of changes from the 6.0 release until the 6.1 release:
 
@@ -916,7 +916,7 @@ sys/dev/usb/if_urndis.c1.4
 
 lib/libc/arch/arm/sys/__aeabi_read_tp.S		1.3
 
-	Add $NetBSD: CHANGES-6.1,v 1.1.2.47 2012/11/29 00:00:02 riz Exp $ tag.  Use ip to save r1 instead of the stack.
+	Add $NetBSD: CHANGES-6.1,v 1.1.2.48 2012/11/29 00:12:19 riz Exp $ tag.  Use ip to save r1 instead of the stack.
 	[matt, ticket #701]
 
 sys/net/npf/npf.c1.14
@@ -7073,3 +7073,24 @@ lib/libpthread/pthread_tsd.c			1.8-1.10
 	values of keys in other threads when pthread_key_delete() is called.
 	[christos, ticket #724]
 
+sys/fs/smbfs/smbfs_smb.c			1.43
+sys/netsmb/smb_smb.c1.33
+
+	Make smbfs actually works on big-endian ports.
+	[nakayama, ticket #725]
+
+distrib/sets/lists/base/mi			1.1010 via patch
+distrib/sets/lists/comp/mi			1.1785 via patch
+etc/rc.d/npf	1.3
+usr.sbin/npf/npfctl/Makefile			1.9
+
+	Move npfctl from /usr/sbin to /sbin so it is available before
+	/usr is mounted.
+	[rmind, ticket #726]
+
+sys/arch/amigappc/conf/files.amigappc		1.26
+
+	Fix fallout from recent ed driver replacement. Makes amigappc
+	build again.
+	[msaitoh, ticket #727]
+



CVS commit: src/share/man/man4

2012-11-28 Thread Julian Fagir
Module Name:src
Committed By:   jdf
Date:   Thu Nov 29 00:12:21 UTC 2012

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

Log Message:
Fix wrong proposal of ifconfig(8) usage:
ifconfig -m device
(which shows information) instead of
ifconfig device media
(which sets information). Fixes PR misc/47197.


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

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

Modified files:

Index: src/share/man/man4/ale.4
diff -u src/share/man/man4/ale.4:1.4 src/share/man/man4/ale.4:1.5
--- src/share/man/man4/ale.4:1.4	Sun Nov 22 16:50:13 2009
+++ src/share/man/man4/ale.4	Thu Nov 29 00:12:21 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: ale.4,v 1.4 2009/11/22 16:50:13 snj Exp $
+.\	$NetBSD: ale.4,v 1.5 2012/11/29 00:12:21 jdf Exp $
 .\	$OpenBSD: ale.4,v 1.2 2009/02/25 03:15:50 deraadt Exp $
 .\
 .\ Copyright (c) 2009 Kevin Lo ke...@openbsd.org
@@ -54,9 +54,9 @@ Set 1000Mbps (Gigabit Ethernet) operatio
 For more information on configuring this device, see
 .Xr ifconfig 8 .
 To view a list of media types and options supported by the card, try
-.Ic ifconfig Ao Ic device Ac Ic media .
+.Ic ifconfig Fl m Ao Ic device Ac .
 For example,
-.Ic ifconfig ale0 media .
+.Ic ifconfig Fl m Ic ale0 .
 .Sh SEE ALSO
 .Xr arp 4 ,
 .Xr atphy 4 ,



CVS commit: src/sbin/sysctl

2012-11-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 29 02:05:38 UTC 2012

Modified Files:
src/sbin/sysctl: Makefile

Log Message:
use the proper variable


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sbin/sysctl/Makefile

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/Makefile
diff -u src/sbin/sysctl/Makefile:1.20 src/sbin/sysctl/Makefile:1.21
--- src/sbin/sysctl/Makefile:1.20	Mon Dec 13 12:47:40 2010
+++ src/sbin/sysctl/Makefile	Wed Nov 28 21:05:38 2012
@@ -1,8 +1,8 @@
-#	$NetBSD: Makefile,v 1.20 2010/12/13 17:47:40 pooka Exp $
+#	$NetBSD: Makefile,v 1.21 2012/11/29 02:05:38 christos Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/6/93
 
 .include bsd.own.mk
-#CFLAGS+=-g
+#DBG=-g
 
 RUMPPRG=sysctl
 MAN=	sysctl.8



CVS commit: src/sbin/sysctl

2012-11-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 29 02:06:18 UTC 2012

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

Log Message:
add a handler for the reserved port sysctl variable.


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 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.143 src/sbin/sysctl/sysctl.c:1.144
--- src/sbin/sysctl/sysctl.c:1.143	Sat Jun  2 17:38:09 2012
+++ src/sbin/sysctl/sysctl.c	Wed Nov 28 21:06:17 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysctl.c,v 1.143 2012/06/02 21:38:09 dsl Exp $ */
+/*	$NetBSD: sysctl.c,v 1.144 2012/11/29 02:06:17 christos Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -68,10 +68,12 @@ __COPYRIGHT(@(#) Copyright (c) 1993\
 #if 0
 static char sccsid[] = @(#)sysctl.c	8.1 (Berkeley) 6/6/93;
 #else
-__RCSID($NetBSD: sysctl.c,v 1.143 2012/06/02 21:38:09 dsl Exp $);
+__RCSID($NetBSD: sysctl.c,v 1.144 2012/11/29 02:06:17 christos Exp $);
 #endif
 #endif /* not lint */
 
+#define FD_SETSIZE 0x1
+#include sys/fd_set.h
 #include sys/types.h
 #include sys/param.h
 #include sys/sysctl.h
@@ -171,6 +173,7 @@ static void proc_limit(HANDLER_PROTO);
 static void machdep_diskinfo(HANDLER_PROTO);
 #endif /* CPU_DISKINFO */
 static void mode_bits(HANDLER_PROTO);
+static void reserve(HANDLER_PROTO);
 
 static const struct handlespec {
 	const char *ps_re;
@@ -210,7 +213,7 @@ static const struct handlespec {
 	{ /net/(inet|inet6)/[^/]+/stats,	printother, NULL, netstat},
 	{ /net/bpf/(stats|peers),		printother, NULL, netstat},
 
-	{ /net/inet.*/tcp.*/deb.*,		printother, NULL, trpt },
+	{ /net/inet.*/ip.*/anonportalgo/reserve, reserve, reserve, NULL },
 
 	{ /net/ns/spp/deb.*,			printother, NULL, trsp },
 
@@ -2685,3 +2688,96 @@ mode_bits(HANDLER_ARGS)
 		}
 	}
 }
+
+static char *
+bitmask_print(const fd_set *o)
+{
+	char *s, *os;
+
+	s = os = NULL;
+	for (size_t i = 0; i  FD_SETSIZE; i++)
+		if (FD_ISSET(i, o)) {
+			int rv;
+
+			if (os)
+				rv = asprintf(s, %s,%zu, os, i);
+			else
+				rv = asprintf(s, %zu, i);
+			if (rv == -1)
+err(1, );
+			free(os);
+			os = s;
+		}
+	if (s == NULL  (s = strdup()) == NULL)
+		err(1, );
+	return s;
+}
+
+static void
+bitmask_scan(const void *v, fd_set *o)
+{
+	char *s = strdup(v);
+	if (s == NULL)
+		err(1, );
+	FD_ZERO(o);
+	for (s = strtok(s, ,); s; s = strtok(NULL, ,)) {
+		char *e;
+		errno = 0;
+		unsigned long l = strtoul(s, e, 0);
+		if ((l == ULONG_MAX  errno == ERANGE) || s == e || *e)
+			errx(1, Invalid port: %s, s);
+		if (l = FD_SETSIZE)
+			errx(1, Port out of range: %s, s);
+		FD_SET(l, o);
+	}
+}
+
+
+static void
+reserve(HANDLER_ARGS)
+{
+	int rc;
+	size_t osz, nsz;
+	fd_set o, n;
+
+	if (fn)
+		trim_whitespace(value, 3);
+
+	osz = sizeof(o);
+	if (value) {
+		bitmask_scan(value, n);
+		value = (char *)n;
+		nsz = sizeof(n);
+	} else
+		nsz = 0;
+
+	rc = prog_sysctl(name, namelen, o, osz, value, nsz);
+	if (rc == -1) {
+		sysctlerror(value == NULL);
+		return;
+	}
+
+	if (value  qflag)
+		return;
+
+	if (rflag || xflag)
+		display_struct(pnode, sname, o, sizeof(o),
+		value ? DISPLAY_OLD : DISPLAY_VALUE);
+	else {
+		char *s = bitmask_print(o);
+		display_string(pnode, sname, s, strlen(s),
+		value ? DISPLAY_OLD : DISPLAY_VALUE);
+		free(s);
+	}
+
+	if (value) {
+		if (rflag || xflag)
+			display_struct(pnode, sname, n, sizeof(n),
+			DISPLAY_NEW);
+		else {
+			char *s = bitmask_print(n);
+			display_string(pnode, sname, s, strlen(s), DISPLAY_NEW);
+			free(s);
+		}
+	}
+}



CVS commit: src/sys

2012-11-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 29 02:07:21 UTC 2012

Modified Files:
src/sys/netinet: ip_input.c portalgo.c portalgo.h
src/sys/netinet6: ip6_input.c

Log Message:
Add a new sysctl to mark ports as reserved, so that they are not used in
the anonymous or reserved port allocation.


To generate a diff of this commit:
cvs rdiff -u -r1.302 -r1.303 src/sys/netinet/ip_input.c
cvs rdiff -u -r1.1 -r1.2 src/sys/netinet/portalgo.c \
src/sys/netinet/portalgo.h
cvs rdiff -u -r1.140 -r1.141 src/sys/netinet6/ip6_input.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/netinet/ip_input.c
diff -u src/sys/netinet/ip_input.c:1.302 src/sys/netinet/ip_input.c:1.303
--- src/sys/netinet/ip_input.c:1.302	Mon Jun 25 11:28:39 2012
+++ src/sys/netinet/ip_input.c	Wed Nov 28 21:07:20 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_input.c,v 1.302 2012/06/25 15:28:39 christos Exp $	*/
+/*	$NetBSD: ip_input.c,v 1.303 2012/11/29 02:07:20 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ip_input.c,v 1.302 2012/06/25 15:28:39 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: ip_input.c,v 1.303 2012/11/29 02:07:20 christos Exp $);
 
 #include opt_inet.h
 #include opt_compat_netbsd.h
@@ -1906,7 +1906,13 @@ sysctl_net_inet_ip_setup(struct sysctllo
 		   CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
 		   CTLTYPE_STRING, selected,
 		   SYSCTL_DESCR(selected algorithm),
-		   sysctl_portalgo_selected, 0, NULL, PORTALGO_MAXLEN,
+		   sysctl_portalgo_selected4, 0, NULL, PORTALGO_MAXLEN,
+		   CTL_CREATE, CTL_EOL);
+	sysctl_createv(clog, 0, portalgo_node, NULL,
+		   CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+		   CTLTYPE_STRUCT, reserve,
+		   SYSCTL_DESCR(bitmap of reserved ports),
+		   sysctl_portalgo_reserve4, 0, NULL, 0,
 		   CTL_CREATE, CTL_EOL);
 }
 

Index: src/sys/netinet/portalgo.c
diff -u src/sys/netinet/portalgo.c:1.1 src/sys/netinet/portalgo.c:1.2
--- src/sys/netinet/portalgo.c:1.1	Mon Jun 25 11:28:39 2012
+++ src/sys/netinet/portalgo.c	Wed Nov 28 21:07:20 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: portalgo.c,v 1.1 2012/06/25 15:28:39 christos Exp $	*/
+/*	$NetBSD: portalgo.c,v 1.2 2012/11/29 02:07:20 christos Exp $	*/
 
 /*
  * Copyright 2011 Vlad Balan
@@ -34,10 +34,12 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: portalgo.c,v 1.1 2012/06/25 15:28:39 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: portalgo.c,v 1.2 2012/11/29 02:07:20 christos Exp $);
 
 #include opt_inet.h
 
+#define FD_SETSIZE 0x1
+#include sys/fd_set.h
 #include sys/param.h
 #include sys/errno.h
 #include sys/kauth.h
@@ -87,9 +89,11 @@ static bool portalgo_debug = true;
 
 #ifdef INET
 static int inet4_portalgo = PORTALGO_BSD;
+static fd_set inet4_reserve;
 #endif
 #ifdef INET6
 static int inet6_portalgo = PORTALGO_BSD;
+static fd_set inet6_reserve;
 #endif
 
 typedef struct {
@@ -250,6 +254,9 @@ check_suitable_port(uint16_t port, struc
 		struct inpcb *pcb;
 		struct sockaddr_in sin;
 
+		if (FD_ISSET(port, inet4_reserve))
+			return false;
+
 		sin.sin_addr = inp-inp_laddr;
 		pcb = in_pcblookup_port(table, sin.sin_addr, htons(port), 1,
 		vestigial);
@@ -292,6 +299,9 @@ check_suitable_port(uint16_t port, struc
 		struct sockaddr_in6 sin6;
 		void *t;
 
+		if (FD_ISSET(port, inet6_reserve))
+			return false;
+
 		sin6.sin6_addr = in6p-in6p_laddr;
 		so = in6p-in6p_socket;
 
@@ -853,10 +863,10 @@ portalgo_algo_index_select(struct inpcb_
 
 /*
  * The sysctl hook that is supposed to check that we are picking one
- * of the valid algorithms. IPv4.
+ * of the valid algorithms.
  */
 static int
-sysctl_portalgo_helper(SYSCTLFN_ARGS, int *algo)
+sysctl_portalgo_selected(SYSCTLFN_ARGS, int *algo)
 {
 	struct sysctlnode node;
 	int error;
@@ -891,23 +901,64 @@ sysctl_portalgo_helper(SYSCTLFN_ARGS, in
 	return error;
 }
 
+static int
+sysctl_portalgo_reserve(SYSCTLFN_ARGS, fd_set *bt)
+{
+	struct sysctlnode node;
+	int error;
+
+	DPRINTF(%s called\n, __func__);
+
+	node = *rnode;
+	node.sysctl_data = bt;
+	node.sysctl_size = sizeof(*bt);
+
+	error = sysctl_lookup(SYSCTLFN_CALL(node));
+
+	if (error || newp == NULL)
+		return error;
+
+#ifdef KAUTH_NETWORK_SOCKET_PORT_RESERVE
+	if (l != NULL  (error = kauth_authorize_system(l-l_cred,
+	KAUTH_NETWORK_SOCKET, KAUTH_NETWORK_SOCKET_PORT_RESERVE, bt,
+	NULL, NULL)) != 0)
+		return error;
+#endif
+	return error;
+}
+
+#ifdef INET
 /*
  * The sysctl hook that is supposed to check that we are picking one
  * of the valid algorithms.
  */
 int
-sysctl_portalgo_selected(SYSCTLFN_ARGS)
+sysctl_portalgo_selected4(SYSCTLFN_ARGS)
+{
+
+	return sysctl_portalgo_selected(SYSCTLFN_CALL(rnode), inet4_portalgo);
+}
+
+int
+sysctl_portalgo_reserve4(SYSCTLFN_ARGS)
 {
 
-	return sysctl_portalgo_helper(SYSCTLFN_CALL(rnode), inet4_portalgo);
+	return 

CVS commit: src/sbin/sysctl

2012-11-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 29 02:24:14 UTC 2012

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

Log Message:
put back line I accidentally deleted.


To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 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.144 src/sbin/sysctl/sysctl.c:1.145
--- src/sbin/sysctl/sysctl.c:1.144	Wed Nov 28 21:06:17 2012
+++ src/sbin/sysctl/sysctl.c	Wed Nov 28 21:24:14 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysctl.c,v 1.144 2012/11/29 02:06:17 christos Exp $ */
+/*	$NetBSD: sysctl.c,v 1.145 2012/11/29 02:24:14 christos Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@ __COPYRIGHT(@(#) Copyright (c) 1993\
 #if 0
 static char sccsid[] = @(#)sysctl.c	8.1 (Berkeley) 6/6/93;
 #else
-__RCSID($NetBSD: sysctl.c,v 1.144 2012/11/29 02:06:17 christos Exp $);
+__RCSID($NetBSD: sysctl.c,v 1.145 2012/11/29 02:24:14 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -213,6 +213,8 @@ static const struct handlespec {
 	{ /net/(inet|inet6)/[^/]+/stats,	printother, NULL, netstat},
 	{ /net/bpf/(stats|peers),		printother, NULL, netstat},
 
+	{ /net/inet.*/tcp.*/deb.*,		printother, NULL, trpt },
+
 	{ /net/inet.*/ip.*/anonportalgo/reserve, reserve, reserve, NULL },
 
 	{ /net/ns/spp/deb.*,			printother, NULL, trsp },



CVS commit: src/share/man/man7

2012-11-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 29 02:27:12 UTC 2012

Modified Files:
src/share/man/man7: sysctl.7

Log Message:
document new reserved ports


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/share/man/man7/sysctl.7

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

Modified files:

Index: src/share/man/man7/sysctl.7
diff -u src/share/man/man7/sysctl.7:1.73 src/share/man/man7/sysctl.7:1.74
--- src/share/man/man7/sysctl.7:1.73	Fri Jun 22 23:13:41 2012
+++ src/share/man/man7/sysctl.7	Wed Nov 28 21:27:12 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: sysctl.7,v 1.73 2012/06/23 03:13:41 christos Exp $
+.\	$NetBSD: sysctl.7,v 1.74 2012/11/29 02:27:12 christos Exp $
 .\
 .\ Copyright (c) 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\	@(#)sysctl.3	8.4 (Berkeley) 5/9/95
 .\
-.Dd June 22, 2012
+.Dd November 28, 2012
 .Dt SYSCTL 7
 .Os
 .Sh NAME
@@ -1225,6 +1225,7 @@ The currently defined protocols and name
 .It ip	allowsrcrt	integer	yes
 .It ip 	anonportalgo.selected	string	yes
 .It ip 	anonportalgo.available	string	yes
+.It ip 	anonportalgo.reserve	struct	yes
 .It ip	anonportmax	integer	yes
 .It ip	anonportmin	integer	yes
 .It ip	checkinterface	integer	yes
@@ -1329,6 +1330,9 @@ Disabled by default.
 If set to 1, the host accepts source routed packets.
 .It Li ip.anonportalgo.available
 The available RFC 6056 port randomization algorithms.
+.It Li ip.anonportalgo.reserve
+A bitmask of ports that will not be used during anonymous or privileged
+port selection.
 .It Li ip.anonportalgo.selected
 The currently selected RFC 6056 port randomization algorithm.
 .It Li ip.anonportmax
@@ -1599,6 +1603,7 @@ The currently defined protocols and name
 .It ip6	accept_rtadv	integer	yes
 .It ip6	anonportalgo.selected	string	yes
 .It ip6	anonportalgo.available	string	yes
+.It ip6 anonportalgo.reserve	struct	yes
 .It ip6	anonportmax	integer	yes
 .It ip6	anonportmin	integer	yes
 .It ip6	auto_flowlabel	integer	yes
@@ -1640,6 +1645,9 @@ The node must be a host
 for the option to be meaningful.
 .It Li ip6.anonportalgo.available
 The available RFC 6056 port randomization algorithms.
+.It Li ip6.anonportalgo.reserve
+A bitmask of ports that will not be used during anonymous or privileged
+port selection.
 .It Li ip6.anonportalgo.selected
 The currently selected RFC 6056 port randomization algorithm.
 .It Li ip6.anonportmax



CVS commit: src/tests/ipf

2012-11-28 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Nov 29 04:57:42 UTC 2012

Modified Files:
src/tests/ipf: t_nat_exec.sh

Log Message:
Since all of the expected-results files provided from upstream include
the -D output (Dump additional internal tables), update the tests to
actually generate the data!

This lets us re-enable 28 of the 30 skipped tests.

XXX Still need to work on tests n12 and n17_6


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/ipf/t_nat_exec.sh

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

Modified files:

Index: src/tests/ipf/t_nat_exec.sh
diff -u src/tests/ipf/t_nat_exec.sh:1.9 src/tests/ipf/t_nat_exec.sh:1.10
--- src/tests/ipf/t_nat_exec.sh:1.9	Sun Jul 22 16:22:41 2012
+++ src/tests/ipf/t_nat_exec.sh	Thu Nov 29 04:57:42 2012
@@ -1,4 +1,4 @@
-# $NetBSD: t_nat_exec.sh,v 1.9 2012/07/22 16:22:41 darrenr Exp $
+# $NetBSD: t_nat_exec.sh,v 1.10 2012/11/29 04:57:42 pgoyette Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -50,7 +50,7 @@ nattest()
 
 	{ while read rule; do
 		atf_check -o save:save -x \
-		echo \$rule\ | ipftest $format -RbN - -i in $args
+		echo \$rule\ | ipftest $format -RDbN - -i in $args
 		cat save out
 		echo --- out
 	done; } reg
@@ -58,42 +58,42 @@ nattest()
 	diff -u exp out || atf_fail results differ
 }
 
-broken_test_case n1 nattest text text
-broken_test_case n2 nattest text text
-broken_test_case n3 nattest text text
-broken_test_case n4 nattest text text
-broken_test_case n5 nattest text text
-broken_test_case n6 nattest text text
-broken_test_case n7 nattest text text
-broken_test_case n8 nattest hex hex -T update_ipid=0
-broken_test_case n9 nattest hex hex -T update_ipid=0
-test_case n10 nattest hex hex -T update_ipid=0 -D
-broken_test_case n11 nattest text text
-broken_test_case n12 nattest hex hex -T update_ipid=0 -v
-broken_test_case n13 nattest text text
-broken_test_case n14 nattest text text
-broken_test_case n15 nattest text text -T update_ipid=0
+test_case n1 nattest text text
+test_case n2 nattest text text
+test_case n3 nattest text text
+test_case n4 nattest text text
+test_case n5 nattest text text
+test_case n6 nattest text text
+test_case n7 nattest text text
+test_case n8 nattest hex hex -T update_ipid=0
+test_case n9 nattest hex hex -T update_ipid=0
+test_case n10 nattest hex hex -T update_ipid=0
+test_case n11 nattest text text
+test_case n12 nattest hex hex -T update_ipid=0 -v
+test_case n13 nattest text text
+test_case n14 nattest text text
+test_case n15 nattest text text -T update_ipid=0
 test_case n16 nattest hex hex -D
 test_case n17 nattest hex hex -D
-broken_test_case n100 nattest text text
-broken_test_case n101 nattest text text
-broken_test_case n102 nattest text text
-broken_test_case n103 nattest text text
-broken_test_case n104 nattest hex hex -T update_ipid=0
-broken_test_case n105 nattest hex hex -T update_ipid=0
-broken_test_case n106 nattest hex hex -T update_ipid=0
-broken_test_case n200 nattest hex hex -T update_ipid=0
-broken_test_case n1_6 nattest text text -6
-broken_test_case n2_6 nattest text text -6
-broken_test_case n4_6 nattest text text -6
-broken_test_case n5_6 nattest text text -6
-broken_test_case n6_6 nattest text text -6
-broken_test_case n7_6 nattest text text -6
-test_case n8_6 nattest hex hex -6D
-test_case n9_6 nattest hex hex -6D
-broken_test_case n11_6 nattest text text -6
-test_case n12_6 nattest hex hex -D6
-broken_test_case n15_6 nattest text text -6
+test_case n100 nattest text text
+test_case n101 nattest text text
+test_case n102 nattest text text
+test_case n103 nattest text text
+test_case n104 nattest hex hex -T update_ipid=0
+test_case n105 nattest hex hex -T update_ipid=0
+test_case n106 nattest hex hex -T update_ipid=0
+test_case n200 nattest hex hex -T update_ipid=0
+test_case n1_6 nattest text text -6
+test_case n2_6 nattest text text -6
+test_case n4_6 nattest text text -6
+test_case n5_6 nattest text text -6
+test_case n6_6 nattest text text -6
+test_case n7_6 nattest text text -6
+test_case n8_6 nattest hex hex -6
+test_case n9_6 nattest hex hex -6
+test_case n11_6 nattest text text -6
+test_case n12_6 nattest hex hex -6
+test_case n15_6 nattest text text -6
 broken_test_case n17_6 nattest hex hex -6
 
 atf_init_test_cases()