[PATCH] readdir, readdir64 are thread-safe
Florian Weimer
fweimer@redhat.com
Tue Apr 11 11:36:00 GMT 2017
They only modify the state in the dirstream argument, and we
generally do not treat this as a reason to mark a function as
not thread-safe. For an example, see random_r, which is marked
as thread-safe even though the random state is not protected
by a lock.
2017-04-11 Florian Weimer <fweimer@redhat.com>
* manual/filesys.texi (Reading/Closing Directory): Mark readdir,
readdir64 as thread-safe.
diff --git a/manual/filesys.texi b/manual/filesys.texi
index edc7c64..23a8173 100644
--- a/manual/filesys.texi
+++ b/manual/filesys.texi
@@ -478,7 +478,7 @@ symbols are declared in the header file @file{dirent.h}.
@comment dirent.h
@comment POSIX.1
@deftypefun {struct dirent *} readdir (DIR *@var{dirstream})
-@safety{@prelim{}@mtunsafe{@mtasurace{:dirstream}}@asunsafe{@asulock{}}@acunsafe{@aculock{}}}
+@safety{@prelim{}@mtsafe{}@asunsafe{@asulock{}}@acunsafe{@aculock{}}}
@c This function holds dirstream's non-recursive lock, which brings
@c about the usual issues with locks and async signals and cancellation,
@c but the lock taking is not enough to make the returned value safe to
@@ -592,7 +592,7 @@ of the last two functions.
@comment dirent.h
@comment LFS
@deftypefun {struct dirent64 *} readdir64 (DIR *@var{dirstream})
-@safety{@prelim{}@mtunsafe{@mtasurace{:dirstream}}@asunsafe{@asulock{}}@acunsafe{@aculock{}}}
+@safety{@prelim{}@mtsafe{}@asunsafe{@asulock{}}@acunsafe{@aculock{}}}
The @code{readdir64} function is just like the @code{readdir} function
except that it returns a pointer to a record of type @code{struct
dirent64}. Some of the members of this data type (notably @code{d_ino})
More information about the Libc-alpha
mailing list