Module Name:    src
Committed By:   christos
Date:           Thu Jan 12 00:35:38 UTC 2017

Modified Files:
        src/lib/libc/include: extern.h namespace.h
        src/lib/libc/string: Makefile.inc
Added Files:
        src/lib/libc/string: strerror_ss.c

Log Message:
Add strerror_ss_r to be used by syslog_ss


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/lib/libc/include/extern.h
cvs rdiff -u -r1.182 -r1.183 src/lib/libc/include/namespace.h
cvs rdiff -u -r1.82 -r1.83 src/lib/libc/string/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/lib/libc/string/strerror_ss.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/include/extern.h
diff -u src/lib/libc/include/extern.h:1.23 src/lib/libc/include/extern.h:1.24
--- src/lib/libc/include/extern.h:1.23	Mon Aug 19 09:03:12 2013
+++ src/lib/libc/include/extern.h	Wed Jan 11 19:35:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.23 2013/08/19 13:03:12 joerg Exp $	*/
+/*	$NetBSD: extern.h,v 1.24 2017/01/12 00:35:38 christos Exp $	*/
 
 /*
  * Copyright (c) 1997 Christos Zoulas.  All rights reserved.
@@ -72,4 +72,6 @@ void	_malloc_postfork(void);
 
 int	_sys_setcontext(const ucontext_t *);
 
+int	strerror_r_ss(int, char *, size_t);
+
 __END_DECLS

Index: src/lib/libc/include/namespace.h
diff -u src/lib/libc/include/namespace.h:1.182 src/lib/libc/include/namespace.h:1.183
--- src/lib/libc/include/namespace.h:1.182	Sat Sep 24 17:31:25 2016
+++ src/lib/libc/include/namespace.h	Wed Jan 11 19:35:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: namespace.h,v 1.182 2016/09/24 21:31:25 christos Exp $	*/
+/*	$NetBSD: namespace.h,v 1.183 2017/01/12 00:35:38 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
@@ -60,6 +60,7 @@
 #define sbrk		_sbrk
 #define strerror_l	_strerror_l
 #define strerror_r	_strerror_r
+#define strerror_r_ss	_strerror_r_ss
 #define strlcat		_strlcat
 #define strlcpy		_strlcpy
 #define strtod_l	_strtod_l

Index: src/lib/libc/string/Makefile.inc
diff -u src/lib/libc/string/Makefile.inc:1.82 src/lib/libc/string/Makefile.inc:1.83
--- src/lib/libc/string/Makefile.inc:1.82	Sat Oct 15 10:22:00 2016
+++ src/lib/libc/string/Makefile.inc	Wed Jan 11 19:35:38 2017
@@ -1,5 +1,5 @@
 #	from: @(#)Makefile.inc	8.1 (Berkeley) 6/4/93
-#	$NetBSD: Makefile.inc,v 1.82 2016/10/15 14:22:00 kamil Exp $
+#	$NetBSD: Makefile.inc,v 1.83 2017/01/12 00:35:38 christos Exp $
 
 # string sources
 .PATH: ${ARCHDIR}/string ${.CURDIR}/string
@@ -10,7 +10,7 @@
 
 SRCS+=	bm.c stpcpy.c stpncpy.c \
 	strcasecmp.c strncasecmp.c strcasestr.c strcoll.c strdup.c \
-	strerror.c strlcat.c strlcpy.c strnlen.c \
+	strerror.c strerror_ss.c strlcat.c strlcpy.c strnlen.c \
 	strmode.c strsignal.c strtok.c \
 	strtok_r.c strxfrm.c __strsignal.c strerror_r.c strndup.c \
 	stresep.c memrchr.c

Added files:

Index: src/lib/libc/string/strerror_ss.c
diff -u /dev/null src/lib/libc/string/strerror_ss.c:1.1
--- /dev/null	Wed Jan 11 19:35:38 2017
+++ src/lib/libc/string/strerror_ss.c	Wed Jan 11 19:35:38 2017
@@ -0,0 +1,65 @@
+/*	$NetBSD: strerror_ss.c,v 1.1 2017/01/12 00:35:38 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2017 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: strerror_ss.c,v 1.1 2017/01/12 00:35:38 christos Exp $");
+
+#include "namespace.h"
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "extern.h"
+
+#ifdef __weak_alias
+__weak_alias(strerror_r_ss,_strerror_r_ss)
+#endif
+
+int
+strerror_r_ss(int num, char *buf, size_t len)
+{
+	if (num >= 0 || num < sys_nerr)
+		strlcpy(buf, sys_errlist[num], len);
+	else
+		snprintf_ss(buf, len, "Unknown error %d", num);
+	return 0;
+}
+
+#ifdef notyet
+__aconst char *
+strerror_ss(int num)
+{
+	static char buf[64];
+
+	strerror_r_ss(num, buf, sizeof(buf));
+	return buf;
+}
+#endif

Reply via email to