Wed Jul 22 19:48:27 2009 UTC ()
Declare strsignal(3) in <string.h>, per POSIX-2008, and adjust
documentation accordingly.

Fixes PR standards/41325 from Perry E. Metzger.


(kleink)
diff -r1.38 -r1.39 src/include/string.h
diff -r1.120 -r1.121 src/include/unistd.h
diff -r1.9 -r1.10 src/lib/libc/string/strsignal.3
diff -r1.13 -r1.14 src/lib/libc/string/strsignal.c

cvs diff -r1.38 -r1.39 src/include/string.h (expand / switch to unified diff)

--- src/include/string.h 2009/05/01 20:01:23 1.38
+++ src/include/string.h 2009/07/22 19:48:27 1.39
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: string.h,v 1.38 2009/05/01 20:01:23 perry Exp $ */ 1/* $NetBSD: string.h,v 1.39 2009/07/22 19:48:27 kleink Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1990, 1993 4 * Copyright (c) 1990, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -74,33 +74,36 @@ int strerror_r(int, char *, size_t); @@ -74,33 +74,36 @@ int strerror_r(int, char *, size_t);
74#endif /* _POSIX_C_SOURCE >= 199506 || XOPEN_SOURCE >= 500 || ... */ 74#endif /* _POSIX_C_SOURCE >= 199506 || XOPEN_SOURCE >= 500 || ... */
75size_t strxfrm(char * __restrict, const char * __restrict, size_t); 75size_t strxfrm(char * __restrict, const char * __restrict, size_t);
76 76
77#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) 77#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
78void *memccpy(void *, const void *, int, size_t); 78void *memccpy(void *, const void *, int, size_t);
79char *strdup(const char *); 79char *strdup(const char *);
80#endif 80#endif
81 81
82#if (_POSIX_C_SOURCE - 0 >= 200809L) || (_XOPEN_SOURCE - 0 >= 700) || \ 82#if (_POSIX_C_SOURCE - 0 >= 200809L) || (_XOPEN_SOURCE - 0 >= 700) || \
83 defined(_NETBSD_SOURCE) 83 defined(_NETBSD_SOURCE)
84char *stpcpy(char * __restrict, const char * __restrict); 84char *stpcpy(char * __restrict, const char * __restrict);
85char *stpncpy(char * __restrict, const char * __restrict, size_t); 85char *stpncpy(char * __restrict, const char * __restrict, size_t);
86size_t strnlen(const char *, size_t); 86size_t strnlen(const char *, size_t);
 87#ifndef __STRSIGNAL_DECLARED
 88#define __STRSIGNAL_DECLARED
 89/* also in unistd.h */
 90__aconst char *strsignal(int);
 91#endif /* __STRSIGNAL_DECLARED */
87/* 92/*
88 * For POSIX compliance, we still need: 93 * For POSIX compliance, we still need:
89 * strcoll_l 94 * strcoll_l
90 * strerror_l 95 * strerror_l
91 * strxfrm_l 96 * strxfrm_l
92 * 
93 * and strsignal needs to be moved from unistd.h to here. 
94 */ 97 */
95#endif 98#endif
96 99
97#if defined(_NETBSD_SOURCE) 100#if defined(_NETBSD_SOURCE)
98#include <strings.h> /* for backwards-compatibilty */ 101#include <strings.h> /* for backwards-compatibilty */
99void *memmem(const void *, size_t, const void *, size_t); 102void *memmem(const void *, size_t, const void *, size_t);
100char *strcasestr(const char *, const char *); 103char *strcasestr(const char *, const char *);
101size_t strlcat(char *, const char *, size_t); 104size_t strlcat(char *, const char *, size_t);
102size_t strlcpy(char *, const char *, size_t); 105size_t strlcpy(char *, const char *, size_t);
103char *strsep(char **, const char *); 106char *strsep(char **, const char *);
104char *stresep(char **, const char *, int); 107char *stresep(char **, const char *, int);
105char *strndup(const char *, size_t); 108char *strndup(const char *, size_t);
106void *memrchr(const void *, int, size_t); 109void *memrchr(const void *, int, size_t);

cvs diff -r1.120 -r1.121 src/include/unistd.h (expand / switch to unified diff)

--- src/include/unistd.h 2009/01/11 03:04:12 1.120
+++ src/include/unistd.h 2009/07/22 19:48:27 1.121
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: unistd.h,v 1.120 2009/01/11 03:04:12 christos Exp $ */ 1/* $NetBSD: unistd.h,v 1.121 2009/07/22 19:48:27 kleink Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998, 1999, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 1999, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Klaus Klein. 8 * by Klaus Klein.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -317,27 +317,31 @@ int reboot(int, char *); @@ -317,27 +317,31 @@ int reboot(int, char *);
317int revoke(const char *); 317int revoke(const char *);
318int rresvport(int *); 318int rresvport(int *);
319int ruserok(const char *, int, const char *, const char *); 319int ruserok(const char *, int, const char *, const char *);
320int setdomainname(const char *, size_t); 320int setdomainname(const char *, size_t);
321int setgroups(int, const gid_t *); 321int setgroups(int, const gid_t *);
322int sethostid(long); 322int sethostid(long);
323int sethostname(const char *, size_t); 323int sethostname(const char *, size_t);
324int setlogin(const char *); 324int setlogin(const char *);
325void *setmode(const char *); 325void *setmode(const char *);
326int setrgid(gid_t); 326int setrgid(gid_t);
327int setruid(uid_t); 327int setruid(uid_t);
328void setusershell(void); 328void setusershell(void);
329void strmode(mode_t, char *); 329void strmode(mode_t, char *);
 330#ifndef __STRSIGNAL_DECLARED
 331#define __STRSIGNAL_DECLARED
 332/* backwards-compatibility; also in string.h */
