CVS commit: src/external/gpl3/gdb/lib/libbfd/arch/mips64el

2015-05-23 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat May 23 22:14:20 UTC 2015

Modified Files:
src/external/gpl3/gdb/lib/libbfd/arch/mips64el: defs.mk

Log Message:
regenerated for N32 support.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/gpl3/gdb/lib/libbfd/arch/mips64el/defs.mk

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/lib/libbfd/arch/mips64el/defs.mk
diff -u src/external/gpl3/gdb/lib/libbfd/arch/mips64el/defs.mk:1.4 src/external/gpl3/gdb/lib/libbfd/arch/mips64el/defs.mk:1.5
--- src/external/gpl3/gdb/lib/libbfd/arch/mips64el/defs.mk:1.4	Thu May  7 14:43:30 2015
+++ src/external/gpl3/gdb/lib/libbfd/arch/mips64el/defs.mk	Sat May 23 22:14:20 2015
@@ -2,8 +2,8 @@
 # Generated from: NetBSD: mknative-gdb,v 1.6 2013/10/03 18:58:37 christos Exp 
 # Generated from: NetBSD: mknative.common,v 1.11 2014/02/17 21:39:43 christos Exp 
 #
-G_libbfd_la_DEPENDENCIES=elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo elf.lo elflink.lo elf-attrs.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo ecofflink.lo elf64-mips.lo elf64.lo coff-mips.lo ecoff.lo elf64-gen.lo elf32-gen.lo cpu-mips.lo netbsd-core.lo archive64.lo ofiles
+G_libbfd_la_DEPENDENCIES=elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo elf.lo elflink.lo elf-attrs.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo ecofflink.lo elfn32-mips.lo elf64-mips.lo elf64.lo coff-mips.lo ecoff.lo elf64-gen.lo elf32-gen.lo cpu-mips.lo netbsd-core.lo archive64.lo ofiles
 G_libbfd_la_OBJECTS=archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo  cache.lo coffgen.lo corefile.lo format.lo init.lo libbfd.lo  opncls.lo reloc.lo section.lo syms.lo targets.lo hash.lo  linker.lo srec.lo binary.lo tekhex.lo ihex.lo stabs.lo  stab-syms.lo merge.lo dwarf2.lo simple.lo compress.lo  verilog.lo
 G_DEFS=-DHAVE_CONFIG_H
-G_INCLUDES=-DNETBSD_CORE   -I. -I${GNUHOSTDIST}/bfd -I${GNUHOSTDIST}/bfd/../include   -DHAVE_bfd_elf32_tradlittlemips_vec -DHAVE_bfd_elf32_tradbigmips_vec -DHAVE_bfd_elf64_tradbigmips_vec -DHAVE_bfd_elf64_tradlittlemips_vec -DHAVE_ecoff_little_vec -DHAVE_ecoff_big_vec -DHAVE_bfd_elf64_little_generic_vec -DHAVE_bfd_elf64_big_generic_vec -DHAVE_bfd_elf32_little_generic_vec -DHAVE_bfd_elf32_big_generic_vec -I./../intl
-G_TDEFAULTS=-DDEFAULT_VECTOR=bfd_elf32_tradlittlemips_vec -DSELECT_VECS='bfd_elf32_tradlittlemips_vec,bfd_elf32_tradbigmips_vec,bfd_elf64_tradbigmips_vec,bfd_elf64_tradlittlemips_vec,ecoff_little_vec,ecoff_big_vec,bfd_elf64_little_generic_vec,bfd_elf64_big_generic_vec,bfd_elf32_little_generic_vec,bfd_elf32_big_generic_vec' -DSELECT_ARCHITECTURES='bfd_mips_arch'
+G_INCLUDES=-DNETBSD_CORE   -I. -I${GNUHOSTDIST}/bfd -I${GNUHOSTDIST}/bfd/../include   -DHAVE_bfd_elf32_tradlittlemips_vec -DHAVE_bfd_elf32_tradbigmips_vec -DHAVE_bfd_elf32_ntradlittlemips_vec -DHAVE_bfd_elf32_ntradbigmips_vec -DHAVE_bfd_elf64_tradbigmips_vec -DHAVE_bfd_elf64_tradlittlemips_vec -DHAVE_ecoff_little_vec -DHAVE_ecoff_big_vec -DHAVE_bfd_elf64_little_generic_vec -DHAVE_bfd_elf64_big_generic_vec -DHAVE_bfd_elf32_little_generic_vec -DHAVE_bfd_elf32_big_generic_vec -I./../intl
+G_TDEFAULTS=-DDEFAULT_VECTOR=bfd_elf32_tradlittlemips_vec -DSELECT_VECS='bfd_elf32_tradlittlemips_vec,bfd_elf32_tradbigmips_vec,bfd_elf32_ntradlittlemips_vec,bfd_elf32_ntradbigmips_vec,bfd_elf64_tradbigmips_vec,bfd_elf64_tradlittlemips_vec,ecoff_little_vec,ecoff_big_vec,bfd_elf64_little_generic_vec,bfd_elf64_big_generic_vec,bfd_elf32_little_generic_vec,bfd_elf32_big_generic_vec' -DSELECT_ARCHITECTURES='bfd_mips_arch'



