Module Name:    src
Committed By:   yamt
Date:           Thu May 22 11:36:35 UTC 2014

Modified Files:
        src/include [yamt-pagecache]: Makefile complex.h ctype.h db.h err.h
            fenv.h inttypes.h iso646.h langinfo.h locale.h lwp.h math.h mpool.h
            netdb.h nl_types.h search.h stdbool.h stddef.h stdio.h stdlib.h
            string.h time.h ttyent.h unistd.h util.h vis.h wchar.h wctype.h
        src/include/rpc [yamt-pagecache]: svc.h
        src/include/rpcsvc [yamt-pagecache]: yp_prot.h
        src/include/ssp [yamt-pagecache]: string.h
Removed Files:
        src/include [yamt-pagecache]: cdbr.h

Log Message:
sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")


To generate a diff of this commit:
cvs rdiff -u -r1.136.2.1 -r1.136.2.2 src/include/Makefile
cvs rdiff -u -r1.1 -r0 src/include/cdbr.h
cvs rdiff -u -r1.3 -r1.3.6.1 src/include/complex.h src/include/stdbool.h
cvs rdiff -u -r1.31 -r1.31.6.1 src/include/ctype.h
cvs rdiff -u -r1.24.2.1 -r1.24.2.2 src/include/db.h
cvs rdiff -u -r1.16 -r1.16.2.1 src/include/err.h
cvs rdiff -u -r1.6.4.1 -r1.6.4.2 src/include/fenv.h
cvs rdiff -u -r1.7 -r1.7.8.1 src/include/inttypes.h
cvs rdiff -u -r1.1 -r1.1.82.1 src/include/iso646.h
cvs rdiff -u -r1.9 -r1.9.54.1 src/include/langinfo.h
cvs rdiff -u -r1.17 -r1.17.6.1 src/include/locale.h
cvs rdiff -u -r1.11 -r1.11.10.1 src/include/lwp.h
cvs rdiff -u -r1.56.2.2 -r1.56.2.3 src/include/math.h
cvs rdiff -u -r1.13 -r1.13.2.1 src/include/mpool.h
cvs rdiff -u -r1.64.6.1 -r1.64.6.2 src/include/netdb.h
cvs rdiff -u -r1.12 -r1.12.6.1 src/include/nl_types.h
cvs rdiff -u -r1.19 -r1.19.2.1 src/include/search.h
cvs rdiff -u -r1.16 -r1.16.8.1 src/include/stddef.h
cvs rdiff -u -r1.79.2.2 -r1.79.2.3 src/include/stdio.h
cvs rdiff -u -r1.97.4.2 -r1.97.4.3 src/include/stdlib.h
cvs rdiff -u -r1.39.8.2 -r1.39.8.3 src/include/string.h
cvs rdiff -u -r1.40.6.1 -r1.40.6.2 src/include/time.h
cvs rdiff -u -r1.14 -r1.14.48.1 src/include/ttyent.h
cvs rdiff -u -r1.127.2.5 -r1.127.2.6 src/include/unistd.h
cvs rdiff -u -r1.59.2.2 -r1.59.2.3 src/include/util.h
cvs rdiff -u -r1.19.4.1 -r1.19.4.2 src/include/vis.h
cvs rdiff -u -r1.30 -r1.30.2.1 src/include/wchar.h
cvs rdiff -u -r1.7 -r1.7.6.1 src/include/wctype.h
cvs rdiff -u -r1.24 -r1.24.2.1 src/include/rpc/svc.h
cvs rdiff -u -r1.17 -r1.17.34.1 src/include/rpcsvc/yp_prot.h
cvs rdiff -u -r1.4.8.1 -r1.4.8.2 src/include/ssp/string.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/Makefile
diff -u src/include/Makefile:1.136.2.1 src/include/Makefile:1.136.2.2
--- src/include/Makefile:1.136.2.1	Tue Apr 17 00:05:10 2012
+++ src/include/Makefile	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.136.2.1 2012/04/17 00:05:10 yamt Exp $
+#	$NetBSD: Makefile,v 1.136.2.2 2014/05/22 11:36:35 yamt Exp $
 #	@(#)Makefile	8.2 (Berkeley) 1/4/94
 
 # Doing a make includes builds /usr/include
@@ -8,7 +8,7 @@ NOOBJ=		# defined
 # Missing: mp.h
 
 INCS=	a.out.h aio.h ar.h assert.h atomic.h \
-	bitstring.h bm.h cdbr.h cdbw.h complex.h cpio.h ctype.h \
+	bitstring.h bm.h cdbw.h complex.h cpio.h ctype.h \
 	db.h dirent.h disktab.h dlfcn.h err.h errno.h fenv.h fmtmsg.h fnmatch.h \
 	fstab.h fts.h ftw.h getopt.h glob.h grp.h ifaddrs.h iconv.h \
 	inttypes.h iso646.h kvm.h langinfo.h libgen.h \

Index: src/include/complex.h
diff -u src/include/complex.h:1.3 src/include/complex.h:1.3.6.1
--- src/include/complex.h:1.3	Wed Sep 15 16:11:30 2010
+++ src/include/complex.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: complex.h,v 1.3 2010/09/15 16:11:30 christos Exp $ */
+/* $NetBSD: complex.h,v 1.3.6.1 2014/05/22 11:36:35 yamt Exp $ */
 
 /*
  * Written by Matthias Drochner.
@@ -20,60 +20,74 @@ __BEGIN_DECLS
 /* 7.3.5.1 The cacos functions */
 double complex cacos(double complex);
 float complex cacosf(float complex);
+long double complex cacosl(long double complex);
 
 /* 7.3.5.2 The casin functions */
 double complex casin(double complex);
 float complex casinf(float complex);
+long double complex casinl(long double complex);
 
 /* 7.3.5.1 The catan functions */
 double complex catan(double complex);
 float complex catanf(float complex);
+long double complex catanl(long double complex);
 
 /* 7.3.5.1 The ccos functions */
 double complex ccos(double complex);
 float complex ccosf(float complex);
+long double complex ccosl(long double complex);
 
 /* 7.3.5.1 The csin functions */
 double complex csin(double complex);
 float complex csinf(float complex);
+long double complex csinl(long double complex);
 
 /* 7.3.5.1 The ctan functions */
 double complex ctan(double complex);
 float complex ctanf(float complex);
+long double complex ctanl(long double complex);
 
 /* 7.3.6 Hyperbolic functions */
 /* 7.3.6.1 The cacosh functions */
 double complex cacosh(double complex);
 float complex cacoshf(float complex);
+long double complex cacoshl(long double complex);
 
 /* 7.3.6.2 The casinh functions */
 double complex casinh(double complex);
 float complex casinhf(float complex);
+long double complex casinhl(long double complex);
 
 /* 7.3.6.3 The catanh functions */
 double complex catanh(double complex);
 float complex catanhf(float complex);
+long double complex catanhl(long double complex);
 
 /* 7.3.6.4 The ccosh functions */
 double complex ccosh(double complex);
 float complex ccoshf(float complex);
+long double complex ccoshl(long double complex);
 
 /* 7.3.6.5 The csinh functions */
 double complex csinh(double complex);
 float complex csinhf(float complex);
+long double complex csinhl(long double complex);
 
 /* 7.3.6.6 The ctanh functions */
 double complex ctanh(double complex);
 float complex ctanhf(float complex);
+long double complex ctanhl(long double complex);
 
 /* 7.3.7 Exponential and logarithmic functions */
 /* 7.3.7.1 The cexp functions */
 double complex cexp(double complex);
 float complex cexpf(float complex);
+long double complex cexpl(long double complex);
 
 /* 7.3.7.2 The clog functions */
 double complex clog(double complex);
 float complex clogf(float complex);
+long double complex clogl(long double complex);
 
 /* 7.3.8 Power and absolute-value functions */
 /* 7.3.8.1 The cabs functions */
@@ -81,20 +95,24 @@ float complex clogf(float complex);
 /* avoid conflict with historical cabs(struct complex) */
 double cabs(double complex) __RENAME(__c99_cabs);
 float cabsf(float complex) __RENAME(__c99_cabsf);
