CVS commit: src

2010-09-05 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Mon Sep  6 01:40:25 UTC 2010

Modified Files:
src/lib/libperfuse: ops.c perfuse.c perfuse_if.h perfuse_priv.h
src/usr.sbin/perfused: msg.c perfused.c

Log Message:
More LP64 fixes


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libperfuse/ops.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libperfuse/perfuse.c
cvs rdiff -u -r1.5 -r1.6 src/lib/libperfuse/perfuse_if.h
cvs rdiff -u -r1.7 -r1.8 src/lib/libperfuse/perfuse_priv.h
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/perfused/msg.c
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/perfused/perfused.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/libperfuse/ops.c
diff -u src/lib/libperfuse/ops.c:1.10 src/lib/libperfuse/ops.c:1.11
--- src/lib/libperfuse/ops.c:1.10	Mon Sep  6 01:17:05 2010
+++ src/lib/libperfuse/ops.c	Mon Sep  6 01:40:24 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.10 2010/09/06 01:17:05 manu Exp $ */
+/*  $NetBSD: ops.c,v 1.11 2010/09/06 01:40:24 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.

Index: src/lib/libperfuse/perfuse.c
diff -u src/lib/libperfuse/perfuse.c:1.3 src/lib/libperfuse/perfuse.c:1.4
--- src/lib/libperfuse/perfuse.c:1.3	Sat Aug 28 03:46:21 2010
+++ src/lib/libperfuse/perfuse.c	Mon Sep  6 01:40:24 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfuse.c,v 1.3 2010/08/28 03:46:21 manu Exp $ */
+/*  $NetBSD: perfuse.c,v 1.4 2010/09/06 01:40:24 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -208,20 +208,20 @@
 	
 
 	pmo.pmo_len = sizeof(pmo);
-	pmo.pmo_len += source ? strlen(source) : 0;
-	pmo.pmo_len += target ? strlen(target) : 0;
-	pmo.pmo_len += filesystemtype ? strlen(filesystemtype) : 0;
-	pmo.pmo_len += data ? strlen(data) : 0;
+	pmo.pmo_len += source ? (uint32_t)strlen(source) : 0;
+	pmo.pmo_len += target ? (uint32_t)strlen(target) : 0;
+	pmo.pmo_len += filesystemtype ? (uint32_t)strlen(filesystemtype) : 0;
+	pmo.pmo_len += data ? (uint32_t)strlen(data) : 0;
 	pmo.pmo_error = 0;
 	pmo.pmo_unique = (uint64_t)-1;
 
 	(void)strcpy(pmo.pmo_magic, PERFUSE_MOUNT_MAGIC);
-	pmo.pmo_source_len = source ? strlen(source) : 0;
-	pmo.pmo_target_len = target ? strlen(target) : 0;
+	pmo.pmo_source_len = source ? (uint32_t)strlen(source) : 0;
+	pmo.pmo_target_len = target ? (uint32_t)strlen(target) : 0;
 	pmo.pmo_filesystemtype_len = 
-	filesystemtype ? strlen(filesystemtype) : 0;
-	pmo.pmo_mountflags = mountflags;
-	pmo.pmo_data_len = data ? strlen(data) : 0;
+	filesystemtype ? (uint32_t)strlen(filesystemtype) : 0;
+	pmo.pmo_mountflags = (uint32_t)mountflags;
+	pmo.pmo_data_len = data ? (uint32_t)strlen(data) : 0;
 	
 
 	if (write(s, &pmo, sizeof(pmo)) != sizeof(pmo)) {

Index: src/lib/libperfuse/perfuse_if.h
diff -u src/lib/libperfuse/perfuse_if.h:1.5 src/lib/libperfuse/perfuse_if.h:1.6
--- src/lib/libperfuse/perfuse_if.h:1.5	Mon Sep  6 01:17:05 2010
+++ src/lib/libperfuse/perfuse_if.h	Mon Sep  6 01:40:24 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfuse_if.h,v 1.5 2010/09/06 01:17:05 manu Exp $ */
+/*  $NetBSD: perfuse_if.h,v 1.6 2010/09/06 01:40:24 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -146,15 +146,15 @@
  * mount request
  */
 struct perfuse_mount_out {
-size_t pmo_len;
+uint32_t pmo_len;
 int32_t pmo_error;  
 uint64_t pmo_unique;
 	char pmo_magic[sizeof(PERFUSE_MOUNT_MAGIC)];
-	size_t pmo_source_len;
-	size_t pmo_target_len;
-	size_t pmo_filesystemtype_len;
-	long pmo_mountflags;
-	size_t pmo_data_len;
+	uint32_t pmo_source_len;
+	uint32_t pmo_target_len;
+	uint32_t pmo_filesystemtype_len;
+	uint32_t pmo_mountflags;
+	uint32_t pmo_data_len;
 };
 
 struct perfuse_mount_info {

Index: src/lib/libperfuse/perfuse_priv.h
diff -u src/lib/libperfuse/perfuse_priv.h:1.7 src/lib/libperfuse/perfuse_priv.h:1.8
--- src/lib/libperfuse/perfuse_priv.h:1.7	Mon Sep  6 01:17:05 2010
+++ src/lib/libperfuse/perfuse_priv.h	Mon Sep  6 01:40:24 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfuse_priv.h,v 1.7 2010/09/06 01:17:05 manu Exp $ */
+/*  $NetBSD: perfuse_priv.h,v 1.8 2010/09/06 01:40:24 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.

Index: src/usr.sbin/perfused/msg.c
diff -u src/usr.sbin/perfused/msg.c:1.3 src/usr.sbin/perfused/msg.c:1.4
--- src/usr.sbin/perfused/msg.c:1.3	Wed Sep  1 14:57:24 2010
+++ src/usr.sbin/perfused/msg.c	Mon Sep  6 01:40:24 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: msg.c,v 1.3 2010/09/01 14:57:24 manu Exp $ */
+/*  $NetBSD: msg.c,v 1.4 2010/09/06 01:40:24 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -128,7 +128,7 @@
 
 	(void)memset(data, 0, len);
 	fih = (struct fuse_in_header *)data;
-	fih->len = len;
+	fih->len = (uint32_t)len;
 	fih->opcode = opcode;
 	fih->unique = perfuse_next_unique(pu);
 	fih->nodeid = nodeid;
@@ -606,7 +606,7 @@
 	int fd;
 	

CVS commit: src/lib/libperfuse

2010-09-05 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Mon Sep  6 01:17:05 UTC 2010

Modified Files:
src/lib/libperfuse: ops.c perfuse_if.h perfuse_priv.h

Log Message:
build fixes for LP64


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libperfuse/ops.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libperfuse/perfuse_if.h
cvs rdiff -u -r1.6 -r1.7 src/lib/libperfuse/perfuse_priv.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/libperfuse/ops.c
diff -u src/lib/libperfuse/ops.c:1.9 src/lib/libperfuse/ops.c:1.10
--- src/lib/libperfuse/ops.c:1.9	Sun Sep  5 06:49:13 2010
+++ src/lib/libperfuse/ops.c	Mon Sep  6 01:17:05 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.9 2010/09/05 06:49:13 manu Exp $ */
+/*  $NetBSD: ops.c,v 1.10 2010/09/06 01:17:05 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -416,7 +416,7 @@
 	fd_offset = 0;
 	written = 0;
 	dents = PERFUSE_NODE_DATA(opc)->pnd_dirent;
-	dents_len = PERFUSE_NODE_DATA(opc)->pnd_dirent_len;
+	dents_len = (size_t)PERFUSE_NODE_DATA(opc)->pnd_dirent_len;
 
 	do {
 		char *ndp;
@@ -569,7 +569,8 @@
 
 #ifdef PERFUSE_DEBUG
 	if (perfuse_diagflags & PDF_READDIR)
-		DPRINTF("%s: readoff = %"PRId64",  pnd->pnd_dirent_len = %zd\n",
+		DPRINTF("%s: readoff = %"PRId64",  "
+			"pnd->pnd_dirent_len = %"PRId64"\n",
 			__func__, *readoff, pnd->pnd_dirent_len);
 #endif
 	if (*readoff >=  pnd->pnd_dirent_len) {
@@ -1067,7 +1068,7 @@
 	pm = ps->ps_new_msg(pu, opc, FUSE_MKNOD, len, pcn->pcn_cred);
 	fmi = GET_INPAYLOAD(ps, pm, fuse_mknod_in);
 	fmi->mode = vap->va_mode | VTTOIF(vap->va_type);
-	fmi->rdev = vap->va_rdev;
+	fmi->rdev = (uint32_t)vap->va_rdev;
 	fmi->umask = 0; 	/* Seems unused bu libfuse */
 	(void)strlcpy((char *)(void *)(fmi + 1), path, len - sizeof(*fmi));
 

Index: src/lib/libperfuse/perfuse_if.h
diff -u src/lib/libperfuse/perfuse_if.h:1.4 src/lib/libperfuse/perfuse_if.h:1.5
--- src/lib/libperfuse/perfuse_if.h:1.4	Wed Sep  1 14:57:24 2010
+++ src/lib/libperfuse/perfuse_if.h	Mon Sep  6 01:17:05 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfuse_if.h,v 1.4 2010/09/01 14:57:24 manu Exp $ */
+/*  $NetBSD: perfuse_if.h,v 1.5 2010/09/06 01:17:05 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -153,7 +153,7 @@
 	size_t pmo_source_len;
 	size_t pmo_target_len;
 	size_t pmo_filesystemtype_len;
-	int pmo_mountflags;
+	long pmo_mountflags;
 	size_t pmo_data_len;
 };
 

Index: src/lib/libperfuse/perfuse_priv.h
diff -u src/lib/libperfuse/perfuse_priv.h:1.6 src/lib/libperfuse/perfuse_priv.h:1.7
--- src/lib/libperfuse/perfuse_priv.h:1.6	Sun Sep  5 06:49:13 2010
+++ src/lib/libperfuse/perfuse_priv.h	Mon Sep  6 01:17:05 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfuse_priv.h,v 1.6 2010/09/05 06:49:13 manu Exp $ */
+/*  $NetBSD: perfuse_priv.h,v 1.7 2010/09/06 01:17:05 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -88,7 +88,7 @@
 	uint64_t pnd_offset;			/* seek state */
 	uint64_t pnd_lock_owner;
 	struct dirent *pnd_dirent;		/* native buffer for readdir */
-	size_t pnd_dirent_len;
+	off_t pnd_dirent_len;
 	struct fuse_dirent *pnd_all_fd;		/* FUSE buffer for readdir */
 	size_t pnd_all_fd_len;
 	TAILQ_HEAD(,perfuse_cc_queue) pnd_pcq;	/* queued requests */



CVS commit: src/share/misc

2010-09-05 Thread Adam Hoka
Module Name:src
Committed By:   ahoka
Date:   Sun Sep  5 23:50:48 UTC 2010

Modified Files:
src/share/misc: acronyms.comp

Log Message:
Add RAS, CAS, VCC, ALE, REST, ONFI


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/share/misc/acronyms.comp

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

Modified files:

Index: src/share/misc/acronyms.comp
diff -u src/share/misc/acronyms.comp:1.108 src/share/misc/acronyms.comp:1.109
--- src/share/misc/acronyms.comp:1.108	Sat Aug 21 06:10:37 2010
+++ src/share/misc/acronyms.comp	Sun Sep  5 23:50:48 2010
@@ -1,4 +1,4 @@
-$NetBSD: acronyms.comp,v 1.108 2010/08/21 06:10:37 jruoho Exp $
+$NetBSD: acronyms.comp,v 1.109 2010/09/05 23:50:48 ahoka Exp $
 
 3WHS	three-way handshake
 ABI	application binary interface
@@ -12,6 +12,7 @@
 AES	Advanced Encryption Standard
 AFS	Andrew File System
 AGP	accelerated graphics port
+ALE	address latch enable
 ALU	arithmetic and logical unit
 AM	amplitude modulation
 AMI	alternate mark inversion
@@ -70,6 +71,7 @@
 CARP	common address redundancy protocol
 CAS	(atomic) compare and swap
 CAS	computer algebra system
+CAS	column address strobe
 CAV	constant angular velocity (as opposed to CLV)
 CCD	charge coupled device
 CD	compact disc
@@ -400,6 +402,7 @@
 ODCM	on-demand clock modulation
 OEM	original equipment manufacturer
 OFDM	orthogonal frequency division multiplexing
+ONFI	open nand flash interface
 OO	object oriented
 OO	OpenOffice
 OOB	out of band
@@ -487,9 +490,11 @@
 RAM	random access memory
 RAS	restartable atomic sequence
 RAS	remote access service
+RAS	row address strobe
 RCS	revision control system
 RCU	read-copy-update
 RDF	resource description format
+REST	representational state transfer
 RGB	red green blue
 RHL	Red Hat Linux
 RIFF	Resource Interchange File Format
@@ -628,6 +633,7 @@
 UUOC	useless use of cat
 VA	virtual address
 VAX	virtual address extension
+VCC	common collector voltage
 VCM	virtual channel memory
 VESA	video electronics standards association
 VG	volume group



CVS commit: src/lib/libc/sys

2010-09-05 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Sep  5 22:44:15 UTC 2010

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

Log Message:
Explain how O_NOFOLLOW may cause EFTYPE. From joerg.
While here, sort errors. Bump date.


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

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

Modified files:

Index: src/lib/libc/sys/open.2
diff -u src/lib/libc/sys/open.2:1.42 src/lib/libc/sys/open.2:1.43
--- src/lib/libc/sys/open.2:1.42	Mon May 31 12:16:20 2010
+++ src/lib/libc/sys/open.2	Sun Sep  5 22:44:15 2010
@@ -1,4 +1,4 @@
-.\"	$NetBSD: open.2,v 1.42 2010/05/31 12:16:20 njoly Exp $
+.\"	$NetBSD: open.2,v 1.43 2010/09/05 22:44:15 wiz Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)open.2	8.2 (Berkeley) 11/16/93
 .\"
-.Dd April 3, 2010
+.Dd September 5, 2010
 .Dt OPEN 2
 .Os
 .Sh NAME
@@ -258,6 +258,9 @@
 .It Bq Er EFAULT
 .Fa path
 points outside the process's allocated address space.
+.It Bq Er EFTYPE
+.Dv O_NOFOLLOW
+was specified, but the last path component is a symlink.
 .It Bq Er EINTR
 The
 .Fn open
@@ -279,12 +282,12 @@
 characters, or an entire path name exceeded
 .Brq Dv PATH_MAX
 characters.
+.It Bq Er ENFILE
+The system file table is full.
 .It Bq Er ENOENT
 .Dv O_CREAT
 is not set and the named file does not exist, or
 a component of the path name that must exist does not exist.
-.It Bq Er ENFILE
-The system file table is full.
 .It Bq Er ENOSPC
 .Dv O_CREAT
 is specified,



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

2010-09-05 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Sep  5 20:52:38 UTC 2010

Modified Files:
src/sys/arch/amd64/amd64: netbsd32_machdep.c

Log Message:
accept the LDT selector in check_sigcontext32() too.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/amd64/amd64/netbsd32_machdep.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.66 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.67
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.66	Sun Sep  5 20:14:39 2010
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c	Sun Sep  5 20:52:38 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.66 2010/09/05 20:14:39 chs Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.67 2010/09/05 20:52:38 chs Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.66 2010/09/05 20:14:39 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.67 2010/09/05 20:52:38 chs Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -962,7 +962,7 @@
 	pcb = lwp_getpcb(curlwp);
 
 	if (((scp->sc_eflags ^ tf->tf_rflags) & PSL_USERSTATIC) != 0 ||
-	scp->sc_cs != GSEL(GUCODE32_SEL, SEL_UPL))
+	!VALID_USER_CSEL32(scp->sc_cs))
 		return EINVAL;
 	if (scp->sc_fs != 0 && !VALID_USER_DSEL32(scp->sc_fs) &&
 	!(scp->sc_fs == GSEL(GUFS_SEL, SEL_UPL) && pcb->pcb_fs != 0))