CVS commit: src/lib/libc/gen

2015-05-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May 23 09:18:01 UTC 2015

Modified Files:
src/lib/libc/gen: utmpx.c

Log Message:
strvisx is used here to encode binary data, but the encoding
depends on locale settings and the result might not be accepted
or even misinterpreted by the strunvis decoder. As a workaround
encode manually as a string of octal numbers.

strvisx should learn how enforce such an encoding by itself.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/lib/libc/gen/utmpx.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/utmpx.c
diff -u src/lib/libc/gen/utmpx.c:1.33 src/lib/libc/gen/utmpx.c:1.34
--- src/lib/libc/gen/utmpx.c:1.33	Thu Feb  5 16:00:39 2015
+++ src/lib/libc/gen/utmpx.c	Sat May 23 09:18:01 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: utmpx.c,v 1.33 2015/02/05 16:00:39 christos Exp $	 */
+/*	$NetBSD: utmpx.c,v 1.34 2015/05/23 09:18:01 mlelstv Exp $	 */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 #include sys/cdefs.h
 
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: utmpx.c,v 1.33 2015/02/05 16:00:39 christos Exp $);
+__RCSID($NetBSD: utmpx.c,v 1.34 2015/05/23 09:18:01 mlelstv Exp $);
 #endif /* LIBC_SCCS and not lint */
 
 #include namespace.h
@@ -308,11 +308,12 @@ utmp_update(const struct utmpx *utx)
 	char buf[sizeof(*utx) * 4 + 1];
 	pid_t pid;
 	int status;
+	unsigned i;
 
 	_DIAGASSERT(utx != NULL);
 