+long double cabsl(long double complex) __RENAME(__c99_cabsl);
 #endif
 
 /* 7.3.8.2 The cpow functions */
 double complex cpow(double complex, double complex);
 float complex cpowf(float complex, float complex);
+long double complex cpowl(long double complex, long double complex);
 
 /* 7.3.8.3 The csqrt functions */
 double complex csqrt(double complex);
 float complex csqrtf(float complex);
+long double complex csqrtl(long double complex);
 
 /* 7.3.9 Manipulation functions */
 /* 7.3.9.1 The carg functions */ 
 double carg(double complex);
 float cargf(float complex);
+long double cargl(long double complex);
 
 /* 7.3.9.2 The cimag functions */
 double cimag(double complex);
Index: src/include/stdbool.h
diff -u src/include/stdbool.h:1.3 src/include/stdbool.h:1.3.6.1
--- src/include/stdbool.h:1.3	Mon Apr 28 20:22:54 2008
+++ src/include/stdbool.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: stdbool.h,v 1.3 2008/04/28 20:22:54 martin Exp $	*/
+/*	$NetBSD: stdbool.h,v 1.3.6.1 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,11 +37,7 @@
 
 #define	true	1
 #define	false	0
-#else
-#define	bool	bool
 
-#define	true	true
-#define	false	false
 #endif /* __cplusplus */
 
 #define	__bool_true_false_are_defined	1

Index: src/include/ctype.h
diff -u src/include/ctype.h:1.31 src/include/ctype.h:1.31.6.1
--- src/include/ctype.h:1.31	Tue Jun  1 13:52:08 2010
+++ src/include/ctype.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ctype.h,v 1.31 2010/06/01 13:52:08 tnozaki Exp $	*/
+/*	$NetBSD: ctype.h,v 1.31.6.1 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*
  * Copyright (c) 1989 The Regents of the University of California.
@@ -57,6 +57,28 @@ int	isxdigit(int);
 int	tolower(int);
 int	toupper(int);
 
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+
+int	isalnum_l(int, locale_t);
+int	isalpha_l(int, locale_t);
+int	isblank_l(int, locale_t);
+int	iscntrl_l(int, locale_t);
+int	isdigit_l(int, locale_t);
+int	isgraph_l(int, locale_t);
+int	islower_l(int, locale_t);
+int	isprint_l(int, locale_t);
+int	ispunct_l(int, locale_t);
+int	isspace_l(int, locale_t);
+int	isupper_l(int, locale_t);
+int	isxdigit_l(int, locale_t);
+int	tolower_l(int, locale_t);
+int	toupper_l(int, locale_t);
+#endif
+
 #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
 int	isascii(int);
 int	toascii(int);
@@ -70,8 +92,11 @@ int	isblank(int);
 #endif
 __END_DECLS
 
-#if defined(_NETBSD_SOURCE) && !defined(_CTYPE_NOINLINE)
+#if defined(_NETBSD_SOURCE) && !defined(_CTYPE_NOINLINE) && \
+    !defined(__cplusplus)
 #include <sys/ctype_inline.h>
+#else
+#include <sys/ctype_bits.h>
 #endif
 
 #endif /* !_CTYPE_H_ */

Index: src/include/db.h
diff -u src/include/db.h:1.24.2.1 src/include/db.h:1.24.2.2
--- src/include/db.h:1.24.2.1	Tue Apr 17 00:05:10 2012
+++ src/include/db.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: db.h,v 1.24.2.1 2012/04/17 00:05:10 yamt Exp $	*/
+/*	$NetBSD: db.h,v 1.24.2.2 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -220,6 +220,9 @@ DB	*__bt_open(const char *, int, mode_t,
 DB	*__hash_open(const char *, int, mode_t, const HASHINFO *, int);
 DB	*__rec_open(const char *, int, mode_t, const RECNOINFO *, int);
 void	 __dbpanic(DB *);
+struct stat;
+int	 __dbopen(const char *, int, mode_t, struct stat *);
+int	 __dbtemp(const char *, struct stat *);
 #endif
 __END_DECLS
 #endif /* !_DB_H_ */

Index: src/include/err.h
diff -u src/include/err.h:1.16 src/include/err.h:1.16.2.1
--- src/include/err.h:1.16	Sun Jul 17 20:54:34 2011
+++ src/include/err.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: err.h,v 1.16 2011/07/17 20:54:34 joerg Exp $	*/
+/*	$NetBSD: err.h,v 1.16.2.1 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -46,6 +46,10 @@ __dead void	errx(int, const char *, ...)
 		     __printflike(2, 3) __dead;
 __dead void	verrx(int, const char *, va_list)
 		    __printflike(2, 0) __dead;
+__dead void	errc(int, int, const char *, ...)
+		     __printflike(3, 4) __dead;
+__dead void	verrc(int, int, const char *, va_list)
+		    __printflike(3, 0) __dead;
 void		warn(const char *, ...)
 		    __printflike(1, 2);
 void		vwarn(const char *, va_list)
@@ -54,6 +58,10 @@ void		warnx(const char *, ...)
 		    __printflike(1, 2);
 void		vwarnx(const char *, va_list)
 		    __printflike(1, 0);
+void		warnc(int, const char *, ...)
+		    __printflike(2, 3);
+void		vwarnc(int, const char *, va_list)
+		    __printflike(2, 0);
 __END_DECLS
 
 #endif /* !_ERR_H_ */

Index: src/include/fenv.h
diff -u src/include/fenv.h:1.6.4.1 src/include/fenv.h:1.6.4.2
--- src/include/fenv.h:1.6.4.1	Tue Apr 17 00:05:10 2012
+++ src/include/fenv.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: fenv.h,v 1.6.4.1 2012/04/17 00:05:10 yamt Exp $	*/
+/*	$NetBSD: fenv.h,v 1.6.4.2 2014/05/22 11:36:35 yamt Exp $	*/
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -25,13 +25,15 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#if !defined(__i386__) && !defined(__amd64__) && !defined(__sparc__)
+#if !defined(__arm__) && !defined(__i386__) \
+    && !defined(__sparc__) && !defined(__x86_64__)
 #error	"fenv.h is currently not supported for this architecture"
 #endif
 
 #ifndef _FENV_H_
 #define _FENV_H_
 
+#include <sys/featuretest.h>
 #include <machine/fenv.h>
 
 __BEGIN_DECLS

Index: src/include/inttypes.h
diff -u src/include/inttypes.h:1.7 src/include/inttypes.h:1.7.8.1
--- src/include/inttypes.h:1.7	Sun Nov 15 22:21:03 2009
+++ src/include/inttypes.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: inttypes.h,v 1.7 2009/11/15 22:21:03 christos Exp $	*/
+/*	$NetBSD: inttypes.h,v 1.7.8.1 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -33,6 +33,7 @@
 #define _INTTYPES_H_
 
 #include <sys/cdefs.h>
+#include <sys/featuretest.h>
 #include <sys/inttypes.h>
 #include <machine/ansi.h>
 
@@ -59,6 +60,21 @@ typedef struct {
 } imaxdiv_t;
 
 imaxdiv_t	imaxdiv(intmax_t, intmax_t);
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+intmax_t	strtoimax_l(const char * __restrict,
+		    char ** __restrict, int, locale_t);
+uintmax_t	strtoumax_l(const char * __restrict,
+		    char ** __restrict, int, locale_t);
+intmax_t	wcstoimax_l(const wchar_t * __restrict,
+		    wchar_t ** __restrict, int, locale_t);
+uintmax_t	wcstoumax_l(const wchar_t * __restrict,
+		    wchar_t ** __restrict, int, locale_t);
+#endif
 __END_DECLS
 
 #endif /* !_INTTYPES_H_ */

