CVS commit: src/lib/libc/stdio

2017-12-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Dec 31 07:22:55 UTC 2017

Modified Files:
src/lib/libc/stdio: printf.3

Log Message:
Fix plurals.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/lib/libc/stdio/printf.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/printf.3
diff -u src/lib/libc/stdio/printf.3:1.67 src/lib/libc/stdio/printf.3:1.68
--- src/lib/libc/stdio/printf.3:1.67	Mon Jul  3 21:32:49 2017
+++ src/lib/libc/stdio/printf.3	Sun Dec 31 07:22:55 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: printf.3,v 1.67 2017/07/03 21:32:49 wiz Exp $
+.\"	$NetBSD: printf.3,v 1.68 2017/12/31 07:22:55 dholland Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -370,7 +370,7 @@ The following length modifiers are valid
 .Cm d , i , n , o , u , x ,
 or
 .Cm X
-conversion:
+conversions:
 .Bl -column ".Cm q Em (deprecated)" ".Vt signed char" ".Vt unsigned long long" ".Vt long long *"
 .It Sy Modifier Ta Cm d , i Ta Cm o , u , x , X Ta Cm n
 .It Cm hh Ta Vt "signed char" Ta Vt "unsigned char" Ta Vt "signed char *"
@@ -416,7 +416,7 @@ macros are used when possible.
 These are further described in
 .Xr inttypes 3 .
 .Pp
-The following length modifier is valid for the
+The following length modifiers are valid for the
 .Cm a ,
 .Cm A ,
 .Cm e ,
@@ -426,7 +426,7 @@ The following length modifier is valid f
 .Cm g ,
 or
 .Cm G
-conversion:
+conversions:
 .Bl -column ".Sy Modifier" ".Cm a , A , e , E , f , F , g , G"
 .It Sy Modifier Ta Cm a , A , e , E , f , F , g , G
 .It Cm l No (ell) Ta Vt double
@@ -438,7 +438,7 @@ The following length modifier is valid f
 .Cm c
 or
 .Cm s
-conversion:
+conversions:
 .Bl -column ".Sy Modifier" ".Vt wint_t" ".Vt wchar_t *"
 .It Sy Modifier Ta Cm c Ta Cm s
 .It Cm l No (ell) Ta Vt wint_t Ta Vt "wchar_t *"



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

2017-12-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Dec 31 07:23:09 UTC 2017

Modified Files:
src/sys/arch/amd64/include: pcb.h

Log Message:
gc unused


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/amd64/include/pcb.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/include/pcb.h
diff -u src/sys/arch/amd64/include/pcb.h:1.27 src/sys/arch/amd64/include/pcb.h:1.28
--- src/sys/arch/amd64/include/pcb.h:1.27	Tue Oct 31 12:02:20 2017
+++ src/sys/arch/amd64/include/pcb.h	Sun Dec 31 07:23:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcb.h,v 1.27 2017/10/31 12:02:20 maxv Exp $	*/
+/*	$NetBSD: pcb.h,v 1.28 2017/12/31 07:23:09 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -79,8 +79,7 @@
 
 struct pcb {
 	int	  pcb_flags;
-#define	PCB_USER_LDT	0x01		/* has user-set LDT */
-#define	PCB_COMPAT32	0x02
+#define	PCB_COMPAT32	0x01
 	u_int	  pcb_cr0;		/* saved image of CR0 */
 	uint64_t pcb_rsp0;
 	uint64_t pcb_cr2;		/* page fault address (CR2) */



CVS commit: src/sys/kern

2017-12-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Dec 31 06:57:12 UTC 2017

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

Log Message:
Check MT_FREE by default, and not just under DEBUG (or DIAGNOSTIC). This
code is fast, with an nonexistent overhead - and we already take care of
setting MT_FREE, so why not check it.

In addition, stop registering the function name, that's not helpful since
the MBUFFREE macro is local. Instead, set m_data to NULL, so that any
access to a freed mbuf's data after mtod() or similar will page fault.

The combination of these two changes provides a fast and efficient way of
detecting use-after-frees in the network stack.


To generate a diff of this commit:
cvs rdiff -u -r1.173 -r1.174 src/sys/kern/uipc_mbuf.c

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

Modified files:

Index: src/sys/kern/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.173 src/sys/kern/uipc_mbuf.c:1.174
--- src/sys/kern/uipc_mbuf.c:1.173	Thu Nov  9 22:21:27 2017
+++ src/sys/kern/uipc_mbuf.c	Sun Dec 31 06:57:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.173 2017/11/09 22:21:27 christos Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.174 2017/12/31 06:57:12 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.173 2017/11/09 22:21:27 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.174 2017/12/31 06:57:12 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -1932,27 +1932,16 @@ m_claim(struct mbuf *m, struct mowner *m
 		MBUFFREE(f, l, m);	\
 	}\
 
-#ifdef DEBUG
 #define MBUFFREE(f, l, m)		\
 	do {\
-		if ((m)->m_type == MT_FREE)\
-			panic("mbuf was already freed at %s,%d", 	\
-			m->m_data, m->m_len);			\
+		if (__predict_false((m)->m_type == MT_FREE)) {		\
+			panic("mbuf %p already freed", m);		\
+		}			\
 		(m)->m_type = MT_FREE;	\
-		(m)->m_data = __UNCONST(f);\
-		(m)->m_len = l;		\
+		(m)->m_data = NULL;	\
 		pool_cache_put(mb_cache, (m));\
 	} while (/*CONSTCOND*/0)
 
