CVS commit: src/lib/libc/arch/sparc64/softfloat

2014-02-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  2 08:14:39 UTC 2014

Modified Files:
src/lib/libc/arch/sparc64/softfloat: qp.c

Log Message:
Fix unsigned 64 bit int to long double conversion for numbers that would not
fit into a signed 64 bit int. Found by latest t_floatunditf test case
failuer, hint from Matt Thomas.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/arch/sparc64/softfloat/qp.c

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

Modified files:

Index: src/lib/libc/arch/sparc64/softfloat/qp.c
diff -u src/lib/libc/arch/sparc64/softfloat/qp.c:1.10 src/lib/libc/arch/sparc64/softfloat/qp.c:1.11
--- src/lib/libc/arch/sparc64/softfloat/qp.c:1.10	Fri Feb 15 09:24:05 2013
+++ src/lib/libc/arch/sparc64/softfloat/qp.c	Sun Feb  2 08:14:39 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: qp.c,v 1.10 2013/02/15 09:24:05 martin Exp $ */
+/* $NetBSD: qp.c,v 1.11 2014/02/02 08:14:39 martin Exp $ */
 
 /*-
  * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -32,6 +32,7 @@
 #include milieu.h
 #include softfloat.h
 
+int printf(const char *, ...);
 
 void _Qp_add(float128 *c, float128 *a, float128 *b);
 int  _Qp_cmp(float128 *a, float128 *b);
@@ -166,9 +167,10 @@ _Qp_mul(float128 *c, float128 *a, float1
 
 
 /*
- * XXX need corresponding softfloat function
+ * XXX need corresponding softfloat functions
  */
 static float128 __sf128_zero = {0x4034, 0x};
+static float128 __sf128_one = {0x3fff, 0};
 
 void
 _Qp_neg(float128 *c, float128 *a)
@@ -268,13 +270,15 @@ _Qp_uitoq(float128 *c, unsigned int a)
 void
 _Qp_uxtoq(float128 *c, unsigned long a)
 {
-
 	if (a  0x8000ULL) {
-		a = (a  1) | (a  1);
-		*c = int64_to_float128((long long)a);
+		/* a would not fit in a signed conversion */
+		*c = int64_to_float128((long long)(a1));
 		*c = float128_add(*c, *c);
-	} else
+		if (a  1)
+			*c = float128_add(*c, __sf128_one);
+	} else {
 		*c = int64_to_float128((long long)a);
+	}
 }
 
 



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

2014-02-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  2 08:16:22 UTC 2014

Modified Files:
src/tests/lib/libc/gen: t_floatunditf.c

Log Message:
Add a few more test values from the range that sparc64 previously would
have got wrong.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/gen/t_floatunditf.c

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

Modified files:

Index: src/tests/lib/libc/gen/t_floatunditf.c
diff -u src/tests/lib/libc/gen/t_floatunditf.c:1.4 src/tests/lib/libc/gen/t_floatunditf.c:1.5
--- src/tests/lib/libc/gen/t_floatunditf.c:1.4	Sat Feb  1 13:53:16 2014
+++ src/tests/lib/libc/gen/t_floatunditf.c	Sun Feb  2 08:16:22 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: t_floatunditf.c,v 1.4 2014/02/01 13:53:16 martin Exp $ */
+/* $NetBSD: t_floatunditf.c,v 1.5 2014/02/02 08:16:22 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -37,6 +37,9 @@ static const struct {
 	long double ld;
 } testcases[] = {
 	{ 0xULL, 0xf.fffp+60L },
+	{ 0xfffeULL, 0xf.ffep+60L },
+	{ 0xfffdULL, 0xf.ffdp+60L },
+	{ 0xfffcULL, 0xf.ffcp+60L },
 	{ 0x7fffULL, 0xf.ffep+59L },
 	{ 0x3fffULL, 0xf.ffcp+58L },
 	{ 0x1fffULL, 0xf.ff8p+57L },



CVS commit: src/sys/kern

2014-02-02 Thread Tom Spindler
Module Name:src
Committed By:   dogcow
Date:   Sun Feb  2 08:25:23 UTC 2014

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

Log Message:
Delete duplicate symbol definition introduced in 1.371. Now builds again.


To generate a diff of this commit:
cvs rdiff -u -r1.371 -r1.372 src/sys/kern/kern_exec.c

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

Modified files:

Index: src/sys/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.371 src/sys/kern/kern_exec.c:1.372
--- src/sys/kern/kern_exec.c:1.371	Sun Feb  2 04:28:42 2014
+++ src/sys/kern/kern_exec.c	Sun Feb  2 08:25:23 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.371 2014/02/02 04:28:42 manu Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.372 2014/02/02 08:25:23 dogcow Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_exec.c,v 1.371 2014/02/02 04:28:42 manu Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_exec.c,v 1.372 2014/02/02 08:25:23 dogcow Exp $);
 
 #include opt_exec.h
 #include opt_execfmt.h
@@ -178,7 +178,6 @@ void	syscall(void);
 /* NetBSD emul struct */
 struct emul emul_netbsd = {
 	.e_name =		netbsd,
-	.e_path =		NULL,
 #ifdef EMUL_NATIVEROOT
 	.e_path =		EMUL_NATIVEROOT,
 #else



CVS commit: src/lib/libc/sys

2014-02-02 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Feb  2 08:31:49 UTC 2014

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

Log Message:
Mark up HZ.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/libc/sys/nanosleep.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/nanosleep.2
diff -u src/lib/libc/sys/nanosleep.2:1.15 src/lib/libc/sys/nanosleep.2:1.16
--- src/lib/libc/sys/nanosleep.2:1.15	Sat Feb  1 22:42:45 2014
+++ src/lib/libc/sys/nanosleep.2	Sun Feb  2 08:31:49 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: nanosleep.2,v 1.15 2014/02/01 22:42:45 christos Exp $
+.\	$NetBSD: nanosleep.2,v 1.16 2014/02/02 08:31:49 wiz Exp $
 .\
 .\ Copyright (c) 1986, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -174,4 +174,6 @@ which is by default
 in most architectures.
 This means that a request to sleep for less than
 .Dv 10ms
-(1 / HZ seconds), is rounded up to that.
+(1 /
+.Dv HZ
+seconds), is rounded up to that.



CVS commit: src/share/man/man4

2014-02-02 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Feb  2 08:34:39 UTC 2014

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

Log Message:
Wording. New sentence, new line. filesystem - file system.


To generate a diff of this commit:
cvs rdiff -u -r1.433 -r1.434 src/share/man/man4/options.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/options.4
diff -u src/share/man/man4/options.4:1.433 src/share/man/man4/options.4:1.434
--- src/share/man/man4/options.4:1.433	Sun Feb  2 04:28:42 2014
+++ src/share/man/man4/options.4	Sun Feb  2 08:34:39 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: options.4,v 1.433 2014/02/02 04:28:42 manu Exp $
+.\	$NetBSD: options.4,v 1.434 2014/02/02 08:34:39 wiz Exp $
 .\
 .\ Copyright (c) 1996
 .\ 	Perry E. Metzger.  All rights reserved.
@@ -451,18 +451,19 @@ are adjusted and some binaries which use
 .Xr sysctl 3
 to retrieve network details would not work properly.
 .It Cd options EMUL_NATIVEROOT=string
-Just like emulated binaries first try to lookup files in 
+Just like emulated binaries first try looking up files in
 an emulation root (e.g.
 .Pa /emul/linux )
-before looking them up in real root, this option cause native
+before looking them up in real root, this option causes native
 binaries to first look up files in an emulation directory too.
 This can be useful to test an amd64 kernel on top of an i386 system
-prior full migration: by unpacking the amd64 distribution in e.g.
-.Pa /emul/netbsd64 
+before full migration: by unpacking the amd64 distribution in e.g.
+.Pa /emul/netbsd64
 and specifying that location as
 .Cd EMUL_NATIVEROOT ,
-native amd64 binaries can be run while the root filesystem remains
-populated with i386 binaries. Beware of 
+native amd64 binaries can be run while the root file system remains
+populated with i386 binaries.
+Beware of
 .Pa /dev
 incompatibilities between i386 and amd64 if you do this.
 .It Cd options EXEC_ELF_NOTELESS
@@ -1036,7 +1037,7 @@ of FFS file systems.
 Maybe useful for install media kernels, small memory systems and
 embedded systems which don't require the snapshot support.
 .It Cd options UFS_EXTATTR
-Enable extended attribute support for UFS1 filesystems.
+Enable extended attribute support for UFS1 file systems.
 .It Cd options UFS_DIRHASH
 Increase lookup performance by maintaining in-core hash tables
 for large directories.



CVS commit: src

2014-02-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  2 14:48:57 UTC 2014

Modified Files:
src/lib/libc/gen: posix_spawn.3 posix_spawn_file_actions_addopen.3
posix_spawn_file_actions_init.3 posix_spawn_fileactions.c
src/sys/compat/netbsd32: netbsd32_execve.c
src/sys/kern: kern_exec.c

Log Message:
Limit the amount of kernel memory a posix_spawn syscall can use (for handling
the file action list) by limiting the maximum number of file actions to
twice the current file descriptor limit.
Fix a few bugs in the support functions and document the new limit.
From Maxime Villard.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/gen/posix_spawn.3
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/gen/posix_spawn_file_actions_addopen.3 \
src/lib/libc/gen/posix_spawn_file_actions_init.3
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/gen/posix_spawn_fileactions.c
cvs rdiff -u -r1.37 -r1.38 src/sys/compat/netbsd32/netbsd32_execve.c
cvs rdiff -u -r1.372 -r1.373 src/sys/kern/kern_exec.c

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

Modified files:

Index: src/lib/libc/gen/posix_spawn.3
diff -u src/lib/libc/gen/posix_spawn.3:1.4 src/lib/libc/gen/posix_spawn.3:1.5
--- src/lib/libc/gen/posix_spawn.3:1.4	Sat Jul 20 21:39:57 2013
+++ src/lib/libc/gen/posix_spawn.3	Sun Feb  2 14:48:57 2014
@@ -1,4 +1,4 @@
-.\ $NetBSD: posix_spawn.3,v 1.4 2013/07/20 21:39:57 wiz Exp $
+.\ $NetBSD: posix_spawn.3,v 1.5 2014/02/02 14:48:57 martin Exp $
 .\
 .\ Copyright (c) 2008 Ed Schouten e...@freebsd.org
 .\ All rights reserved.
@@ -182,6 +182,12 @@ flag set (see
 is closed.
 .El
 .Pp
+The maximum number of
+.Fa file_actions
+objects is limited to the
+.Dv RLIMIT_NOFILE
+rlimit times 2.
+.Pp
 The
 .Vt posix_spawnattr_t
 spawn attributes object type is defined in
@@ -420,6 +426,11 @@ or
 .Fn dup2 ,
 in addition to those described by
 .Fn open .
+Finally, if the number of
+.Fa file_actions
+objects exceeds the allowed limit,
+.Er EINVAL
+is returned.
 .El
 .Sh SEE ALSO
 .Xr close 2 ,

Index: src/lib/libc/gen/posix_spawn_file_actions_addopen.3
diff -u src/lib/libc/gen/posix_spawn_file_actions_addopen.3:1.3 src/lib/libc/gen/posix_spawn_file_actions_addopen.3:1.4
--- src/lib/libc/gen/posix_spawn_file_actions_addopen.3:1.3	Sat Jul 20 21:39:57 2013
+++ src/lib/libc/gen/posix_spawn_file_actions_addopen.3	Sun Feb  2 14:48:57 2014
@@ -1,4 +1,4 @@
-.\ $NetBSD: posix_spawn_file_actions_addopen.3,v 1.3 2013/07/20 21:39:57 wiz Exp $
+.\ $NetBSD: posix_spawn_file_actions_addopen.3,v 1.4 2014/02/02 14:48:57 martin Exp $
 .\
 .\ Copyright (c) 2008 Ed Schouten e...@freebsd.org
 .\ All rights reserved.
@@ -149,6 +149,10 @@ functions fail if:
 .Bl -tag -width Er
 .It Bq Er EINVAL
 The value specified by
+.Fa file_actions
+is invalid.
+.It Bq Er EBADF
+The value specified by
 .Fa fildes
 or
 .Fa newfildes
Index: src/lib/libc/gen/posix_spawn_file_actions_init.3
diff -u src/lib/libc/gen/posix_spawn_file_actions_init.3:1.3 src/lib/libc/gen/posix_spawn_file_actions_init.3:1.4
--- src/lib/libc/gen/posix_spawn_file_actions_init.3:1.3	Sat Jul 20 21:39:57 2013
+++ src/lib/libc/gen/posix_spawn_file_actions_init.3	Sun Feb  2 14:48:57 2014
@@ -1,4 +1,4 @@
-.\ $NetBSD: posix_spawn_file_actions_init.3,v 1.3 2013/07/20 21:39:57 wiz Exp $
+.\ $NetBSD: posix_spawn_file_actions_init.3,v 1.4 2014/02/02 14:48:57 martin Exp $
 .\
 .\ Copyright (c) 2008 Ed Schouten e...@freebsd.org
 .\ All rights reserved.
@@ -81,6 +81,10 @@ function will fail if:
 .Bl -tag -width Er
 .It Bq Er ENOMEM
 Insufficient memory exists to initialize the spawn file actions object.
+.It Bq Er EINVAL
+The value specified by
+.Fa file_actions
+is invalid.
 .El
 .Sh SEE ALSO
 .Xr posix_spawn 3 ,

Index: src/lib/libc/gen/posix_spawn_fileactions.c
diff -u src/lib/libc/gen/posix_spawn_fileactions.c:1.2 src/lib/libc/gen/posix_spawn_fileactions.c:1.3
--- src/lib/libc/gen/posix_spawn_fileactions.c:1.2	Sun Apr  8 11:27:44 2012
+++ src/lib/libc/gen/posix_spawn_fileactions.c	Sun Feb  2 14:48:57 2014
@@ -25,7 +25,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: posix_spawn_fileactions.c,v 1.2 2012/04/08 11:27:44 martin Exp $);
+__RCSID($NetBSD: posix_spawn_fileactions.c,v 1.3 2014/02/02 14:48:57 martin Exp $);
 
 #include namespace.h
 
@@ -48,11 +48,11 @@ int
 posix_spawn_file_actions_init(posix_spawn_file_actions_t *fa)
 {
 	if (fa == NULL)
-		return (-1);
+		return (EINVAL);
 
 	fa-fae = malloc(MIN_SIZE * sizeof(struct posix_spawn_file_actions_entry));
 	if (fa-fae == NULL)
-		return (-1);
+		return (ENOMEM);
 	fa-size = MIN_SIZE;
 	fa-len = 0;
 
@@ -65,7 +65,7 @@ posix_spawn_file_actions_destroy(posix_s
 	unsigned int i;
 
 	if (fa == NULL)
-		return (-1);
+		return (EINVAL);
 
 	for (i = 0; i  fa-len; i++) {
 		if (fa-fae[i].fae_action == FAE_OPEN)
@@ -77,48 +77,53 @@ posix_spawn_file_actions_destroy(posix_s
 }
 
 static int
-posix_spawn_file_actions_getentry(posix_spawn_file_actions_t *fa)

CVS commit: src/sys/kern

2014-02-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  2 14:50:46 UTC 2014

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

Log Message:
Cosmetics: return is an operator, not a function: remove ().


To generate a diff of this commit:
cvs rdiff -u -r1.373 -r1.374 src/sys/kern/kern_exec.c

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

Modified files:

Index: src/sys/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.373 src/sys/kern/kern_exec.c:1.374
--- src/sys/kern/kern_exec.c:1.373	Sun Feb  2 14:48:57 2014
+++ src/sys/kern/kern_exec.c	Sun Feb  2 14:50:46 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.373 2014/02/02 14:48:57 martin Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.374 2014/02/02 14:50:46 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_exec.c,v 1.373 2014/02/02 14:48:57 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_exec.c,v 1.374 2014/02/02 14:50:46 martin Exp $);
 
 #include opt_exec.h
 #include opt_execfmt.h
@@ -908,7 +908,7 @@ execve_runproc(struct lwp *l, struct exe
 	KASSERT(no_local_exec_lock || rw_lock_held(exec_lock));
 	KASSERT(data != NULL);
 	if (data == NULL)
-		return (EINVAL);
+		return EINVAL;
 
 	p = l-l_proc;
 	if (no_local_exec_lock)
@@ -1427,7 +1427,7 @@ execve_runproc(struct lwp *l, struct exe
 	pathbuf_destroy(data-ed_pathbuf);
 	PNBUF_PUT(data-ed_resolvedpathbuf);
 	DPRINTF((%s finished\n, __func__));
-	return (EJUSTRETURN);
+	return EJUSTRETURN;
 
  exec_abort:
 	SDT_PROBE(proc,,,exec_failure, error, 0, 0, 0, 0);
@@ -1757,7 +1757,7 @@ exec_sigcode_map(struct proc *p, const s
 printf(kernel mapping failed %d\n, error);
 (*uobj-pgops-pgo_detach)(uobj);
 mutex_exit(sigobject_lock);
-return (error);
+return error;
 			}
 			memcpy((void *)va, e-e_sigcode, sz);
 #ifdef PMAP_NEED_PROCWR
@@ -1795,10 +1795,10 @@ exec_sigcode_map(struct proc *p, const s
 		__func__, __LINE__, p-p_vmspace-vm_map, round_page(sz),
 		va, error));
 		(*uobj-pgops-pgo_detach)(uobj);
-		return (error);
+		return error;
 	}
 	p-p_sigctx.ps_sigcode = (void *)va;
-	return (0);
+	return 0;
 }
 
 /*



CVS commit: src/lib/libc/gen

2014-02-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  2 14:54:39 UTC 2014

Modified Files:
src/lib/libc/gen: posix_spawn_fileactions.c posix_spawn_sched.c

Log Message:
Remove paranthesis from return operands.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/gen/posix_spawn_fileactions.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/gen/posix_spawn_sched.c

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

Modified files:

Index: src/lib/libc/gen/posix_spawn_fileactions.c
diff -u src/lib/libc/gen/posix_spawn_fileactions.c:1.3 src/lib/libc/gen/posix_spawn_fileactions.c:1.4
--- src/lib/libc/gen/posix_spawn_fileactions.c:1.3	Sun Feb  2 14:48:57 2014
+++ src/lib/libc/gen/posix_spawn_fileactions.c	Sun Feb  2 14:54:39 2014
@@ -25,7 +25,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: posix_spawn_fileactions.c,v 1.3 2014/02/02 14:48:57 martin Exp $);
+__RCSID($NetBSD: posix_spawn_fileactions.c,v 1.4 2014/02/02 14:54:39 martin Exp $);
 
 #include namespace.h
 
@@ -48,15 +48,15 @@ int
 posix_spawn_file_actions_init(posix_spawn_file_actions_t *fa)
 {
 	if (fa == NULL)
-		return (EINVAL);
+		return EINVAL;
 
 	fa-fae = malloc(MIN_SIZE * sizeof(struct posix_spawn_file_actions_entry));
 	if (fa-fae == NULL)
-		return (ENOMEM);
+		return ENOMEM;
 	fa-size = MIN_SIZE;
 	fa-len = 0;
 
-	return (0);
+	return 0;
 }
 
 int
@@ -65,7 +65,7 @@ posix_spawn_file_actions_destroy(posix_s
 	unsigned int i;
 
 	if (fa == NULL)
-		return (EINVAL);
+		return EINVAL;
 
 	for (i = 0; i  fa-len; i++) {
 		if (fa-fae[i].fae_action == FAE_OPEN)
@@ -73,7 +73,7 @@ posix_spawn_file_actions_destroy(posix_s
 	}
 
 	free(fa-fae);
-	return (0);
+	return 0;
 }
 
 static int
@@ -83,21 +83,21 @@ posix_spawn_file_actions_getentry(posix_
 	posix_spawn_file_actions_entry_t *fae;
 
 	if (fa == NULL)
-		return (EINVAL);
+		return EINVAL;
 
 	if (fa-len  fa-size)
 		goto out;
 
 	fae = realloc(fa-fae, (fa-size + MIN_SIZE) * sizeof(*fa-fae));
 	if (fae == NULL)
-		return (ENOMEM);
+		return ENOMEM;
 
 	fa-fae = fae;
 	fa-size += MIN_SIZE;
 
 out:
 	*i = fa-len;
-	return (0);
+	return 0;
 }
 
 int
@@ -109,15 +109,15 @@ posix_spawn_file_actions_addopen(posix_s
 	int error;
 
 	if (fildes  0)
-		return (EBADF);
+		return EBADF;
 
 	error = posix_spawn_file_actions_getentry(fa, i);
 	if (error)
-		return (error);
+		return error;
 
 	faepath = strdup(path);
 	if (faepath == NULL)
-		return (ENOMEM);
+		return ENOMEM;
 
 	fa-fae[i].fae_action = FAE_OPEN;
 	fa-fae[i].fae_path = faepath;
@@ -126,7 +126,7 @@ posix_spawn_file_actions_addopen(posix_s
 	fa-fae[i].fae_mode = mode;
 	fa-len++;
 
-	return (0);
+	return 0;
 }
 
 int
@@ -137,18 +137,18 @@ posix_spawn_file_actions_adddup2(posix_s
 	int error;
 
 	if (fildes  0 || newfildes  0)
-		return (EBADF);
+		return EBADF;
 
 	error = posix_spawn_file_actions_getentry(fa, i);
 	if (error)
-		return (error);
+		return error;
 
 	fa-fae[i].fae_action = FAE_DUP2;
 	fa-fae[i].fae_fildes = fildes;
 	fa-fae[i].fae_newfildes = newfildes;
 	fa-len++;
 
-	return (0);
+	return 0;
 }
 
 int
@@ -159,15 +159,15 @@ posix_spawn_file_actions_addclose(posix_
 	int error;
 
 	if (fildes  0)
-		return (EBADF);
+		return EBADF;
 
 	error = posix_spawn_file_actions_getentry(fa, i);
 	if (error)
-		return (error);
+		return error;
 
 	fa-fae[i].fae_action = FAE_CLOSE;
 	fa-fae[i].fae_fildes = fildes;
 	fa-len++;
 
-	return (0);
+	return 0;
 }

Index: src/lib/libc/gen/posix_spawn_sched.c
diff -u src/lib/libc/gen/posix_spawn_sched.c:1.1 src/lib/libc/gen/posix_spawn_sched.c:1.2
--- src/lib/libc/gen/posix_spawn_sched.c:1.1	Sat Feb 11 23:31:24 2012
+++ src/lib/libc/gen/posix_spawn_sched.c	Sun Feb  2 14:54:39 2014
@@ -25,7 +25,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: posix_spawn_sched.c,v 1.1 2012/02/11 23:31:24 martin Exp $);
+__RCSID($NetBSD: posix_spawn_sched.c,v 1.2 2014/02/02 14:54:39 martin Exp $);
 
 #include namespace.h
 
@@ -49,7 +49,7 @@ posix_spawnattr_init(posix_spawnattr_t *
 		return -1;
 	
 	memset(ret, 0, sizeof(posix_spawnattr_t));
-	return (0);
+	return 0;
 }
 
 int
@@ -58,7 +58,7 @@ posix_spawnattr_destroy(posix_spawnattr_
 	if (sa == NULL)
 		return -1;
 
-	return (0);
+	return 0;
 }
 
 int
@@ -66,7 +66,7 @@ posix_spawnattr_getflags(const posix_spa
 short * __restrict flags)
 {
 	*flags = sa-sa_flags;
-	return (0);
+	return 0;
 }
 
 int
@@ -74,7 +74,7 @@ posix_spawnattr_getpgroup(const posix_sp
 pid_t * __restrict pgroup)
 {
 	*pgroup = sa-sa_pgroup;
-	return (0);
+	return 0;
 }
 
 int
@@ -82,7 +82,7 @@ posix_spawnattr_getschedparam(const posi
 struct sched_param * __restrict schedparam)
 {
 	*schedparam = sa-sa_schedparam;
-	return (0);
+	return 0;
 }
 
 int
@@ -90,7 +90,7 @@ posix_spawnattr_getschedpolicy(const pos
 int * __restrict schedpolicy)
 {
 	*schedpolicy = sa-sa_schedpolicy;
-	return (0);
+	return 0;
 }
 
 int
@@ -98,7 +98,7 @@ posix_spawnattr_getsigdefault(const posi
 sigset_t * 

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

2014-02-02 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Feb  2 15:35:06 UTC 2014

Modified Files:
src/sys/arch/luna68k/dev: lunaws.c sio.c siotty.c siovar.h

Log Message:
Misc cleanup of sio drivers.

- register softc of child devices as an argument of the sio interrupt
  handler to avoid device_lookup_private() calls on every interrupt
- change type of sc_reg from (void *) to (struct sioreg *)
  to avoid weird address offset calculations with redundant casts
- rename struct sio_softc members for consistency
- use a channel number passed via sio_attach_args in lunaws_attach()

No functional chnages.  Tested on LUNA.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/luna68k/dev/lunaws.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/luna68k/dev/sio.c
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/luna68k/dev/siotty.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/luna68k/dev/siovar.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/luna68k/dev/lunaws.c
diff -u src/sys/arch/luna68k/dev/lunaws.c:1.27 src/sys/arch/luna68k/dev/lunaws.c:1.28
--- src/sys/arch/luna68k/dev/lunaws.c:1.27	Mon Sep 23 17:27:09 2013
+++ src/sys/arch/luna68k/dev/lunaws.c	Sun Feb  2 15:35:06 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: lunaws.c,v 1.27 2013/09/23 17:27:09 tsutsui Exp $ */
+/* $NetBSD: lunaws.c,v 1.28 2014/02/02 15:35:06 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: lunaws.c,v 1.27 2013/09/23 17:27:09 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: lunaws.c,v 1.28 2014/02/02 15:35:06 tsutsui Exp $);
 
 #include wsmouse.h
 
@@ -118,7 +118,7 @@ static const struct wsmouse_accessops om
 };
 #endif
 
-static void wsintr(int);
+static void wsintr(void *);
 static void wssoftintr(void *);
 
 static int  wsmatch(device_t, cfdata_t, void *);
@@ -144,14 +144,16 @@ static void
 wsattach(device_t parent, device_t self, void *aux)
 {
 	struct ws_softc *sc = device_private(self);
-	struct sio_softc *scp = device_private(parent);
+	struct sio_softc *siosc = device_private(parent);
 	struct sio_attach_args *args = aux;
+	int channel = args-channel;
 	struct wskbddev_attach_args a;
 
 	sc-sc_dev = self;
-	sc-sc_ctl = (struct sioreg *)scp-scp_ctl + 1;
+	sc-sc_ctl = siosc-sc_ctl[channel];
 	memcpy(sc-sc_wr, ch1_regs, sizeof(ch1_regs));
-	scp-scp_intr[1] = wsintr;
+	siosc-sc_intrhand[channel].ih_func = wsintr;
+	siosc-sc_intrhand[channel].ih_arg = sc;
 
 	setsioreg(sc-sc_ctl, WR0, sc-sc_wr[WR0]);
 	setsioreg(sc-sc_ctl, WR4, sc-sc_wr[WR4]);
@@ -189,9 +191,9 @@ wsattach(device_t parent, device_t self,
 
 /*ARGSUSED*/
 static void
-wsintr(int chan)
+wsintr(void *arg)
 {
-	struct ws_softc *sc = device_lookup_private(ws_cd, 0);
+	struct ws_softc *sc = arg;
 	struct sioreg *sio = sc-sc_ctl;
 	uint8_t code;
 	int rr;

Index: src/sys/arch/luna68k/dev/sio.c
diff -u src/sys/arch/luna68k/dev/sio.c:1.12 src/sys/arch/luna68k/dev/sio.c:1.13
--- src/sys/arch/luna68k/dev/sio.c:1.12	Mon Sep 23 17:27:09 2013
+++ src/sys/arch/luna68k/dev/sio.c	Sun Feb  2 15:35:06 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: sio.c,v 1.12 2013/09/23 17:27:09 tsutsui Exp $ */
+/* $NetBSD: sio.c,v 1.13 2014/02/02 15:35:06 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: sio.c,v 1.12 2013/09/23 17:27:09 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: sio.c,v 1.13 2014/02/02 15:35:06 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -52,7 +52,7 @@ static int  sio_print(void *, const char
 CFATTACH_DECL_NEW(sio, sizeof(struct sio_softc),
 sio_match, sio_attach, NULL, NULL);
 
-static void nullintr(int);
+static void nullintr(void *);
 static int xsiointr(void *);
 
 static int
@@ -78,10 +78,10 @@ sio_attach(device_t parent, device_t sel
 
 	aprint_normal(: uPD7201A\n);
 
-	sc-scp_dev = self;
-	sc-scp_ctl = (void *)ma-ma_addr;
-	sc-scp_intr[0] = sc-scp_intr[1] = nullintr;
+	sc-sc_dev = self;
+	sc-sc_ctl = (void *)ma-ma_addr;
 	for (channel = 0; channel  2; channel++) {
+		sc-sc_intrhand[channel].ih_func = nullintr;
 		sio_args.channel = channel;
 		sio_args.hwflags = (channel == sysconsole);
 		config_found(self, (void *)sio_args, sio_print);
@@ -109,12 +109,16 @@ xsiointr(void *arg)
 {
 	struct sio_softc *sc = arg;
 
-	(*sc-scp_intr[0])(0);	/* 0: ttya system serial port */
-	(*sc-scp_intr[1])(1);	/* 1: keyboard and mouse */
+	/* channel 0: ttya system serial port */
+	(*sc-sc_intrhand[0].ih_func)(sc-sc_intrhand[0].ih_arg);
+
+	/* channel 1: keyboard and mouse */
+	(*sc-sc_intrhand[1].ih_func)(sc-sc_intrhand[1].ih_arg);
+
 	return 1;
 }
 
 static void
-nullintr(int v)
+nullintr(void *arg)
 {
 }

Index: src/sys/arch/luna68k/dev/siotty.c
diff -u src/sys/arch/luna68k/dev/siotty.c:1.38 

CVS commit: src/lib/libc/gen

2014-02-02 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Feb  2 16:59:06 UTC 2014

Modified Files:
src/lib/libc/gen: posix_spawn.3

Log Message:
Bump date for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/gen/posix_spawn.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/gen/posix_spawn.3
diff -u src/lib/libc/gen/posix_spawn.3:1.5 src/lib/libc/gen/posix_spawn.3:1.6
--- src/lib/libc/gen/posix_spawn.3:1.5	Sun Feb  2 14:48:57 2014
+++ src/lib/libc/gen/posix_spawn.3	Sun Feb  2 16:59:06 2014
@@ -1,4 +1,4 @@
-.\ $NetBSD: posix_spawn.3,v 1.5 2014/02/02 14:48:57 martin Exp $
+.\ $NetBSD: posix_spawn.3,v 1.6 2014/02/02 16:59:06 wiz Exp $
 .\
 .\ Copyright (c) 2008 Ed Schouten e...@freebsd.org
 .\ All rights reserved.
@@ -36,7 +36,7 @@
 .\
 .\ $FreeBSD: src/lib/libc/gen/posix_spawn.3,v 1.2.2.1.4.1 2010/06/14 02:09:06 kensmith Exp $
 .\
-.Dd December 20, 2011
+.Dd February 2, 2014
 .Dt POSIX_SPAWN 3
 .Os
 .Sh NAME



CVS commit: src/lib/libc/gen

2014-02-02 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Feb  2 16:59:13 UTC 2014

Modified Files:
src/lib/libc/gen: posix_spawn_file_actions_addopen.3
posix_spawn_file_actions_init.3

Log Message:
Sort errors. Bump date for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/gen/posix_spawn_file_actions_addopen.3 \
src/lib/libc/gen/posix_spawn_file_actions_init.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/gen/posix_spawn_file_actions_addopen.3
diff -u src/lib/libc/gen/posix_spawn_file_actions_addopen.3:1.4 src/lib/libc/gen/posix_spawn_file_actions_addopen.3:1.5
--- src/lib/libc/gen/posix_spawn_file_actions_addopen.3:1.4	Sun Feb  2 14:48:57 2014
+++ src/lib/libc/gen/posix_spawn_file_actions_addopen.3	Sun Feb  2 16:59:13 2014
@@ -1,4 +1,4 @@
-.\ $NetBSD: posix_spawn_file_actions_addopen.3,v 1.4 2014/02/02 14:48:57 martin Exp $
+.\ $NetBSD: posix_spawn_file_actions_addopen.3,v 1.5 2014/02/02 16:59:13 wiz Exp $
 .\
 .\ Copyright (c) 2008 Ed Schouten e...@freebsd.org
 .\ All rights reserved.
@@ -36,7 +36,7 @@
 .\
 .\ $FreeBSD: src/lib/libc/gen/posix_spawn_file_actions_addopen.3,v 1.2.2.1.4.1 2010/06/14 02:09:06 kensmith Exp $
 .\
-.Dd December 20, 2011
+.Dd February 2, 2014
 .Dt POSIX_SPAWN_FILE_ACTIONS_ADDOPEN 3
 .Os
 .Sh NAME
@@ -147,16 +147,16 @@ otherwise, an error number is returned t
 These
 functions fail if:
 .Bl -tag -width Er
-.It Bq Er EINVAL
-The value specified by
-.Fa file_actions
-is invalid.
 .It Bq Er EBADF
 The value specified by
 .Fa fildes
 or
 .Fa newfildes
 is negative.
+.It Bq Er EINVAL
+The value specified by
+.Fa file_actions
+is invalid.
 .It Bq Er ENOMEM
 Insufficient memory exists to add to the spawn file actions object.
 .El
Index: src/lib/libc/gen/posix_spawn_file_actions_init.3
diff -u src/lib/libc/gen/posix_spawn_file_actions_init.3:1.4 src/lib/libc/gen/posix_spawn_file_actions_init.3:1.5
--- src/lib/libc/gen/posix_spawn_file_actions_init.3:1.4	Sun Feb  2 14:48:57 2014
+++ src/lib/libc/gen/posix_spawn_file_actions_init.3	Sun Feb  2 16:59:13 2014
@@ -1,4 +1,4 @@
-.\ $NetBSD: posix_spawn_file_actions_init.3,v 1.4 2014/02/02 14:48:57 martin Exp $
+.\ $NetBSD: posix_spawn_file_actions_init.3,v 1.5 2014/02/02 16:59:13 wiz Exp $
 .\
 .\ Copyright (c) 2008 Ed Schouten e...@freebsd.org
 .\ All rights reserved.
@@ -36,7 +36,7 @@
 .\
 .\ $FreeBSD: src/lib/libc/gen/posix_spawn_file_actions_init.3,v 1.1.2.1.4.1 2010/06/14 02:09:06 kensmith Exp $
 .\
-.Dd December 20, 2011
+.Dd February 2, 2014
 .Dt POSIX_SPAWN_FILE_ACTIONS_INIT 3
 .Os
 .Sh NAME
@@ -79,12 +79,12 @@ The
 .Fn posix_spawn_file_actions_init
 function will fail if:
 .Bl -tag -width Er
-.It Bq Er ENOMEM
-Insufficient memory exists to initialize the spawn file actions object.
 .It Bq Er EINVAL
 The value specified by
 .Fa file_actions
 is invalid.
+.It Bq Er ENOMEM
+Insufficient memory exists to initialize the spawn file actions object.
 .El
 .Sh SEE ALSO
 .Xr posix_spawn 3 ,



CVS commit: src/lib/libc/atomic

2014-02-02 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Feb  2 17:30:06 UTC 2014

Modified Files:
src/lib/libc/atomic: atomic_cas.3

Log Message:
Rework description for clarity; prompted by chat comments from bad@.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/atomic/atomic_cas.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/atomic/atomic_cas.3
diff -u src/lib/libc/atomic/atomic_cas.3:1.2 src/lib/libc/atomic/atomic_cas.3:1.3
--- src/lib/libc/atomic/atomic_cas.3:1.2	Fri Feb 12 22:23:17 2010
+++ src/lib/libc/atomic/atomic_cas.3	Sun Feb  2 17:30:06 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: atomic_cas.3,v 1.2 2010/02/12 22:23:17 dyoung Exp $
+.\	$NetBSD: atomic_cas.3,v 1.3 2014/02/02 17:30:06 dholland Exp $
 .\
 .\ Copyright (c) 2007, 2010 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -48,49 +48,53 @@
 .Sh SYNOPSIS
 .In sys/atomic.h
 .Ft uint32_t
-.Fn atomic_cas_32 volatile uint32_t *ptr uint32_t old uint32_t new
+.Fn atomic_cas_32 volatile uint32_t *ptr uint32_t expected uint32_t new
 .Ft unsigned int
-.Fn atomic_cas_uint volatile unsigned int *ptr unsigned int old \
+.Fn atomic_cas_uint volatile unsigned int *ptr unsigned int expected \
 unsigned int new
 .Ft unsigned long
-.Fn atomic_cas_ulong volatile unsigned long *ptr unsigned long old \
+.Fn atomic_cas_ulong volatile unsigned long *ptr unsigned long expected \
 unsigned long new
 .Ft void *
-.Fn atomic_cas_ptr volatile void *ptr void *old void *new
+.Fn atomic_cas_ptr volatile void *ptr void *expected void *new
 .Ft uint64_t
-.Fn atomic_cas_64 volatile uint64_t *ptr uint64_t old uint64_t new
+.Fn atomic_cas_64 volatile uint64_t *ptr uint64_t expected uint64_t new
 .Ft uint32_t
-.Fn atomic_cas_32_ni volatile uint32_t *ptr uint32_t old uint32_t new
+.Fn atomic_cas_32_ni volatile uint32_t *ptr uint32_t expected \
+uint32_t new
 .Ft unsigned int
-.Fn atomic_cas_uint_ni volatile unsigned int *ptr unsigned int old \
+.Fn atomic_cas_uint_ni volatile unsigned int *ptr unsigned int expected \
 unsigned int new
 .Ft unsigned long
-.Fn atomic_cas_ulong_ni volatile unsigned long *ptr unsigned long old \
-unsigned long new
+.Fn atomic_cas_ulong_ni volatile unsigned long *ptr \
+unsigned long expected unsigned long new
 .Ft void *
-.Fn atomic_cas_ptr_ni volatile void *ptr void *old void *new
+.Fn atomic_cas_ptr_ni volatile void *ptr void *expected void *new
 .Ft uint64_t
-.Fn atomic_cas_64_ni volatile uint64_t *ptr uint64_t old uint64_t new
+.Fn atomic_cas_64_ni volatile uint64_t *ptr uint64_t expected \
+uint64_t new
 .Sh DESCRIPTION
 The
 .Nm atomic_cas
-family of functions perform a compare-and-swap operation in an atomic fashion.
-The value of the variable referenced by
-.Fa ptr
-is compared against
-.Fa old .
-If the values are equal,
+family of functions perform an atomic conditional assignment.
+The value
 .Fa new
-is stored in the variable referenced by
+is assigned to the variable referenced by
 .Fa ptr .
-.Pp
-The old value of the variable referenced by
-.Fa ptr
-is always returned regardless of whether or not the new value was stored.
-Applications can test for success of the operation by comparing the
-return value to the value passed as
-.Fa old ;
-if they are equal then the new value was stored.
+The assignment succeeds
+if and only if its current value matches the value
+.Fa expected .
+If the value is different, the assignment fails and no change is
+made.
+This operation is sometimes known as
+.Dq compare-and-swap .
+These functions always return the value found via
+.Fa ptr .
+Callers test for success by comparing the return value to the value
+passed as
+.Fa expected ;
+if they are equal then the new value was stored; if they are not, the
+value was not changed.
 .Pp
 The non-interlocked variants,
 .Fn *_ni ,



CVS commit: src/lib/libc/atomic

2014-02-02 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Feb  2 17:32:38 UTC 2014

Modified Files:
src/lib/libc/atomic: atomic_cas.3

Log Message:
Reorg second paragraph too, to group related info together.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/atomic/atomic_cas.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/atomic/atomic_cas.3
diff -u src/lib/libc/atomic/atomic_cas.3:1.3 src/lib/libc/atomic/atomic_cas.3:1.4
--- src/lib/libc/atomic/atomic_cas.3:1.3	Sun Feb  2 17:30:06 2014
+++ src/lib/libc/atomic/atomic_cas.3	Sun Feb  2 17:32:38 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: atomic_cas.3,v 1.3 2014/02/02 17:30:06 dholland Exp $
+.\	$NetBSD: atomic_cas.3,v 1.4 2014/02/02 17:32:38 dholland Exp $
 .\
 .\ Copyright (c) 2007, 2010 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -100,15 +100,11 @@ The non-interlocked variants,
 .Fn *_ni ,
 guarantee atomicity within the same CPU with respect to
 interrupts and preemption.
-For example, they are suitable for synchronizing compare-and-swap
-operations on a variable shared by a thread and an interrupt
-that are bound to the same CPU.
-The
-.Fn *_ni
-variants are not atomic with respect to different CPUs.
-.Fn *_ni
-variants should avoid the interprocessor synchronization overhead
-of the standard compare-and-swap operations.
+They are not atomic with respect to different CPUs.
+These can be used to avoid interprocessor synchronization overhead
+in some cases; for example, they are suitable for synchronized
+operations on a variable shared by a thread and an interrupt that are
+bound to the same CPU.
 .Pp
 The 64-bit variants of these functions are available only on platforms
 that can support atomic 64-bit memory access.



CVS commit: src/lib/libc/atomic

2014-02-02 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Feb  2 18:06:33 UTC 2014

Modified Files:
src/lib/libc/atomic: atomic_cas.3

Log Message:
bump date for previous


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/atomic/atomic_cas.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/atomic/atomic_cas.3
diff -u src/lib/libc/atomic/atomic_cas.3:1.4 src/lib/libc/atomic/atomic_cas.3:1.5
--- src/lib/libc/atomic/atomic_cas.3:1.4	Sun Feb  2 17:32:38 2014
+++ src/lib/libc/atomic/atomic_cas.3	Sun Feb  2 18:06:33 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: atomic_cas.3,v 1.4 2014/02/02 17:32:38 dholland Exp $
+.\	$NetBSD: atomic_cas.3,v 1.5 2014/02/02 18:06:33 dholland Exp $
 .\
 .\ Copyright (c) 2007, 2010 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 February 11, 2010
+.Dd February 2, 2014
 .Dt ATOMIC_CAS 3
 .Os
 .Sh NAME



CVS commit: src/external/gpl3/gdb/dist/gdb

2014-02-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb  2 22:00:38 UTC 2014

Modified Files:
src/external/gpl3/gdb/dist/gdb: inf-ptrace.c

Log Message:
Fix threading bug again.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/gpl3/gdb/dist/gdb/inf-ptrace.c

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

Modified files:

Index: src/external/gpl3/gdb/dist/gdb/inf-ptrace.c
diff -u src/external/gpl3/gdb/dist/gdb/inf-ptrace.c:1.6 src/external/gpl3/gdb/dist/gdb/inf-ptrace.c:1.7
--- src/external/gpl3/gdb/dist/gdb/inf-ptrace.c:1.6	Thu Oct  3 14:30:44 2013
+++ src/external/gpl3/gdb/dist/gdb/inf-ptrace.c	Sun Feb  2 17:00:38 2014
@@ -364,7 +364,13 @@ inf_ptrace_resume (struct target_ops *op
  all possible successor instructions), so we don't have to
  worry about that here.  */
   request = PT_STEP;
-}
+#ifdef __NetBSD__
+  sig = ptid_get_lwp(ptid);
+#else
+  sig = 0;
+#endif
+} else
+  sig = gdb_signal_to_host (signal);
 
   /* An address of (PTRACE_TYPE_ARG3)1 tells ptrace to continue from
  where it was.  If GDB wanted it to start some other way, we have
@@ -374,7 +380,7 @@ inf_ptrace_resume (struct target_ops *op
 XXX __NetBSD__: We used to pass this as the signal
 sig = ptid_get_lwp(ptid);
*/
-  ptrace (request, pid, (PTRACE_TYPE_ARG3)1, gdb_signal_to_host (signal));
+  ptrace (request, pid, (PTRACE_TYPE_ARG3)1, sig);
   if (errno != 0)
 perror_with_name ((ptrace));
 }