CVS commit: src/doc

2010-09-05 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Sep  5 20:27:19 UTC 2010

Modified Files:
src/doc: 3RDPARTY

Log Message:
gdb-7.2 out.


To generate a diff of this commit:
cvs rdiff -u -r1.776 -r1.777 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.776 src/doc/3RDPARTY:1.777
--- src/doc/3RDPARTY:1.776	Thu Aug 26 15:01:07 2010
+++ src/doc/3RDPARTY	Sun Sep  5 20:27:19 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.776 2010/08/26 15:01:07 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.777 2010/09/05 20:27:19 wiz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -350,7 +350,7 @@
 
 Package:	gdb
 Version:	6.5
-Current Vers:	7.1
+Current Vers:	7.2
 Maintainer:	FSF
 Archive Site:	ftp://ftp.gnu.org/gnu/gdb/
 Home Page:	http://www.gnu.org/software/gdb/



CVS commit: src/sys/arch/amd64

2010-09-05 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Sep  5 20:14:40 UTC 2010

Modified Files:
src/sys/arch/amd64/amd64: netbsd32_machdep.c
src/sys/arch/amd64/include: segments.h

Log Message:
in check_mcontext32(), accept the LDT selector for 32-bit user code
as well as the GDT selector.  fixes PR 43835.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/amd64/amd64/netbsd32_machdep.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/amd64/include/segments.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/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.65 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.66
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.65	Sun Aug  8 18:13:54 2010
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c	Sun Sep  5 20:14:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.65 2010/08/08 18:13:54 chs Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.66 2010/09/05 20:14:39 chs Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.65 2010/08/08 18:13:54 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.66 2010/09/05 20:14:39 chs Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -991,7 +991,7 @@
 	pcb = lwp_getpcb(l);
 
 	if (((gr[_REG32_EFL] ^ tf->tf_rflags) & PSL_USERSTATIC) != 0 ||
-	gr[_REG32_CS] != GSEL(GUCODE32_SEL, SEL_UPL))
+	!VALID_USER_CSEL32(gr[_REG32_CS]))
 		return EINVAL;
 	if (gr[_REG32_FS] != 0 && !VALID_USER_DSEL32(gr[_REG32_FS]) &&
 	!(gr[_REG32_FS] == GSEL(GUFS_SEL, SEL_UPL) && pcb->pcb_fs != 0))