-#else
-#define MBUFFREE(f, l, m)		\
-	do {\
-		KASSERT((m)->m_type != MT_FREE);			\
-		(m)->m_type = MT_FREE;	\
-		pool_cache_put(mb_cache, (m));\
-	} while (/*CONSTCOND*/0)
-#endif
-
 struct mbuf *
 m__free(const char *f, int l, struct mbuf *m)
 {



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

2017-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 31 03:38:06 UTC 2017

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

Log Message:
explain that a.out never shipped on x86_64 and put back compat_nomid


To generate a diff of this commit:
cvs rdiff -u -r1.475 -r1.476 src/sys/arch/amd64/conf/GENERIC

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

Modified files:

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.475 src/sys/arch/amd64/conf/GENERIC:1.476
--- src/sys/arch/amd64/conf/GENERIC:1.475	Sun Dec 10 12:19:48 2017
+++ src/sys/arch/amd64/conf/GENERIC	Sat Dec 30 22:38:06 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.475 2017/12/10 17:19:48 bouyer Exp $
+# $NetBSD: GENERIC,v 1.476 2017/12/31 03:38:06 christos Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.475 $"
+#ident		"GENERIC-$Revision: 1.476 $"
 
 maxusers	64		# estimated number of users
 
@@ -115,11 +115,14 @@ makeoptions	DEBUG="-g"	# compile full sy
 options 	KDTRACE_HOOKS	# kernel DTrace hooks
 
 # Compatibility options
+# x86_64 never shipped with a.out binaries; the two options below are
+# only relevant to 32-bit i386 binaries
 #options 	EXEC_AOUT	# required by binaries from before 1.5
+#options	COMPAT_NOMID	# NetBSD 0.8, 386BSD, and BSDI
 
 # NetBSD backward compatibility. Support goes from COMPAT_15 up until
 # the latest release. Note that really old compat (< COMPAT_16) is only
-# useful for 32-bit binaries.
+# useful for 32-bit i386 binaries.
 include 	"conf/compat_netbsd15.config"
 
 #options 	COMPAT_386BSD_MBRPART # recognize old partition ID



CVS commit: src/sys/miscfs/procfs

2017-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 31 03:29:18 UTC 2017

Modified Files:
src/sys/miscfs/procfs: procfs.h procfs_cmdline.c procfs_subr.c
procfs_vfsops.c

Log Message:
rename some "cmdline" stuff now that it is used to print environment too


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/miscfs/procfs/procfs.h
cvs rdiff -u -r1.29 -r1.30 src/sys/miscfs/procfs/procfs_cmdline.c
cvs rdiff -u -r1.110 -r1.111 src/sys/miscfs/procfs/procfs_subr.c
cvs rdiff -u -r1.99 -r1.100 src/sys/miscfs/procfs/procfs_vfsops.c

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

Modified files:

Index: src/sys/miscfs/procfs/procfs.h
diff -u src/sys/miscfs/procfs/procfs.h:1.73 src/sys/miscfs/procfs/procfs.h:1.74
--- src/sys/miscfs/procfs/procfs.h:1.73	Sat Dec 30 22:02:23 2017
+++ src/sys/miscfs/procfs/procfs.h	Sat Dec 30 22:29:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs.h,v 1.73 2017/12/31 03:02:23 christos Exp $	*/
+/*	$NetBSD: procfs.h,v 1.74 2017/12/31 03:29:18 christos Exp $	*/
 
 /*
  * Copyright (c) 1993
@@ -208,7 +208,7 @@ int procfs_dostatus(struct lwp *, struct
 struct uio *);
 int procfs_domap(struct lwp *, struct proc *, struct pfsnode *,
 struct uio *, int);
-int procfs_docmdline(struct lwp *, struct proc *, struct pfsnode *,
+int procfs_doprocargs(struct lwp *, struct proc *, struct pfsnode *,
 struct uio *, int);
 int procfs_domeminfo(struct lwp *, struct proc *, struct pfsnode *,
 struct uio *);

Index: src/sys/miscfs/procfs/procfs_cmdline.c
diff -u src/sys/miscfs/procfs/procfs_cmdline.c:1.29 src/sys/miscfs/procfs/procfs_cmdline.c:1.30
--- src/sys/miscfs/procfs/procfs_cmdline.c:1.29	Sat Dec 30 22:02:23 2017
+++ src/sys/miscfs/procfs/procfs_cmdline.c	Sat Dec 30 22:29:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_cmdline.c,v 1.29 2017/12/31 03:02:23 christos Exp $	*/
+/*	$NetBSD: procfs_cmdline.c,v 1.30 2017/12/31 03:29:18 christos Exp $	*/
 
 /*
  * Copyright (c) 1999 Jaromir Dolecek 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_cmdline.c,v 1.29 2017/12/31 03:02:23 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_cmdline.c,v 1.30 2017/12/31 03:29:18 christos Exp $");
 
 #include 
 #include 
@@ -46,7 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: procfs_cmdli
 #include 
 
 static int
-procfs_docmdline_helper(void *cookie, const void *src, size_t off, size_t len)
+procfs_doprocargs_helper(void *cookie, const void *src, size_t off, size_t len)
 {
 	struct uio *uio = cookie;
 	char *buf = __UNCONST(src);
@@ -58,10 +58,10 @@ procfs_docmdline_helper(void *cookie, co
 }
 
 /*
- * code for returning process's command line arguments
+ * code for returning process's command line arguments/environment
  */
 int
-procfs_docmdline(
+procfs_doprocargs(
 struct lwp *curl,
 struct proc *p,
 struct pfsnode *pfs,
@@ -74,7 +74,7 @@ procfs_docmdline(
 
 	/* Don't allow writing. */
 	if (uio->uio_rw != UIO_READ)
-		return (EOPNOTSUPP);
+		return EOPNOTSUPP;
 
 	/*
 	 * Zombies don't have a stack, so we can't read their psstrings.
@@ -87,25 +87,22 @@ procfs_docmdline(
 		if (0 == uio->uio_offset) {
 			error = uiomove(msg, 1, uio);
 			if (error)
-return (error);
+return error;
 		}
 		len = strlen(p->p_comm);
 		if (len >= uio->uio_offset) {
 			start = uio->uio_offset - 1;
 			error = uiomove(p->p_comm + start, len - start, uio);
 			if (error)
-return (error);
+return error;
 		}
 		if (len + 2 >= uio->uio_offset) {
 			start = uio->uio_offset - 1 - len;
 			error = uiomove(msg + 1 + start, 2 - start, uio);
 		}
-		return (error);
+		return error;
 	}
 
 	len = uio->uio_offset + uio->uio_resid;
-
-	error = copy_procargs(p, oid, ,
-	procfs_docmdline_helper, uio);
-	return error;
+	return copy_procargs(p, oid, , procfs_doprocargs_helper, uio);
 }

Index: src/sys/miscfs/procfs/procfs_subr.c
diff -u src/sys/miscfs/procfs/procfs_subr.c:1.110 src/sys/miscfs/procfs/procfs_subr.c:1.111
--- src/sys/miscfs/procfs/procfs_subr.c:1.110	Sat Dec 30 22:02:23 2017
+++ src/sys/miscfs/procfs/procfs_subr.c	Sat Dec 30 22:29:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_subr.c,v 1.110 2017/12/31 03:02:23 christos Exp $	*/
+/*	$NetBSD: procfs_subr.c,v 1.111 2017/12/31 03:29:18 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -102,7 +102,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_subr.c,v 1.110 2017/12/31 03:02:23 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_subr.c,v 1.111 2017/12/31 03:29:18 christos Exp $");
 
 #include 
 #include 
@@ -222,11 +222,11 @@ procfs_rw(void *v)
 		break;
 
 	case PFScmdline:
-		error = procfs_docmdline(curl, p, pfs, uio, KERN_PROC_ARGV);
+		error = procfs_doprocargs(curl, p, pfs, uio, KERN_PROC_ARGV);
 		break;
 
 	case PFSenviron:
-		error = procfs_docmdline(curl, p, pfs, uio, KERN_PROC_ENV);
+		error = procfs_doprocargs(curl, p, pfs, uio, 

CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2017-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 31 03:08:49 UTC 2017

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: dwarf.c

Log Message:
add trivial handling for DW_ATE_UTF, does not work.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.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/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.23 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.24
--- src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.23	Wed Jun  8 17:32:27 2016
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c	Sat Dec 30 22:08:49 2017
@@ -1536,6 +1536,12 @@ die_base_from_dwarf(dwarf_t *dw, Dwarf_D
 		intr->intr_signed = 1;
 		intr->intr_fformat = die_base_type2enc(dw, off, enc, sz);
 		break;
+	case DW_ATE_UTF:
+		// XXX: c++ char16_t/char32_t; we don't deal with it.
+		intr->intr_type = INTR_INT;
+		intr->intr_signed = 1;
+		intr->intr_iformat = 'v';
+		break;
 	default:
 		terminate("die %ju: unknown base type encoding 0x%jx\n",
 		(uintmax_t)off, (uintmax_t)enc);



CVS commit: src/usr.sbin/mtree

2017-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 31 03:04:44 UTC 2017

Modified Files:
src/usr.sbin/mtree: create.c

Log Message:
factor out common code from Poul-Henning Kamp.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/usr.sbin/mtree/create.c

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

Modified files:

Index: src/usr.sbin/mtree/create.c
diff -u src/usr.sbin/mtree/create.c:1.74 src/usr.sbin/mtree/create.c:1.75
--- src/usr.sbin/mtree/create.c:1.74	Thu Dec 14 13:34:41 2017
+++ src/usr.sbin/mtree/create.c	Sat Dec 30 22:04:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: create.c,v 1.74 2017/12/14 18:34:41 christos Exp $	*/
+/*	$NetBSD: create.c,v 1.75 2017/12/31 03:04:44 christos Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)create.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: create.c,v 1.74 2017/12/14 18:34:41 christos Exp $");
+__RCSID("$NetBSD: create.c,v 1.75 2017/12/31 03:04:44 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -179,14 +179,58 @@ cwalk(FILE *fp)
 }
 
 static void
+dosum(FILE *fp, int indent, FTSENT *p, int *offset, int flag,
+char * (*func)(const char *, char *), const char *key)
+{
+	char *digestbuf;
+
+	if ((keys & flag) == 0)
+		return;
+
+	digestbuf = (*func)(p->fts_accpath, NULL);
+	if (digestbuf != NULL) {
+		output(fp, indent, offset, "%s=%s", key, digestbuf);
+		free(digestbuf);
+		return;
+	}
+
+	if (qflag) {
+		warn("%s: %s failed", p->fts_path, key);
+		return;
+	}
+
+	mtree_err("%s: %s failed: %s", p->fts_path, key, strerror(errno));
+}
+
+static char *
+crcFile(const char *fname, char *dummy __unused)
+{
+	char *ptr;
+	uint32_t val, len;
+	int fd, e;
+
+	if ((fd = open(fname, O_RDONLY)) == -1)
+		goto out;
+
+	e = crc(fd, , );
+	close(fd);
+	if (e)
+		goto out;
+
+	if (asprintf(, "%u", val) < 0)
+		goto out;
+
+	return ptr;
+out:
+	mtree_err("%s: %s", fname, strerror(errno));
+	return NULL;
+}
+
+static void
 statf(FILE *fp, int indent, FTSENT *p)
 {
-	u_int32_t len, val;
-	int fd, offset;
+	int offset;
 	const char *name = NULL;
-#if !defined(NO_MD5) || !defined(NO_RMD160) || !defined(NO_SHA1) || !defined(NO_SHA2)
-	char *digestbuf;
-#endif
 
 	offset = fprintf(fp, "%*s%s%s", indent, "",
 	S_ISDIR(p->fts_statp->st_mode) ? "" : "", vispath(p->fts_name));
@@ -239,65 +283,25 @@ statf(FILE *fp, int indent, FTSENT *p)
 		output(fp, indent, , "time=%jd.%09ld",
 		(intmax_t)p->fts_statp->st_mtime, (long)0);
 #endif
-	if (keys & F_CKSUM && S_ISREG(p->fts_statp->st_mode)) {
-		if ((fd = open(p->fts_accpath, O_RDONLY, 0)) < 0 ||
-		crc(fd, , ))
-			mtree_err("%s: %s", p->fts_accpath, strerror(errno));
-		close(fd);
-		output(fp, indent, , "cksum=%lu", (long)val);
-	}
+	if (S_ISREG(p->fts_statp->st_mode))  {
+		dosum(fp, indent, p, , F_CKSUM, crcFile, "cksum");
 #ifndef NO_MD5
-	if (keys & F_MD5 && S_ISREG(p->fts_statp->st_mode)) {
-		if ((digestbuf = MD5File(p->fts_accpath, NULL)) == NULL)
-			mtree_err("%s: MD5File failed: %s", p->fts_accpath,
-			strerror(errno));
-		output(fp, indent, , "%s=%s", MD5KEY, digestbuf);
-		free(digestbuf);
-	}
+		dosum(fp, indent, p, , F_MD5, MD5File, MD5KEY);
 #endif	/* ! NO_MD5 */
 #ifndef NO_RMD160
-	if (keys & F_RMD160 && S_ISREG(p->fts_statp->st_mode)) {
-		if ((digestbuf = RMD160File(p->fts_accpath, NULL)) == NULL)
-			mtree_err("%s: RMD160File failed: %s", p->fts_accpath,
-			strerror(errno));
-		output(fp, indent, , "%s=%s", RMD160KEY, digestbuf);
-		free(digestbuf);
-	}
+		dosum(fp, indent, p, , F_RMD160, RMD160File, RMD160KEY);
 #endif	/* ! NO_RMD160 */
 #ifndef NO_SHA1
-	if (keys & F_SHA1 && S_ISREG(p->fts_statp->st_mode)) {
-		if ((digestbuf = SHA1File(p->fts_accpath, NULL)) == NULL)
-			mtree_err("%s: SHA1File failed: %s", p->fts_accpath,
-			strerror(errno));
-		output(fp, indent, , "%s=%s", SHA1KEY, digestbuf);
-		free(digestbuf);
-	}
+		dosum(fp, indent, p, , F_SHA1, SHA1File, SHA1KEY);
 #endif	/* ! NO_SHA1 */
 #ifndef NO_SHA2
-	if (keys & F_SHA256 && S_ISREG(p->fts_statp->st_mode)) {
-		if ((digestbuf = SHA256_File(p->fts_accpath, NULL)) == NULL)
-			mtree_err("%s: SHA256_File failed: %s", p->fts_accpath,
-			strerror(errno));
-		output(fp, indent, , "%s=%s", SHA256KEY, digestbuf);
-		free(digestbuf);
-	}
+		dosum(fp, indent, p, , F_SHA256, SHA256_File, SHA256KEY);
 #ifdef SHA384_BLOCK_LENGTH
-	if (keys & F_SHA384 && S_ISREG(p->fts_statp->st_mode)) {
-		if ((digestbuf = SHA384_File(p->fts_accpath, NULL)) == NULL)
-			mtree_err("%s: SHA384_File failed: %s", p->fts_accpath,
-			strerror(errno));
-		output(fp, indent, , "%s=%s", SHA384KEY, digestbuf);
-		free(digestbuf);
-	}
+		dosum(fp, indent, p, , F_SHA384, SHA384_File, SHA384KEY);
 #endif
-	if (keys & F_SHA512 && S_ISREG(p->fts_statp->st_mode)) {
-		if ((digestbuf = SHA512_File(p->fts_accpath, NULL)) == NULL)
-			mtree_err("%s: SHA512_File failed: %s", p->fts_accpath,
-			   

CVS commit: src/sys/miscfs/procfs

2017-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 31 03:02:23 UTC 2017

Modified Files:
src/sys/miscfs/procfs: procfs.h procfs_cmdline.c procfs_subr.c
procfs_vfsops.c procfs_vnops.c

Log Message:
Add an environ node


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/miscfs/procfs/procfs.h
cvs rdiff -u -r1.28 -r1.29 src/sys/miscfs/procfs/procfs_cmdline.c
cvs rdiff -u -r1.109 -r1.110 src/sys/miscfs/procfs/procfs_subr.c
cvs rdiff -u -r1.98 -r1.99 src/sys/miscfs/procfs/procfs_vfsops.c
cvs rdiff -u -r1.201 -r1.202 src/sys/miscfs/procfs/procfs_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/miscfs/procfs/procfs.h
diff -u src/sys/miscfs/procfs/procfs.h:1.72 src/sys/miscfs/procfs/procfs.h:1.73
--- src/sys/miscfs/procfs/procfs.h:1.72	Sun Aug 27 20:46:07 2017
+++ src/sys/miscfs/procfs/procfs.h	Sat Dec 30 22:02:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs.h,v 1.72 2017/08/28 00:46:07 kamil Exp $	*/
+/*	$NetBSD: procfs.h,v 1.73 2017/12/31 03:02:23 christos Exp $	*/
 
 /*
  * Copyright (c) 1993
@@ -94,6 +94,7 @@ typedef enum {
 	PFSnotepg,	/* process group notifier */
 	PFSmap,		/* memory map */
 	PFScmdline,	/* process command line args */
+	PFSenviron,	/* process environment */
 	PFSmeminfo,	/* system memory info (if -o linux) */
 	PFScpuinfo,	/* CPU info (if -o linux) */
 	PFSmaps,	/* memory map, Linux style (if -o linux) */
@@ -208,7 +209,7 @@ int procfs_dostatus(struct lwp *, struct
 int procfs_domap(struct lwp *, struct proc *, struct pfsnode *,
 struct uio *, int);
 int procfs_docmdline(struct lwp *, struct proc *, struct pfsnode *,
-struct uio *);
+struct uio *, int);
 int procfs_domeminfo(struct lwp *, struct proc *, struct pfsnode *,
 struct uio *);
 int procfs_dodevices(struct lwp *, struct proc *, struct pfsnode *,

Index: src/sys/miscfs/procfs/procfs_cmdline.c
diff -u src/sys/miscfs/procfs/procfs_cmdline.c:1.28 src/sys/miscfs/procfs/procfs_cmdline.c:1.29
--- src/sys/miscfs/procfs/procfs_cmdline.c:1.28	Fri Mar  4 17:25:32 2011
+++ src/sys/miscfs/procfs/procfs_cmdline.c	Sat Dec 30 22:02:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_cmdline.c,v 1.28 2011/03/04 22:25:32 joerg Exp $	*/
+/*	$NetBSD: procfs_cmdline.c,v 1.29 2017/12/31 03:02:23 christos Exp $	*/
 
 /*
  * Copyright (c) 1999 Jaromir Dolecek 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_cmdline.c,v 1.28 2011/03/04 22:25:32 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_cmdline.c,v 1.29 2017/12/31 03:02:23 christos Exp $");
 
 #include 
 #include 
@@ -65,7 +65,8 @@ procfs_docmdline(
 struct lwp *curl,
 struct proc *p,
 struct pfsnode *pfs,
-struct uio *uio
+struct uio *uio,
+int oid
 )
 {
 	size_t len, start;
@@ -104,7 +105,7 @@ procfs_docmdline(
 
 	len = uio->uio_offset + uio->uio_resid;
 
-	error = copy_procargs(p, KERN_PROC_ARGV, ,
+	error = copy_procargs(p, oid, ,
 	procfs_docmdline_helper, uio);
 	return error;
 }

Index: src/sys/miscfs/procfs/procfs_subr.c
diff -u src/sys/miscfs/procfs/procfs_subr.c:1.109 src/sys/miscfs/procfs/procfs_subr.c:1.110
--- src/sys/miscfs/procfs/procfs_subr.c:1.109	Sun Aug 27 20:46:07 2017
+++ src/sys/miscfs/procfs/procfs_subr.c	Sat Dec 30 22:02:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_subr.c,v 1.109 2017/08/28 00:46:07 kamil Exp $	*/
+/*	$NetBSD: procfs_subr.c,v 1.110 2017/12/31 03:02:23 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -102,7 +102,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_subr.c,v 1.109 2017/08/28 00:46:07 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_subr.c,v 1.110 2017/12/31 03:02:23 christos Exp $");
 
 #include 
 #include 
@@ -114,6 +114,7 @@ __KERNEL_RCSID(0, "$NetBSD: procfs_subr.
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -221,7 +222,11 @@ procfs_rw(void *v)
 		break;
 
 	case PFScmdline:
-		error = procfs_docmdline(curl, p, pfs, uio);
+		error = procfs_docmdline(curl, p, pfs, uio, KERN_PROC_ARGV);
+		break;
+
+	case PFSenviron:
+		error = procfs_docmdline(curl, p, pfs, uio, KERN_PROC_ENV);
 		break;
 
 	case PFSmeminfo:

Index: src/sys/miscfs/procfs/procfs_vfsops.c
diff -u src/sys/miscfs/procfs/procfs_vfsops.c:1.98 src/sys/miscfs/procfs/procfs_vfsops.c:1.99
--- src/sys/miscfs/procfs/procfs_vfsops.c:1.98	Sun Aug 27 20:46:07 2017
+++ src/sys/miscfs/procfs/procfs_vfsops.c	Sat Dec 30 22:02:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_vfsops.c,v 1.98 2017/08/28 00:46:07 kamil Exp $	*/
+/*	$NetBSD: procfs_vfsops.c,v 1.99 2017/12/31 03:02:23 christos Exp $	*/
 
 /*
  * Copyright (c) 1993
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.98 2017/08/28 00:46:07 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.99 2017/12/31 03:02:23 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ 

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

2017-12-30 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Dec 31 00:53:29 UTC 2017

Added Files:
src/sys/arch/arm/dts: sun50i-h5-nanopi-neo-plus2.dts

Log Message:
Enable Gigabit Ethernet on Nano Pi Neo Plus 2.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts

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

Added files:

Index: src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts
diff -u /dev/null src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts:1.1
--- /dev/null	Sun Dec 31 00:53:29 2017
+++ src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts	Sun Dec 31 00:53:29 2017
@@ -0,0 +1,67 @@
+/* $NetBSD: sun50i-h5-nanopi-neo-plus2.dts,v 1.1 2017/12/31 00:53:29 jakllsch Exp $ */
+
+/*
+ *  and _mdio portions lifted from
+ * src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts
+ * which is ..
+ */
+
+/*
+ * Copyright (C) 2017 Icenowy Zheng 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "../../../external/gpl2/dts/dist/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo-plus2.dts"
+
+ {
+	pinctrl-names = "default";
+	pinctrl-0 = <_rgmii_pins>;
+	phy-supply = <_gmac_3v3>;
+	phy-handle = <_rgmii_phy>;
+	phy-mode = "rgmii";
+	status = "okay";
+};
+
+_mdio {
+	ext_rgmii_phy: ethernet-phy@7 {
+		compatible = "ethernet-phy-ieee802.3-c22";
+		reg = <7>;
+	};
+};



CVS commit: src/bin/sh

2017-12-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Dec 30 23:24:19 UTC 2017

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

Log Message:
In addition to previous the which fixed a (harmless) MSAN detected ref
of uninit'd field also fix a couple more (still harmless) related
technical C usage bugs.

Explaining why these issues were harmless would take too long to include here.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/bin/sh/jobs.c

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

Modified files:

Index: src/bin/sh/jobs.c
diff -u src/bin/sh/jobs.c:1.97 src/bin/sh/jobs.c:1.98
--- src/bin/sh/jobs.c:1.97	Sat Dec 30 20:42:28 2017
+++ src/bin/sh/jobs.c	Sat Dec 30 23:24:19 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.97 2017/12/30 20:42:28 christos Exp $	*/
+/*	$NetBSD: jobs.c,v 1.98 2017/12/30 23:24:19 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)jobs.c	8.5 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: jobs.c,v 1.97 2017/12/30 20:42:28 christos Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.98 2017/12/30 23:24:19 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -465,9 +465,11 @@ showjob(struct output *out, struct job *
 			fmtstr(s, 16, "[%ld] %c ",
 (long)(jp - jobtab + 1),
 #if JOBS
-jp == jobtab + curjob ? '+' :
-curjob != -1 && jp == jobtab +
-	jobtab[curjob].prev_job ? '-' :
+jp - jobtab == curjob ?
+	  '+' :
+curjob != -1 &&
+jp - jobtab == jobtab[curjob].prev_job ?
+	  '-' :
 #endif
 ' ');
 		else



CVS commit: src/tests/net/net

2017-12-30 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sat Dec 30 22:02:34 UTC 2017

Modified Files:
src/tests/net/net: t_pktinfo_send.c

Log Message:
Use the default ATF timeout instead of a reduced one of 5 seconds,
which isn't enough for pmax under gxemul on babylon5.netbsd.org.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/net/t_pktinfo_send.c

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

Modified files:

Index: src/tests/net/net/t_pktinfo_send.c
diff -u src/tests/net/net/t_pktinfo_send.c:1.2 src/tests/net/net/t_pktinfo_send.c:1.3
--- src/tests/net/net/t_pktinfo_send.c:1.2	Mon Dec 11 05:47:18 2017
+++ src/tests/net/net/t_pktinfo_send.c	Sat Dec 30 22:02:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_pktinfo_send.c,v 1.2 2017/12/11 05:47:18 ryo Exp $	*/
+/*	$NetBSD: t_pktinfo_send.c,v 1.3 2017/12/30 22:02:34 gson Exp $	*/
 
 /*-
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_pktinfo_send.c,v 1.2 2017/12/11 05:47:18 ryo Exp $");
+__RCSID("$NetBSD: t_pktinfo_send.c,v 1.3 2017/12/30 22:02:34 gson Exp $");
 
 #include 
 #include 
@@ -223,7 +223,6 @@ ATF_TC(pktinfo_send_unbound);
 ATF_TC_HEAD(pktinfo_send_unbound, tc)
 {
 	atf_tc_set_md_var(tc, "descr", "sendmsg with IP_PKTINFO");
-	atf_tc_set_md_var(tc, "timeout", "5");
 }
 ATF_TC_BODY(pktinfo_send_unbound, tc)
 {
@@ -247,7 +246,6 @@ ATF_TC_HEAD(pktinfo_send_bindany, tc)
 {
 	atf_tc_set_md_var(tc, "descr",
 	"sendmsg with IP_PKTINFO on bind(INADDR_ANY) socket");
-	atf_tc_set_md_var(tc, "timeout", "5");
 }
 ATF_TC_BODY(pktinfo_send_bindany, tc)
 {
@@ -272,7 +270,6 @@ ATF_TC_HEAD(pktinfo_send_bindaddr, tc)
 {
 	atf_tc_set_md_var(tc, "descr",
 	"sendmsg with IP_PKTINFO on bind(addr:0) socket");
-	atf_tc_set_md_var(tc, "timeout", "5");
 }
 ATF_TC_BODY(pktinfo_send_bindaddr, tc)
 {
@@ -297,7 +294,6 @@ ATF_TC_HEAD(pktinfo_send_bindport, tc)
 {
 	atf_tc_set_md_var(tc, "descr",
 	"sendmsg with IP_PKTINFO on bind(INADDR_ANY:12345) socket");
-	atf_tc_set_md_var(tc, "timeout", "5");
 }
 ATF_TC_BODY(pktinfo_send_bindport, tc)
 {
@@ -322,7 +318,6 @@ ATF_TC_HEAD(pktinfo_send_bindaddrport, t
 {
 	atf_tc_set_md_var(tc, "descr",
 	"sendmsg with IP_PKTINFO on bind(addr:12345) socket");
-	atf_tc_set_md_var(tc, "timeout", "5");
 }
 ATF_TC_BODY(pktinfo_send_bindaddrport, tc)
 {
@@ -347,7 +342,6 @@ ATF_TC_HEAD(pktinfo_send_bindother, tc)
 {
 	atf_tc_set_md_var(tc, "descr",
 	"sendmsg with IP_PKTINFO from address bound by other socket");
-	atf_tc_set_md_var(tc, "timeout", "5");
 }
 ATF_TC_BODY(pktinfo_send_bindother, tc)
 {
@@ -374,7 +368,6 @@ ATF_TC_HEAD(pktinfo_send_connected, tc)
 {
 	atf_tc_set_md_var(tc, "descr",
 	"sendmsg with IP_PKTINFO on connected socket");
-	atf_tc_set_md_var(tc, "timeout", "5");
 }
 ATF_TC_BODY(pktinfo_send_connected, tc)
 {
@@ -412,7 +405,6 @@ ATF_TC_HEAD(pktinfo_send_notown, tc)
 {
 	atf_tc_set_md_var(tc, "descr",
 	"sendmsg with IP_PKTINFO from no-own address");
-	atf_tc_set_md_var(tc, "timeout", "5");
 }
 ATF_TC_BODY(pktinfo_send_notown, tc)
 {
@@ -445,7 +437,6 @@ ATF_TC_HEAD(pktinfo_send_notown_bind, tc
 {
 	atf_tc_set_md_var(tc, "descr",
 	"sendmsg with IP_PKTINFO from no-own address on bind socket");
-	atf_tc_set_md_var(tc, "timeout", "5");
 }
 ATF_TC_BODY(pktinfo_send_notown_bind, tc)
 {
@@ -493,7 +484,6 @@ ATF_TC_HEAD(pktinfo_send_rawip, tc)
 {
 	atf_tc_set_md_var(tc, "descr",
 	"sendmsg raw-ip with IP_PKTINFO");
-	atf_tc_set_md_var(tc, "timeout", "5");
 }
 ATF_TC_BODY(pktinfo_send_rawip, tc)
 {
@@ -526,7 +516,6 @@ ATF_TC_HEAD(pktinfo_send_rawip_notown, t
 {
 	atf_tc_set_md_var(tc, "descr",
 	"sendmsg raw-ip with IP_PKTINFO from no-own address");
-	atf_tc_set_md_var(tc, "timeout", "5");
 }
 ATF_TC_BODY(pktinfo_send_rawip_notown, tc)
 {
@@ -564,7 +553,6 @@ ATF_TC_HEAD(pktinfo_send_invalidarg, tc)
 {
 	atf_tc_set_md_var(tc, "descr",
 	"sendmsg IP_PKTINFO with invalid argument");
-	atf_tc_set_md_var(tc, "timeout", "5");
 }
 ATF_TC_BODY(pktinfo_send_invalidarg, tc)
 {
@@ -603,7 +591,6 @@ ATF_TC_HEAD(pktinfo_send_ifindex, tc)
 {
 	atf_tc_set_md_var(tc, "descr",
 	"sendmsg with IP_PKTINFO to specified interface");
-	atf_tc_set_md_var(tc, "timeout", "5");
 }
 ATF_TC_BODY(pktinfo_send_ifindex, tc)
 {
@@ -700,7 +687,6 @@ ATF_TC_HEAD(pktinfo_send_multicast, tc)
 	atf_tc_set_md_var(tc, "descr",
 	"sendmsg with IP_PKTINFO to multicast address"
 	" and specified interface");
-	atf_tc_set_md_var(tc, "timeout", "5");
 }
 ATF_TC_BODY(pktinfo_send_multicast, tc)
 {



CVS commit: src/bin/sh

2017-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Dec 30 20:42:28 UTC 2017

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

Log Message:
initialize just used and prev_job


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/bin/sh/jobs.c

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

Modified files:

Index: src/bin/sh/jobs.c
diff -u src/bin/sh/jobs.c:1.96 src/bin/sh/jobs.c:1.97
--- src/bin/sh/jobs.c:1.96	Fri Dec 29 20:21:25 2017
+++ src/bin/sh/jobs.c	Sat Dec 30 15:42:28 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.96 2017/12/30 01:21:25 christos Exp $	*/
+/*	$NetBSD: jobs.c,v 1.97 2017/12/30 20:42:28 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)jobs.c	8.5 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: jobs.c,v 1.96 2017/12/30 01:21:25 christos Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.97 2017/12/30 20:42:28 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -1053,8 +1053,10 @@ makejob(union node *node, int nprocs)
 jobtab = jp;
 			}
 			jp = jobtab + njobs;
-			for (i = 4 ; --i >= 0 ; )
-memset([njobs++], 0, sizeof(*jobtab));
+			for (i = 4 ; --i >= 0 ; njobs++) {
+jobtab[njobs].used = 0;
+jobtab[njobs].prev_job = -1;
+			}
 			INTON;
 			break;
 		}



CVS commit: src/lib/libm/arch/alpha

2017-12-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Dec 30 17:59:25 UTC 2017

Modified Files:
src/lib/libm/arch/alpha: fenv.c

Log Message:
Fix usage of sysarch(ALPHA_FPGETMASK)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/arch/alpha/fenv.c

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

Modified files:

Index: src/lib/libm/arch/alpha/fenv.c
diff -u src/lib/libm/arch/alpha/fenv.c:1.2 src/lib/libm/arch/alpha/fenv.c:1.3
--- src/lib/libm/arch/alpha/fenv.c:1.2	Wed Mar 22 23:11:08 2017
+++ src/lib/libm/arch/alpha/fenv.c	Sat Dec 30 17:59:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fenv.c,v 1.2 2017/03/22 23:11:08 chs Exp $	*/
+/*	$NetBSD: fenv.c,v 1.3 2017/12/30 17:59:24 martin Exp $	*/
 
 /*-
  * Copyright (c) 2004-2005 David Schultz 
@@ -28,7 +28,7 @@
  * $FreeBSD: src/lib/msun/alpha/fenv.c,v 1.2 2005/03/16 19:03:44 das Exp $
  */
 #include 
-__RCSID("$NetBSD: fenv.c,v 1.2 2017/03/22 23:11:08 chs Exp $");
+__RCSID("$NetBSD: fenv.c,v 1.3 2017/12/30 17:59:24 martin Exp $");
 
 #include "namespace.h"
 
@@ -63,7 +63,7 @@ fegetenv(fenv_t *envp)
 	 * only need to issue an excb after the mf_fpcr to ensure that
 	 * the read is executed before any subsequent FP ops.
 	 */
-	sysarch(ALPHA_FPGETMASK, (char *));
+	p.mask = sysarch(ALPHA_FPGETMASK, 0);
 	__mf_fpcr(__d);
 	*envp = r.__bits | p.mask;
 	__excb();
@@ -76,7 +76,7 @@ feholdexcept(fenv_t *envp)
 	struct alpha_fp_except_args p;
 	union __fpcr r;
 
-	sysarch(ALPHA_FPGETMASK, (char *));
+	p.mask = sysarch(ALPHA_FPGETMASK, 0);
 	__mf_fpcr(__d);
 	*envp = r.__bits | p.mask;
 	r.__bits &= ~((fenv_t)FE_ALL_EXCEPT << _FPUSW_SHIFT);
@@ -124,7 +124,7 @@ feenableexcept(int mask)
 {
 	struct alpha_fp_except_args p;
 
-	sysarch(ALPHA_FPGETMASK, );
+	p.mask = sysarch(ALPHA_FPGETMASK, 0);
 	p.mask |= (mask & FE_ALL_EXCEPT);
 	sysarch(ALPHA_FPSETMASK, );
 	return p.mask;
@@ -135,7 +135,7 @@ fedisableexcept(int mask)
 {
 	struct alpha_fp_except_args p;
 
-	sysarch(ALPHA_FPGETMASK, );
+	p.mask = sysarch(ALPHA_FPGETMASK, 0);
 	p.mask &= ~(mask & FE_ALL_EXCEPT);
 	sysarch(ALPHA_FPSETMASK, );
 	return p.mask;
@@ -144,8 +144,6 @@ fedisableexcept(int mask)
 int
 fegetexcept(void)
 {
-	struct alpha_fp_except_args p;
 
-	sysarch(ALPHA_FPGETMASK, );
-	return p.mask;
+	return sysarch(ALPHA_FPGETMASK, 0);
 }



CVS commit: src/tests/kernel

2017-12-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Dec 30 17:06:27 UTC 2017

Modified Files:
src/tests/kernel: t_timeleft.c

Log Message:
Double the nanosleep() time to make the test work more reliably on my
dual CPU alpha (where previously we sometimes ended up with no delay
at all).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/kernel/t_timeleft.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/kernel/t_timeleft.c
diff -u src/tests/kernel/t_timeleft.c:1.1 src/tests/kernel/t_timeleft.c:1.2
--- src/tests/kernel/t_timeleft.c:1.1	Fri Dec  8 01:19:29 2017
+++ src/tests/kernel/t_timeleft.c	Sat Dec 30 17:06:27 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_timeleft.c,v 1.1 2017/12/08 01:19:29 christos Exp $ */
+/* $NetBSD: t_timeleft.c,v 1.2 2017/12/30 17:06:27 martin Exp $ */
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_timeleft.c,v 1.1 2017/12/08 01:19:29 christos Exp $");
+__RCSID("$NetBSD: t_timeleft.c,v 1.2 2017/12/30 17:06:27 martin Exp $");
 
 #include 
 #include 
@@ -84,7 +84,7 @@ static void
 tester(void (*fun)(struct timespec *))
 {
 	const struct timespec ts = { 5, 0 };
-	const struct timespec sts = { 0, 100 };
+	const struct timespec sts = { 0, 200 };
 	struct info i = { fun, ts };
 	pthread_t thr;
 



CVS commit: src/tests/libexec/ld.elf_so

2017-12-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Dec 30 16:53:34 UTC 2017

Modified Files:
src/tests/libexec/ld.elf_so: t_ifunc.c

Log Message:
Skip all tests on architectures w/o ifunc linker/ld.elf_so support.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/libexec/ld.elf_so/t_ifunc.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/libexec/ld.elf_so/t_ifunc.c
diff -u src/tests/libexec/ld.elf_so/t_ifunc.c:1.5 src/tests/libexec/ld.elf_so/t_ifunc.c:1.6
--- src/tests/libexec/ld.elf_so/t_ifunc.c:1.5	Mon Nov  6 21:16:03 2017
+++ src/tests/libexec/ld.elf_so/t_ifunc.c	Sat Dec 30 16:53:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ifunc.c,v 1.5 2017/11/06 21:16:03 joerg Exp $	*/
+/*	$NetBSD: t_ifunc.c,v 1.6 2017/12/30 16:53:34 martin Exp $	*/
 
 /*
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -35,6 +35,13 @@
 
 #include "h_macros.h"
 
+#if !defined( __arm__) && !defined(__i386__) && !defined(__x86_64__) && !defined(__powerpc__) && !defined(__sparc__)
+#define	LINKER_SUPPORT()	\
+	atf_tc_skip("Missing linker support for ifunc relocations")
+#else
+#define	LINKER_SUPPORT()	/* yes */
+#endif
+
 ATF_TC(rtld_ifunc);
 
 ATF_TC_HEAD(rtld_ifunc, tc)
@@ -56,9 +63,7 @@ ATF_TC_BODY(rtld_ifunc, tc)
 	const char *error;
 	size_t i;
 
-#if !defined( __arm__) && !defined(__i386__) && !defined(__x86_64__) && !defined(__powerpc__) && !defined(__sparc__)
-	atf_tc_expect_fail("Missing linker support for hidden ifunc relocations");
-#endif
+	LINKER_SUPPORT();
 
 	for (i = 0; i < __arraycount(envstr); ++i) {
 		setenv("USE_IFUNC2", envstr[i], 1);
@@ -111,6 +116,8 @@ ATF_TC_BODY(rtld_hidden_ifunc, tc)
 	const char *error;
 	size_t i;
 
+	LINKER_SUPPORT();
+
 	for (i = 0; i < __arraycount(envstr); ++i) {
 		setenv("USE_IFUNC2", envstr[i], 1);
 
@@ -172,6 +179,7 @@ unsigned int ifunc(void);
 
 ATF_TC_BODY(rtld_main_ifunc, tc)
 {
+	LINKER_SUPPORT();
 	ATF_CHECK(ifunc() == 0xdeadbeef);
 }
 



CVS commit: src/tests/lib/libc/arch/alpha

2017-12-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Dec 30 16:35:03 UTC 2017

Modified Files:
src/tests/lib/libc/arch/alpha: return_one.S

Log Message:
Implement helper function for alpha


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/arch/alpha/return_one.S

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/arch/alpha/return_one.S
diff -u src/tests/lib/libc/arch/alpha/return_one.S:1.1 src/tests/lib/libc/arch/alpha/return_one.S:1.2
--- src/tests/lib/libc/arch/alpha/return_one.S:1.1	Mon Jul 18 23:16:09 2011
+++ src/tests/lib/libc/arch/alpha/return_one.S	Sat Dec 30 16:35:03 2017
@@ -1,8 +1,11 @@
-/*	$NetBSD: return_one.S,v 1.1 2011/07/18 23:16:09 jym Exp $ */
+/*	$NetBSD: return_one.S,v 1.2 2017/12/30 16:35:03 martin Exp $ */
 
 #include 
 
 .globl	return_one, return_one_end;
 
-return_one: return_one_end:
+return_one:
+	lda	v0,1
+	ret
+return_one_end:
 	nop