CVS commit: src/sys/arch

2014-02-02 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Sun Feb  2 22:41:20 UTC 2014

Modified Files:
src/sys/arch/i386/acpi: acpi_wakecode.S
src/sys/arch/i386/i386: i386_trap.S locore.S machdep.c mptramp.S
src/sys/arch/i386/isa: npx.c
src/sys/arch/x86/x86: procfs_machdep.c

Log Message:
Minor fpu initialisation cleanups:
Set default CR) so that the FPU is enabled (unset CR0_EM) and initialise
  i386_fpu_present to 1.
No need to call the npx trap indirectly, rename to fpunda() to match amd64.
Remove the i386_fpu_exception variable and sysctl (It used to indicate
  which irq was used for fpu exceptions, but we only support 'internal'
  now).  Hopefully no one cares.
fpuinit() now only needs to clear TS before the fninit(). Apart from the
  checks for 486SX and the 'fdiv bug' this matches the amd64 version.
Exclude fpuinit() from XEN kernels, they don't call it - which rather begs
  the question as to whether it is needed at all!


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/i386/acpi/acpi_wakecode.S
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/i386/i386_trap.S
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.744 -r1.745 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/i386/i386/mptramp.S
cvs rdiff -u -r1.149 -r1.150 src/sys/arch/i386/isa/npx.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/x86/procfs_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/i386/acpi/acpi_wakecode.S
diff -u src/sys/arch/i386/acpi/acpi_wakecode.S:1.15 src/sys/arch/i386/acpi/acpi_wakecode.S:1.16
--- src/sys/arch/i386/acpi/acpi_wakecode.S:1.15	Thu Apr 19 18:00:34 2012
+++ src/sys/arch/i386/acpi/acpi_wakecode.S	Sun Feb  2 22:41:20 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_wakecode.S,v 1.15 2012/04/19 18:00:34 jym Exp $	*/
+/*	$NetBSD: acpi_wakecode.S,v 1.16 2014/02/02 22:41:20 dsl Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -165,7 +165,7 @@ wakeup_32:
 	movl	WAKEUP_r_cr3 + ACPI_WAKEUP_ADDR,%eax
 	movl	%eax,%cr3
 	movl	%cr0,%eax
-	orl	$(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_EM|CR0_MP|CR0_WP|CR0_AM),%eax
+	orl	$(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_MP|CR0_WP|CR0_AM),%eax
 	movl	%eax,%cr0
 
 	/* Flush the prefetch queue */