Index: src/sys/arch/amd64/include/segments.h
diff -u src/sys/arch/amd64/include/segments.h:1.20 src/sys/arch/amd64/include/segments.h:1.21
--- src/sys/arch/amd64/include/segments.h:1.20	Wed Jul  7 01:14:52 2010
+++ src/sys/arch/amd64/include/segments.h	Sun Sep  5 20:14:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: segments.h,v 1.20 2010/07/07 01:14:52 chs Exp $	*/
+/*	$NetBSD: segments.h,v 1.21 2010/09/05 20:14:40 chs Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -395,10 +395,8 @@
 #define VALID_USER_DSEL32(s) \
 (((s) & 0x) == GSEL(GUDATA32_SEL, SEL_UPL) || \
  ((s) & 0x) == LSEL(LUDATA32_SEL, SEL_UPL))
-#if 0 /* not used */
 #define VALID_USER_CSEL32(s) \
 ((s) == GSEL(GUCODE32_SEL, SEL_UPL) || (s) == LSEL(LUCODE32_SEL, SEL_UPL))
-#endif
 
 #define VALID_USER_CSEL(s) \
 ((s) == GSEL(GUCODE_SEL, SEL_UPL) || (s) == LSEL(LUCODE_SEL, SEL_UPL))



CVS commit: src/sys/kern

