aboutsummaryrefslogtreecommitdiff
path: root/manual
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1996-10-02 01:40:17 +0000
committerUlrich Drepper <drepper@redhat.com>1996-10-02 01:40:17 +0000
commita68b0d31a37a86785b3dbeeee3fad96ee71fadcd (patch)
tree61537b1f028002a9e6e0f5354fced6128bda8b9c /manual
parent2d07133b507b13d4a5ed6dc250f4345c8a26942a (diff)
downloadglibc-a68b0d31a37a86785b3dbeeee3fad96ee71fadcd.zip
glibc-a68b0d31a37a86785b3dbeeee3fad96ee71fadcd.tar.gz
glibc-a68b0d31a37a86785b3dbeeee3fad96ee71fadcd.tar.bz2
update from main archive 961001
Diffstat (limited to 'manual')
-rw-r--r--manual/filesys.texi30
1 files changed, 30 insertions, 0 deletions
diff --git a/manual/filesys.texi b/manual/filesys.texi
index e269663..3132526 100644
--- a/manual/filesys.texi
+++ b/manual/filesys.texi
@@ -327,6 +327,36 @@ conditions are defined for this function:
@item EBADF
The @var{dirstream} argument is not valid.
@end table
+
+@code{readdir} is not thread safe. Multiple threads using
+@code{readdir} on the same @var{dirstream} may overwrite the return
+value. Use @code{readdir_r} when this is critical.
+@end deftypefun
+
+@comment dirent.h
+@comment GNU
+@deftypefun int readdir_r (DIR *@var{dirstream}, struct *@var{entry}, struct **@var{result})
+This function is the reentrant version of @code{reentrant}. Like
+@code{readdir} it returns the next entry from the directory. But to
+prevent conflicts for simultanously running threads the result is not
+stored in some internal memory. Instead the argument @var{entry} has to
+point to a place where the result is stored.
+
+The return value is @code{0} in case the next entry was read
+successfully. In this case a pointer to the result is returned in
+*@var{result}. It is not required that *@var{result} is the same as
+@var{entry}. If somethings goes wrong while exeucting @code{readdir_r}
+the function return @code{-1}. The @code{errno} variable is set like
+described for @code{readdir}.
+
+@strong{Portability Note:} On some systems, @code{readdir_r} may not
+return a terminated string as the file name even if no @code{d_reclen}
+element is available in @code{struct dirent} and the file name as the
+maximal allowed size. Modern systems all have the @code{d_reclen} field
+and on old systems multi threading is not critical. In any case, there
+is no such problem with the @code{readdir} function so that even on
+systems without @code{d_reclen} field one could use multiple threads by
+using external locking.
@end deftypefun
@comment dirent.h