poll tests: Avoid test failure on BSD and Solaris systems.
[gnulib.git] / doc / posix-functions / strerror_r.texi
blob123d7f385ada4aadfb7b09bc25a660d1b549f103
1 @node strerror_r
2 @section @code{strerror_r}
3 @findex strerror_r
5 POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9699919799/functions/strerror_r.html}
7 LSB specification:
8 @itemize
9 @item
10 @url{https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib-strerror-r.html}
11 @item
12 @url{https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib---xpg-strerror-r.html}
13 @end itemize
15 Gnulib module: strerror_r-posix
17 Portability problems fixed by Gnulib:
18 @itemize
19 @item
20 This function is missing on some platforms:
21 NetBSD 3.0, Minix 3.1.8, HP-UX 11.23, IRIX 6.5, Solaris 9, mingw, MSVC 14.
22 @item
23 glibc, Cygwin, and Android have an incompatible version of this function.
24 The POSIX compliant code
25 @smallexample
26 char *s = (strerror_r (err, buf, buflen) == 0 ? buf : NULL);
27 @end smallexample
28 is essentially equivalent to this code using the glibc function:
29 @smallexample
30 char *s = strerror_r (err, buf, buflen);
31 @end smallexample
32 @item
33 This function clobbers the @code{strerror} buffer on some platforms:
34 Cygwin 1.7.9.
35 @item
36 This function is sometimes not declared in @code{<string.h>} on some platforms:
37 glibc 2.8.
38 @item
39 The third argument is of type @code{int} instead of @code{size_t} on some
40 platforms:
41 AIX 5.1.
42 @item
43 When this function fails, it returns @minus{}1 and sets @code{errno}, instead of
44 returning the error number, on some platforms:
45 glibc 2.12 with @code{-D_POSIX_C_SOURCE=200112L}, AIX 6.1.
46 @item
47 When this function fails, it corrupts @code{errno}, on some platforms:
48 Solaris 10.
49 @item
50 This function does not support many error values defined in @code{<errno.h>} on
51 some platforms:
52 MSVC 14.
53 @item
54 This function does not support the error values that are specified by POSIX
55 but not defined by the system, on some platforms:
56 OpenBSD 4.0, NonStop Kernel, Cygwin 1.5.x.
57 @item
58 This function reports failure for @code{strerror_r(0, buf, len)},
59 although POSIX requires this to succeed, on some platforms:
60 FreeBSD 8.2.
61 @item
62 This function produces a different string for @code{0} than
63 @code{strerror} on some platforms:
64 Mac OS X 10.13.
65 @item
66 This function always fails when the third argument is less than 80 on some
67 platforms:
68 HP-UX 11.31.
69 @item
70 When the buffer is too small and the value is in range, this function
71 does not fail, but instead truncates the result and returns 0 on some
72 platforms:
73 AIX 6.1, Haiku 2017.
74 @item
75 When the value is not in range or the buffer is too small, this
76 function fails to leave a NUL-terminated string in the buffer on some
77 platforms:
78 glibc 2.13, FreeBSD 8.2, Solaris 10.
79 @item
80 When the value is out of range but the buffer is too small, this
81 function does not always return the longest possible string on some
82 platforms:
83 OpenBSD 4.7.
84 @end itemize
86 Portability problems not fixed by Gnulib:
87 @itemize
88 @end itemize