2010-09-05 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sun Sep  5 18:03:37 UTC 2010

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

Log Message:
Cosmetic: remove unnecessary parenthesization in return statements.
Don't "test truth" of ints, but compare with 0, instead.

The generated assembly is the same before & after this change.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/kern/tty_pty.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/tty_pty.c
diff -u src/sys/kern/tty_pty.c:1.122 src/sys/kern/tty_pty.c:1.123
--- src/sys/kern/tty_pty.c:1.122	Sun Jun 13 03:32:47 2010
+++ src/sys/kern/tty_pty.c	Sun Sep  5 18:03:37 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty_pty.c,v 1.122 2010/06/13 03:32:47 yamt Exp $	*/
+/*	$NetBSD: tty_pty.c,v 1.123 2010/09/05 18:03:37 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.122 2010/06/13 03:32:47 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.123 2010/09/05 18:03:37 dyoung Exp $");
 
 #include "opt_ptm.h"
 
@@ -189,7 +189,7 @@
 		if (ptn >= maxptys) {
 	limit_reached:
 			tablefull("pty", "increase kern.maxptys");
-			return (ENXIO);
+			return ENXIO;
 		}
 
 		/* Allocate a larger pty array */
@@ -262,7 +262,7 @@
 			seldestroy(&pti->pt_selr);
 			seldestroy(&pti->pt_selw);
 			kmem_free(pti, sizeof(*pti));
