summaryrefslogtreecommitdiff
path: root/src/lib/libc/string/strerror.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/string/strerror.3')
-rw-r--r--src/lib/libc/string/strerror.337
1 files changed, 28 insertions, 9 deletions
diff --git a/src/lib/libc/string/strerror.3 b/src/lib/libc/string/strerror.3
index c9d8504dbb..fa573bc72a 100644
--- a/src/lib/libc/string/strerror.3
+++ b/src/lib/libc/string/strerror.3
@@ -13,11 +13,7 @@
13.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\" notice, this list of conditions and the following disclaimer in the 14.\" notice, this list of conditions and the following disclaimer in the
15.\" documentation and/or other materials provided with the distribution. 15.\" documentation and/or other materials provided with the distribution.
16.\" 3. All advertising materials mentioning features or use of this software 16.\" 3. Neither the name of the University nor the names of its contributors
17.\" must display the following acknowledgement:
18.\" This product includes software developed by the University of
19.\" California, Berkeley and its contributors.
20.\" 4. Neither the name of the University nor the names of its contributors
21.\" may be used to endorse or promote products derived from this software 17.\" may be used to endorse or promote products derived from this software
22.\" without specific prior written permission. 18.\" without specific prior written permission.
23.\" 19.\"
@@ -33,12 +29,11 @@
33.\" 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
34.\" SUCH DAMAGE. 30.\" SUCH DAMAGE.
35.\" 31.\"
36.\" from: @(#)strerror.3 6.9 (Berkeley) 6/29/91 32.\" $OpenBSD: strerror.3,v 1.6 2003/06/02 20:18:38 millert Exp $
37.\" $Id: strerror.3,v 1.1.1.1 1995/10/18 08:42:22 deraadt Exp $
38.\" 33.\"
39.Dd June 29, 1991 34.Dd June 29, 1991
40.Dt STRERROR 3 35.Dt STRERROR 3
41.Os BSD 4 36.Os
42.Sh NAME 37.Sh NAME
43.Nm strerror 38.Nm strerror
44.Nd get error message string 39.Nd get error message string
@@ -46,15 +41,35 @@
46.Fd #include <string.h> 41.Fd #include <string.h>
47.Ft char * 42.Ft char *
48.Fn strerror "int errnum" 43.Fn strerror "int errnum"
44.Ft int
45.Fn strerror_r "int errnum" "char *strerrbuf" "size_t buflen"
49.Sh DESCRIPTION 46.Sh DESCRIPTION
50The 47The
51.Fn strerror 48.Fn strerror
52function returns a pointer to the language-dependent error message 49function returns a pointer to the language-dependent error message
53string affiliated with an error number. 50string affiliated with the specified error number
51.Fa errnum .
52The returned string contains a maximum of
53.Dv NL_TEXTMAX
54characters, including the trailing NUL.
54.Pp 55.Pp
55The array pointed to is not to be modified by the program, but may be 56The array pointed to is not to be modified by the program, but may be
56overwritten by subsequent calls to 57overwritten by subsequent calls to
57.Fn strerror . 58.Fn strerror .
59.Pp
60.Fn strerror_r
61is a thread safe version of
62.Fn strerror
63that places the error message in the given buffer
64.Fa strerrbuf .
65If the error message is larger then
66.Fa buflen
67the message will be truncated to fit within buflen and
68.Er ERANGE
69is returned.
70.Fn strerror_r
71returns zero upon successful completion.
72An error number is returned, otherwise.
58.Sh SEE ALSO 73.Sh SEE ALSO
59.Xr intro 2 , 74.Xr intro 2 ,
60.Xr perror 3 , 75.Xr perror 3 ,
@@ -64,3 +79,7 @@ The
64.Fn strerror 79.Fn strerror
65function conforms to 80function conforms to
66.St -ansiC . 81.St -ansiC .
82The
83.Fn strerror_r
84function conforms to
85.St -p1003.1 .