Index: src/include/iso646.h
diff -u src/include/iso646.h:1.1 src/include/iso646.h:1.1.82.1
--- src/include/iso646.h:1.1	Fri Feb 17 09:08:10 1995
+++ src/include/iso646.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: iso646.h,v 1.1 1995/02/17 09:08:10 jtc Exp $	*/
+/*	$NetBSD: iso646.h,v 1.1.82.1 2014/05/22 11:36:35 yamt Exp $	*/
 
 /* 
  * Written by J.T. Conklin <j...@wimsey.com> 02/16/95.
@@ -8,6 +8,7 @@
 #ifndef _ISO646_H_
 #define _ISO646_H_
 
+#ifndef __cplusplus
 #define and	&&
 #define and_eq	&=
 #define bitand	&
@@ -19,5 +20,6 @@
 #define or_eq	|=
 #define xor	^
 #define xor_eq	^=
+#endif
 
 #endif	/* !_ISO646_H_ */

Index: src/include/langinfo.h
diff -u src/include/langinfo.h:1.9 src/include/langinfo.h:1.9.54.1
--- src/include/langinfo.h:1.9	Thu Feb  3 04:39:32 2005
+++ src/include/langinfo.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: langinfo.h,v 1.9 2005/02/03 04:39:32 perry Exp $	*/
+/*	$NetBSD: langinfo.h,v 1.9.54.1 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*
  * Written by J.T. Conklin <j...@netbsd.org>
@@ -88,4 +88,14 @@ __BEGIN_DECLS
 char *nl_langinfo(nl_item);
 __END_DECLS
 
+#if defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+__BEGIN_DECLS
+char *nl_langinfo_l(nl_item, locale_t);
+__END_DECLS
+#endif
+
 #endif	/* _LANGINFO_H_ */

Index: src/include/locale.h
diff -u src/include/locale.h:1.17 src/include/locale.h:1.17.6.1
--- src/include/locale.h:1.17	Mon Jun  7 13:52:29 2010
+++ src/include/locale.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: locale.h,v 1.17 2010/06/07 13:52:29 tnozaki Exp $	*/
+/*	$NetBSD: locale.h,v 1.17.6.1 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -34,6 +34,8 @@
 #ifndef _LOCALE_H_
 #define _LOCALE_H_
 
+#include <sys/featuretest.h>
+
 struct lconv {
 	char	*decimal_point;
 	char	*thousands_sep;
@@ -75,17 +77,51 @@ struct lconv {
 
 #include <sys/cdefs.h>
 
-#ifdef __SETLOCALE_SOURCE__
-
-typedef struct _locale_impl_t		*_locale_t;
-
-#define _LC_GLOBAL_LOCALE		((_locale_t)-1)
-
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE) || \
+    defined(__SETLOCALE_SOURCE__)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
 #endif
 
 __BEGIN_DECLS
 struct lconv *localeconv(void);
 char *setlocale(int, const char *) __RENAME(__setlocale50);
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+#define	LC_ALL_MASK		((int)~0)
+#define	LC_COLLATE_MASK		((int)(1 << LC_COLLATE))
+#define	LC_CTYPE_MASK		((int)(1 << LC_CTYPE))
+#define	LC_MONETARY_MASK	((int)(1 << LC_MONETARY))
+#define	LC_NUMERIC_MASK		((int)(1 << LC_NUMERIC))
+#define	LC_TIME_MASK		((int)(1 << LC_TIME))
+#define	LC_MESSAGES_MASK	((int)(1 << LC_MESSAGES))
+locale_t	duplocale(locale_t);
+void		freelocale(locale_t);
+struct lconv	*localeconv_l(locale_t);
+locale_t	newlocale(int, const char *, locale_t);
+
+#ifndef _LIBC
+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)
+#  ifndef _LIBC
+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
 
 #endif /* _LOCALE_H_ */

Index: src/include/lwp.h
diff -u src/include/lwp.h:1.11 src/include/lwp.h:1.11.10.1
--- src/include/lwp.h:1.11	Sun Jan 11 03:04:12 2009
+++ src/include/lwp.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: lwp.h,v 1.11 2009/01/11 03:04:12 christos Exp $	*/
+/*	$NetBSD: lwp.h,v 1.11.10.1 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -54,8 +54,8 @@ void	_lwp_setprivate(void *);
 int	_lwp_kill(lwpid_t, int);
 int	_lwp_detach(lwpid_t);
 #ifndef __LIBC12_SOURCE__
-int	_lwp_park(const struct timespec *, lwpid_t, const void *, const void *)
-    __RENAME(___lwp_park50);
+int	_lwp_park(clockid_t, int, const struct timespec *, lwpid_t,
+    const void *, const void *) __RENAME(___lwp_park60);
 #endif
 int	_lwp_unpark(lwpid_t, const void *);
 ssize_t	_lwp_unpark_all(const lwpid_t *, size_t, const void *);

Index: src/include/math.h
diff -u src/include/math.h:1.56.2.2 src/include/math.h:1.56.2.3
--- src/include/math.h:1.56.2.2	Wed May 23 10:07:30 2012
+++ src/include/math.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: math.h,v 1.56.2.2 2012/05/23 10:07:30 yamt Exp $	*/
+/*	$NetBSD: math.h,v 1.56.2.3 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*
  * ====================================================
@@ -38,6 +38,20 @@ union __long_double_u {
 
 #include <machine/math.h>		/* may use __float_u, __double_u,
 					   or __long_double_u */
+#include <limits.h>			/* for INT_{MIN,MAX} */
+
+#if ((_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE))
+#  if defined(__FLT_EVAL_METHOD__) && (__FLT_EVAL_METHOD__ - 0) == 0
+typedef double double_t;
+typedef float float_t;
+#  elif (__FLT_EVAL_METHOD__ - 0) == 1
+typedef double double_t;
+typedef double float_t;
+#  elif (__FLT_EVAL_METHOD__ - 0) == 2
+typedef long double double_t;
+typedef long double float_t;
+#  endif
+#endif
 
 #ifdef __HAVE_LONG_DOUBLE
 #define	__fpmacro_unary_floating(__name, __arg0)			\
@@ -116,6 +130,9 @@ extern const union __float_u __nanf;
 #define	_FP_LOMD	0x80		/* range for machine-specific classes */
 #define	_FP_HIMD	0xff
 
+#define	FP_ILOGB0	INT_MIN
+#define	FP_ILOGBNAN	INT_MAX
+
 #endif /* !_ANSI_SOURCE && ... */
 
 /*
@@ -282,6 +299,14 @@ float	cosf(float);
 float	sinf(float);
 float	tanf(float);
 
+long double	acosl(long double);
+long double	asinl(long double);
+long double	atanl(long double);
+long double	atan2l(long double, long double);
+long double	cosl(long double);
+long double	sinl(long double);
+long double	tanl(long double);
+
 /* 7.12.5 hyperbolic */
 
 float	acoshf(float);
@@ -290,6 +315,12 @@ float	atanhf(float);
 float	coshf(float);
 float	sinhf(float);
 float	tanhf(float);
+long double	acoshl(long double);
+long double	asinhl(long double);
+long double	atanhl(long double);
+long double	coshl(long double);
+long double	sinhl(long double);
+long double	tanhl(long double);
 
 /* 7.12.6 exp / log */
 
@@ -306,65 +337,110 @@ float	log1pf(float);
 float	logbf(float);
 float	modff(float, float *);
 float	scalbnf(float, int);
+float	scalblnf(float, long);
+
+long double	expl(long double);
+long double	exp2l(long double);
+long double	expm1l(long double);
+long double	frexpl(long double, int *);
+int		ilogbl(long double);
+long double	ldexpl(long double, int);
+long double	logl(long double);
+long double	log2l(long double);
+long double	log10l(long double);
+long double	log1pl(long double);
+long double	logbl(long double);
+long double	modfl(long double, long double *);
+long double	scalbnl(long double, int);
+long double	scalblnl(long double, long);
+
 
 /* 7.12.7 power / absolute */
 
 float	cbrtf(float);
 float	fabsf(float);
-long double	fabsl(long double);
 float	hypotf(float, float);
 float	powf(float, float);
 float	sqrtf(float);
+long double	cbrtl(long double);
+long double	fabsl(long double);
+long double	hypotl(long double, long double);
+long double	powl(long double, long double);
+long double	sqrtl(long double);
 
 /* 7.12.8 error / gamma */
 
+double	tgamma(double);
 float	erff(float);
 float	erfcf(float);
 float	lgammaf(float);
 float	tgammaf(float);
