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

2016-03-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Mar  8 07:49:20 UTC 2016

Modified Files:
src/sys/arch/arm/nvidia: tegra_usbphy.c

Log Message:
Use the nvidia,has-utmi-pad-registers property.

>From Jared.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/nvidia/tegra_usbphy.c

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



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

2016-03-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Mar  8 07:49:20 UTC 2016

Modified Files:
src/sys/arch/arm/nvidia: tegra_usbphy.c

Log Message:
Use the nvidia,has-utmi-pad-registers property.

>From Jared.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/nvidia/tegra_usbphy.c

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

Modified files:

Index: src/sys/arch/arm/nvidia/tegra_usbphy.c
diff -u src/sys/arch/arm/nvidia/tegra_usbphy.c:1.5 src/sys/arch/arm/nvidia/tegra_usbphy.c:1.6
--- src/sys/arch/arm/nvidia/tegra_usbphy.c:1.5	Tue Dec 22 22:10:36 2015
+++ src/sys/arch/arm/nvidia/tegra_usbphy.c	Tue Mar  8 07:49:20 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_usbphy.c,v 1.5 2015/12/22 22:10:36 jmcneill Exp $ */
+/* $NetBSD: tegra_usbphy.c,v 1.6 2016/03/08 07:49:20 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra_usbphy.c,v 1.5 2015/12/22 22:10:36 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_usbphy.c,v 1.6 2016/03/08 07:49:20 skrll Exp $");
 
 #include 
 #include 
@@ -192,7 +192,6 @@ tegra_usbphy_parse_properties(struct teg
 static void
 tegra_usbphy_utmip_init(struct tegra_usbphy_softc *sc)
 {
-	static u_int init_count = 0;
 	bus_space_tag_t bst = sc->sc_bst;
 	bus_space_handle_t bsh = sc->sc_bsh;
 	int retry;
@@ -230,7 +229,7 @@ tegra_usbphy_utmip_init(struct tegra_usb
 		  TEGRA_EHCI_UTMIP_XCVR_CFG1_TERM_RANGE_ADJ),
 	TEGRA_EHCI_UTMIP_XCVR_CFG1_TERM_RANGE_ADJ);
 
-	if (atomic_inc_uint_nv(_count) == 1) {
+	if (of_getprop_bool(sc->sc_phandle, "nvidia,has-utmi-pad-registers")) {
 		tegra_reg_set_clear(bst, bsh, TEGRA_EHCI_UTMIP_BIAS_CFG0_REG,
 		TEGRA_EHCI_UTMIP_BIAS_CFG0_HSDISCON_LEVEL_MSB |
 		__SHIFTIN(sc->sc_hsdiscon_level,



CVS commit: src

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar  8 05:02:55 UTC 2016

Modified Files:
src/include: limits.h
src/sys/kern: kern_time.c
src/sys/sys: timevar.h

Log Message:
- GC pts_fired, and fix the comment about MAX_TIMERS
- Bump MAX_TIMERS to 36 so that we have 32 POSIX user timers which is the
  minimum required.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/include/limits.h
cvs rdiff -u -r1.184 -r1.185 src/sys/kern/kern_time.c
cvs rdiff -u -r1.35 -r1.36 src/sys/sys/timevar.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/limits.h
diff -u src/include/limits.h:1.35 src/include/limits.h:1.36
--- src/include/limits.h:1.35	Fri Feb 26 12:10:23 2016
+++ src/include/limits.h	Tue Mar  8 00:02:55 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: limits.h,v 1.35 2016/02/26 17:10:23 christos Exp $	*/
+/*	$NetBSD: limits.h,v 1.36 2016/03/08 05:02:55 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -92,7 +92,7 @@
 /* Not yet: PTHREAD_STACK_MIN */
 #define	PTHREAD_THREADS_MAX		_POSIX_THREAD_THREADS_MAX
 
-#define	_POSIX_TIMER_MAX	28
+#define	_POSIX_TIMER_MAX	32
 #define	_POSIX_TTY_NAME_MAX	9
 #define	_POSIX_TZNAME_MAX	6
 

Index: src/sys/kern/kern_time.c
diff -u src/sys/kern/kern_time.c:1.184 src/sys/kern/kern_time.c:1.185
--- src/sys/kern/kern_time.c:1.184	Wed Mar  2 20:39:17 2016
+++ src/sys/kern/kern_time.c	Tue Mar  8 00:02:55 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time.c,v 1.184 2016/03/03 01:39:17 uwe Exp $	*/
+/*	$NetBSD: kern_time.c,v 1.185 2016/03/08 05:02:55 christos Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.184 2016/03/03 01:39:17 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.185 2016/03/08 05:02:55 christos Exp $");
 
 #include 
 #include 
@@ -1200,7 +1200,6 @@ timers_alloc(struct proc *p)
 	LIST_INIT(>pts_prof);
 	for (i = 0; i < TIMER_MAX; i++)
 		pts->pts_timers[i] = NULL;
-	pts->pts_fired = 0;
 	mutex_spin_enter(_lock);
 	if (p->p_timers == NULL) {
 		p->p_timers = pts;

Index: src/sys/sys/timevar.h
diff -u src/sys/sys/timevar.h:1.35 src/sys/sys/timevar.h:1.36
--- src/sys/sys/timevar.h:1.35	Fri Feb 26 12:08:58 2016
+++ src/sys/sys/timevar.h	Tue Mar  8 00:02:55 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: timevar.h,v 1.35 2016/02/26 17:08:58 christos Exp $	*/
+/*	$NetBSD: timevar.h,v 1.36 2016/03/08 05:02:55 christos Exp $	*/
 
 /*
  *  Copyright (c) 2005, 2008 The NetBSD Foundation.
@@ -94,7 +94,7 @@ struct 	ptimer {
 
 #define	TIMER_MIN	4	/* [0..3] are reserved for setitimer(2) */
 /* REAL=0,VIRTUAL=1,PROF=2,MONOTONIC=3 */
-#define	TIMER_MAX	32	/* See ptimers->pts_fired if you enlarge this */
+#define	TIMER_MAX	36	/* 32 is minimum user timers per POSIX */
 #define	TIMERS_ALL	0
 #define	TIMERS_POSIX	1
 