Index: src/sys/arch/i386/i386/i386_trap.S
diff -u src/sys/arch/i386/i386/i386_trap.S:1.2 src/sys/arch/i386/i386/i386_trap.S:1.3
--- src/sys/arch/i386/i386/i386_trap.S:1.2	Sun Jan 26 19:16:17 2014
+++ src/sys/arch/i386/i386/i386_trap.S	Sun Feb  2 22:41:20 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386_trap.S,v 1.2 2014/01/26 19:16:17 dsl Exp $	*/
+/*	$NetBSD: i386_trap.S,v 1.3 2014/02/02 22:41:20 dsl Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -66,7 +66,7 @@
 
 #if 0
 #include machine/asm.h
-__KERNEL_RCSID(0, $NetBSD: i386_trap.S,v 1.2 2014/01/26 19:16:17 dsl Exp $);
+__KERNEL_RCSID(0, $NetBSD: i386_trap.S,v 1.3 2014/02/02 22:41:20 dsl Exp $);
 #endif
 
 /*
@@ -163,7 +163,7 @@ IDTVEC(trap07)
 	movl	CPUVAR(ILEVEL),%ebx
 #endif
 	pushl	CPUVAR(SELF)
-	call	*_C_LABEL(npxdna_func)
+	call	_C_LABEL(fpudna)
 	addl	$4,%esp
 	testl	%eax,%eax
 	jz	calltrap

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.110 src/sys/arch/i386/i386/locore.S:1.111
--- src/sys/arch/i386/i386/locore.S:1.110	Sun Jan 26 19:16:17 2014
+++ src/sys/arch/i386/i386/locore.S	Sun Feb  2 22:41:20 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.110 2014/01/26 19:16:17 dsl Exp $	*/
+/*	$NetBSD: locore.S,v 1.111 2014/02/02 22:41:20 dsl Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -129,7 +129,7 @@
  */
 
 #include machine/asm.h
