diff options
author | wes <wes@FreeBSD.org> | 2001-11-27 07:39:46 +0000 |
---|---|---|
committer | wes <wes@FreeBSD.org> | 2001-11-27 07:39:46 +0000 |
commit | bdb2c68332b68e36058dc5c28babfde3e25eb657 (patch) | |
tree | b90fb7c1ae21a4aea48bd726dac9ed2e1334e2f1 /lib/libc/string/strerror.3 | |
parent | 2181f49061145e58c15976406275f1c9fd4b82f9 (diff) | |
download | FreeBSD-src-bdb2c68332b68e36058dc5c28babfde3e25eb657.zip FreeBSD-src-bdb2c68332b68e36058dc5c28babfde3e25eb657.tar.gz |
Add strerror_r function per Posix prototype.
Reviewed by: Mike Barcroft <mike@FreeBSD.org>
MFC after: 2 weeks
Diffstat (limited to 'lib/libc/string/strerror.3')
-rw-r--r-- | lib/libc/string/strerror.3 | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/lib/libc/string/strerror.3 b/lib/libc/string/strerror.3 index 447e208..ed63b25 100644 --- a/lib/libc/string/strerror.3 +++ b/lib/libc/string/strerror.3 @@ -36,12 +36,13 @@ .\" @(#)strerror.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd June 9, 1993 +.Dd Nov 26, 2001 .Dt STRERROR 3 .Os .Sh NAME .Nm perror , .Nm strerror , +.Nm strerror_r , .Nm sys_errlist , .Nm sys_nerr .Nd system error messages @@ -56,9 +57,12 @@ .In string.h .Ft char * .Fn strerror "int errnum" +.Ft int +.Fn strerror_r "int errnum" "char * strerrbuf" "size_t buflen" .Sh DESCRIPTION The -.Fn strerror +.Fn strerror , +.Fn strerror_r and .Fn perror functions look up the error message string corresponding to an @@ -68,11 +72,27 @@ The .Fn strerror function accepts an error number argument .Fa errnum -and -returns a pointer to the corresponding +and returns a pointer to the corresponding message string. .Pp The +.Fn strerror_r +function renders the same result into +.Fa strerrbuf +for a maximum of +.Fa buflen +characters and returns 0 upon success. If insufficient +storage is provided in +.Fa strerrbuf +(as specified in +.Fa buflen ) +to contain the error string, +.Er ERANGE +is returned and the string in +.Fa strerrbuf +may not be null-terminated. +.Pp +The .Fn perror function finds the error message corresponding to the current value of the global variable @@ -107,6 +127,8 @@ contains a count of the messages in .Va sys_errlist . The use of these variables is deprecated; .Fn strerror +or +.Fn strerror_r should be used instead. .Sh SEE ALSO .Xr intro 2 , @@ -118,6 +140,13 @@ and .Fn perror functions first appeared in .Bx 4.4 . +The +.Fn strerror_r +function was implemented in +.Fx 4.4 +by +.An Wes Peters +.Aq wes@freebsd.org . .Sh BUGS For unknown error numbers, the .Fn strerror |