-			return (0);
+			return 0;
 		}
 		tty_attach(pti->pt_tty);
 		pt_softc[ptn] = pti;
@@ -270,7 +270,7 @@
 		mutex_exit(&pt_softc_mutex);
 	}
 
-	return (0);
+	return 0;
 }
 
 /*
@@ -281,7 +281,7 @@
 pty_maxptys(int newmax, int set)
 {
 	if (!set)
-		return (maxptys);
+		return maxptys;
 
 	/*
 	 * We have to grab the pt_softc lock, so that we would pick correct
@@ -332,7 +332,7 @@
 	int ptn = minor(dev);
 
 	if ((error = pty_check(ptn)) != 0)
-		return (error);
+		return error;
 
 	mutex_spin_enter(&tty_lock);
 	pti = pt_softc[ptn];
@@ -348,7 +348,7 @@
 	} else if (kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_OPEN,
 	tp) != 0) {
 		mutex_spin_exit(&tty_lock);
-		return (EBUSY);
+		return EBUSY;
 	}
 	if (tp->t_oproc)			/* Ctrlr still around. */
 		SET(tp->t_state, TS_CARR_ON);
@@ -357,16 +357,16 @@
 			tp->t_wopen++;
 			error = ttysleep(tp, &tp->t_rawcv, true, 0);
 			tp->t_wopen--;
