diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libc/string/strerror.3 | 89 |
1 files changed, 73 insertions, 16 deletions
diff --git a/src/lib/libc/string/strerror.3 b/src/lib/libc/string/strerror.3 index c9d8504dbb..264ac39052 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,28 +29,76 @@ | |||
| 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.13 2014/04/07 17:57:56 schwarze 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 $Mdocdate: April 7 2014 $ |
| 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 , |
| 39 | .Nm strerror_r | ||
| 44 | .Nd get error message string | 40 | .Nd get error message string |
| 45 | .Sh SYNOPSIS | 41 | .Sh SYNOPSIS |
| 46 | .Fd #include <string.h> | 42 | .In string.h |
| 47 | .Ft char * | 43 | .Ft char * |
| 48 | .Fn strerror "int errnum" | 44 | .Fn strerror "int errnum" |
| 45 | .Ft int | ||
| 46 | .Fn strerror_r "int errnum" "char *strerrbuf" "size_t buflen" | ||
| 49 | .Sh DESCRIPTION | 47 | .Sh DESCRIPTION |
| 50 | The | 48 | The |
| 51 | .Fn strerror | 49 | .Fn strerror |
| 52 | function returns a pointer to the language-dependent error message | 50 | and |
| 53 | string affiliated with an error number. | 51 | .Fn strerror_r |
| 52 | functions map the error number | ||
| 53 | .Fa errnum | ||
| 54 | to a language-dependent error message string. | ||
| 54 | .Pp | 55 | .Pp |
| 55 | The array pointed to is not to be modified by the program, but may be | 56 | .Fn strerror |
| 56 | overwritten by subsequent calls to | 57 | returns a string containing a maximum of |
| 58 | .Dv NL_TEXTMAX | ||
| 59 | characters, including the trailing NUL. | ||
| 60 | This string is not to be modified by the calling program, | ||
| 61 | but may be overwritten by subsequent calls to | ||
| 57 | .Fn strerror . | 62 | .Fn strerror . |
| 63 | .Pp | ||
| 64 | .Fn strerror_r | ||
| 65 | is a thread safe version of | ||
| 66 | .Fn strerror | ||
| 67 | that places the error message in the specified buffer | ||
| 68 | .Fa strerrbuf . | ||
| 69 | .Sh RETURN VALUES | ||
| 70 | .Fn strerror | ||
| 71 | returns a pointer to the error message string. | ||
| 72 | If an error occurs, the error code is stored in | ||
| 73 | .Va errno . | ||
| 74 | .Pp | ||
| 75 | .Fn strerror_r | ||
| 76 | returns zero upon successful completion. | ||
| 77 | If an error occurs, the error code is stored in | ||
| 78 | .Va errno | ||
| 79 | and the error code is returned. | ||
| 80 | .Sh ERRORS | ||
| 81 | .Fn strerror | ||
| 82 | and | ||
| 83 | .Fn strerror_r | ||
| 84 | may fail if: | ||
| 85 | .Bl -tag -width Er | ||
| 86 | .It Bq Er EINVAL | ||
| 87 | .Fa errnum | ||
| 88 | is not a valid error number. | ||
| 89 | The returned error string will consist of an error message that includes | ||
| 90 | .Fa errnum . | ||
| 91 | .El | ||
| 92 | .Pp | ||
| 93 | .Fn strerror_r | ||
| 94 | may fail if: | ||
| 95 | .Bl -tag -width Er | ||
| 96 | .It Bq Er ERANGE | ||
| 97 | The error message is larger than | ||
| 98 | .Fa buflen | ||
| 99 | characters. | ||
| 100 | The message will be truncated to fit. | ||
| 101 | .El | ||
| 58 | .Sh SEE ALSO | 102 | .Sh SEE ALSO |
| 59 | .Xr intro 2 , | 103 | .Xr intro 2 , |
| 60 | .Xr perror 3 , | 104 | .Xr perror 3 , |
| @@ -63,4 +107,17 @@ overwritten by subsequent calls to | |||
| 63 | The | 107 | The |
| 64 | .Fn strerror | 108 | .Fn strerror |
| 65 | function conforms to | 109 | function conforms to |
| 66 | .St -ansiC . | 110 | .St -ansiC-99 . |
| 111 | The | ||
| 112 | .Fn strerror_r | ||
| 113 | function conforms to | ||
| 114 | .St -p1003.1-2008 . | ||
| 115 | .Sh HISTORY | ||
| 116 | The | ||
| 117 | .Fn strerror | ||
| 118 | function first appeared in | ||
| 119 | .Bx 4.3 Reno . | ||
| 120 | The | ||
| 121 | .Fn strerror_r | ||
| 122 | function first appeared in | ||
| 123 | .Ox 3.3 . | ||
