diff options
Diffstat (limited to 'src/lib/libc')
| -rw-r--r-- | src/lib/libc/string/strerror.3 | 58 |
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 |
| 47 | The | 47 | The |
| 48 | .Fn strerror | 48 | .Fn strerror |
| 49 | function returns a pointer to the language-dependent error message | 49 | and |
| 50 | string affiliated with the specified error number | 50 | .Fn strerror_r |
| 51 | .Fa errnum . | 51 | functions map the error number |
| 52 | The returned string contains a maximum of | 52 | .Fa errnum |
| 53 | to a language-dependent error message string. | ||
| 54 | .Pp | ||
| 55 | .Fn strerror | ||
| 56 | returns a string containing a maximum of | ||
| 53 | .Dv NL_TEXTMAX | 57 | .Dv NL_TEXTMAX |
| 54 | characters, including the trailing NUL. | 58 | characters, including the trailing NUL. |
| 55 | .Pp | 59 | This string is not to be modified by the calling program, |
| 56 | The array pointed to is not to be modified by the program, but may be | 60 | but may be overwritten by subsequent calls to |
| 57 | overwritten by subsequent calls to | ||
| 58 | .Fn strerror . | 61 | .Fn strerror . |
| 59 | .Pp | 62 | .Pp |
| 60 | .Fn strerror_r | 63 | .Fn strerror_r |
| 61 | is a thread safe version of | 64 | is a thread safe version of |
| 62 | .Fn strerror | 65 | .Fn strerror |
| 63 | that places the error message in the given buffer | 66 | that places the error message in the specified buffer |
| 64 | .Fa strerrbuf . | 67 | .Fa strerrbuf . |
| 65 | If the error message is larger then | 68 | .Sh RETURN VALUES |
| 66 | .Fa buflen | 69 | .Fn strerror |
| 67 | the message will be truncated to fit within buflen and | 70 | returns a pointer to the error message string. |
| 68 | .Er ERANGE | 71 | If an error occurs, the error code is stored in |
| 69 | is returned. | 72 | .Va errno . |
| 73 | .Pp | ||
| 70 | .Fn strerror_r | 74 | .Fn strerror_r |
| 71 | returns zero upon successful completion. | 75 | returns zero upon successful completion. |
| 72 | An error number is returned, otherwise. | 76 | If an error occurs, the error code is stored in |
| 77 | .Va errno | ||
| 78 | and the error code is returned. | ||
| 79 | .Sh ERRORS | ||
| 80 | .Fn strerror | ||
| 81 | and | ||
| 82 | .Fn strerror_r | ||
| 83 | may fail if: | ||
| 84 | .Bl -tag -width Er | ||
| 85 | .It Bq Er EINVAL | ||
| 86 | .Fa errnum | ||
| 87 | is not a valid error number. | ||
| 88 | The returned error string will consist of an error message that includes | ||
| 89 | .Fa errnum . | ||
| 90 | .El | ||
| 91 | .Pp | ||
| 92 | .Fn strerror_r | ||
| 93 | may fail if: | ||
| 94 | .Bl -tag -width Er | ||
| 95 | .It Bq Er ERANGE | ||
| 96 | The error message is larger then | ||
| 97 | .Fa buflen | ||
| 98 | characters. | ||
| 99 | The 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 , |