-	(void)strvisx(buf, (const char *)(const void *)utx, sizeof(*utx),
-	VIS_WHITE);
+	for (i=0; isizeof(*utx); ++i)
+		sprintf(buf[4*i],\\%03o,((const char*)utx)[i]);
 	switch (pid = fork()) {
 	case 0:
 		(void)execl(_PATH_UTMP_UPDATE,



CVS commit: src/sys/dev/pci

2015-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat May 23 13:44:40 UTC 2015

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

Log Message:
Remove debug printf().


To generate a diff of this commit:
cvs rdiff -u -r1.290 -r1.291 src/sys/dev/pci/if_bge.c

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

Modified files:

Index: src/sys/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.290 src/sys/dev/pci/if_bge.c:1.291
--- src/sys/dev/pci/if_bge.c:1.290	Mon May 18 01:06:35 2015
+++ src/sys/dev/pci/if_bge.c	Sat May 23 13:44:40 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.290 2015/05/18 01:06:35 msaitoh Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.291 2015/05/23 13:44:40 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_bge.c,v 1.290 2015/05/18 01:06:35 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_bge.c,v 1.291 2015/05/23 13:44:40 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -4745,7 +4745,6 @@ bge_intr(void *xsc)
 	if (sc-bge_flags  BGEF_TAGGED_STATUS) {
 		if (sc-bge_lasttag == statustag 
 		(~pcistate  intrmask)) {
-			printf([SP]);
 			return (0);
 		}
 		sc-bge_lasttag = statustag;



CVS commit: src/lib/libc/gen

2015-05-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 23 14:01:08 UTC 2015

Modified Files:
src/lib/libc/gen: vis.c

Log Message:
Grr need to deal with isgraph(3). Is there a better way?


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/lib/libc/gen/vis.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/vis.c
diff -u src/lib/libc/gen/vis.c:1.67 src/lib/libc/gen/vis.c:1.68
--- src/lib/libc/gen/vis.c:1.67	Sat May 23 07:47:56 2015
+++ src/lib/libc/gen/vis.c	Sat May 23 10:01:07 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: vis.c,v 1.67 2015/05/23 11:47:56 christos Exp $	*/
+/*	$NetBSD: vis.c,v 1.68 2015/05/23 14:01:07 christos Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -57,7 +57,7 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: vis.c,v 1.67 2015/05/23 11:47:56 christos Exp $);
+__RCSID($NetBSD: vis.c,v 1.68 2015/05/23 14:01:07 christos Exp $);
 #endif /* LIBC_SCCS and not lint */
 #ifdef __FBSDID
 __FBSDID($FreeBSD$);
@@ -97,6 +97,25 @@ static wchar_t *do_svis(wchar_t *, wint_
 
 #undef BELL
 #define BELL L'\a'
+ 
+#if defined(__NetBSD__)  defined(_CTYPE_G)
+#define iscgraph(c)  ((int)((_C_ctype_tab_ + 1)[(c)]  _CTYPE_G)) 
+#else
+static int
+iscgraph(int c) {
+	int rv;
+	char *ol;
+
+	ol = setlocale(LC_CTYPE, C);
+	rv = isgraph(c);
+	if (ol)
+		setlocale(LC_CTYPE, ol);
+	return rv;
+}
+#endif
+
+#define ISGRAPH(flags, c) \
+(((flags)  VIS_NOLOCALE) ? iscgraph(c) : iswgraph(c))
 
 #define iswoctal(c)	(((u_char)(c)) = L'0'  ((u_char)(c)) = L'7')
 #define iswwhite(c)	(c == L' ' || c == L'\t' || c == L'\n')
@@ -232,7 +251,7 @@ do_mbyte(wchar_t *dst, wint_t c, int fla
 		case L'$': /* vis(1) -l */
 			break;
 		default:
-			if (iswgraph(c)  !iswoctal(c)) {
+			if (ISGRAPH(flags, c)  !iswoctal(c)) {
 *dst++ = L'\\';
 *dst++ = c;
 return dst;
@@ -284,7 +303,7 @@ do_svis(wchar_t *dst, wint_t c, int flag
 	uint64_t bmsk, wmsk;
 
 	iswextra = wcschr(extra, c) != NULL;
-	if (!iswextra  (iswgraph(c) || iswwhite(c) ||
+	if (!iswextra  (ISGRAPH(flags, c) || iswwhite(c) ||
 	((flags  VIS_SAFE)  iswsafe(c {
 		*dst++ = c;
 		return dst;



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

2015-05-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 23 14:02:11 UTC 2015

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

Log Message:
Add a VIS_NOLOCALE test


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libc/gen/t_vis.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_vis.c
diff -u src/tests/lib/libc/gen/t_vis.c:1.7 src/tests/lib/libc/gen/t_vis.c:1.8
--- src/tests/lib/libc/gen/t_vis.c:1.7	Mon Sep  8 15:01:03 2014
+++ src/tests/lib/libc/gen/t_vis.c	Sat May 23 10:02:11 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vis.c,v 1.7 2014/09/08 19:01:03 christos Exp $	*/
+/*	$NetBSD: t_vis.c,v 1.8 2015/05/23 14:02:11 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -32,6 +32,7 @@
 
 #include string.h
 #include stdlib.h
+#include locale.h
 #include err.h
 #include vis.h
 
@@ -143,6 +144,35 @@ ATF_TC_BODY(strunvis_hex, tc)
 	}
 }
 
+ATF_TC(strvis_locale);
+ATF_TC_HEAD(strvis_locale, tc)
+{
+	atf_tc_set_md_var(tc, descr, Test strvis(3) with locale);
+}
+
+ATF_TC_BODY(strvis_locale, tc)
+{
+	char s[256], cd[sizeof(s) * 4 + 1], jd[sizeof(cd)], *ol;
+	int jr, cr;
+
+	for (size_t i = 0; i  sizeof(s) - 1; i++)
+		s[i] = i + 1;
+	s[sizeof(s) - 1] = '\0';
+
+	ol = setlocale(LC_CTYPE, ja_JP.UTF-8);
+	ATF_REQUIRE(ol != NULL);
+	jr = strvisx(jd, s, sizeof(s), VIS_WHITE | VIS_NOLOCALE);
+	ATF_REQUIRE(jr != -1);
+	ol = strdup(ol);
+	ATF_REQUIRE(ol != NULL);
+	ATF_REQUIRE(setlocale(LC_CTYPE, C) != NULL);
+	cr = strvisx(cd, s, sizeof(s), VIS_WHITE);
+	ATF_REQUIRE(jr == cr);
+	ATF_REQUIRE(memcmp(jd, cd, jr) == 0);
+	setlocale(LC_CTYPE, ol);
+	free(ol);
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 
@@ -150,6 +180,7 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, strvis_null);
 	ATF_TP_ADD_TC(tp, strvis_empty);
 	ATF_TP_ADD_TC(tp, strunvis_hex);
+	ATF_TP_ADD_TC(tp, strvis_locale);
 
 	return atf_no_error();
 }



CVS commit: src/lib/libc/gen

2015-05-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 23 11:47:56 UTC 2015

Modified Files:
src/lib/libc/gen: vis.3 vis.c

Log Message:
Add VIS_NOLOCALE to avoid ambiguous conversions.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/lib/libc/gen/vis.3
cvs rdiff -u -r1.66 -r1.67 src/lib/libc/gen/vis.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/vis.3
diff -u src/lib/libc/gen/vis.3:1.42 src/lib/libc/gen/vis.3:1.43
--- src/lib/libc/gen/vis.3:1.42	Thu Sep 25 22:30:27 2014
+++ src/lib/libc/gen/vis.3	Sat May 23 07:47:56 2015
@@ -1,4 +1,4 @@
-.\	$NetBSD: vis.3,v 1.42 2014/09/26 02:30:27 wiz Exp $
+.\	$NetBSD: vis.3,v 1.43 2015/05/23 11:47:56 christos Exp $
 .\
 .\ Copyright (c) 1989, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\ @(#)vis.3	8.1 (Berkeley) 6/9/93
 .\
-.Dd September 26, 2014
+.Dd May 23, 2015
 .Dt VIS 3
 .Os
 .Sh NAME
@@ -436,6 +436,11 @@ The encoding conversion is influenced by
 environment variable which defines the set of characters
 that can be copied without encoding.
 .Pp
+If
+.Dv VIS_NOLOCALE
+is set, processing is done assuming the C locale and overriding
+any other environment settings.
+.Pp
 When 8-bit data is present in the input,
 .Ev LC_CTYPE
 must be set to the correct locale or to the C locale.

Index: src/lib/libc/gen/vis.c
diff -u src/lib/libc/gen/vis.c:1.66 src/lib/libc/gen/vis.c:1.67
--- src/lib/libc/gen/vis.c:1.66	Fri Sep 26 11:58:59 2014
+++ src/lib/libc/gen/vis.c	Sat May 23 07:47:56 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: vis.c,v 1.66 2014/09/26 15:58:59 roy Exp $	*/
+/*	$NetBSD: vis.c,v 1.67 2015/05/23 11:47:56 christos Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -57,7 +57,7 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: vis.c,v 1.66 2014/09/26 15:58:59 roy Exp $);
+__RCSID($NetBSD: vis.c,v 1.67 2015/05/23 11:47:56 christos Exp $);
 #endif /* LIBC_SCCS and not lint */
 #ifdef __FBSDID
 __FBSDID($FreeBSD$);
@@ -334,7 +334,7 @@ makeextralist(int flags, const char *src
 	if ((dst = calloc(len + MAXEXTRAS, sizeof(*dst))) == NULL)
 		return NULL;
 
-	if (mbstowcs(dst, src, len) == (size_t)-1) {
+	if ((flags  VIS_NOLOCALE) || mbstowcs(dst, src, len) == (size_t)-1) {
 		size_t i;
 		for (i = 0; i  len; i++)
 			dst[i] = (wchar_t)(u_char)src[i];
@@ -373,7 +373,7 @@ istrsenvisx(char *mbdst, size_t *dlen, c
 	uint64_t bmsk, wmsk;
 	wint_t c;
 	visfun_t f;
-	int clen = 0, cerr = 0, error = -1, i, shft;
+	int clen = 0, cerr, error = -1, i, shft;
 	ssize_t mbslength, maxolen;
 
 	_DIAGASSERT(mbdst != NULL);
@@ -402,9 +402,13 @@ istrsenvisx(char *mbdst, size_t *dlen, c
 	dst = pdst;
 	src = psrc;
 
-	/* Use caller's multibyte conversion error flag. */
-	if (cerr_ptr)
-		cerr = *cerr_ptr;
+	if (flags  VIS_NOLOCALE) {
+		/* Do one byte at a time conversion */
+		cerr = 1;
+	} else {
+		/* Use caller's multibyte conversion error flag. */
+		cerr = cerr_ptr ? *cerr_ptr : 0;
+	}
 
 	/*
 	 * Input loop.
@@ -531,9 +535,11 @@ istrsenvisx(char *mbdst, size_t *dlen, c
 	/* Terminate the output string. */
 	*mbdst = '\0';
 
-	/* Pass conversion error flag out. */
-	if (cerr_ptr)
-		*cerr_ptr = cerr;
+	if (flags  VIS_NOLOCALE) {
+		/* Pass conversion error flag out. */
+		if (cerr_ptr)
+			*cerr_ptr = cerr;
+	}
 
 	free(extra);
 	free(pdst);



CVS commit: src/include

2015-05-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 23 11:48:31 UTC 2015

Modified Files:
src/include: vis.h

Log Message:
add VIS_NOLOCALE flag


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/include/vis.h

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

Modified files:

Index: src/include/vis.h
diff -u src/include/vis.h:1.22 src/include/vis.h:1.23
--- src/include/vis.h:1.22	Thu Sep 25 21:21:07 2014
+++ src/include/vis.h	Sat May 23 07:48:31 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: vis.h,v 1.22 2014/09/26 01:21:07 christos Exp $	*/
+/*	$NetBSD: vis.h,v 1.23 2015/05/23 11:48:31 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -65,6 +65,7 @@
 #define	VIS_GLOB	0x1000	/* encode glob(3) magic characters */
 #define	VIS_SHELL	0x2000	/* encode shell special characters [not glob] */
 #define	VIS_META	(VIS_WHITE | VIS_GLOB | VIS_SHELL)
+#define	VIS_NOLOCALE	0x4000	/* encode using the C locale */
 
 /*
  * unvis return codes



CVS commit: src/lib/libc/gen

2015-05-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 23 11:48:13 UTC 2015

Modified Files:
src/lib/libc/gen: utmpx.c

Log Message:
use VIS_NOLOCALE


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/lib/libc/gen/utmpx.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/utmpx.c
diff -u src/lib/libc/gen/utmpx.c:1.34 src/lib/libc/gen/utmpx.c:1.35
--- src/lib/libc/gen/utmpx.c:1.34	Sat May 23 05:18:01 2015
+++ src/lib/libc/gen/utmpx.c	Sat May 23 07:48:13 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: utmpx.c,v 1.34 2015/05/23 09:18:01 mlelstv Exp $	 */
+/*	$NetBSD: utmpx.c,v 1.35 2015/05/23 11:48:13 christos Exp $	 */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 #include sys/cdefs.h
 
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: utmpx.c,v 1.34 2015/05/23 09:18:01 mlelstv Exp $);
+__RCSID($NetBSD: utmpx.c,v 1.35 2015/05/23 11:48:13 christos Exp $);
 #endif /* LIBC_SCCS and not lint */
 
 #include namespace.h
@@ -308,12 +308,11 @@ utmp_update(const struct utmpx *utx)
 	char buf[sizeof(*utx) * 4 + 1];
 	pid_t pid;
 	int status;
-	unsigned i;
 
 	_DIAGASSERT(utx != NULL);
 
-	for (i=0; isizeof(*utx); ++i)
-		sprintf(buf[4*i],\\%03o,((const char*)utx)[i]);
+	(void)strvisx(buf, (const char *)(const void *)utx, sizeof(*utx),
+	VIS_WHITE | VIS_NOLOCALE);
 	switch (pid = fork()) {
 	case 0:
 		(void)execl(_PATH_UTMP_UPDATE,



CVS commit: src/lib/libc/gen

2015-05-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 23 14:21:11 UTC 2015

Modified Files:
src/lib/libc/gen: vis.c

Log Message:
fix the tools build.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/lib/libc/gen/vis.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/vis.c
diff -u src/lib/libc/gen/vis.c:1.68 src/lib/libc/gen/vis.c:1.69
--- src/lib/libc/gen/vis.c:1.68	Sat May 23 10:01:07 2015
+++ src/lib/libc/gen/vis.c	Sat May 23 10:21:11 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: vis.c,v 1.68 2015/05/23 14:01:07 christos Exp $	*/
+/*	$NetBSD: vis.c,v 1.69 2015/05/23 14:21:11 christos Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -57,7 +57,7 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: vis.c,v 1.68 2015/05/23 14:01:07 christos Exp $);
+__RCSID($NetBSD: vis.c,v 1.69 2015/05/23 14:21:11 christos Exp $);
 #endif /* LIBC_SCCS and not lint */
 #ifdef __FBSDID
 __FBSDID($FreeBSD$);
@@ -101,6 +101,10 @@ static wchar_t *do_svis(wchar_t *, wint_
 #if defined(__NetBSD__)  defined(_CTYPE_G)
 #define iscgraph(c)  ((int)((_C_ctype_tab_ + 1)[(c)]  _CTYPE_G)) 
 #else
+/* Keep it simple for now, no locale stuff */
+#define iscgraph(c)	isgraph(c)
+#ifdef notyet
+#include locale.h
 static int
 iscgraph(int c) {
 	int rv;
@@ -113,6 +117,7 @@ iscgraph(int c) {
 	return rv;
 }
 #endif
+#endif
 
 #define ISGRAPH(flags, c) \
 (((flags)  VIS_NOLOCALE) ? iscgraph(c) : iswgraph(c))



CVS commit: src/sys/ufs/ffs

2015-05-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 23 16:59:13 UTC 2015

Modified Files:
src/sys/ufs/ffs: ffs_vfsops.c

Log Message:
Add a missing goto.

(was here before my changes)

ok christos@


To generate a diff of this commit:
cvs rdiff -u -r1.333 -r1.334 src/sys/ufs/ffs/ffs_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/ufs/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.333 src/sys/ufs/ffs/ffs_vfsops.c:1.334
--- src/sys/ufs/ffs/ffs_vfsops.c:1.333	Tue May 19 06:44:42 2015
+++ src/sys/ufs/ffs/ffs_vfsops.c	Sat May 23 16:59:13 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_vfsops.c,v 1.333 2015/05/19 06:44:42 martin Exp $	*/
+/*	$NetBSD: ffs_vfsops.c,v 1.334 2015/05/23 16:59:13 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ffs_vfsops.c,v 1.333 2015/05/19 06:44:42 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: ffs_vfsops.c,v 1.334 2015/05/23 16:59:13 maxv Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_ffs.h
@@ -1332,6 +1332,8 @@ ffs_mountfs(struct vnode *devvp, struct 
 			DPRINTF(bcount %x != fsize %x, bp-b_bcount,
 			fs-fs_fsize);
 			error = EINVAL;
+			bset = BC_INVAL;
+			goto out;
 		}
 		brelse(bp, BC_INVAL);
 		bp = NULL;



CVS commit: src/sys/compat/svr4

2015-05-23 Thread Tyler R. Retzlaff
Module Name:src
Committed By:   rtr
Date:   Sat May 23 15:27:55 UTC 2015

Modified Files:
src/sys/compat/svr4: svr4_stream.c

Log Message:
get rid of unnecessary use of mbuf to hold sockaddr, which was leaked...

while here change use to typed pointer sockaddr * instead of void * which
also lets us get rid of sasize variable used to track length (since we
can now use sa_len easily)


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/compat/svr4/svr4_stream.c

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

Modified files:

Index: src/sys/compat/svr4/svr4_stream.c
diff -u src/sys/compat/svr4/svr4_stream.c:1.85 src/sys/compat/svr4/svr4_stream.c:1.86
--- src/sys/compat/svr4/svr4_stream.c:1.85	Sat May  2 17:18:03 2015
+++ src/sys/compat/svr4/svr4_stream.c	Sat May 23 15:27:55 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_stream.c,v 1.85 2015/05/02 17:18:03 rtr Exp $	 */
+/*	$NetBSD: svr4_stream.c,v 1.86 2015/05/23 15:27:55 rtr Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: svr4_stream.c,v 1.85 2015/05/02 17:18:03 rtr Exp $);
+__KERNEL_RCSID(0, $NetBSD: svr4_stream.c,v 1.86 2015/05/23 15:27:55 rtr Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -1366,16 +1366,14 @@ int
 svr4_sys_putmsg(struct lwp *l, const struct svr4_sys_putmsg_args *uap, register_t *retval)
 {
 	struct proc *p = l-l_proc;
+	struct sockaddr *skp;
 	file_t	*fp;
 	struct svr4_strbuf dat, ctl;
 	struct svr4_strmcmd sc;
 	struct sockaddr_in sain;
 	struct sockaddr_un saun;
-	void *skp;
-	int sasize;
 	struct svr4_strm *st;
 	int error;
-	struct mbuf *nam;
 	struct msghdr msg;
 	struct iovec aiov;
 
@@ -1454,8 +1452,7 @@ svr4_sys_putmsg(struct lwp *l, const str
 			goto out;
 		}
 		netaddr_to_sockaddr_in(sain, sc);
-		skp = sain;
-		sasize = sizeof(sain);
+		skp = (struct sockaddr *)sain;
 		error = sain.sin_family != st-s_family;
 		break;
 
@@ -1471,13 +1468,14 @@ svr4_sys_putmsg(struct lwp *l, const str
 			/* Maybe we've been given a device/inode pair */
 			dev_t *dev = SVR4_ADDROF(sc);
 			svr4_ino_t *ino = (svr4_ino_t *) dev[1];
-			skp = svr4_find_socket(p, fp, *dev, *ino);
+			skp = (struct sockaddr *)svr4_find_socket(
+			p, fp, *dev, *ino);
 			if (skp == NULL) {
-skp = saun;
+skp = (struct sockaddr *)saun;
 /* I guess we have it by name */
-netaddr_to_sockaddr_un(skp, sc);
+netaddr_to_sockaddr_un(
+(struct sockaddr_un *)skp, sc);
 			}
-			sasize = sizeof(saun);
 		}
 		break;
 
@@ -1488,24 +1486,19 @@ svr4_sys_putmsg(struct lwp *l, const str
 		goto out;
 	}
 
-	nam = m_get(M_WAIT, MT_SONAME);
-	nam-m_len = sasize;
-	memcpy(mtod(nam, void *), skp, sasize);
-
  	switch (st-s_cmd = sc.cmd) {
 	case SVR4_TI_CONNECT_REQUEST:	/* connect 	*/
 	 	KERNEL_UNLOCK_ONE(NULL);
-		return do_sys_connect(l, SCARG(uap, fd),
-		mtod(nam, struct sockaddr *));
+		return do_sys_connect(l, SCARG(uap, fd), skp);
 
 	case SVR4_TI_SENDTO_REQUEST:	/* sendto 	*/
 	 	KERNEL_UNLOCK_ONE(NULL);
-		msg.msg_name = nam;
-		msg.msg_namelen = sasize;
+		msg.msg_name = skp;
+		msg.msg_namelen = skp-sa_len;
 		msg.msg_iov = aiov;
 		msg.msg_iovlen = 1;
 		msg.msg_control = NULL;
-		msg.msg_flags = MSG_NAMEMBUF;
+		msg.msg_flags = 0;
 		aiov.iov_base = NETBSD32PTR(dat.buf);
 		aiov.iov_len = dat.len;
 		error = do_sys_sendmsg(l, SCARG(uap, fd), msg,
@@ -1513,9 +1506,7 @@ svr4_sys_putmsg(struct lwp *l, const str
 
 		*retval = 0;
 		return error;
-  
 	default:
-		m_free(nam);
 		DPRINTF((putmsg: Unimplemented command %lx\n, sc.cmd));
 		error = ENOSYS;
 		goto out;



CVS commit: src/share/man/man9

2015-05-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 23 17:05:03 UTC 2015

Modified Files:
src/share/man/man9: malloc.9

Log Message:
Remove the DIAGNOSTIC section, and two references to MALLOC and FREE.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/share/man/man9/malloc.9

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/man9/malloc.9
diff -u src/share/man/man9/malloc.9:1.51 src/share/man/man9/malloc.9:1.52
--- src/share/man/man9/malloc.9:1.51	Sat Dec 27 20:45:08 2014
+++ src/share/man/man9/malloc.9	Sat May 23 17:05:03 2015
@@ -1,4 +1,4 @@
-.\	$NetBSD: malloc.9,v 1.51 2014/12/27 20:45:08 wiz Exp $
+.\	$NetBSD: malloc.9,v 1.52 2015/05/23 17:05:03 maxv Exp $
 .\
 .\ Copyright (c) 1996, 2003 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,15 +27,13 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd December 27, 2014
+.Dd May 23, 2015
 .Dt MALLOC 9
 .Os
 .Sh NAME
 .Nm malloc ,
-.Nm MALLOC ,
 .Nm realloc ,
 .Nm free ,
-.Nm FREE ,
 .Nm malloc_type_attach ,
 .Nm malloc_type_detach ,
 .Nm MALLOC_DEFINE ,
@@ -268,50 +266,6 @@ and can be examined by using
 .Fn malloc
 returns a kernel virtual address that is suitably aligned for storage of
 any type of object.
-.Sh DIAGNOSTICS
-A kernel compiled with the
-.Dv DIAGNOSTIC
-configuration option attempts to detect memory corruption caused by
-such things as writing outside the allocated area and imbalanced calls to the
-.Fn malloc
-and
-.Fn free
-functions.
-Failing consistency checks will cause a panic or a system console message:
-.Pp
-.Bl -bullet -offset indent -compact
-.It
-panic:
-.Dq malloc - bogus type
-.It
-panic:
-.Dq malloc: out of space in kmem_map
-.It
-panic:
-.Dq malloc: allocation too large
-.It
-panic:
-.Dq malloc: wrong bucket
-.It
-panic:
-.Dq malloc: lost data
-.It
-panic:
-.Dq free: unaligned addr
-.It
-panic:
-.Dq free: duplicated free
-.It
-panic:
-.Dq free: multiple frees
-.It
-panic:
-.Dq init: minbucket too small/struct freelist too big
-.It
-.Dq multiply freed item Aq addr
-.It
-.Dq Data modified on freelist: Aq data object description
-.El
 .Sh SEE ALSO
 .Xr vmstat 1 ,
 .Xr memoryallocators 9