]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r305154: directory(3): Deprecate readdir_r(). Clarify dirent buffers.
authorjilles <jilles@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Wed, 7 Sep 2016 21:09:44 +0000 (21:09 +0000)
committerjilles <jilles@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Wed, 7 Sep 2016 21:09:44 +0000 (21:09 +0000)
commit9e70cccac8745508f33af4669276aecc26421a75
treea177024a6425568d8e034aa1210e530c25be0b05
parent3d3630c86021f1cdf044944ed80d89af2445f31c
MFC r305154: directory(3): Deprecate readdir_r(). Clarify dirent buffers.

In existing implementations including FreeBSD, there is no reason to use
readdir_r() in the common case where potentially multiple threads each list
their own directory. Code using readdir() is simpler.

What's more, although readdir_r() can safely be used on FreeBSD because
NAME_MAX is forced to 255, it cannot be used safely on systems where
{NAME_MAX} is not fixed. As a concrete example, FAT/NTFS filenames can be up
to 255 UTF-16 code units long, which can be up to 765 UTF-8 bytes.

Deprecating readdir_r() in POSIX has been proposed in
http://www.austingroupbugs.net/view.php?id=696
and glibc wants to deprecate it as well.

git-svn-id: svn://svn.freebsd.org/base/stable/10@305569 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
lib/libc/gen/directory.3