330__aconst char *strsignal(int); 333__aconst char *strsignal(int);
 334#endif /* __STRSIGNAL_DECLARED */
331int swapctl(int, void *, int); 335int swapctl(int, void *, int);
332int swapon(const char *); /* obsoleted by swapctl() */ 336int swapon(const char *); /* obsoleted by swapctl() */
333int syscall(int, ...); 337int syscall(int, ...);
334quad_t __syscall(quad_t, ...); 338quad_t __syscall(quad_t, ...);
335int undelete(const char *); 339int undelete(const char *);
336 340
337#if 1 /*INET6*/ 341#if 1 /*INET6*/
338int rcmd_af(char **, int, const char *, 342int rcmd_af(char **, int, const char *,
339 const char *, const char *, int *, int); 343 const char *, const char *, int *, int);
340int rresvport_af(int *, int); 344int rresvport_af(int *, int);
341int iruserok_sa(const void *, int, int, const char *, const char *); 345int iruserok_sa(const void *, int, int, const char *, const char *);
342#endif 346#endif
343 347

cvs diff -r1.9 -r1.10 src/lib/libc/string/strsignal.3 (expand / switch to unified diff)

--- src/lib/libc/string/strsignal.3 2003/08/07 16:43:52 1.9
+++ src/lib/libc/string/strsignal.3 2009/07/22 19:48:27 1.10
@@ -20,40 +20,45 @@ @@ -20,40 +20,45 @@
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE. 30.\" SUCH DAMAGE.
31.\" 31.\"
32.\" from: @(#)strerror.3 6.9 (Berkeley) 6/29/91 32.\" from: @(#)strerror.3 6.9 (Berkeley) 6/29/91
33.\" $NetBSD: strsignal.3,v 1.9 2003/08/07 16:43:52 agc Exp $ 33.\" $NetBSD: strsignal.3,v 1.10 2009/07/22 19:48:27 kleink Exp $
34.\" 34.\"
35.Dd June 29, 1991 35.Dd July 22, 2009
36.Dt STRSIGNAL 3 36.Dt STRSIGNAL 3
37.Os 37.Os
38.Sh NAME 38.Sh NAME
39.Nm strsignal 39.Nm strsignal
40.Nd get signal description string 40.Nd get signal description string
41.Sh LIBRARY 41.Sh LIBRARY
42.Lb libc 42.Lb libc
43.Sh SYNOPSIS 43.Sh SYNOPSIS
44.In unistd.h 44.In string.h
45.Ft char * 45.Ft char *
46.Fn strsignal "int sig" 46.Fn strsignal "int sig"
47.Sh DESCRIPTION 47.Sh DESCRIPTION
48The 48The
49.Fn strsignal 49.Fn strsignal
50function returns a pointer to the language-dependent string describing 50function returns a pointer to the language-dependent string describing
51a signal. 51a signal.
52.Pp 52.Pp
53The array pointed to is not to be modified by the program, but may be 53The array pointed to is not to be modified by the program, but may be
54overwritten by subsequent calls to 54overwritten by subsequent calls to
55.Fn strsignal . 55.Fn strsignal .
56.Sh SEE ALSO 56.Sh SEE ALSO
57.Xr intro 2 , 57.Xr intro 2 ,
58.Xr psignal 3 , 58.Xr psignal 3 ,
59.Xr setlocale 3 59.Xr setlocale 3
 60.\" .Sh STANDARDS
 61.\" The
 62.\" .Fn strsignal
 63.\" function conforms to
 64.\" .St -p1003.1-2008 .

cvs diff -r1.13 -r1.14 src/lib/libc/string/strsignal.c (expand / switch to unified diff)

--- src/lib/libc/string/strsignal.c 2005/11/29 03:12:00 1.13
+++ src/lib/libc/string/strsignal.c 2009/07/22 19:48:27 1.14
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: strsignal.c,v 1.13 2005/11/29 03:12:00 christos Exp $ */ 1/* $NetBSD: strsignal.c,v 1.14 2009/07/22 19:48:27 kleink Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1988 Regents of the University of California. 4 * Copyright (c) 1988 Regents of the University of California.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -24,32 +24,32 @@ @@ -24,32 +24,32 @@
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33#if defined(LIBC_SCCS) && !defined(lint) 33#if defined(LIBC_SCCS) && !defined(lint)
34#if 0 34#if 0
35static char *sccsid = "@(#)strerror.c 5.6 (Berkeley) 5/4/91"; 35static char *sccsid = "@(#)strerror.c 5.6 (Berkeley) 5/4/91";
36#else 36#else
37__RCSID("$NetBSD: strsignal.c,v 1.13 2005/11/29 03:12:00 christos Exp $"); 37__RCSID("$NetBSD: strsignal.c,v 1.14 2009/07/22 19:48:27 kleink Exp $");
38#endif 38#endif
39#endif /* LIBC_SCCS and not lint */ 39#endif /* LIBC_SCCS and not lint */
40 40
41#include "namespace.h" 41#include "namespace.h"
42#include <unistd.h> 42#include <string.h>
43#include <limits.h> 43#include <limits.h>
44#include "extern.h" 44#include "extern.h"
45 45
46#ifdef __weak_alias 46#ifdef __weak_alias
47__weak_alias(strsignal,_strsignal) 47__weak_alias(strsignal,_strsignal)
48#endif 48#endif
49 49
50__aconst char * 50__aconst char *
51strsignal(sig) 51strsignal(sig)
52 int sig; 52 int sig;
53{ 53{
54 static char buf[NL_TEXTMAX]; 54 static char buf[NL_TEXTMAX];
55 55