-			if (error) {
+			if (error != 0) {
 mutex_spin_exit(&tty_lock);
-return (error);
+return error;
 			}
 		}
 	}
 	mutex_spin_exit(&tty_lock);
 	error = (*tp->t_linesw->l_open)(dev, tp);
 	ptcwakeup(tp, FREAD|FWRITE);
-	return (error);
+	return error;
 }
 
 int
@@ -379,7 +379,7 @@
 	error = (*tp->t_linesw->l_close)(tp, flag);
 	error |= ttyclose(tp);
 	ptcwakeup(tp, FREAD|FWRITE);
-	return (error);
+	return error;
 }
 
 int
@@ -399,24 +399,24 @@
 			p->p_pgrp->pg_jobc == 0 ||
 			p->p_lflag & PL_PPWAIT) {
 mutex_spin_exit(&tty_lock);
-return (EIO);
+return EIO;
 			}
 			ttysig(tp, TTYSIG_PG1, SIGTTIN);
 			error = ttysleep(tp, &lbolt, true, 0);
-			if (error) {
+			if (error != 0) {
 mutex_spin_exit(&tty_lock);
-return (error);
+return error;
 			}
 		}
 		if (tp->t_canq.c_cc == 0) {
 			if (flag & IO_NDELAY) {
 mutex_spin_exit(&tty_lock);
-return (EWOULDBLOCK);
+return EWOULDBLOCK;
 			}
 			error = ttysleep(tp, &tp->t_cancv, true, 0);
 			mutex_spin_exit(&tty_lock);
-			if (error)
-return (error);
+			if (error != 0)
+return error;
 			goto again;
 		}
 		while(error == 0 && tp->t_canq.c_cc > 1 && uio->uio_resid > 0) {
@@ -431,11 +431,11 @@
 		cc = tp->t_canq.c_cc;
 		mutex_spin_exit(&tty_lock);
 		if (cc)
-			return (error);
+			return error;
 	} else if (tp->t_oproc)
 		error = (*tp->t_linesw->l_read)(tp, uio, flag);
 	ptcwakeup(tp, FWRITE);