-double	tgamma(double);
+long double	erfl(long double);
+long double	erfcl(long double);
+long double	lgammal(long double);
+long double	tgammal(long double);
 
 /* 7.12.9 nearest integer */
 
-float	ceilf(float);
-float	floorf(float);
-float	rintf(float);
-double	round(double);
-float	roundf(float);
-double	trunc(double);
-float	truncf(float);
-long int	lrint(double);
-long int	lrintf(float);
 /* LONGLONG */
 long long int	llrint(double);
-/* LONGLONG */
-long long int	llrintf(float);
 long int	lround(double);
-long int	lroundf(float);
 /* LONGLONG */
 long long int	llround(double);
+long int	lrint(double);
+double	round(double);
+double	trunc(double);
+
+float	ceilf(float);
+float	floorf(float);
+/* LONGLONG */
+long long int	llrintf(float);
+long int	lroundf(float);
 /* LONGLONG */
 long long int	llroundf(float);
+long int	lrintf(float);
+float	rintf(float);
+float	roundf(float);
+float	truncf(float);
+long double	ceill(long double);
+long double	floorl(long double);
+/* LONGLONG */
+long long int	llrintl(long double);
+long int	lroundl(long double);
+/* LONGLONG */
+long long int	llroundl(long double);
+long int	lrintl(long double);
+long double	rintl(long double);
+long double	roundl(long double);
+long double	truncl(long double);
 
 /* 7.12.10 remainder */
 
 float	fmodf(float, float);
 float	remainderf(float, float);
+long double	fmodl(long double, long double);
+long double	remainderl(long double, long double);
 
 /* 7.12.10.3 The remquo functions */
 double	remquo(double, double, int *);
 float	remquof(float, float, int *);
+long double	remquol(long double, long double, int *);
 
 /* 7.12.11 manipulation */
 
-float	copysignf(float, float);
-long double	copysignl(long double, long double);
 double	nan(const char *);
+double	nearbyint(double);
+double	nexttoward(double, long double);
+float	copysignf(float, float);
 float	nanf(const char *);
-long double	nanl(const char *);
+float	nearbyintf(float);
 float	nextafterf(float, float);
+float	nexttowardf(float, long double);
+long double	copysignl(long double, long double);
+long double	nanl(const char *);
+long double	nearbyintl(long double);
 long double     nextafterl(long double, long double);
-double	nexttoward(double, long double);
+long double	nexttowardl(long double, long double);
 
 /* 7.12.14 comparison */
 
@@ -376,12 +452,15 @@ double	nexttoward(double, long double);
 #define islessgreater(x, y)	(!isunordered((x), (y)) && \
 				 ((x) > (y) || (y) > (x)))
 double	fdim(double, double);
+double	fma(double, double, double);
 double	fmax(double, double);
 double	fmin(double, double);
 float	fdimf(float, float);
+float	fmaf(float, float, float);
 float	fmaxf(float, float);
 float	fminf(float, float);
 long double fdiml(long double, long double);
+long double fmal(long double, long double, long double);
 long double fmaxl(long double, long double);
 long double fminl(long double, long double);
 
