summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormillert <>2004-05-03 14:37:59 +0000
committermillert <>2004-05-03 14:37:59 +0000
commit93ef721c4aced997f082c99d8f900fa2b74a7f02 (patch)
tree4ea126c3d8bf5dd954dba02fbe8db2c8a65f8d1b
parent76aa3dd62e5e4b02cca65819f1c8d9938aec06fd (diff)
downloadopenbsd-93ef721c4aced997f082c99d8f900fa2b74a7f02.tar.gz
openbsd-93ef721c4aced997f082c99d8f900fa2b74a7f02.tar.bz2
openbsd-93ef721c4aced997f082c99d8f900fa2b74a7f02.zip
Do a better job of documenting strerror_r() and add an ERRORS section.
-rw-r--r--src/lib/libc/string/strerror.358
1 files changed, 43 insertions, 15 deletions
diff --git a/src/lib/libc/string/strerror.3 b/src/lib/libc/string/strerror.3
index fa573bc72a..8cdaa67feb 100644
--- a/src/lib/libc/string/strerror.3
+++ b/src/lib/libc/string/strerror.3
@@ -29,7 +29,7 @@
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.\" $OpenBSD: strerror.3,v 1.6 2003/06/02 20:18:38 millert Exp $ 32.\" $OpenBSD: strerror.3,v 1.7 2004/05/03 14:37:59 millert Exp $
33.\" 33.\"
34.Dd June 29, 1991 34.Dd June 29, 1991
35.Dt STRERROR 3 35.Dt STRERROR 3
@@ -46,30 +46,58 @@
46.Sh DESCRIPTION 46.Sh DESCRIPTION
47The 47The
48.Fn strerror 48.Fn strerror
49function returns a pointer to the language-dependent error message 49and
50string affiliated with the specified error number 50.Fn strerror_r
51.Fa errnum . 51functions map the error number
52The returned string contains a maximum of 52.Fa errnum
53to a language-dependent error message string.
54.Pp
55.Fn strerror
56returns a string containing a maximum of
53.Dv NL_TEXTMAX 57.Dv NL_TEXTMAX
54characters, including the trailing NUL. 58characters, including the trailing NUL.
55.Pp 59This string is not to be modified by the calling program,
56The array pointed to is not to be modified by the program, but may be 60but may be overwritten by subsequent calls to
57overwritten by subsequent calls to
58.Fn strerror . 61.Fn strerror .
59.Pp 62.Pp
60.Fn strerror_r 63.Fn strerror_r
61is a thread safe version of 64is a thread safe version of
62.Fn strerror 65.Fn strerror
63that places the error message in the given buffer 66that places the error message in the specified buffer
64.Fa strerrbuf . 67.Fa strerrbuf .
65If the error message is larger then 68.Sh RETURN VALUES
66.Fa buflen 69.Fn strerror
67the message will be truncated to fit within buflen and 70returns a pointer to the error message string.
68.Er ERANGE 71If an error occurs, the error code is stored in
69is returned. 72.Va errno .
73.Pp
70.Fn strerror_r 74.Fn strerror_r
71returns zero upon successful completion. 75returns zero upon successful completion.
72An error number is returned, otherwise. 76If an error occurs, the error code is stored in
77.Va errno
78and the error code is returned.
79.Sh ERRORS
80.Fn strerror
81and
82.Fn strerror_r
83may fail if:
84.Bl -tag -width Er
85.It Bq Er EINVAL
86.Fa errnum
87is not a valid error number.
88The returned error string will consist of an error message that includes
89.Fa errnum .
90.El
91.Pp
92.Fn strerror_r
93may fail if:
94.Bl -tag -width Er
95.It Bq Er ERANGE
96The error message is larger then
97.Fa buflen
98characters.
99The message will be truncated to fit.
100.El
73.Sh SEE ALSO 101.Sh SEE ALSO
74.Xr intro 2 , 102.Xr intro 2 ,
75.Xr perror 3 , 103.Xr perror 3 ,