-	return (error);
+	return error;
 }
 
 /*
@@ -450,8 +450,8 @@
 	struct tty *tp = pti->pt_tty;
 
 	if (tp->t_oproc == NULL)
-		return (EIO);
-	return ((*tp->t_linesw->l_write)(tp, uio, flag));
+		return EIO;
+	return (*tp->t_linesw->l_write)(tp, uio, flag);
 }
 
 /*
@@ -464,9 +464,9 @@
 	struct tty *tp = pti->pt_tty;
 
 	if (tp->t_oproc == NULL)
-		return (POLLHUP);
+		return POLLHUP;
 
-	return ((*tp->t_linesw->l_poll)(tp, events, l));
+	return (*tp->t_linesw->l_poll)(tp, events, l);
 }
 
 /*
@@ -547,7 +547,7 @@
 	int ptn = minor(dev);
 
 	if ((error = pty_check(ptn)) != 0)
-		return (error);
+		return error;
 
 	pti = pt_softc[ptn];
 	tp = pti->pt_tty;
@@ -555,7 +555,7 @@
 	mutex_spin_enter(&tty_lock);
 	if (tp->t_oproc) {
 		mutex_spin_exit(&tty_lock);
-		return (EIO);
+		return EIO;
 	}
 	tp->t_oproc = ptsstart;
 	mutex_spin_exit(&tty_lock);
@@ -564,7 +564,7 @@
 	pti->pt_flags = 0;
 	pti->pt_send = 0;
 	pti->pt_ucntl = 0;
-	return (0);
+	return 0;
 }
 
 /*ARGSUSED*/
@@ -579,7 +579,7 @@
 	CLR(tp->t_state, TS_CARR_ON);
 	tp->t_oproc = NULL;		/* mark closed */
 	mutex_spin_exit(&tty_lock);
-	return (0);
+	return 0;
 }
 
 int
@@ -607,8 

CVS commit: src/sys/dist/ipf/netinet

2010-09-05 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Sep  5 12:36:46 UTC 2010

Modified Files:
src/sys/dist/ipf/netinet: ip_fil_netbsd.c

Log Message:
Fix mbuf corruption when sending ICMP errors for blocked IPv6
packets due to wrong buffer size computations. The corrupted
mbufs could lead to a panic.

Fix computation of link mtu where the link mtu itself is unspecified.

Limit ICMP error packets for IPv6 to MMTU as required by RFC4443. This
also avoids dropped errors when the length exceeds the link mtu.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/dist/ipf/netinet/ip_fil_netbsd.c

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

Modified files:

Index: src/sys/dist/ipf/netinet/ip_fil_netbsd.c
diff -u src/sys/dist/ipf/netinet/ip_fil_netbsd.c:1.55 src/sys/dist/ipf/netinet/ip_fil_netbsd.c:1.56
--- src/sys/dist/ipf/netinet/ip_fil_netbsd.c:1.55	Tue Jun  1 08:53:20 2010
+++ src/sys/dist/ipf/netinet/ip_fil_netbsd.c	Sun Sep  5 12:36:46 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_fil_netbsd.c,v 1.55 2010/06/01 08:53:20 plunky Exp $	*/
+/*	$NetBSD: ip_fil_netbsd.c,v 1.56 2010/09/05 12:36:46 mlelstv Exp $	*/
 
 /*
  * Copyright (C) 1993-2003 by Darren Reed.
@@ -8,7 +8,7 @@
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.55 2010/06/01 08:53:20 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.56 2010/09/05 12:36:46 mlelstv Exp $");
 #else
 static const char sccsid[] = "@(#)ip_fil.c	2.41 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_fil_netbsd.c,v 2.55.2.67 2009/12/19 05:41:08 darrenr Exp";
@@ -1076,6 +1076,7 @@
 
 		hlen = sizeof(ip_t);
 		ohlen = fin->fin_hlen;
+		iclen = hlen + offsetof(struct icmp, icmp_ip) + ohlen;
 		if (fin->fin_hlen < fin->fin_plen)
 			xtra = MIN(fin->fin_dlen, 8);
 		else
@@ -1086,12 +1087,12 @@
 	else if (fin->fin_v == 6) {
 		hlen = sizeof(ip6_t);
 		ohlen = sizeof(ip6_t);
+		iclen = hlen + offsetof(struct icmp, icmp_ip) + ohlen;
 		type = icmptoicmp6types[type];
 		if (type == ICMP6_DST_UNREACH)
 			code = icmptoicmp6unreach[code];
 
-		if (hlen + sizeof(*icmp) + max_linkhdr +
-		fin->fin_plen > avail) {
+		if (iclen + max_linkhdr + fin->fin_plen > avail) {
 			MCLGET(m, M_DONTWAIT);
 			if (m == NULL)
 return -1;
@@ -1102,7 +1103,14 @@
 			avail = MCLBYTES;
 		}
 		xtra = MIN(fin->fin_plen,
-			   avail - hlen - sizeof(*icmp) - max_linkhdr);
+			   avail - iclen - max_linkhdr);
+		/* RFC4443 asks for 'as much of invoking packet
+		 * as possible without the ICMPv6 packet exceeding
+		 * the minimum IPv6 MTU'
+		 * fr_send_ip also drops packets larger than the
+		 * link mtu
+		 */
+		xtra = MIN(xtra, IPV6_MMTU - iclen);
 		if (dst == 0) {
 			if (fr_ifpaddr(6, FRI_NORMAL, ifp,
    (struct in_addr *)&dst6, NULL) == -1) {
@@ -1118,7 +1126,6 @@
 		return -1;
 	}
 
-	iclen = hlen + sizeof(*icmp);
 	avail -= (max_linkhdr + iclen);
 	if (avail < 0) {
 		FREE_MB_T(m);
@@ -1584,9 +1591,7 @@
 
 	{
 # if (__NetBSD_Version__ >= 10601)
-#  if (__NetBSD_Version__ >= 399001400)
-		struct in6_ifextra *ife;
-#  else
+#  if (__NetBSD_Version__ < 399001400)
 		struct in6_addr finaldst = fin->fin_dst6;
 		int frag;
 #  endif
@@ -1605,8 +1610,7 @@
 		mtu = nd_ifinfo[ifp->if_index].linkmtu;
 # else
 #  if (__NetBSD_Version__ >= 399001400)
-		ife = (struct in6_ifextra *)(ifp)->if_afdata[AF_INET6];
-		mtu = ife->nd_ifinfo[ifp->if_index].linkmtu;
+		mtu = IN6_LINKMTU(ifp);
 #  else
 		error = ip6_getpmtu(ro, ro, ifp, &finaldst, &mtu, &frag);
 #  endif