On 2023-08-13 22:21, Alejandro Colomar wrote: > From: Shani Leviim <sleviim@xxxxxxxxxx> > > The information in this patch was obtained from a glibc upstream patch, > commit ID 28aff047818eb1726394296d27b9c7885340bead > > According the patch above, for glibc versions >=2.32, > strerror() is considered MT-Safe, and the man page should be changed accordingly. > > Signed-off-by: Shani Leviim <sleviim@xxxxxxxxxx> > Cc: Florian Weimer <fweimer@xxxxxxxxxx> > Cc: Carlos O'Donell <carlos@xxxxxxxxxx> > Cc: Sergei Gromeniuk <sgromeni@xxxxxxxxxx> > Cc: Gobinda Das <godas@xxxxxxxxxx> > Signed-off-by: Alejandro Colomar <alx@xxxxxxxxxx> > --- Patch applied. Cheers, Alex > > v3: Added the CCs from the original thread. > > man3/strerror.3 | 31 +++++++++++++++---------------- > 1 file changed, 15 insertions(+), 16 deletions(-) > > diff --git a/man3/strerror.3 b/man3/strerror.3 > index 8b36d6487..73199ef85 100644 > --- a/man3/strerror.3 > +++ b/man3/strerror.3 > @@ -72,11 +72,12 @@ .SH DESCRIPTION > is > .BR EINVAL , > the returned description will be "Invalid argument".) > -This string must not be modified by the application, but may be > -modified by a subsequent call to > +This string must not be modified by the application, > +and the returned pointer will be invalidated on a subsequent call to > .BR strerror () > or > -.BR strerror_l (). > +.BR strerror_l (), > +or if the thread that obtained the string exits. > No other library function, including > .BR perror (3), > will modify this string. > @@ -101,12 +102,12 @@ .SH DESCRIPTION > as an argument, this function returns a pointer to the string "EPERM". > .\" > .SS strerror_r() > -The > .BR strerror_r () > -function is similar to > +is like > .BR strerror (), > -but is > -thread safe. > +but might use the supplied buffer > +.I buf > +instead of allocating one internally. > This function is available in two versions: > an XSI-compliant version specified in POSIX.1-2001 > (available since glibc 2.3.4, but not POSIX-compliant until glibc 2.13), > @@ -231,7 +232,7 @@ .SH ATTRIBUTES > T} Thread safety T{ > .na > .nh > -MT-Unsafe race:strerror > +MT-Safe > T} > T{ > .na > @@ -246,6 +247,10 @@ .SH ATTRIBUTES > .BR strerror_l () > T} Thread safety MT-Safe > .TE > +.PP > +Before glibc 2.32, > +.BR strerror () > +is not MT-Safe. > .SH STANDARDS > .TP > .BR strerror () > @@ -301,13 +306,6 @@ .SH HISTORY > .BR strerrordesc_np () > glibc 2.32. > .SH NOTES > -The GNU C Library uses a buffer of 1024 characters for > -.BR strerror (). > -This buffer size therefore should be sufficient to avoid an > -.B ERANGE > -error when calling > -.BR strerror_r (). > -.PP > .BR strerrorname_np () > and > .BR strerrordesc_np () > @@ -318,4 +316,5 @@ .SH SEE ALSO > .BR error (3), > .BR perror (3), > .BR strsignal (3), > -.BR locale (7) > +.BR locale (7), > +.BR signal-safety (7) -- <http://www.alejandro-colomar.es/> GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
Attachment:
OpenPGP_signature
Description: OpenPGP digital signature