@@ -104,7 +104,6 @@ struct	ptimers {
 	struct ptlist pts_virtual;
 	struct ptlist pts_prof;
 	struct ptimer *pts_timers[TIMER_MAX];
-	int pts_fired;
 };
 
 /*



CVS commit: src

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar  8 05:02:55 UTC 2016

Modified Files:
src/include: limits.h
src/sys/kern: kern_time.c
src/sys/sys: timevar.h

Log Message:
- GC pts_fired, and fix the comment about MAX_TIMERS
- Bump MAX_TIMERS to 36 so that we have 32 POSIX user timers which is the
  minimum required.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/include/limits.h
cvs rdiff -u -r1.184 -r1.185 src/sys/kern/kern_time.c
cvs rdiff -u -r1.35 -r1.36 src/sys/sys/timevar.h

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



CVS commit: src/lib/libc/locale

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar  8 04:00:11 UTC 2016

Modified Files:
src/lib/libc/locale: global_locale.c

Log Message:
Undo the __dso_protected hackery.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/lib/libc/locale/global_locale.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/locale/global_locale.c
diff -u src/lib/libc/locale/global_locale.c:1.22 src/lib/libc/locale/global_locale.c:1.23
--- src/lib/libc/locale/global_locale.c:1.22	Fri Jan 29 10:18:08 2016
+++ src/lib/libc/locale/global_locale.c	Mon Mar  7 23:00:11 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: global_locale.c,v 1.22 2016/01/29 15:18:08 christos Exp $ */
+/* $NetBSD: global_locale.c,v 1.23 2016/03/08 04:00:11 christos Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: global_locale.c,v 1.22 2016/01/29 15:18:08 christos Exp $");
+__RCSID("$NetBSD: global_locale.c,v 1.23 2016/03/08 04:00:11 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -143,7 +143,7 @@ __dso_hidden const struct _locale_cache_
 .numeric_name = _lc_C_locale_name,
 };
 
-/* __dso_protected */ struct _locale _lc_global_locale = {
+__dso_protected struct _locale _lc_global_locale = {
 .cache = &_C_cache,
 .query = { _C_LOCALE },
 .part_name = {
@@ -171,7 +171,7 @@ __dso_hidden const struct _locale_cache_
 },
 };
 
-/* __dso_protected */ const struct _locale _lc_C_locale = {
+__dso_protected const struct _locale _lc_C_locale = {
 .cache = &_C_cache,
 .query = { _C_LOCALE },
 .part_name = {



CVS commit: src/lib/libc/locale

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar  8 04:00:11 UTC 2016

Modified Files:
src/lib/libc/locale: global_locale.c

Log Message:
Undo the __dso_protected hackery.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/lib/libc/locale/global_locale.c

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



CVS commit: src/include

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar  8 03:58:31 UTC 2016

Modified Files:
src/include: locale.h

Log Message:
undo protected symbol hack.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/include/locale.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/locale.h
diff -u src/include/locale.h:1.25 src/include/locale.h:1.26
--- src/include/locale.h:1.25	Fri Jan 29 10:18:33 2016
+++ src/include/locale.h	Mon Mar  7 22:58:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: locale.h,v 1.25 2016/01/29 15:18:33 christos Exp $	*/
+/*	$NetBSD: locale.h,v 1.26 2016/03/08 03:58:31 christos Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -106,20 +106,12 @@ void		freelocale(locale_t);
 struct lconv	*localeconv_l(locale_t);
 locale_t	newlocale(int, const char *, locale_t);
 
-#if 1 	// used to be _LIBC, workaround broken binutils
-extern struct _locale	_lc_global_locale;
-#else
 extern __dso_protected struct _locale	_lc_global_locale;
-#endif
 #define LC_GLOBAL_LOCALE	(&_lc_global_locale)
 #endif /* _POSIX_SOURCE >= 200809 || _NETBSD_SOURCE */
 
 #if defined(_NETBSD_SOURCE)
-#  if 1 	// used to be _LIBC, workaround broken binutils
-extern const struct _locale _lc_C_locale;
-#  else
 extern __dso_protected const struct _locale _lc_C_locale;
-#  endif
 #define LC_C_LOCALE		((locale_t)__UNCONST(&_lc_C_locale))
 #endif
 __END_DECLS



CVS commit: src/include

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar  8 03:58:31 UTC 2016

Modified Files:
src/include: locale.h

Log Message:
undo protected symbol hack.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/include/locale.h

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



CVS commit: src/external/gpl3/gcc.old/dist/gcc

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar  8 03:58:08 UTC 2016

Modified Files:
src/external/gpl3/gcc.old/dist/gcc: output.h varasm.c
src/external/gpl3/gcc.old/dist/gcc/config/i386: i386.c

Log Message:
Fix copy relocations against protected symbols from:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/gcc.old/dist/gcc/output.h \
src/external/gpl3/gcc.old/dist/gcc/varasm.c
cvs rdiff -u -r1.3 -r1.4 \
src/external/gpl3/gcc.old/dist/gcc/config/i386/i386.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/gcc.old/dist/gcc/output.h
diff -u src/external/gpl3/gcc.old/dist/gcc/output.h:1.3 src/external/gpl3/gcc.old/dist/gcc/output.h:1.4
--- src/external/gpl3/gcc.old/dist/gcc/output.h:1.3	Tue Sep 22 23:39:11 2015
+++ src/external/gpl3/gcc.old/dist/gcc/output.h	Mon Mar  7 22:58:08 2016
@@ -583,6 +583,7 @@ extern void default_asm_output_anchor (r
 extern bool default_use_anchors_for_symbol_p (const_rtx);
 extern bool default_binds_local_p (const_tree);
 extern bool default_binds_local_p_1 (const_tree, int);
+extern bool default_binds_local_p_2 (const_tree);
 extern void default_globalize_label (FILE *, const char *);
 extern void default_globalize_decl_name (FILE *, tree);
 extern void default_emit_unwind_label (FILE *, tree, int, int);
Index: src/external/gpl3/gcc.old/dist/gcc/varasm.c
diff -u src/external/gpl3/gcc.old/dist/gcc/varasm.c:1.3 src/external/gpl3/gcc.old/dist/gcc/varasm.c:1.4
--- src/external/gpl3/gcc.old/dist/gcc/varasm.c:1.3	Tue Sep 22 23:39:12 2015
+++ src/external/gpl3/gcc.old/dist/gcc/varasm.c	Mon Mar  7 22:58:08 2016
@@ -6620,95 +6620,106 @@ resolution_local_p (enum ld_plugin_symbo
 
 /* Assume ELF-ish defaults, since that's pretty much the most liberal
wrt cross-module name binding.  */
-
-bool
-default_binds_local_p (const_tree exp)
+static bool
+default_binds_local_p_3 (const_tree exp, bool shlib, bool weak_dominate,
+			 bool extern_protected_data)
 {
-  return default_binds_local_p_1 (exp, flag_shlib);
-}
+  /* A non-decl is an entry in the constant pool.  */
+  if (!DECL_P (exp))
+return true;
 
-bool
-default_binds_local_p_1 (const_tree exp, int shlib)
-{
-  bool local_p;
-  bool resolved_locally = false;
-  bool resolved_to_local_def = false;
+  /* Weakrefs may not bind locally, even though the weakref itself is always
+ static and therefore local.  Similarly, the resolver for ifunc functions
+ might resolve to a non-local function.
+ FIXME: We can resolve the weakref case more curefuly by looking at the
+ weakref alias.  */
+  if (lookup_attribute ("weakref", DECL_ATTRIBUTES (exp))
+	   || (TREE_CODE (exp) == FUNCTION_DECL
+	   && lookup_attribute ("ifunc", DECL_ATTRIBUTES (exp
+return false;
+
+  /* Static variables are always local.  */
+  if (! TREE_PUBLIC (exp))
+return true;
 
-  /* With resolution file in hands, take look into resolutions.
+  /* With resolution file in hand, take look into resolutions.
  We can't just return true for resolved_locally symbols,
  because dynamic linking might overwrite symbols
  in shared libraries.  */
+  bool resolved_locally = false;
+  bool defined_locally = !DECL_EXTERNAL (exp);
   if (TREE_CODE (exp) == VAR_DECL && TREE_PUBLIC (exp)
   && (TREE_STATIC (exp) || DECL_EXTERNAL (exp)))
 {
   struct varpool_node *vnode = varpool_get_node (exp);
-  if (vnode && resolution_local_p (vnode->symbol.resolution))
+  if (vnode && vnode->symbol.in_other_partition)
+	defined_locally = true;
+  if (vnode && resolution_to_local_definition_p (vnode->symbol.resolution))
+	defined_locally = resolved_locally = true;
+  else if (vnode && resolution_local_p (vnode->symbol.resolution))
 	resolved_locally = true;
-  if (vnode
-	  && resolution_to_local_definition_p (vnode->symbol.resolution))
-	resolved_to_local_def = true;
-}
-  else if (TREE_CODE (exp) == FUNCTION_DECL && TREE_PUBLIC (exp))
-{
-  struct cgraph_node *node = cgraph_get_node (exp);
-  if (node
-	  && resolution_local_p (node->symbol.resolution))
-	resolved_locally = true;
-  if (node
-	  && resolution_to_local_definition_p (node->symbol.resolution))
-	resolved_to_local_def = true;
 }
+  if (defined_locally && weak_dominate && !shlib)
+resolved_locally = true;
+
+  /* Undefined weak symbols are never defined locally.  */
+  if (DECL_WEAK (exp) && !defined_locally)
+return false;
+
+  /* A symbol is local if the user has said explicitly that it will be,
+ or if we have a definition for the symbol.  We cannot infer visibility
+ for undefined symbols.  */
+  if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT
+  && (TREE_CODE (exp) == FUNCTION_DECL
+	  || !extern_protected_data
+	  || DECL_VISIBILITY (exp) != VISIBILITY_PROTECTED)
+  && 

CVS commit: src/external/gpl3/gcc.old/dist/gcc

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar  8 03:58:08 UTC 2016

Modified Files:
src/external/gpl3/gcc.old/dist/gcc: output.h varasm.c
src/external/gpl3/gcc.old/dist/gcc/config/i386: i386.c

Log Message:
Fix copy relocations against protected symbols from:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/gcc.old/dist/gcc/output.h \
src/external/gpl3/gcc.old/dist/gcc/varasm.c
cvs rdiff -u -r1.3 -r1.4 \
src/external/gpl3/gcc.old/dist/gcc/config/i386/i386.c

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



CVS commit: src/usr.bin/elf2aout

2016-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar  7 22:16:38 UTC 2016

Modified Files:
src/usr.bin/elf2aout: elf2aout.c

Log Message:
Gcc, please shut up with those stupid warnings!


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/elf2aout/elf2aout.c

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



CVS commit: src/usr.bin/elf2aout

2016-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar  7 22:16:38 UTC 2016

Modified Files:
src/usr.bin/elf2aout: elf2aout.c

Log Message:
Gcc, please shut up with those stupid warnings!


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/elf2aout/elf2aout.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.bin/elf2aout/elf2aout.c
diff -u src/usr.bin/elf2aout/elf2aout.c:1.18 src/usr.bin/elf2aout/elf2aout.c:1.19
--- src/usr.bin/elf2aout/elf2aout.c:1.18	Mon Mar  7 08:59:00 2016
+++ src/usr.bin/elf2aout/elf2aout.c	Mon Mar  7 22:16:38 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf2aout.c,v 1.18 2016/03/07 08:59:00 martin Exp $	*/
+/*	$NetBSD: elf2aout.c,v 1.19 2016/03/07 22:16:38 martin Exp $	*/
 
 /*
  * Copyright (c) 1995
@@ -370,7 +370,7 @@ translate_syms(int out, int in, off_t sy
 	memset(outbuf, 0, sizeof outbuf);
 
 	/* Find number of symbols to process... */
-	remaining = symsize / (off_t)sizeof(Elf32_Sym);
+	remaining = (ssize_t)(symsize / (off_t)sizeof(Elf32_Sym));
 
 	/* Suck in the old string table... */
 	oldstrings = saveRead(in, stroff, (size_t)strsize, "string table");



CVS commit: src/usr.bin/make

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  7 21:45:43 UTC 2016

Modified Files:
src/usr.bin/make: main.c meta.c meta.h

Log Message:
str2Lst_Append tokenizes the string and uses it in the list so we can't
free the string afterwards. Keep a copy of it and cleanup at the end.


To generate a diff of this commit:
cvs rdiff -u -r1.241 -r1.242 src/usr.bin/make/main.c
cvs rdiff -u -r1.52 -r1.53 src/usr.bin/make/meta.c
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/meta.h

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



CVS commit: src/usr.bin/make

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  7 21:45:43 UTC 2016

Modified Files:
src/usr.bin/make: main.c meta.c meta.h

Log Message:
str2Lst_Append tokenizes the string and uses it in the list so we can't
free the string afterwards. Keep a copy of it and cleanup at the end.


To generate a diff of this commit:
cvs rdiff -u -r1.241 -r1.242 src/usr.bin/make/main.c
cvs rdiff -u -r1.52 -r1.53 src/usr.bin/make/meta.c
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/meta.h

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

Modified files:

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.241 src/usr.bin/make/main.c:1.242
--- src/usr.bin/make/main.c:1.241	Thu Feb 18 19:11:45 2016
+++ src/usr.bin/make/main.c	Mon Mar  7 16:45:43 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.241 2016/02/19 00:11:45 sjg Exp $	*/
+/*	$NetBSD: main.c,v 1.242 2016/03/07 21:45:43 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.241 2016/02/19 00:11:45 sjg Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.242 2016/03/07 21:45:43 christos Exp $";
 #else
 #include 
 #ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.241 2016/02/19 00:11:45 sjg Exp $");
+__RCSID("$NetBSD: main.c,v 1.242 2016/03/07 21:45:43 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1381,6 +1381,9 @@ main(int argc, char **argv)
 	if (enterFlag)
 		printf("%s: Leaving directory `%s'\n", progname, curdir);
 
+#ifdef USE_META
+	meta_finish();
+#endif
 	Suff_End();
 Targ_End();
 	Arch_End();

Index: src/usr.bin/make/meta.c
diff -u src/usr.bin/make/meta.c:1.52 src/usr.bin/make/meta.c:1.53
--- src/usr.bin/make/meta.c:1.52	Sat Feb 27 11:20:06 2016
+++ src/usr.bin/make/meta.c	Mon Mar  7 16:45:43 2016
@@ -1,4 +1,4 @@
-/*  $NetBSD: meta.c,v 1.52 2016/02/27 16:20:06 christos Exp $ */
+/*  $NetBSD: meta.c,v 1.53 2016/03/07 21:45:43 christos Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -55,7 +55,9 @@
 
 static BuildMon Mybm;			/* for compat */
 static Lst metaBailiwick;		/* our scope of control */
+static char *metaBailiwickStr;		/* string storage for the list */
 static Lst metaIgnorePaths;		/* paths we deliberately ignore */
+static char *metaIgnorePathsStr;	/* string storage for the list */
 
 #ifndef MAKE_META_IGNORE_PATHS
 #define MAKE_META_IGNORE_PATHS ".MAKE.META.IGNORE_PATHS"
@@ -597,25 +599,23 @@ meta_mode_init(const char *make_mode)
  * We consider ourselves master of all within ${.MAKE.META.BAILIWICK}
  */
 metaBailiwick = Lst_Init(FALSE);
-cp = Var_Subst(NULL, "${.MAKE.META.BAILIWICK:O:u:tA}", VAR_GLOBAL,
-		   VARF_WANTRES);
-if (cp) {
-	str2Lst_Append(metaBailiwick, cp, NULL);
+metaBailiwickStr = Var_Subst(NULL, "${.MAKE.META.BAILIWICK:O:u:tA}",
+	VAR_GLOBAL, VARF_WANTRES);
+if (metaBailiwickStr) {
+	str2Lst_Append(metaBailiwick, metaBailiwickStr, NULL);
 }
-free(cp);
 /*
  * We ignore any paths that start with ${.MAKE.META.IGNORE_PATHS}
  */
 metaIgnorePaths = Lst_Init(FALSE);
 Var_Append(MAKE_META_IGNORE_PATHS,
 	   "/dev /etc /proc /tmp /var/run /var/tmp ${TMPDIR}", VAR_GLOBAL);
-cp = Var_Subst(NULL,
+metaIgnorePathsStr = Var_Subst(NULL,
 		   "${" MAKE_META_IGNORE_PATHS ":O:u:tA}", VAR_GLOBAL,
 		   VARF_WANTRES);
-if (cp) {
-	str2Lst_Append(metaIgnorePaths, cp, NULL);
+if (metaIgnorePathsStr) {
+	str2Lst_Append(metaIgnorePaths, metaIgnorePathsStr, NULL);
 }
-free(cp);
 }
 
 /*
@@ -775,6 +775,15 @@ meta_job_finish(Job *job)
 }
 }
 
+void
+meta_finish(void)
+{
+Lst_Destroy(metaBailiwick, NULL);
+free(metaBailiwickStr);
+Lst_Destroy(metaIgnorePaths, NULL);
+free(metaIgnorePathsStr);
+}
+
 /*
  * Fetch a full line from fp - growing bufp if needed
  * Return length in bufp.

Index: src/usr.bin/make/meta.h
diff -u src/usr.bin/make/meta.h:1.3 src/usr.bin/make/meta.h:1.4
--- src/usr.bin/make/meta.h:1.3	Sat Mar 23 01:31:29 2013
+++ src/usr.bin/make/meta.h	Mon Mar  7 16:45:43 2016
@@ -1,4 +1,4 @@
-/*  $NetBSD: meta.h,v 1.3 2013/03/23 05:31:29 sjg Exp $ */
+/*  $NetBSD: meta.h,v 1.4 2016/03/07 21:45:43 christos Exp $ */
 
 /*
  * Things needed for 'meta' mode.
@@ -42,6 +42,7 @@ extern Boolean useMeta;
 
 struct Job;/* not defined yet */
 void meta_init(void);
+void meta_finish(void);
 void meta_mode_init(const char *);
 void meta_job_start(struct Job *, GNode *);
 void meta_job_child(struct Job *);



CVS commit: src/usr.bin/make

2016-03-07 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Mon Mar  7 20:20:35 UTC 2016

Modified Files:
src/usr.bin/make: var.c
src/usr.bin/make/unit-tests: modts.exp modts.mk

Log Message:
For :ts numeric escapes \x* is hex, anything else is octal.


To generate a diff of this commit:
cvs rdiff -u -r1.205 -r1.206 src/usr.bin/make/var.c
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/modts.exp \
src/usr.bin/make/unit-tests/modts.mk

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

Modified files:

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.205 src/usr.bin/make/var.c:1.206
--- src/usr.bin/make/var.c:1.205	Sat Feb 20 01:19:03 2016
+++ src/usr.bin/make/var.c	Mon Mar  7 20:20:35 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.205 2016/02/20 01:19:03 sjg Exp $	*/
+/*	$NetBSD: var.c,v 1.206 2016/03/07 20:20:35 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.205 2016/02/20 01:19:03 sjg Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.206 2016/03/07 20:20:35 sjg Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.205 2016/02/20 01:19:03 sjg Exp $");
+__RCSID("$NetBSD: var.c,v 1.206 2016/03/07 20:20:35 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3006,6 +3006,9 @@ ApplyModifiers(char *nstr, const char *t
 			parsestate.varSpace = 0; /* no separator */
 			cp = tstr + 2;
 			} else if (tstr[2] == '\\') {
+			const char *xp = [3];
+			int base = 8; /* assume octal */
+
 			switch (tstr[3]) {
 			case 'n':
 parsestate.varSpace = '\n';
@@ -3015,12 +3018,20 @@ ApplyModifiers(char *nstr, const char *t
 parsestate.varSpace = '\t';
 cp = tstr + 4;
 break;
+			case 'x':
+base = 16;
+xp++;
+goto get_numeric;
+			case '0':
+base = 0;
+goto get_numeric;
 			default:
 if (isdigit((unsigned char)tstr[3])) {
 char *ep;
 
+get_numeric:
 parsestate.varSpace =
-	strtoul([3], , 0);
+	strtoul(xp, , base);
 if (*ep != ':' && *ep != endc)
 	goto bad_modifier;
 cp = ep;

Index: src/usr.bin/make/unit-tests/modts.exp
diff -u src/usr.bin/make/unit-tests/modts.exp:1.1 src/usr.bin/make/unit-tests/modts.exp:1.2
--- src/usr.bin/make/unit-tests/modts.exp:1.1	Thu Aug 21 13:44:51 2014
+++ src/usr.bin/make/unit-tests/modts.exp	Mon Mar  7 20:20:35 2016
@@ -23,10 +23,16 @@ THREE
 FOUR
 FIVE
 SIX"
+LIST:ts/xa:tu="ONE
+TWO
+THREE
+FOUR
+FIVE
+SIX"
 make: Bad modifier `:tx' for LIST
 LIST:tx="}"
-make: Bad modifier `:ts\x' for LIST
-LIST:ts/x:tu="\x:tu}"
+make: Bad modifier `:ts\X' for LIST
+LIST:ts/x:tu="\X:tu}"
 FU_mod-ts="a/b/cool"
 FU_mod-ts:ts:T="cool" == cool?
 B.${AAA:ts}="Baaa" == Baaa?
Index: src/usr.bin/make/unit-tests/modts.mk
diff -u src/usr.bin/make/unit-tests/modts.mk:1.1 src/usr.bin/make/unit-tests/modts.mk:1.2
--- src/usr.bin/make/unit-tests/modts.mk:1.1	Thu Aug 21 13:44:51 2014
+++ src/usr.bin/make/unit-tests/modts.mk	Mon Mar  7 20:20:35 2016
@@ -36,8 +36,9 @@ mod-ts:
 	@${PRINT} 'LIST:ts/n="${LIST:ts\n}"'
 	@${PRINT} 'LIST:ts/t="${LIST:ts\t}"'
 	@${PRINT} 'LIST:ts/012:tu="${LIST:ts\012:tu}"'
+	@${PRINT} 'LIST:ts/xa:tu="${LIST:ts\xa:tu}"'
 	@${PRINT} 'LIST:tx="${LIST:tx}"'
-	@${PRINT} 'LIST:ts/x:tu="${LIST:ts\x:tu}"'
+	@${PRINT} 'LIST:ts/x:tu="${LIST:ts\X:tu}"'
 	@${PRINT} 'FU_$@="${FU_${@:ts}:ts}"'
 	@${PRINT} 'FU_$@:ts:T="${FU_${@:ts}:ts:T}" == cool?'
 	@${PRINT} 'B.$${AAA:ts}="${B.${AAA:ts}}" == Baaa?'



CVS commit: src/usr.bin/make

2016-03-07 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Mon Mar  7 20:20:35 UTC 2016

Modified Files:
src/usr.bin/make: var.c
src/usr.bin/make/unit-tests: modts.exp modts.mk

Log Message:
For :ts numeric escapes \x* is hex, anything else is octal.


To generate a diff of this commit:
cvs rdiff -u -r1.205 -r1.206 src/usr.bin/make/var.c
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/modts.exp \
src/usr.bin/make/unit-tests/modts.mk

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



Re: CVS commit: src/sys/netipsec

2016-03-07 Thread Christos Zoulas
On Mar 7,  7:36pm, ja...@uninett.no (Jarle Greipsland) wrote:
-- Subject: Re: CVS commit: src/sys/netipsec

| "Christos Zoulas"  writes:
| > Module Name:src
| > Committed By:   christos
| > Date:   Sat Mar  5 20:13:40 UTC 2016
| > 
| > Modified Files:
| > src/sys/netipsec: key.c
| > 
| > Log Message:
| > Fix port matching; we need to ignore ports when they are 0 not only in
| > the second saidx but the first one too. Fixes NAT-T issue with NetBSD
| > being the host behind NAT.
| Will this fix also resolve bin/47894?  Or is that one an entirely
| different beast?

I am not sure. From the log it does not seem that it fails to complete
find the saidx entry for it. But I would definitely give it a try, because
being behind NAT was not working for me before and now it is. I also have
a much better clue how to debug the problem now :-)

christos


Re: CVS commit: src/sys/netipsec

2016-03-07 Thread Jarle Greipsland
"Christos Zoulas"  writes:
> Module Name:  src
> Committed By: christos
> Date: Sat Mar  5 20:13:40 UTC 2016
> 
> Modified Files:
>   src/sys/netipsec: key.c
> 
> Log Message:
> Fix port matching; we need to ignore ports when they are 0 not only in
> the second saidx but the first one too. Fixes NAT-T issue with NetBSD
> being the host behind NAT.
Will this fix also resolve bin/47894?  Or is that one an entirely
different beast?
-jarle


CVS commit: src/usr.sbin/makefs/chfs

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  7 15:58:05 UTC 2016

Modified Files:
src/usr.sbin/makefs/chfs: chfs_mkfs.c

Log Message:
PR/50911: David Binderman: Optimize memset


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/makefs/chfs/chfs_mkfs.c

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



CVS commit: src/usr.sbin/makefs/chfs

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  7 15:58:05 UTC 2016

Modified Files:
src/usr.sbin/makefs/chfs: chfs_mkfs.c

Log Message:
PR/50911: David Binderman: Optimize memset


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/makefs/chfs/chfs_mkfs.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/makefs/chfs/chfs_mkfs.c
diff -u src/usr.sbin/makefs/chfs/chfs_mkfs.c:1.6 src/usr.sbin/makefs/chfs/chfs_mkfs.c:1.7
--- src/usr.sbin/makefs/chfs/chfs_mkfs.c:1.6	Mon Jan 28 16:03:28 2013
+++ src/usr.sbin/makefs/chfs/chfs_mkfs.c	Mon Mar  7 10:58:05 2016
@@ -124,7 +124,6 @@ write_eb_header(fsinfo_t *fsopts)
 	if ((uint32_t)opts->pagesize < MINSIZE)
 		errx(EXIT_FAILURE, "pagesize cannot be less than %zu", MINSIZE);
 	buf = emalloc(opts->pagesize);
-	memset(buf, 0xFF, opts->pagesize);
 
 	ebhdr.ec_hdr.magic = htole32(CHFS_MAGIC_BITMASK);
 	ebhdr.ec_hdr.erase_cnt = htole32(1);
@@ -132,6 +131,8 @@ write_eb_header(fsinfo_t *fsopts)
 	(uint8_t *)_hdr + 8, 4));
 
 	memcpy(buf, _hdr, CHFS_EB_EC_HDR_SIZE);
+	memset(buf + CHFS_EB_EC_HDR_SIZE, 0xFF,
+	opts->pagesize - CHFS_EB_EC_HDR_SIZE);
 
 	buf_write(fsopts, buf, opts->pagesize);
 



CVS commit: src/sbin/ifconfig

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  7 15:56:17 UTC 2016

Modified Files:
src/sbin/ifconfig: env.c

Log Message:
PR/50909: David Binderman: Optimize memset


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sbin/ifconfig/env.c

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

Modified files:

Index: src/sbin/ifconfig/env.c
diff -u src/sbin/ifconfig/env.c:1.10 src/sbin/ifconfig/env.c:1.11
--- src/sbin/ifconfig/env.c:1.10	Mon Mar  7 07:48:53 2016
+++ src/sbin/ifconfig/env.c	Mon Mar  7 10:56:17 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: env.c,v 1.10 2016/03/07 12:48:53 christos Exp $	*/
+/*	$NetBSD: env.c,v 1.11 2016/03/07 15:56:17 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 David Young.  All rights reserved.
@@ -27,7 +27,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: env.c,v 1.10 2016/03/07 12:48:53 christos Exp $");
+__RCSID("$NetBSD: env.c,v 1.11 2016/03/07 15:56:17 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -141,8 +141,8 @@ getargdata(prop_dictionary_t env, const 
 		errno = ENAMETOOLONG; 
 		return -1;
 	}
-	memset(buf, 0, buflen);
 	memcpy(buf, prop_data_data_nocopy(data), datalen);
+	memset(buf + datalen, 0, buflen - datalen);
 	return datalen;
 }
 



CVS commit: src/sbin/ifconfig

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  7 15:56:17 UTC 2016

Modified Files:
src/sbin/ifconfig: env.c

Log Message:
PR/50909: David Binderman: Optimize memset


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sbin/ifconfig/env.c

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



CVS commit: src/sbin/newfs

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  7 15:55:06 UTC 2016

Modified Files:
src/sbin/newfs: mkfs.c

Log Message:
PR/50910: David Binderman: Optimize memset.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sbin/newfs/mkfs.c

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



CVS commit: src/sbin/newfs

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  7 15:55:06 UTC 2016

Modified Files:
src/sbin/newfs: mkfs.c

Log Message:
PR/50910: David Binderman: Optimize memset.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sbin/newfs/mkfs.c

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

Modified files:

Index: src/sbin/newfs/mkfs.c
diff -u src/sbin/newfs/mkfs.c:1.126 src/sbin/newfs/mkfs.c:1.127
--- src/sbin/newfs/mkfs.c:1.126	Mon Mar  7 10:09:55 2016
+++ src/sbin/newfs/mkfs.c	Mon Mar  7 10:55:06 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkfs.c,v 1.126 2016/03/07 15:09:55 dholland Exp $	*/
+/*	$NetBSD: mkfs.c,v 1.127 2016/03/07 15:55:06 christos Exp $	*/
 
 /*
  * Copyright (c) 1980, 1989, 1993
@@ -73,7 +73,7 @@
 #if 0
 static char sccsid[] = "@(#)mkfs.c	8.11 (Berkeley) 5/3/95";
 #else
-__RCSID("$NetBSD: mkfs.c,v 1.126 2016/03/07 15:09:55 dholland Exp $");
+__RCSID("$NetBSD: mkfs.c,v 1.127 2016/03/07 15:55:06 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -735,8 +735,10 @@ mkfs(const char *fsys, int fi, int fo,
 	 * Write out the super-block and zeros until the first cg info
 	 */
 	i = cgsblock(, 0) * sblock.fs_fsize - sblock.fs_sblockloc;
-	memset(iobuf, 0, i);
-	memcpy(iobuf, , sizeof sblock);
+	if ((size_t)i < sizeof(sblock))
+		errx(1, "No space for superblock");
+	memcpy(iobuf, , sizeof(sblock));
+	memset(iobuf + sizeof(sblock), 0, i - sizeof(sblock));
 	if (needswap)
 		ffs_sb_swap(, (struct fs *)iobuf);
 	if ((sblock.fs_old_flags & FS_FLAGS_UPDATED) == 0)



CVS commit: src/sbin/newfs

2016-03-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Mar  7 15:09:55 UTC 2016

Modified Files:
src/sbin/newfs: mkfs.c

Log Message:
Terminate expression with a semicolon, instead of accidentally
splicing to the next line with a comma. Noticed by Christos. Has no
actual effect, fortunately. (Compiler output is unchanged.)


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sbin/newfs/mkfs.c

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

Modified files:

Index: src/sbin/newfs/mkfs.c
diff -u src/sbin/newfs/mkfs.c:1.125 src/sbin/newfs/mkfs.c:1.126
--- src/sbin/newfs/mkfs.c:1.125	Tue Jun 16 23:18:55 2015
+++ src/sbin/newfs/mkfs.c	Mon Mar  7 15:09:55 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkfs.c,v 1.125 2015/06/16 23:18:55 christos Exp $	*/
+/*	$NetBSD: mkfs.c,v 1.126 2016/03/07 15:09:55 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1989, 1993
@@ -73,7 +73,7 @@
 #if 0
 static char sccsid[] = "@(#)mkfs.c	8.11 (Berkeley) 5/3/95";
 #else
-__RCSID("$NetBSD: mkfs.c,v 1.125 2015/06/16 23:18:55 christos Exp $");
+__RCSID("$NetBSD: mkfs.c,v 1.126 2016/03/07 15:09:55 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -734,7 +734,7 @@ mkfs(const char *fsys, int fi, int fo,
 	/*
 	 * Write out the super-block and zeros until the first cg info
 	 */
-	i = cgsblock(, 0) * sblock.fs_fsize - sblock.fs_sblockloc,
+	i = cgsblock(, 0) * sblock.fs_fsize - sblock.fs_sblockloc;
 	memset(iobuf, 0, i);
 	memcpy(iobuf, , sizeof sblock);
 	if (needswap)



CVS commit: src/sbin/newfs

2016-03-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Mar  7 15:09:55 UTC 2016

Modified Files:
src/sbin/newfs: mkfs.c

Log Message:
Terminate expression with a semicolon, instead of accidentally
splicing to the next line with a comma. Noticed by Christos. Has no
actual effect, fortunately. (Compiler output is unchanged.)


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sbin/newfs/mkfs.c

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



CVS commit: src/sbin/fsck_msdos

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  7 14:47:25 UTC 2016

Modified Files:
src/sbin/fsck_msdos: dir.c

Log Message:
PR/50908: David Binderman: Optimize memset's


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sbin/fsck_msdos/dir.c

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



CVS commit: src/sbin/fsck_msdos

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  7 14:47:25 UTC 2016

Modified Files:
src/sbin/fsck_msdos: dir.c

Log Message:
PR/50908: David Binderman: Optimize memset's


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sbin/fsck_msdos/dir.c

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

Modified files:

Index: src/sbin/fsck_msdos/dir.c
diff -u src/sbin/fsck_msdos/dir.c:1.27 src/sbin/fsck_msdos/dir.c:1.28
--- src/sbin/fsck_msdos/dir.c:1.27	Fri Jan  2 01:21:28 2015
+++ src/sbin/fsck_msdos/dir.c	Mon Mar  7 09:47:25 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.27 2015/01/02 06:21:28 mlelstv Exp $	*/
+/*	$NetBSD: dir.c,v 1.28 2016/03/07 14:47:25 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank
@@ -30,7 +30,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: dir.c,v 1.27 2015/01/02 06:21:28 mlelstv Exp $");
+__RCSID("$NetBSD: dir.c,v 1.28 2016/03/07 14:47:25 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -929,6 +929,7 @@ int
 reconnect(int dosfs, struct bootblock *boot, struct fatEntry *fat, cl_t head)
 {
 	struct dosDirEntry d;
+	int len;
 	u_char *p;
 
 	if (!ask(1, "Reconnect"))
@@ -980,14 +981,15 @@ reconnect(int dosfs, struct bootblock *b
 	boot->NumFiles++;
 	/* Ensure uniqueness of entry here!XXX */
 	memset(, 0, sizeof d);
-	(void)snprintf(d.name, sizeof(d.name), "%u", head);
+	/* worst case -1 = 4294967295, 10 digits */
+	len = snprintf(d.name, sizeof(d.name), "%u", head);
 	d.flags = 0;
 	d.head = head;
 	d.size = fat[head].length * boot->ClusterSize;
 
-	memset(p, 0, 32);
-	memset(p, ' ', 11);
-	memcpy(p, d.name, strlen(d.name));
+	memcpy(p, d.name, len);
+	memset(p + len, ' ', 11 - len);
+	memset(p + 11, 0, 32 - 11);
 	p[26] = (u_char)d.head;
 	p[27] = (u_char)(d.head >> 8);
 	if (boot->ClustMask == CLUST32_MASK) {



CVS commit: [netbsd-7] src/doc

2016-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar  7 14:39:55 UTC 2016

Modified Files:
src/doc [netbsd-7]: CHANGES-7.1

Log Message:
Fix ticket #1124


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.65 -r1.1.2.66 src/doc/CHANGES-7.1

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

Modified files:

Index: src/doc/CHANGES-7.1
diff -u src/doc/CHANGES-7.1:1.1.2.65 src/doc/CHANGES-7.1:1.1.2.66
--- src/doc/CHANGES-7.1:1.1.2.65	Mon Mar  7 09:04:58 2016
+++ src/doc/CHANGES-7.1	Mon Mar  7 14:39:55 2016
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1,v 1.1.2.65 2016/03/07 09:04:58 msaitoh Exp $
+# $NetBSD: CHANGES-7.1,v 1.1.2.66 2016/03/07 14:39:55 martin Exp $
 
 A complete list of changes from the NetBSD 7.0 release to the NetBSD 7.1
 release:
@@ -2312,7 +2312,7 @@ lib/Makefile	1.237
 	multiple threads.
 	[christos, ticket #1123]
 
-sys/dev/usb/ugen.c1.127-1.130
+sys/dev/usb/ugen.c1.127-1.131
 
 	Remove always true conditional.
 	Only clear the endpoint information in ugen_set_interface only



CVS commit: [netbsd-7] src/doc

2016-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar  7 14:39:55 UTC 2016

Modified Files:
src/doc [netbsd-7]: CHANGES-7.1

Log Message:
Fix ticket #1124


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.65 -r1.1.2.66 src/doc/CHANGES-7.1

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



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

2016-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar  7 14:38:48 UTC 2016

Modified Files:
src/doc [netbsd-7-0]: CHANGES-7.0.1

Log Message:
Fix ticket #1124


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.39 -r1.1.2.40 src/doc/CHANGES-7.0.1

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

Modified files:

Index: src/doc/CHANGES-7.0.1
diff -u src/doc/CHANGES-7.0.1:1.1.2.39 src/doc/CHANGES-7.0.1:1.1.2.40
--- src/doc/CHANGES-7.0.1:1.1.2.39	Sun Mar  6 18:11:41 2016
+++ src/doc/CHANGES-7.0.1	Mon Mar  7 14:38:47 2016
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0.1,v 1.1.2.39 2016/03/06 18:11:41 martin Exp $
+# $NetBSD: CHANGES-7.0.1,v 1.1.2.40 2016/03/07 14:38:47 martin Exp $
 
 A complete list of changes from the NetBSD 7.0 release to the NetBSD 7.0.1
 release:
@@ -1027,7 +1027,7 @@ sys/kern/kern_time.c1.184
 	Don't leak garabage from the kernel stack on sleep(0) and equivalents.
 	[uwe, ticket #1128]
 
-sys/dev/usb/ugen.c1.127-1.130
+sys/dev/usb/ugen.c1.127-1.131
 
 	Remove always true conditional.
 	Only clear the endpoint information in ugen_set_interface only



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

2016-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar  7 14:38:48 UTC 2016

Modified Files:
src/doc [netbsd-7-0]: CHANGES-7.0.1

Log Message:
Fix ticket #1124


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.39 -r1.1.2.40 src/doc/CHANGES-7.0.1

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



CVS commit: [netbsd-7-0] src/sys/dev/usb

2016-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar  7 14:37:48 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7-0]: ugen.c

Log Message:
Additionally pull up r1.131 for ticket #1124 (requested by skrll)


To generate a diff of this commit:
cvs rdiff -u -r1.124.4.1 -r1.124.4.2 src/sys/dev/usb/ugen.c

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



CVS commit: [netbsd-7-0] src/sys/dev/usb

2016-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar  7 14:37:48 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7-0]: ugen.c

Log Message:
Additionally pull up r1.131 for ticket #1124 (requested by skrll)


To generate a diff of this commit:
cvs rdiff -u -r1.124.4.1 -r1.124.4.2 src/sys/dev/usb/ugen.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/usb/ugen.c
diff -u src/sys/dev/usb/ugen.c:1.124.4.1 src/sys/dev/usb/ugen.c:1.124.4.2
--- src/sys/dev/usb/ugen.c:1.124.4.1	Sun Mar  6 18:10:20 2016
+++ src/sys/dev/usb/ugen.c	Mon Mar  7 14:37:48 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ugen.c,v 1.124.4.1 2016/03/06 18:10:20 martin Exp $	*/
+/*	$NetBSD: ugen.c,v 1.124.4.2 2016/03/07 14:37:48 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.124.4.1 2016/03/06 18:10:20 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.124.4.2 2016/03/07 14:37:48 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -172,6 +172,7 @@ Static usb_config_descriptor_t *ugen_get
 	   int index, int *lenp);
 Static usbd_status ugen_set_interface(struct ugen_softc *, int, int);
 Static int ugen_get_alt_index(struct ugen_softc *sc, int ifaceidx);
+Static void ugen_clear_endpoints(struct ugen_softc *);
 
 #define UGENUNIT(n) ((minor(n) >> 4) & 0xf)
 #define UGENENDPOINT(n) (minor(n) & 0xf)



CVS commit: [netbsd-7] src/sys/dev/usb

2016-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar  7 14:36:55 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7]: ugen.c

Log Message:
Additionally pull up r1.131 for ticket #1124 (requested by skrll)


To generate a diff of this commit:
cvs rdiff -u -r1.124.2.1 -r1.124.2.2 src/sys/dev/usb/ugen.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/usb/ugen.c
diff -u src/sys/dev/usb/ugen.c:1.124.2.1 src/sys/dev/usb/ugen.c:1.124.2.2
--- src/sys/dev/usb/ugen.c:1.124.2.1	Sun Mar  6 18:08:04 2016
+++ src/sys/dev/usb/ugen.c	Mon Mar  7 14:36:55 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ugen.c,v 1.124.2.1 2016/03/06 18:08:04 martin Exp $	*/
+/*	$NetBSD: ugen.c,v 1.124.2.2 2016/03/07 14:36:55 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.124.2.1 2016/03/06 18:08:04 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.124.2.2 2016/03/07 14:36:55 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -172,6 +172,7 @@ Static usb_config_descriptor_t *ugen_get
 	   int index, int *lenp);
 Static usbd_status ugen_set_interface(struct ugen_softc *, int, int);
 Static int ugen_get_alt_index(struct ugen_softc *sc, int ifaceidx);
+Static void ugen_clear_endpoints(struct ugen_softc *);
 
 #define UGENUNIT(n) ((minor(n) >> 4) & 0xf)
 #define UGENENDPOINT(n) (minor(n) & 0xf)



CVS commit: [netbsd-7] src/sys/dev/usb

2016-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar  7 14:36:55 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7]: ugen.c

Log Message:
Additionally pull up r1.131 for ticket #1124 (requested by skrll)


To generate a diff of this commit:
cvs rdiff -u -r1.124.2.1 -r1.124.2.2 src/sys/dev/usb/ugen.c

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



CVS commit: src/lib/libresolv

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  7 14:35:39 UTC 2016

Modified Files:
src/lib/libresolv: hmac_link.c

Log Message:
PR/50907: David Binderman: Remove useless strlen()'s and memcpy()'s.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libresolv/hmac_link.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/libresolv/hmac_link.c
diff -u src/lib/libresolv/hmac_link.c:1.2 src/lib/libresolv/hmac_link.c:1.3
--- src/lib/libresolv/hmac_link.c:1.2	Thu Nov 15 21:16:38 2012
+++ src/lib/libresolv/hmac_link.c	Mon Mar  7 09:35:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: hmac_link.c,v 1.2 2012/11/16 02:16:38 christos Exp $	*/
+/*	$NetBSD: hmac_link.c,v 1.3 2016/03/07 14:35:39 christos Exp $	*/
 
 /*
  * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
@@ -20,7 +20,7 @@
 #if 0
 static const char rcsid[] = "Header: /proj/cvs/prod/libbind/dst/hmac_link.c,v 1.8 2007/09/24 17:18:25 each Exp ";
 #else
-__RCSID("$NetBSD: hmac_link.c,v 1.2 2012/11/16 02:16:38 christos Exp $");
+__RCSID("$NetBSD: hmac_link.c,v 1.3 2016/03/07 14:35:39 christos Exp $");
 #endif
 
 /*%
@@ -268,48 +268,48 @@ dst_hmac_md5_key_to_file_format(const DS
 			const int buff_len)
 {
 	char *bp;
-	int len, i, key_len;
+#define BUF_LEFT (size_t)(buff_len - (bp - buff))
+	int len, key_len;
 	u_char key[HMAC_LEN];
 	HMAC_Key *hkey;
+	static const char keystr[] = "Key: ";
+
+	if (buff == NULL)
+		return -1;	/*%< no output area */
 
 	if (dkey == NULL || dkey->dk_KEY_struct == NULL) 
-		return (0);
-	/*
-	 * Using snprintf() would be so much simpler here.
-	 */
-	if (buff == NULL ||
-	buff_len <= (int)(strlen(KEY_FILE_FMT_STR) +
-			  strlen(KEY_FILE_FORMAT) + 4))
-		return (-1);	/*%< no OR not enough space in output area */
-	hkey = (HMAC_Key *) dkey->dk_KEY_struct;
-	memset(buff, 0, buff_len);	/*%< just in case */
+		return 0;
+
 	/* write file header */
-	snprintf(buff, buff_len, KEY_FILE_FMT_STR, KEY_FILE_FORMAT,
+	hkey = (HMAC_Key *) dkey->dk_KEY_struct;
+	len = snprintf(buff, buff_len, KEY_FILE_FMT_STR, KEY_FILE_FORMAT,
 	KEY_HMAC_MD5, "HMAC");
-
-	bp = buff + strlen(buff);
-
-	memset(key, 0, HMAC_LEN);
-	for (i = 0; i < HMAC_LEN; i++)
-		key[i] = hkey->hk_ipad[i] ^ HMAC_IPAD;
-	for (i = HMAC_LEN - 1; i >= 0; i--)
-		if (key[i] != 0)
+	if (len < 0 || len >= buff_len)
+		return -1; 	/*%< not enough space in output area */
+	bp = buff + len;
+	if (BUF_LEFT < sizeof(keystr))
+		return -1;
+
+	memcpy(bp, keystr, sizeof(keystr) - 1);
+	bp += sizeof(keystr) - 1;
+
+	for (key_len = 0; key_len < HMAC_LEN; key_len++)
+		key[key_len] = hkey->hk_ipad[key_len] ^ HMAC_IPAD;
+	for (key_len = HMAC_LEN - 1; key_len >= 0; key_len--)
+		if (key[key_len] != 0)
 			break;
-	key_len = i + 1;
+	key_len++;
 
-	if (buff_len - (bp - buff) < 6)
-		return (-1);
-	strcat(bp, "Key: ");
-	bp += strlen("Key: ");
-
-	len = b64_ntop(key, key_len, bp, (size_t)(buff_len - (bp - buff)));
+	len = b64_ntop(key, key_len, bp, BUF_LEFT);
 	if (len < 0) 
-		return (-1);
+		return -1;
 	bp += len;
-	if (buff_len - (bp - buff) < 2)
-		return (-1);
+
+	if (BUF_LEFT < 2)
+		return -1;
 	*(bp++) = '\n';
-	*bp = '\0';
+
+	memset(bp, 0, BUF_LEFT);
 
 	return (int)(bp - buff);
 }



CVS commit: src/lib/libresolv

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  7 14:35:39 UTC 2016

Modified Files:
src/lib/libresolv: hmac_link.c

Log Message:
PR/50907: David Binderman: Remove useless strlen()'s and memcpy()'s.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libresolv/hmac_link.c

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



CVS commit: src/external/mit/xorg/server/drivers/xf86-video-geode

2016-03-07 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Mar  7 14:35:21 UTC 2016

Modified Files:
src/external/mit/xorg/server/drivers/xf86-video-geode: Makefile

Log Message:
Ignore clang's empty loop-body warning, it is used extensively via
macros.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/mit/xorg/server/drivers/xf86-video-geode/Makefile

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

Modified files:

Index: src/external/mit/xorg/server/drivers/xf86-video-geode/Makefile
diff -u src/external/mit/xorg/server/drivers/xf86-video-geode/Makefile:1.3 src/external/mit/xorg/server/drivers/xf86-video-geode/Makefile:1.4
--- src/external/mit/xorg/server/drivers/xf86-video-geode/Makefile:1.3	Mon Jul 20 06:34:29 2015
+++ src/external/mit/xorg/server/drivers/xf86-video-geode/Makefile	Mon Mar  7 14:35:21 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.3 2015/07/20 06:34:29 mrg Exp $
+#	$NetBSD: Makefile,v 1.4 2016/03/07 14:35:21 joerg Exp $
 
 DRIVER=		xf86-video-geode
 DRIVER_NAME=	geode_drv
@@ -44,6 +44,8 @@ COPTS.gx_randr.c+=	-Wno-error	# XXX
 COPTS.lx_memory.c+=	-Wno-error	# XXX
 COPTS.panel.c+=		-Wno-error	# XXX -- huh? don't get this one
 
+CWARNFLAGS.clang+=	-Wno-empty-body
+
 .include "../Makefile.xf86-driver"
 
 XORG_PKG_VER_PROG=	${DRIVER}



CVS commit: src/external/mit/xorg/server/drivers/xf86-video-geode

2016-03-07 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Mar  7 14:35:21 UTC 2016

Modified Files:
src/external/mit/xorg/server/drivers/xf86-video-geode: Makefile

Log Message:
Ignore clang's empty loop-body warning, it is used extensively via
macros.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/mit/xorg/server/drivers/xf86-video-geode/Makefile

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



CVS commit: src/external/bsd/elftoolchain/dist/libdwarf

2016-03-07 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Mar  7 14:32:02 UTC 2016

Modified Files:
src/external/bsd/elftoolchain/dist/libdwarf: libdwarf_elf_init.c

Log Message:
Relocation of type SHT_REL must use the current value as addend.

Fixes ctfconvert for i386 where section .debug_info uses this relocation.

Ok: Christos Zoulas


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/bsd/elftoolchain/dist/libdwarf/libdwarf_elf_init.c

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



CVS commit: src/external/bsd/elftoolchain/dist/libdwarf

2016-03-07 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Mar  7 14:32:02 UTC 2016

Modified Files:
src/external/bsd/elftoolchain/dist/libdwarf: libdwarf_elf_init.c

Log Message:
Relocation of type SHT_REL must use the current value as addend.

Fixes ctfconvert for i386 where section .debug_info uses this relocation.

Ok: Christos Zoulas


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/bsd/elftoolchain/dist/libdwarf/libdwarf_elf_init.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/bsd/elftoolchain/dist/libdwarf/libdwarf_elf_init.c
diff -u src/external/bsd/elftoolchain/dist/libdwarf/libdwarf_elf_init.c:1.3 src/external/bsd/elftoolchain/dist/libdwarf/libdwarf_elf_init.c:1.4
--- src/external/bsd/elftoolchain/dist/libdwarf/libdwarf_elf_init.c:1.3	Sat Feb 20 02:43:41 2016
+++ src/external/bsd/elftoolchain/dist/libdwarf/libdwarf_elf_init.c	Mon Mar  7 14:32:02 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: libdwarf_elf_init.c,v 1.3 2016/02/20 02:43:41 christos Exp $	*/
+/*	$NetBSD: libdwarf_elf_init.c,v 1.4 2016/03/07 14:32:02 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2009 Kai Wang
@@ -28,7 +28,7 @@
 
 #include "_libdwarf.h"
 
-__RCSID("$NetBSD: libdwarf_elf_init.c,v 1.3 2016/02/20 02:43:41 christos Exp $");
+__RCSID("$NetBSD: libdwarf_elf_init.c,v 1.4 2016/03/07 14:32:02 hannken Exp $");
 ELFTC_VCSID("Id: libdwarf_elf_init.c 3161 2015-02-15 21:43:36Z emaste ");
 
 static const char *debug_name[] = {
@@ -54,7 +54,8 @@ static const char *debug_name[] = {
 
 static void
 _dwarf_elf_write_reloc(Dwarf_Debug dbg, Elf_Data *symtab_data, int endian,
-void *buf, uint64_t offset, GElf_Xword r_info, GElf_Sxword r_addend)
+void *buf, uint64_t offset, GElf_Xword r_info, GElf_Sxword r_addend,
+int is_rel)
 {
 	GElf_Sym sym;
 	int size;
@@ -63,6 +64,14 @@ _dwarf_elf_write_reloc(Dwarf_Debug dbg, 
 		return;
 	if ((size = _dwarf_get_reloc_size(dbg, GELF_R_TYPE(r_info))) == 0)
 		return; /* Unknown or non-absolute relocation. */
+	if (is_rel) {
+		uint64_t roffset = offset;
+
+		if (endian == ELFDATA2MSB)
+			r_addend = _dwarf_read_msb(buf, , size);
+		else
+			r_addend = _dwarf_read_lsb(buf, , size);
+	}
 	if (endian == ELFDATA2MSB)
 		_dwarf_write_msb(buf, , sym.st_value + r_addend, size);
 	else
@@ -79,7 +88,7 @@ _dwarf_elf_apply_rel_reloc(Dwarf_Debug d
 	j = 0;
 	while (gelf_getrel(rel_data, j++, ) != NULL)
 		_dwarf_elf_write_reloc(dbg, symtab_data, endian, buf,
-		 rel.r_offset, rel.r_info, 0);
+		 rel.r_offset, rel.r_info, 0, 1);
 }
 
 static void
@@ -92,7 +101,7 @@ _dwarf_elf_apply_rela_reloc(Dwarf_Debug 
 	j = 0;
 	while (gelf_getrela(rel_data, j++, ) != NULL)
 		_dwarf_elf_write_reloc(dbg, symtab_data, endian, buf,
-		rela.r_offset, rela.r_info, rela.r_addend);
+		rela.r_offset, rela.r_info, rela.r_addend, 0);
 }
 
 static int



CVS commit: src/sys/netipsec

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  7 13:08:48 UTC 2016

Modified Files:
src/sys/netipsec: key.c

Log Message:
PR/50905: Henning Petersen: Fix useless comparison (from FreeBSD)


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/netipsec/key.c

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



CVS commit: src/sbin/ifconfig

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  7 12:48:53 UTC 2016

Modified Files:
src/sbin/ifconfig: env.c

Log Message:
PR/50909: David Binderman: Optimize memset


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sbin/ifconfig/env.c

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

Modified files:

Index: src/sbin/ifconfig/env.c
diff -u src/sbin/ifconfig/env.c:1.9 src/sbin/ifconfig/env.c:1.10
--- src/sbin/ifconfig/env.c:1.9	Thu Feb  7 08:20:51 2013
+++ src/sbin/ifconfig/env.c	Mon Mar  7 07:48:53 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: env.c,v 1.9 2013/02/07 13:20:51 apb Exp $	*/
+/*	$NetBSD: env.c,v 1.10 2016/03/07 12:48:53 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 David Young.  All rights reserved.
@@ -27,7 +27,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: env.c,v 1.9 2013/02/07 13:20:51 apb Exp $");
+__RCSID("$NetBSD: env.c,v 1.10 2016/03/07 12:48:53 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -162,8 +162,8 @@ getargstr(prop_dictionary_t env, const c
 		errno = ENAMETOOLONG; 
 		return -1;
 	}
-	memset(buf, 0, buflen);
 	memcpy(buf, prop_data_data_nocopy(data), datalen);
+	memset(buf + datalen, 0, buflen - datalen);
 	return datalen;
 }
 



CVS commit: src/sbin/ifconfig

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  7 12:48:53 UTC 2016

Modified Files:
src/sbin/ifconfig: env.c

Log Message:
PR/50909: David Binderman: Optimize memset


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sbin/ifconfig/env.c

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



CVS commit: src/sys/dev/usb

2016-03-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Mar  7 10:52:17 UTC 2016

Modified Files:
src/sys/dev/usb: if_smsc.c

Log Message:
PR/50904: Fix variable assignment inside if-clause.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/usb/if_smsc.c

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



CVS commit: src/sys/dev/usb

2016-03-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Mar  7 10:52:17 UTC 2016

Modified Files:
src/sys/dev/usb: if_smsc.c

Log Message:
PR/50904: Fix variable assignment inside if-clause.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/usb/if_smsc.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/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.25 src/sys/dev/usb/if_smsc.c:1.26
--- src/sys/dev/usb/if_smsc.c:1.25	Tue Feb  9 08:32:12 2016
+++ src/sys/dev/usb/if_smsc.c	Mon Mar  7 10:52:17 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.25 2016/02/09 08:32:12 ozaki-r Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.26 2016/03/07 10:52:17 skrll Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -772,7 +772,7 @@ smsc_chip_init(struct smsc_softc *sc)
 	smsc_write_reg(sc, SMSC_PM_CTRL, SMSC_PM_CTRL_PHY_RST);
 
 	if ((err = smsc_wait_for_bits(sc, SMSC_PM_CTRL,
-	SMSC_PM_CTRL_PHY_RST) != 0)) {
+	SMSC_PM_CTRL_PHY_RST)) != 0) {
 		smsc_warn_printf(sc, "timed-out waiting for phy reset to "
 		"complete\n");
 		goto init_failed;



Re: CVS commit: src/usr.bin/vmstat

2016-03-07 Thread Martin Husemann
On Sun, Mar 06, 2016 at 01:01:28PM -0500, Christos Zoulas wrote:
> Module Name:  src
> Committed By: christos
> Date: Sun Mar  6 18:01:28 UTC 2016
> 
> Modified Files:
>   src/usr.bin/vmstat: Makefile
> 
> Log Message:
> Work around gcc on sparc64 bug

This warning should in general be made non-fatal, as it only tells us something
about the compiler backend, not the code being compiled.

Martin


CVS commit: [netbsd-7] src/doc

2016-03-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Mar  7 09:04:58 UTC 2016

Modified Files:
src/doc [netbsd-7]: CHANGES-7.1

Log Message:
Fix for ticket 1132. Not EM_IAMCU but STT_GNU_IFUNC.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.64 -r1.1.2.65 src/doc/CHANGES-7.1

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

Modified files:

Index: src/doc/CHANGES-7.1
diff -u src/doc/CHANGES-7.1:1.1.2.64 src/doc/CHANGES-7.1:1.1.2.65
--- src/doc/CHANGES-7.1:1.1.2.64	Mon Mar  7 08:20:07 2016
+++ src/doc/CHANGES-7.1	Mon Mar  7 09:04:58 2016
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1,v 1.1.2.64 2016/03/07 08:20:07 msaitoh Exp $
+# $NetBSD: CHANGES-7.1,v 1.1.2.65 2016/03/07 09:04:58 msaitoh Exp $
 
 A complete list of changes from the NetBSD 7.0 release to the NetBSD 7.1
 release:
@@ -2380,6 +2380,6 @@ sys/arch/xen/xen/if_xennet_xenbus.c		1.6
 
 sys/sys/exec_elf.h1.143
 
-	Add definition of EM_IAMCU. This change fixes build break caused by
-	ticket 1126.
+	Add definition of STT_GNU_IFUNC. This change fixes build break caused
+	by ticket 1126.
 	[htodd, ticket #1132]



CVS commit: [netbsd-7] src/doc

2016-03-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Mar  7 09:04:58 UTC 2016

Modified Files:
src/doc [netbsd-7]: CHANGES-7.1

Log Message:
Fix for ticket 1132. Not EM_IAMCU but STT_GNU_IFUNC.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.64 -r1.1.2.65 src/doc/CHANGES-7.1

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



Re: CVS commit: [netbsd-7] src/sys/sys

2016-03-07 Thread Masanobu SAITOH

Hi.

On 2016/03/07 17:59, Takeshi Nakayama wrote:

"SAITOH Masanobu"  wrote



Module Name:src
Committed By:   msaitoh
Date:   Mon Mar  7 08:08:52 UTC 2016

Modified Files:
src/sys/sys [netbsd-7]: exec_elf.h

Log Message:
Pullup the following revision (requested by htodd in ticket #1132):

sys/sys/exec_elf.h  1.143

Add definition of EM_IAMCU. This change fixes build break caused by
ticket 1126.


Wrong commit message?  This is for 1.153 not 1.143.


Sorry. Yo're right. I'll fix the commit message and doc/CHANGES-7.1



-- Takeshi Nakayama




--
---
SAITOH Masanobu (msai...@execsw.org
 msai...@netbsd.org)


Re: CVS commit: [netbsd-7] src/sys/sys

2016-03-07 Thread Takeshi Nakayama
>>> "SAITOH Masanobu"  wrote

> Module Name:  src
> Committed By: msaitoh
> Date: Mon Mar  7 08:08:52 UTC 2016
> 
> Modified Files:
>   src/sys/sys [netbsd-7]: exec_elf.h
> 
> Log Message:
> Pullup the following revision (requested by htodd in ticket #1132):
> 
> sys/sys/exec_elf.h1.143
> 
> Add definition of EM_IAMCU. This change fixes build break caused by
> ticket 1126.

Wrong commit message?  This is for 1.153 not 1.143.

-- Takeshi Nakayama


CVS commit: src/usr.bin/elf2aout

2016-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar  7 08:59:00 UTC 2016

Modified Files:
src/usr.bin/elf2aout: elf2aout.c

Log Message:
Try to fix build on 32bit architectures.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/elf2aout/elf2aout.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.bin/elf2aout/elf2aout.c
diff -u src/usr.bin/elf2aout/elf2aout.c:1.17 src/usr.bin/elf2aout/elf2aout.c:1.18
--- src/usr.bin/elf2aout/elf2aout.c:1.17	Sun Mar  6 16:13:21 2016
+++ src/usr.bin/elf2aout/elf2aout.c	Mon Mar  7 08:59:00 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf2aout.c,v 1.17 2016/03/06 16:13:21 christos Exp $	*/
+/*	$NetBSD: elf2aout.c,v 1.18 2016/03/07 08:59:00 martin Exp $	*/
 
 /*
  * Copyright (c) 1995
@@ -370,7 +370,7 @@ translate_syms(int out, int in, off_t sy
 	memset(outbuf, 0, sizeof outbuf);
 
 	/* Find number of symbols to process... */
-	remaining = symsize / (ssize_t)sizeof(Elf32_Sym);
+	remaining = symsize / (off_t)sizeof(Elf32_Sym);
 
 	/* Suck in the old string table... */
 	oldstrings = saveRead(in, stroff, (size_t)strsize, "string table");
@@ -478,7 +478,9 @@ copy(int out, int in, off_t offset, off_
 	/* Go to the start of the ELF symbol table... */
 	if (lseek(in, offset, SEEK_SET) < 0)
 		err(EXIT_FAILURE, "%s: lseek failed", __func__);
-	remaining = size;
+	if (size > SSIZE_MAX)
+		err(EXIT_FAILURE, "%s: can not copy this much", __func__);
+	remaining = (ssize_t)size;
 	while (remaining) {
 		cur = remaining;
 		if (cur > (int)sizeof ibuf)



CVS commit: src/usr.bin/elf2aout

2016-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar  7 08:59:00 UTC 2016

Modified Files:
src/usr.bin/elf2aout: elf2aout.c

Log Message:
Try to fix build on 32bit architectures.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/elf2aout/elf2aout.c

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



CVS commit: [netbsd-7] src/doc

2016-03-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Mar  7 08:20:08 UTC 2016

Modified Files:
src/doc [netbsd-7]: CHANGES-7.1

Log Message:
Update ticket 1118. Add ticket 1132.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.63 -r1.1.2.64 src/doc/CHANGES-7.1

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



CVS commit: [netbsd-7] src/doc

2016-03-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Mar  7 08:20:08 UTC 2016

Modified Files:
src/doc [netbsd-7]: CHANGES-7.1

Log Message:
Update ticket 1118. Add ticket 1132.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.63 -r1.1.2.64 src/doc/CHANGES-7.1

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

Modified files:

Index: src/doc/CHANGES-7.1
diff -u src/doc/CHANGES-7.1:1.1.2.63 src/doc/CHANGES-7.1:1.1.2.64
--- src/doc/CHANGES-7.1:1.1.2.63	Sun Mar  6 18:53:50 2016
+++ src/doc/CHANGES-7.1	Mon Mar  7 08:20:07 2016
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1,v 1.1.2.63 2016/03/06 18:53:50 martin Exp $
+# $NetBSD: CHANGES-7.1,v 1.1.2.64 2016/03/07 08:20:07 msaitoh Exp $
 
 A complete list of changes from the NetBSD 7.0 release to the NetBSD 7.1
 release:
@@ -2276,6 +2276,7 @@ sys/arch/x86/include/cpu.h			1.67
 sys/arch/x86/include/cpuvar.h			1.47
 sys/arch/x86/x86/cpu.c1.117
 sys/arch/x86/x86/identcpu.c			1.49
+sys/arch/xen/x86/cpu.c1.102-1.103
 
 	Retrieve cpuid7 (Structured Extended Features) into ci_feat_val.
 	[msaitoh, ticket #1118]
@@ -2377,3 +2378,8 @@ sys/arch/xen/xen/if_xennet_xenbus.c		1.6
 	freed.
 	[bouyer, ticket #1125]
 
+sys/sys/exec_elf.h1.143
+
+	Add definition of EM_IAMCU. This change fixes build break caused by
+	ticket 1126.
+	[htodd, ticket #1132]



CVS commit: [netbsd-7] src/sys/arch/xen/x86

2016-03-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Mar  7 08:17:19 UTC 2016

Modified Files:
src/sys/arch/xen/x86 [netbsd-7]: cpu.c

Log Message:
Pullup the following revision to fix build break caused by ticket #1118:

sys/arch/xen/x86/cpu.c  1.102-1.103

Increase the number of entries of cpu_features from 5 to 7.


To generate a diff of this commit:
cvs rdiff -u -r1.98.4.1 -r1.98.4.2 src/sys/arch/xen/x86/cpu.c

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



CVS commit: [netbsd-7] src/sys/arch/xen/x86

2016-03-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Mar  7 08:17:19 UTC 2016

Modified Files:
src/sys/arch/xen/x86 [netbsd-7]: cpu.c

Log Message:
Pullup the following revision to fix build break caused by ticket #1118:

sys/arch/xen/x86/cpu.c  1.102-1.103

Increase the number of entries of cpu_features from 5 to 7.


To generate a diff of this commit:
cvs rdiff -u -r1.98.4.1 -r1.98.4.2 src/sys/arch/xen/x86/cpu.c

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

Modified files:

Index: src/sys/arch/xen/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.98.4.1 src/sys/arch/xen/x86/cpu.c:1.98.4.2
--- src/sys/arch/xen/x86/cpu.c:1.98.4.1	Tue Aug  4 18:12:28 2015
+++ src/sys/arch/xen/x86/cpu.c	Mon Mar  7 08:17:19 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.98.4.1 2015/08/04 18:12:28 snj Exp $	*/
+/*	$NetBSD: cpu.c,v 1.98.4.2 2016/03/07 08:17:19 msaitoh Exp $	*/
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.98.4.1 2015/08/04 18:12:28 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.98.4.2 2016/03/07 08:17:19 msaitoh Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -172,12 +172,14 @@ struct cpu_info phycpu_info_primary __al
 struct cpu_info *cpu_info_list = _info_primary;
 struct cpu_info *phycpu_info_list = _info_primary;
 
-uint32_t cpu_feature[5]; /* X86 CPUID feature bits
+uint32_t cpu_feature[7]; /* X86 CPUID feature bits
 			  *	[0] basic features %edx
 			  *	[1] basic features %ecx
 			  *	[2] extended features %edx
 			  *	[3] extended features %ecx
 			  *	[4] VIA padlock features
+			  * [5] structured extended features cpuid.7:%ebx
+			  * [6] structured extended features cpuid.7:%ecx
 			  */
 
 bool x86_mp_online;



CVS commit: [netbsd-7] src/sys/sys

2016-03-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Mar  7 08:08:52 UTC 2016

Modified Files:
src/sys/sys [netbsd-7]: exec_elf.h

Log Message:
Pullup the following revision (requested by htodd in ticket #1132):

sys/sys/exec_elf.h  1.143

Add definition of EM_IAMCU. This change fixes build break caused by
ticket 1126.


To generate a diff of this commit:
cvs rdiff -u -r1.141.2.1 -r1.141.2.2 src/sys/sys/exec_elf.h

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

Modified files:

Index: src/sys/sys/exec_elf.h
diff -u src/sys/sys/exec_elf.h:1.141.2.1 src/sys/sys/exec_elf.h:1.141.2.2
--- src/sys/sys/exec_elf.h:1.141.2.1	Sun Nov  8 00:57:09 2015
+++ src/sys/sys/exec_elf.h	Mon Mar  7 08:08:52 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_elf.h,v 1.141.2.1 2015/11/08 00:57:09 riz Exp $	*/
+/*	$NetBSD: exec_elf.h,v 1.141.2.2 2016/03/07 08:08:52 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -515,6 +515,7 @@ typedef struct {
 #define STT_NUM			7
 
 #define STT_LOOS		10	/* Operating system specific range */
+#define STT_GNU_IFUNC		10	/* GNU extension: indirect function */
 #define STT_HIOS		12
 #define STT_LOPROC		13	/* Processor-specific range */
 #define STT_HIPROC		15



CVS commit: [netbsd-7] src/sys/sys

2016-03-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Mar  7 08:08:52 UTC 2016

Modified Files:
src/sys/sys [netbsd-7]: exec_elf.h

Log Message:
Pullup the following revision (requested by htodd in ticket #1132):

sys/sys/exec_elf.h  1.143

Add definition of EM_IAMCU. This change fixes build break caused by
ticket 1126.


To generate a diff of this commit:
cvs rdiff -u -r1.141.2.1 -r1.141.2.2 src/sys/sys/exec_elf.h

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