@@ -393,14 +472,14 @@ long double fminl(long double, long doub
     ((_POSIX_C_SOURCE - 0) >= 200112L) || \
     defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
 /* 7.12.3.3 int isinf(real-floating x) */
-#ifdef __isinf
+#if defined(__isinf) || defined(__HAVE_INLINE___ISINF)
 #define	isinf(__x)	__isinf(__x)
 #else
 #define	isinf(__x)	__fpmacro_unary_floating(isinf, __x)
 #endif
 
 /* 7.12.3.4 int isnan(real-floating x) */
-#ifdef __isnan
+#if defined(__isnan) || defined(__HAVE_INLINE___ISNAN)
 #define	isnan(__x)	__isnan(__x)
 #else
 #define	isnan(__x)	__fpmacro_unary_floating(isnan, __x)
@@ -422,6 +501,7 @@ double	significand(double);
  */
 double	copysign(double, double);
 double	scalbn(double, int);
+double	scalbln(double, long);
 
 /*
  * BSD math library entry points
@@ -500,10 +580,6 @@ int	__isnanl(long double);
 int	__signbitl(long double);
 #endif
 
-int		ilogbl(long double);
-long double	logbl(long double);
-long double	scalbnl(long double, int);
-
 __END_DECLS
 
 #endif /* _MATH_H_ */

Index: src/include/mpool.h
diff -u src/include/mpool.h:1.13 src/include/mpool.h:1.13.2.1
--- src/include/mpool.h:1.13	Tue Aug 26 21:18:38 2008
+++ src/include/mpool.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mpool.h,v 1.13 2008/08/26 21:18:38 joerg Exp $	*/
+/*	$NetBSD: mpool.h,v 1.13.2.1 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -49,8 +49,8 @@
 
 /* The BKT structures are the elements of the queues. */
 typedef struct _bkt {
-	CIRCLEQ_ENTRY(_bkt) hq;		/* hash queue */
-	CIRCLEQ_ENTRY(_bkt) q;		/* lru queue */
+	TAILQ_ENTRY(_bkt) hq;		/* hash queue */
+	TAILQ_ENTRY(_bkt) q;		/* lru queue */
 	void    *page;			/* page */
 	pgno_t   pgno;			/* page number */
 
@@ -60,9 +60,9 @@ typedef struct _bkt {
 } BKT;
 
 typedef struct MPOOL {
-	CIRCLEQ_HEAD(_lqh, _bkt) lqh;	/* lru queue head */
+	TAILQ_HEAD(_lqh, _bkt) lqh;	/* lru queue head */
 					/* hash queue array */
-	CIRCLEQ_HEAD(_hqh, _bkt) hqh[HASHSIZE];
+	TAILQ_HEAD(_hqh, _bkt) hqh[HASHSIZE];
 	pgno_t	curcache;		/* current number of cached pages */
 	pgno_t	maxcache;		/* max number of cached pages */
 	pgno_t	npages;			/* number of pages in the file */

Index: src/include/netdb.h
diff -u src/include/netdb.h:1.64.6.1 src/include/netdb.h:1.64.6.2
--- src/include/netdb.h:1.64.6.1	Tue Apr 17 00:05:10 2012
+++ src/include/netdb.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: netdb.h,v 1.64.6.1 2012/04/17 00:05:10 yamt Exp $	*/
+/*	$NetBSD: netdb.h,v 1.64.6.2 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*
  * ++Copyright++ 1980, 1983, 1988, 1993
@@ -90,10 +90,9 @@
 #ifndef _NETDB_H_
 #define	_NETDB_H_
 
-#include <machine/ansi.h>
+#include <sys/cdefs.h>
 #include <machine/endian_machdep.h>
 #include <sys/ansi.h>
-#include <sys/cdefs.h>
 #include <sys/featuretest.h>
 #include <inttypes.h>
 /*
@@ -267,11 +266,18 @@ struct addrinfo {
 #define	AI_CANONNAME	0x00000002 /* fill ai_canonname */
 #define	AI_NUMERICHOST	0x00000004 /* prevent host name resolution */
 #define	AI_NUMERICSERV	0x00000008 /* prevent service name resolution */
+#define	AI_ADDRCONFIG	0x00000400 /* only if any address is assigned */
 /* valid flags for addrinfo (not a standard def, apps should not use it) */
+#ifdef _NETBSD_SOURCE
+#define	AI_SRV		0x00000800 /* do _srv lookups */
+#define	AI_MASK	\
+    (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | \
+    AI_ADDRCONFIG | AI_SRV)
+#else
 #define	AI_MASK	\
     (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | \
     AI_ADDRCONFIG)
-#define	AI_ADDRCONFIG	0x00000400 /* only if any address is assigned */
+#endif
 #endif
 
 #if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
@@ -314,7 +320,7 @@ void		endservent(void);
 void		freehostent(struct hostent *);
 #endif
 #endif
-struct hostent	*gethostbyaddr(const char *, socklen_t, int);
+struct hostent	*gethostbyaddr(const void *, socklen_t, int);
 struct hostent	*gethostbyname(const char *);
 #if defined(_NETBSD_SOURCE)
 struct hostent	*gethostbyname2(const char *, int);

Index: src/include/nl_types.h
diff -u src/include/nl_types.h:1.12 src/include/nl_types.h:1.12.6.1
--- src/include/nl_types.h:1.12	Mon Apr 28 20:22:54 2008
+++ src/include/nl_types.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: nl_types.h,v 1.12 2008/04/28 20:22:54 martin Exp $	*/
+/*	$NetBSD: nl_types.h,v 1.12.6.1 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -83,9 +83,18 @@ typedef long	nl_item;
 
 __BEGIN_DECLS
 nl_catd  catopen(const char *, int);
-char    *catgets(nl_catd, int, int, const char *)
-	__attribute__((__format_arg__(4)));
+char    *catgets(nl_catd, int, int, const char *) __format_arg(4);
 int	 catclose(nl_catd);
 __END_DECLS
 
+#if defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+__BEGIN_DECLS
+nl_catd  catopen_l(const char *, int, locale_t);
+__END_DECLS
+#endif
+
 #endif	/* _NL_TYPES_H_ */

Index: src/include/search.h
diff -u src/include/search.h:1.19 src/include/search.h:1.19.2.1
--- src/include/search.h:1.19	Wed Sep 14 23:34:26 2011
+++ src/include/search.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: search.h,v 1.19 2011/09/14 23:34:26 christos Exp $	*/
+/*	$NetBSD: search.h,v 1.19.2.1 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*
  * Written by J.T. Conklin <j...@netbsd.org>
@@ -9,6 +9,7 @@
 #define _SEARCH_H_
 
 #include <sys/cdefs.h>
+#include <sys/featuretest.h>
 #include <machine/ansi.h>
 
 #ifdef	_BSD_SIZE_T_

Index: src/include/stddef.h
diff -u src/include/stddef.h:1.16 src/include/stddef.h:1.16.8.1
--- src/include/stddef.h:1.16	Sun Nov 15 22:21:03 2009
+++ src/include/stddef.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: stddef.h,v 1.16 2009/11/15 22:21:03 christos Exp $	*/
+/*	$NetBSD: stddef.h,v 1.16.8.1 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -38,7 +38,10 @@
 #include <sys/featuretest.h>
 #include <machine/ansi.h>
 
+#ifdef	_BSD_PTRDIFF_T_
 typedef	_BSD_PTRDIFF_T_	ptrdiff_t;
+#undef	_BSD_PTRDIFF_T_
+#endif
 
 #ifdef	_BSD_SIZE_T_
 typedef	_BSD_SIZE_T_	size_t;

Index: src/include/stdio.h
diff -u src/include/stdio.h:1.79.2.2 src/include/stdio.h:1.79.2.3
--- src/include/stdio.h:1.79.2.2	Wed May 23 10:07:30 2012
+++ src/include/stdio.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: stdio.h,v 1.79.2.2 2012/05/23 10:07:30 yamt Exp $	*/
+/*	$NetBSD: stdio.h,v 1.79.2.3 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -228,7 +228,7 @@ int	 fflush(FILE *);
 int	 fgetc(FILE *);
 char	*fgets(char * __restrict, int, FILE * __restrict);
 FILE	*fopen(const char * __restrict , const char * __restrict);
-int	 fprintf(FILE * __restrict , const char * __restrict, ...)
+int	 fprintf(FILE * __restrict, const char * __restrict, ...)
 		__printflike(2, 3);
 int	 fputc(int, FILE *);
 int	 fputs(const char * __restrict, FILE * __restrict);
@@ -485,7 +485,7 @@ static __inline int __sputc(int _c, FILE
 #define	__sfileno(p)	\
     ((p)->_file == -1 ? -1 : (int)(unsigned short)(p)->_file)
 
-#ifndef __lint__
+#if !defined(__lint__) && !defined(__cplusplus)
 #if !defined(_REENTRANT) && !defined(_PTHREADS)
 #define	feof(p)		__sfeof(p)
 #define	ferror(p)	__sferror(p)
@@ -494,17 +494,18 @@ static __inline int __sputc(int _c, FILE
 #define	getc(fp)	__sgetc(fp)
 #define putc(x, fp)	__sputc(x, fp)
 #endif /* !_REENTRANT && !_PTHREADS */
-#endif /* __lint__ */
 
 #define	getchar()	getc(stdin)
 #define	putchar(x)	putc(x, stdout)
 
-#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
-    defined(_NETBSD_SOURCE)
+#endif /* !__lint__ && !__cplusplus */
+
+#if (defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)) && !defined(__cplusplus)
 #if !defined(_REENTRANT) && !defined(_PTHREADS)
 #define	fileno(p)	__sfileno(p)
 #endif /* !_REENTRANT && !_PTHREADS */
-#endif /* !_ANSI_SOURCE */
+#endif /* !_ANSI_SOURCE && !__cplusplus*/
 
 #if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
 int	 vdprintf(int, const char * __restrict, __va_list)
@@ -514,7 +515,7 @@ int	 dprintf(int, const char * __restric
 #endif /* (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE) */
 
 #if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
-    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
+    defined(_REENTRANT) || defined(_NETBSD_SOURCE) && !defined(__cplusplus)
 #define getc_unlocked(fp)	__sgetc(fp)
 #define putc_unlocked(x, fp)	__sputc(x, fp)
 
@@ -527,6 +528,63 @@ int	 dprintf(int, const char * __restric
 FILE *fmemopen(void * __restrict, size_t, const char * __restrict);
 #endif
 
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+__BEGIN_DECLS
+int	 fprintf_l(FILE * __restrict, locale_t, const char * __restrict, ...)
+		__printflike(3, 4);
+int	 vfprintf_l(FILE * __restrict, locale_t, const char * __restrict,
+		__va_list) __printflike(3, 0);
+int	 printf_l(locale_t, const char * __restrict, ...)
+		__printflike(2, 3);
+int	 vprintf_l(locale_t, const char * __restrict, __va_list)
+		__printflike(2, 0);
+int	 asprintf_l(char ** __restrict, locale_t, const char * __restrict, ...)
+		__printflike(3, 4);
+int	 vasprintf_l(char ** __restrict, locale_t, const char * __restrict,
+    __va_list)
+		__printflike(3, 0);
+int	 vdprintf_l(int, locale_t, const char * __restrict, __va_list)
+		__printflike(3, 0);
+int	 dprintf_l(int, locale_t, const char * __restrict, ...)
+		__printflike(3, 4);
+int	 snprintf_l(char * __restrict, size_t, locale_t,
+		    const char * __restrict, ...) __printflike(4, 5);
+int	 vsnprintf_l(char * __restrict, size_t, locale_t,
+		     const char * __restrict, __va_list) __printflike(4, 0);
+#ifndef __AUDIT__
+int	 sprintf_l(char * __restrict, locale_t, const char * __restrict, ...)
+		   __printflike(3, 4);
+int	 vsprintf_l(char * __restrict, locale_t, const char * __restrict,
+		    __va_list) __printflike(3, 0);
+#endif
+
+int	 fscanf_l(FILE * __restrict, locale_t, const char * __restrict, ...)
+    __scanflike(3, 4);
+int	 scanf_l(locale_t, const char * __restrict, ...)
+    __scanflike(2, 3);
+int	 sscanf_l(const char * __restrict, locale_t,
+    const char * __restrict, ...) __scanflike(3, 4);
+int	 vscanf_l(locale_t, const char * __restrict, __va_list)
+    __scanflike(2, 0);
+int	 vscanf_l(locale_t, const char * __restrict, __va_list)
+    __scanflike(2, 0);
+int	 vfscanf_l(FILE * __restrict, locale_t, const char * __restrict,
+    __va_list) __scanflike(3, 0);
+int	 vsscanf_l(const char * __restrict, locale_t, const char * __restrict,
+    __va_list) __scanflike(3, 0);
+#ifdef _NETBSD_SOURCE
+int	snprintf_ss(char *restrict, size_t, const char * __restrict, ...)
+    __printflike(3, 4);
+int	vsnprintf_ss(char *restrict, size_t, const char * __restrict, __va_list)
+    __printflike(3, 0);
+#endif
+__END_DECLS
+#endif
+
 #if _FORTIFY_SOURCE > 0
 #include <ssp/stdio.h>
 #endif

Index: src/include/stdlib.h
diff -u src/include/stdlib.h:1.97.4.2 src/include/stdlib.h:1.97.4.3
--- src/include/stdlib.h:1.97.4.2	Tue Oct 30 18:58:33 2012
+++ src/include/stdlib.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: stdlib.h,v 1.97.4.2 2012/10/30 18:58:33 yamt Exp $	*/
+/*	$NetBSD: stdlib.h,v 1.97.4.3 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -65,7 +65,7 @@ typedef struct {
 
 #if !defined(_ANSI_SOURCE) && \
     (defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \
-     defined(_NETBSD_SOURCE))
+     (__cplusplus - 0) >= 201103L || defined(_NETBSD_SOURCE))
 typedef struct {
 	/* LONGLONG */
 	long long int quot;	/* quotient */
@@ -207,7 +207,8 @@ char	*ptsname(int);
  * ISO C99
  */
 #if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \
-    defined(_NETBSD_SOURCE)
+    defined(_NETBSD_SOURCE) || (__cplusplus - 0) >= 201103L
+
 /* LONGLONG */
 long long int	atoll(const char *);
 /* LONGLONG */
@@ -223,6 +224,12 @@ float		strtof(const char * __restrict, c
 long double	strtold(const char * __restrict, char ** __restrict);
 #endif
 
+#if defined(_ISOC11_SOURCE) || (__STDC_VERSION__ - 0) >= 201101L || \
+    defined(_NETBSD_SOURCE) || (__cplusplus - 0) >= 201103L
+int	at_quick_exit(void (*)(void));
+__dead void quick_exit(int);
+#endif
+
 /*
  * The Open Group Base Specifications, Issue 6; IEEE Std 1003.1-2001 (POSIX)
  */
@@ -295,6 +302,7 @@ void	 cfree(void *);
 int	 heapsort(void *, size_t, size_t, int (*)(const void *, const void *));
 int	 mergesort(void *, size_t, size_t,
 	    int (*)(const void *, const void *));
+int	 ptsname_r(int, char *, size_t);
 int	 radixsort(const unsigned char **, int, const unsigned char *,
 	    unsigned);
 int	 sradixsort(const unsigned char **, int, const unsigned char *,
@@ -328,6 +336,44 @@ size_t	shquotev(int, char * const *, cha
 #if defined(_NETBSD_SOURCE)
 qdiv_t	 qdiv(quad_t, quad_t);
 #endif
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+double		strtod_l(const char * __restrict, char ** __restrict, locale_t);
+float		strtof_l(const char * __restrict, char ** __restrict, locale_t);
+long double	strtold_l(const char * __restrict, char ** __restrict,
+			  locale_t);
+long	 strtol_l(const char * __restrict, char ** __restrict, int, locale_t);
+unsigned long
+	 strtoul_l(const char * __restrict, char ** __restrict, int, locale_t);
+/* LONGLONG */
+long long int
+	strtoll_l(const char * __restrict, char ** __restrict, int, locale_t);
+/* LONGLONG */
+unsigned long long int
+	strtoull_l(const char * __restrict, char ** __restrict, int, locale_t);
+
+#  if defined(_NETBSD_SOURCE)
+quad_t	 strtoq_l(const char * __restrict, char ** __restrict, int, locale_t);
+u_quad_t strtouq_l(const char * __restrict, char ** __restrict, int, locale_t);
+
+size_t	_mb_cur_max_l(locale_t);
+#define	MB_CUR_MAX_L(loc)	_mb_cur_max_l(loc)
+int	 mblen_l(const char *, size_t, locale_t);
+size_t	 mbstowcs_l(wchar_t * __restrict, const char * __restrict, size_t,
+		    locale_t);
+int	 wctomb_l(char *, wchar_t, locale_t);
+int	 mbtowc_l(wchar_t * __restrict, const char * __restrict, size_t,
+	          locale_t);
+size_t	 wcstombs_l(char * __restrict, const wchar_t * __restrict, size_t,
+		    locale_t);
+
+#  endif /* _NETBSD_SOURCE */
+#endif /* _POSIX_C_SOURCE >= 200809 || _NETBSD_SOURCE */
+
 __END_DECLS
 
 #endif /* !_STDLIB_H_ */

Index: src/include/string.h
diff -u src/include/string.h:1.39.8.2 src/include/string.h:1.39.8.3
--- src/include/string.h:1.39.8.2	Tue Oct 30 18:58:33 2012
+++ src/include/string.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: string.h,v 1.39.8.2 2012/10/30 18:58:33 yamt Exp $	*/
+/*	$NetBSD: string.h,v 1.39.8.3 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -89,12 +89,6 @@ size_t	strnlen(const char *, size_t);
 /* also in unistd.h */
 __aconst char *strsignal(int);
 #endif /* __STRSIGNAL_DECLARED */
-/*
- * For POSIX compliance, we still need:
- * strcoll_l
- * strerror_l
- * strxfrm_l
- */
 #endif
 __END_DECLS
 
@@ -109,11 +103,23 @@ char	*strsep(char **, const char *);
 char	*stresep(char **, const char *, int);
 char	*strndup(const char *, size_t);
 void	*memrchr(const void *, int, size_t);
-void	__explicit_bzero(void *, size_t);
-int	__consttime_bcmp(const void *, const void *, size_t);
+void	*explicit_memset(void *, int, size_t);
+int	consttime_memequal(const void *, const void *, size_t);
 __END_DECLS
 #endif
 
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+__BEGIN_DECLS
+int	 strcoll_l(const char *, const char *, locale_t);
+size_t	 strxfrm_l(char * __restrict, const char * __restrict, size_t, locale_t);
+__aconst char *strerror_l(int, locale_t);
+__END_DECLS
+#endif /* _POSIX_C_SOURCE || _NETBSD_SOURCE */
+
 #if _FORTIFY_SOURCE > 0
 #include <ssp/string.h>
 #endif

Index: src/include/time.h
diff -u src/include/time.h:1.40.6.1 src/include/time.h:1.40.6.2
--- src/include/time.h:1.40.6.1	Tue Oct 30 18:58:33 2012
+++ src/include/time.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: time.h,v 1.40.6.1 2012/10/30 18:58:33 yamt Exp $	*/
+/*	$NetBSD: time.h,v 1.40.6.2 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -174,6 +174,16 @@ struct tm *localtime_r(const time_t * __
 #endif
 #endif
 
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+size_t strftime_l(char * __restrict, size_t, const char * __restrict,
+    const struct tm * __restrict, locale_t)
+    __attribute__((__format__(__strftime__, 3, 0)));
+#endif
+
 #if defined(_NETBSD_SOURCE)
 
 typedef struct __state *timezone_t;
@@ -200,9 +210,14 @@ void tzfree(const timezone_t) __RENAME(_
 const char *tzgetname(const timezone_t, int) __RENAME(__tzgetname50);
 #endif
 
+size_t strftime_lz(const timezone_t, char * __restrict, size_t,
+    const char * __restrict, const struct tm * __restrict, locale_t)
+    __attribute__((__format__(__strftime__, 4, 0)));
 size_t strftime_z(const timezone_t, char * __restrict, size_t,
     const char * __restrict, const struct tm * __restrict)
     __attribute__((__format__(__strftime__, 4, 0)));
+char *strptime_l(const char * __restrict, const char * __restrict,
+    struct tm * __restrict, locale_t);
 
 #endif /* _NETBSD_SOURCE */
 

Index: src/include/ttyent.h
diff -u src/include/ttyent.h:1.14 src/include/ttyent.h:1.14.48.1
--- src/include/ttyent.h:1.14	Mon Apr 17 23:29:21 2006
+++ src/include/ttyent.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ttyent.h,v 1.14 2006/04/17 23:29:21 salo Exp $	*/
+/*	$NetBSD: ttyent.h,v 1.14.48.1 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -35,6 +35,7 @@
 #define	_TTYENT_H_
 
 #include <sys/cdefs.h>
+#include <sys/featuretest.h>
 
 #define	_PATH_TTYS	"/etc/ttys"
 

Index: src/include/unistd.h
diff -u src/include/unistd.h:1.127.2.5 src/include/unistd.h:1.127.2.6
--- src/include/unistd.h:1.127.2.5	Wed Jan 23 00:05:21 2013
+++ src/include/unistd.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: unistd.h,v 1.127.2.5 2013/01/23 00:05:21 yamt Exp $	*/
+/*	$NetBSD: unistd.h,v 1.127.2.6 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2008 The NetBSD Foundation, Inc.
@@ -159,6 +159,16 @@ extern	 int optopt;
 #endif
 
 /*
+ * The Open Group Base Specifications, Issue 5; IEEE Std 1003.1-2001 (POSIX)
+ */
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+#if __SSP_FORTIFY_LEVEL == 0
+ssize_t	 readlink(const char * __restrict, char * __restrict, size_t);
+#endif
+#endif
+
+/*
  * The Open Group Base Specifications, Issue 6; IEEE Std 1003.1-2001 (POSIX)
  */
 #if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 600 || \
@@ -260,9 +270,6 @@ int	 lchown(const char *, uid_t, gid_t) 
 int	 lchown(const char *, uid_t, gid_t);
 #endif
 int	 lockf(int, int, off_t);
-#if __SSP_FORTIFY_LEVEL == 0
-ssize_t	 readlink(const char * __restrict, char * __restrict, size_t);
-#endif
 void	*sbrk(intptr_t);
 /* XXX prototype wrong! */
 int	 setpgrp(pid_t, pid_t);			/* obsoleted by setpgid() */
@@ -298,11 +305,7 @@ ssize_t	 pwrite(int, const void *, size_
     defined(_INCOMPLETE_XOPEN_C063) || defined(_NETBSD_SOURCE)
 int	linkat(int, const char *, int, const char *, int);
 int	renameat(int, const char *, int, const char *);
-int	mkfifoat(int, const char *, mode_t);
-int	mknodat(int, const char *, mode_t, uint32_t);
-int	mkdirat(int, const char *, mode_t);
 int	faccessat(int, const char *, int, int);
-int	fchmodat(int, const char *, mode_t, int);
 int	fchownat(int, const char *, uid_t, gid_t, int);
 int	readlinkat(int, const char *, char *, size_t);
 int	symlinkat(const char *, int, const char *);

Index: src/include/util.h
diff -u src/include/util.h:1.59.2.2 src/include/util.h:1.59.2.3
--- src/include/util.h:1.59.2.2	Wed Jan 16 05:32:23 2013
+++ src/include/util.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.h,v 1.59.2.2 2013/01/16 05:32:23 yamt Exp $	*/
+/*	$NetBSD: util.h,v 1.59.2.3 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1995
@@ -73,6 +73,7 @@ struct sockaddr;
 char	       *flags_to_string(unsigned long, const char *);
 pid_t		forkpty(int *, char *, struct termios *, struct winsize *);
 const char     *getbootfile(void);
+int		getbyteorder(void);
 off_t		getlabeloffset(void);
 int		getlabelsector(void);
 int		getlabelusesmbr(void);

Index: src/include/vis.h
diff -u src/include/vis.h:1.19.4.1 src/include/vis.h:1.19.4.2
--- src/include/vis.h:1.19.4.1	Wed Jan 23 00:05:21 2013
+++ src/include/vis.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vis.h,v 1.19.4.1 2013/01/23 00:05:21 yamt Exp $	*/
+/*	$NetBSD: vis.h,v 1.19.4.2 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -95,9 +95,12 @@ int	strsnvis(char *, size_t, const char 
 
 int	strvisx(char *, const char *, size_t, int);
 int	strnvisx(char *, size_t, const char *, size_t, int);
+int 	strenvisx(char *, size_t, const char *, size_t, int, int *);
 
 int	strsvisx(char *, const char *, size_t, int, const char *);
 int	strsnvisx(char *, size_t, const char *, size_t, int, const char *);
+int	strsenvisx(char *, size_t, const char *, size_t , int, const char *,
+    int *);
 
 int	strunvis(char *, const char *);
 int	strnunvis(char *, size_t, const char *);

Index: src/include/wchar.h
diff -u src/include/wchar.h:1.30 src/include/wchar.h:1.30.2.1
--- src/include/wchar.h:1.30	Sun Jul 17 20:54:34 2011
+++ src/include/wchar.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: wchar.h,v 1.30 2011/07/17 20:54:34 joerg Exp $	*/
+/*	$NetBSD: wchar.h,v 1.30.2.1 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*-
  * Copyright (c)1999 Citrus Project,
@@ -145,7 +145,8 @@ long int wcstol(const wchar_t * __restri
 double wcstod(const wchar_t * __restrict, wchar_t ** __restrict);
 
 #if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) > 199901L || \
-    defined(_NETBSD_SOURCE)
+    defined(_NETBSD_SOURCE) || \
+	(_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 600
 float wcstof(const wchar_t * __restrict, wchar_t ** __restrict);
 long double wcstold(const wchar_t * __restrict, wchar_t ** __restrict);
 
@@ -181,7 +182,8 @@ int vwprintf(const wchar_t * __restrict,
 int wprintf(const wchar_t * __restrict, ...);
 int wscanf(const wchar_t * __restrict, ...);
 #if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) > 199901L || \
-    defined(_NETBSD_SOURCE)
+    defined(_NETBSD_SOURCE) || \
+	(_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 600
 int vfwscanf(FILE * __restrict, const wchar_t * __restrict, __va_list);
 int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict,
     __va_list);
@@ -206,4 +208,83 @@ __END_DECLS
 #define putwc(wc, f) fputwc((wc), (f))
 #define putwchar(wc) putwc((wc), stdout)
 
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+__BEGIN_DECLS
+size_t	mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
+	    size_t, mbstate_t * __restrict);
+size_t	wcsnrtombs(char * __restrict, const wchar_t ** __restrict, size_t,
+	    size_t, mbstate_t * __restrict);
+
+int	wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
+size_t	wcsxfrm_l(wchar_t *, const wchar_t *, size_t, locale_t);
+int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
+int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
+
+size_t	wcsftime_l(wchar_t * __restrict, size_t, const wchar_t * __restrict,
+	    const struct tm * __restrict, locale_t);
+
+float wcstof_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t);
+double wcstod_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t);
+long double wcstold_l(const wchar_t * __restrict, wchar_t ** __restrict,
+    locale_t);
+long int wcstol_l(const wchar_t * __restrict, wchar_t ** __restrict, int,
+		  locale_t);
+unsigned long int wcstoul_l(const wchar_t * __restrict,
+	wchar_t ** __restrict, int, locale_t);
+/* LONGLONG */
+long long int wcstoll_l(const wchar_t * __restrict, wchar_t ** __restrict, int,
+			locale_t);
+/* LONGLONG */
+unsigned long long int wcstoull_l(const wchar_t * __restrict,
+				  wchar_t ** __restrict, int, locale_t);
+int	wcwidth_l(wchar_t, locale_t);
+int	wcswidth_l(const wchar_t *, size_t, locale_t);
+__END_DECLS
+#endif /* _POSIX_C_SOURCE || _NETBSD_SOURCE */
+
+#if defined(_NETBSD_SOURCE)
+__BEGIN_DECLS
+wint_t	btowc_l(int, locale_t);
+size_t	mbrlen_l(const char * __restrict, size_t, mbstate_t * __restrict,
+		locale_t);
+size_t	mbrtowc_l(wchar_t * __restrict, const char * __restrict, size_t,
+	    mbstate_t * __restrict, locale_t);
+int	mbsinit_l(const mbstate_t *, locale_t);
+size_t	mbsrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t,
+	    mbstate_t * __restrict, locale_t);
+size_t	mbsnrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t,
+	    size_t, mbstate_t * __restrict, locale_t);
+size_t	wcrtomb_l(char * __restrict, wchar_t, mbstate_t * __restrict, locale_t);
+size_t	wcsrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t,
+	    mbstate_t * __restrict, locale_t);
+size_t	wcsnrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t,
+	    size_t, mbstate_t * __restrict, locale_t);
+int	wctob_l(wint_t, locale_t);
+
+int fwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...);
+int swprintf_l(wchar_t * __restrict, size_t n, locale_t,
+    const wchar_t * __restrict, ...);
+int vfwprintf_l(FILE * __restrict, locale_t,
+    const wchar_t * __restrict, __va_list);
+int vswprintf_l(wchar_t * __restrict, size_t, locale_t,
+    const wchar_t * __restrict, __va_list);
+int vwprintf_l(locale_t, const wchar_t * __restrict, __va_list);
+int wprintf_l(locale_t, const wchar_t * __restrict, ...);
+
+int fwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...);
+int swscanf_l(const wchar_t * __restrict, locale_t, const wchar_t *
+    __restrict, ...);
+int wscanf_l(locale_t, const wchar_t * __restrict, ...);
+int vfwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict,
+    __va_list);
+int vswscanf_l(const wchar_t * __restrict, locale_t, const wchar_t * __restrict,
+    __va_list);
+int vwscanf_l(locale_t, const wchar_t * __restrict, __va_list);
+__END_DECLS
+#endif /* _NETBSD_SOURCE */
+
 #endif /* !_WCHAR_H_ */

Index: src/include/wctype.h
diff -u src/include/wctype.h:1.7 src/include/wctype.h:1.7.6.1
--- src/include/wctype.h:1.7	Sat Mar 27 22:14:09 2010
+++ src/include/wctype.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: wctype.h,v 1.7 2010/03/27 22:14:09 tnozaki Exp $	*/
+/*	$NetBSD: wctype.h,v 1.7.6.1 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*-
  * Copyright (c)1999 Citrus Project,
@@ -32,6 +32,7 @@
 #define	_WCTYPE_H_
 
 #include <sys/cdefs.h>
+#include <sys/featuretest.h>
 #include <sys/ansi.h>
 
 #ifdef	_BSD_WINT_T_
@@ -72,6 +73,31 @@ wint_t	towlower(wint_t);
 wint_t	towupper(wint_t);
 wctrans_t wctrans(const char *);
 wctype_t wctype(const char *);
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale		*locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+int	iswalnum_l(wint_t, locale_t);
+int	iswalpha_l(wint_t, locale_t);
+int	iswblank_l(wint_t, locale_t);
+int	iswcntrl_l(wint_t, locale_t);
+int	iswdigit_l(wint_t, locale_t);
+int	iswgraph_l(wint_t, locale_t);
+int	iswlower_l(wint_t, locale_t);
+int	iswprint_l(wint_t, locale_t);
+int	iswpunct_l(wint_t, locale_t);
+int	iswspace_l(wint_t, locale_t);
+int	iswupper_l(wint_t, locale_t);
+int	iswxdigit_l(wint_t, locale_t);
+int	iswctype_l(wint_t, wctype_t, locale_t);
+wint_t	towctrans_l(wint_t, wctrans_t, locale_t);
+wint_t	towlower_l(wint_t, locale_t);
+wint_t	towupper_l(wint_t, locale_t);
+wctrans_t wctrans_l(const char *, locale_t);
+wctype_t wctype_l(const char *, locale_t);
+#endif
 __END_DECLS
 
 #endif		/* _WCTYPE_H_ */

Index: src/include/rpc/svc.h
diff -u src/include/rpc/svc.h:1.24 src/include/rpc/svc.h:1.24.2.1
--- src/include/rpc/svc.h:1.24	Tue Aug 30 17:06:20 2011
+++ src/include/rpc/svc.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: svc.h,v 1.24 2011/08/30 17:06:20 plunky Exp $	*/
+/*	$NetBSD: svc.h,v 1.24.2.1 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -221,7 +221,7 @@ __END_DECLS
  *	SVCXPRT *xprt;
  */
 __BEGIN_DECLS
-extern void	xprt_register	(SVCXPRT *);
+extern bool_t	xprt_register	(SVCXPRT *);
 __END_DECLS
 
 /*

Index: src/include/rpcsvc/yp_prot.h
diff -u src/include/rpcsvc/yp_prot.h:1.17 src/include/rpcsvc/yp_prot.h:1.17.34.1
--- src/include/rpcsvc/yp_prot.h:1.17	Sat Oct  6 16:17:34 2007
+++ src/include/rpcsvc/yp_prot.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: yp_prot.h,v 1.17 2007/10/06 16:17:34 yamt Exp $	*/
+/*	$NetBSD: yp_prot.h,v 1.17.34.1 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993 Theo de Raadt <dera...@fsa.ca>
@@ -287,7 +287,7 @@ struct yppushresp_xfr {
 #define YPPUSH_AGE	((unsigned int)2)	/* Master's version not newer */
 #define YPPUSH_NOMAP 	((unsigned int)-1)	/* Can't find server for map */
 #define YPPUSH_NODOM 	((unsigned int)-2)	/* Domain not supported */
-#define YPPUSH_RSRC 	((unsigned int)-3)	/* Local resouce alloc failure */
+#define YPPUSH_RSRC 	((unsigned int)-3)	/* Local resource alloc failure */
 #define YPPUSH_RPC 	((unsigned int)-4)	/* RPC failure talking to server */
 #define YPPUSH_MADDR	((unsigned int)-5)	/* Can't get master address */
 #define YPPUSH_YPERR 	((unsigned int)-6)	/* YP server/map db error */

Index: src/include/ssp/string.h
diff -u src/include/ssp/string.h:1.4.8.1 src/include/ssp/string.h:1.4.8.2
--- src/include/ssp/string.h:1.4.8.1	Tue Oct 30 18:58:34 2012
+++ src/include/ssp/string.h	Thu May 22 11:36:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: string.h,v 1.4.8.1 2012/10/30 18:58:34 yamt Exp $	*/
+/*	$NetBSD: string.h,v 1.4.8.2 2014/05/22 11:36:35 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -31,12 +31,14 @@
 #ifndef _SSP_STRING_H_
 #define _SSP_STRING_H_
 
+#include <sys/cdefs.h>
 #include <ssp/ssp.h>
 
 __BEGIN_DECLS
 void *__memcpy_chk(void *, const void *, size_t, size_t);
 void *__memmove_chk(void *, void *, size_t, size_t);
 void *__memset_chk(void *, int, size_t, size_t);
+char *__stpcpy_chk(char *, const char *, size_t);
 char *__strcat_chk(char *, const char *, size_t);
 char *__strcpy_chk(char *, const char *, size_t);
 char *__strncat_chk(char *, const char *, size_t, size_t);
@@ -80,6 +82,8 @@ __BEGIN_DECLS
 __ssp_bos_icheck3_restrict(memcpy, void *, const void *)
 __ssp_bos_icheck3(memmove, void *, const void *)
 __ssp_bos_icheck3(memset, void *, int)
+__ssp_bos_icheck2_restrict(stpcpy, char *, const char *)
+__ssp_bos_icheck3_restrict(stpncpy, char *, const char *)
 __ssp_bos_icheck2_restrict(strcpy, char *, const char *)
 __ssp_bos_icheck2_restrict(strcat, char *, const char *)
 __ssp_bos_icheck3_restrict(strncpy, char *, const char *)
@@ -89,6 +93,10 @@ __END_DECLS
 #define memcpy(dst, src, len) __ssp_bos_check3(memcpy, dst, src, len)
 #define memmove(dst, src, len) __ssp_bos_check3(memmove, dst, src, len)
 #define memset(dst, val, len) __ssp_bos_check3(memset, dst, val, len)
+#define stpcpy(dst, src) __ssp_bos_check2(stpcpy, dst, src)
+#if __GNUC_PREREQ__(4,8) || defined(__clang__)
+#define stpncpy(dst, src, len) __ssp_bos_check3(stpncpy, dst, src, len)
+#endif
 #define strcpy(dst, src) __ssp_bos_check2(strcpy, dst, src)
 #define strcat(dst, src) __ssp_bos_check2(strcat, dst, src)
 #define strncpy(dst, src, len) __ssp_bos_check3(strncpy, dst, src, len)

Reply via email to