-__KERNEL_RCSID(0, $NetBSD: locore.S,v 1.110 2014/01/26 19:16:17 dsl Exp $);
+__KERNEL_RCSID(0, $NetBSD: locore.S,v 1.111 2014/02/02 22:41:20 dsl Exp $);
 
 #include opt_compat_oldboot.h
 #include opt_ddb.h
@@ -697,8 +697,8 @@ try586:	/* Use the `cpuid' instruction. 
 	 * 2. Enable paging and the rest of it.
 	 */
 	movl	%cr0,%eax		# get control word
-	# enable paging  NPX emulation
-	orl	$(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_EM|CR0_MP|CR0_WP|CR0_AM),%eax
+	# enable paging  NPX
+	orl	$(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_MP|CR0_WP|CR0_AM),%eax
 	movl	%eax,%cr0		# and page NOW!
 
 	pushl	$begin			# jump to high mem

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.744 src/sys/arch/i386/i386/machdep.c:1.745
--- src/sys/arch/i386/i386/machdep.c:1.744	Sat Feb  1 18:57:38 2014
+++ src/sys/arch/i386/i386/machdep.c	Sun Feb  2 22:41:20 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.744 2014/02/01 18:57:38 bouyer Exp $	*/
+/*	$NetBSD: machdep.c,v 1.745 2014/02/02 22:41:20 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.744 2014/02/01 18:57:38 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.745 2014/02/02 22:41:20 dsl 

CVS commit: src/external/gpl3/gdb/dist/gdb

2014-02-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb  2 23:17:54 UTC 2014

Modified Files:
src/external/gpl3/gdb/dist/gdb: inf-ptrace.c

Log Message:
remove stale comment and explain what we are doing. thanks dsl


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/gpl3/gdb/dist/gdb/inf-ptrace.c

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

Modified files:

Index: src/external/gpl3/gdb/dist/gdb/inf-ptrace.c
diff -u src/external/gpl3/gdb/dist/gdb/inf-ptrace.c:1.7 src/external/gpl3/gdb/dist/gdb/inf-ptrace.c:1.8
--- src/external/gpl3/gdb/dist/gdb/inf-ptrace.c:1.7	Sun Feb  2 17:00:38 2014
+++ src/external/gpl3/gdb/dist/gdb/inf-ptrace.c	Sun Feb  2 18:17:54 2014
@@ -365,6 +365,10 @@ inf_ptrace_resume (struct target_ops *op
  worry about that here.  */
   request = PT_STEP;
 #ifdef __NetBSD__
+  /*
+   * On NetBSD the data field of PT_STEP contains the thread
+   * be stepped and all other threads are continued if  0
+   */
   sig = ptid_get_lwp(ptid);
 #else
   sig = 0;
@@ -376,10 +380,6 @@ inf_ptrace_resume (struct target_ops *op
  where it was.  If GDB wanted it to start some other way, we have
  already written a new program counter value to the child.  */
   errno = 0;
-  /*
-XXX __NetBSD__: We used to pass this as the signal
-sig = ptid_get_lwp(ptid);
-   */
   ptrace (request, pid, (PTRACE_TYPE_ARG3)1, sig);
   if (errno != 0)
 perror_with_name ((ptrace));



CVS commit: src

2014-02-02 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Mon Feb  3 02:21:52 UTC 2014

Modified Files:
src/lib/libnpf: npf.3 npf.c npf.h
src/usr.sbin/npf/npfctl: npf_build.c npf_data.c npfctl.h

Log Message:
- npfctl: fix table IDs (breakage since the table naming was added).
- libnpf: remove npf_table_exists_p() from public API.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libnpf/npf.3
cvs rdiff -u -r1.24 -r1.25 src/lib/libnpf/npf.c
cvs rdiff -u -r1.21 -r1.22 src/lib/libnpf/npf.h
cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/npf/npfctl/npf_build.c
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/npf/npfctl/npf_data.c
cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/npf/npfctl/npfctl.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/libnpf/npf.3
diff -u src/lib/libnpf/npf.3:1.14 src/lib/libnpf/npf.3:1.15
--- src/lib/libnpf/npf.3:1.14	Wed Jan  8 10:14:21 2014
+++ src/lib/libnpf/npf.3	Mon Feb  3 02:21:52 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: npf.3,v 1.14 2014/01/08 10:14:21 njoly Exp $
+.\	$NetBSD: npf.3,v 1.15 2014/02/03 02:21:52 rmind Exp $
 .\
 .\ Copyright (c) 2011-2013 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 November 12, 2013
+.Dd February 2, 2014
 .Dt NPF 3
 .Os
 .Sh NAME
@@ -82,8 +82,6 @@
 .Ft int
 .Fn npf_table_add_entry nl_table_t *tl int af \
 in_addr_t addr in_addr_t mask
-.Ft bool
-.Fn npf_table_exists_p nl_config_t *ncf u_int tid
 .Ft int
 .Fn npf_table_insert nl_config_t *ncf nl_table_t *tl
 .Ft void
@@ -290,16 +288,6 @@ must be either
 for IPv4 or
 .Dv AF_INET6
 for IPv6 address.
-.It Fn npf_table_exists_p ncf name
-Determine whether table with ID
-.Fa tid
-exists in the configuration
-.Fa ncf .
-Return
-.Dv true
-if exists, and
-.Dv false
-otherwise.
 .It Fn npf_table_insert ncf tl
 Insert table into set of configuration.
 Routine performs a check for duplicate table ID.

Index: src/lib/libnpf/npf.c
diff -u src/lib/libnpf/npf.c:1.24 src/lib/libnpf/npf.c:1.25
--- src/lib/libnpf/npf.c:1.24	Fri Nov 22 00:25:51 2013
+++ src/lib/libnpf/npf.c	Mon Feb  3 02:21:52 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf.c,v 1.24 2013/11/22 00:25:51 rmind Exp $	*/
+/*	$NetBSD: npf.c,v 1.25 2014/02/03 02:21:52 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2010-2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: npf.c,v 1.24 2013/11/22 00:25:51 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: npf.c,v 1.25 2014/02/03 02:21:52 rmind Exp $);
 
 #include sys/types.h
 #include netinet/in_systm.h
@@ -961,8 +961,8 @@ npf_table_add_entry(nl_table_t *tl, int 
 	return 0;
 }
 
-bool
-npf_table_exists_p(nl_config_t *ncf, const char *name)
+static bool
+_npf_table_exists_p(nl_config_t *ncf, const char *name)
 {
 	prop_dictionary_t tldict;
 	prop_object_iterator_t it;
@@ -988,7 +988,7 @@ npf_table_insert(nl_config_t *ncf, nl_ta
 	if (!prop_dictionary_get_cstring_nocopy(tldict, name, name)) {
 		return EINVAL;
 	}
-	if (npf_table_exists_p(ncf, name)) {
+	if (_npf_table_exists_p(ncf, name)) {
 		return EEXIST;
 	}
 	prop_array_add(ncf-ncf_table_list, tldict);

Index: src/lib/libnpf/npf.h
diff -u src/lib/libnpf/npf.h:1.21 src/lib/libnpf/npf.h:1.22
--- src/lib/libnpf/npf.h:1.21	Fri Nov 22 00:25:51 2013
+++ src/lib/libnpf/npf.h	Mon Feb  3 02:21:52 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf.h,v 1.21 2013/11/22 00:25:51 rmind Exp $	*/
+/*	$NetBSD: npf.h,v 1.22 2014/02/03 02:21:52 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2011-2013 The NetBSD Foundation, Inc.
@@ -111,7 +111,6 @@ int		npf_nat_insert(nl_config_t *, nl_na
 nl_table_t *	npf_table_create(const char *, u_int, int);
 int		npf_table_add_entry(nl_table_t *, int,
 		const npf_addr_t *, const npf_netmask_t);
-bool		npf_table_exists_p(nl_config_t *, const char *);
 int		npf_table_insert(nl_config_t *, nl_table_t *);
 void		npf_table_destroy(nl_table_t *);
 

Index: src/usr.sbin/npf/npfctl/npf_build.c
diff -u src/usr.sbin/npf/npfctl/npf_build.c:1.31 src/usr.sbin/npf/npfctl/npf_build.c:1.32
--- src/usr.sbin/npf/npfctl/npf_build.c:1.31	Fri Nov 22 00:25:51 2013
+++ src/usr.sbin/npf/npfctl/npf_build.c	Mon Feb  3 02:21:52 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_build.c,v 1.31 2013/11/22 00:25:51 rmind Exp $	*/
+/*	$NetBSD: npf_build.c,v 1.32 2014/02/03 02:21:52 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2011-2013 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: npf_build.c,v 1.31 2013/11/22 00:25:51 rmind Exp $);
+__RCSID($NetBSD: npf_build.c,v 1.32 2014/02/03 02:21:52 rmind Exp $);
 
 #include sys/types.h
 #include sys/ioctl.h
@@ -123,10 +123,25 @@ npfctl_debug_addif(const char *ifname)
 	return 0;
 }
 
-bool
-npfctl_table_exists_p(const char *name)
+unsigned
+npfctl_table_getid(const char *name)
 {
-	return npf_conf ? npf_table_exists_p(npf_conf, name) : 

CVS commit: src/sys/dev/marvell

2014-02-02 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Feb  3 05:56:23 UTC 2014

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
 Carefully set IFF_OACTIVE in mvgbe_start(). Even if mvgbe_encap()
returns other than 0, the TX ring might not full. Check whether
the TX ring has one or more packets. If the ring is empty,
dont' set IFF_OACTIVE because an TX complete interrupt never
occur and IFF_OACTIVE flags is left. The interface's timer
isn't reset, so a device timeout desn't occur.

 Fixes a bug that IFF_OACTIVE flag is left on heavy load.
Part of PR#48568.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/marvell/if_mvgbe.c

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

Modified files:

Index: src/sys/dev/marvell/if_mvgbe.c
diff -u src/sys/dev/marvell/if_mvgbe.c:1.35 src/sys/dev/marvell/if_mvgbe.c:1.36
--- src/sys/dev/marvell/if_mvgbe.c:1.35	Mon Dec 23 02:23:25 2013
+++ src/sys/dev/marvell/if_mvgbe.c	Mon Feb  3 05:56:23 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvgbe.c,v 1.35 2013/12/23 02:23:25 kiyohara Exp $	*/
+/*	$NetBSD: if_mvgbe.c,v 1.36 2014/02/03 05:56:23 msaitoh Exp $	*/
 /*
  * Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_mvgbe.c,v 1.35 2013/12/23 02:23:25 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_mvgbe.c,v 1.36 2014/02/03 05:56:23 msaitoh Exp $);
 
 #include opt_multiprocessor.h
 
@@ -1059,7 +1059,8 @@ mvgbe_start(struct ifnet *ifp)
 		 * for the NIC to drain the ring.
 		 */
 		if (mvgbe_encap(sc, m_head, idx)) {
-			ifp-if_flags |= IFF_OACTIVE;
+			if (sc-sc_cdata.mvgbe_tx_cnt  0)
+ifp-if_flags |= IFF_OACTIVE;
 			break;
 		}