This is the mail archive of the
mailing list for the libstdc++ project.
Re: [patch] libstdc++/67747 Allocate space for dirent::d_name
- From: Florian Weimer <fweimer at redhat dot com>
- To: Martin Sebor <msebor at gmail dot com>, Jonathan Wakely <jwakely at redhat dot com>
- Cc: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Fri, 2 Oct 2015 19:43:41 +0200
- Subject: Re: [patch] libstdc++/67747 Allocate space for dirent::d_name
- Authentication-results: sourceware.org; auth=none
- References: <20150929113726 dot GU12094 at redhat dot com> <560E759E dot 2000005 at redhat dot com> <20151002123428 dot GP12094 at redhat dot com> <560EB776 dot 2090504 at gmail dot com> <560EBA49 dot 7050008 at redhat dot com> <560EC0F3 dot 3020705 at gmail dot com>
On 10/02/2015 07:37 PM, Martin Sebor wrote:
> I'm not sure what you are basing this assertion on. In the man
> pages I have looked at, memcpy is documented as MT-Safe. readdir
> is documented as MT-Unsafe. The Unsafe definition is clear:
> contains global and static data that is not protected.
I think the Solaris thread-safety attributes are a bit too simplistic to
capture the whole scope of thread safety issues for functions operating
on mutable data.
> For example, Solaris 11.2:
“It is safe to use readdir() in a threaded application, so long as only
one thread reads from the directory stream at any given time. The
readdir() function is generally preferred over the readdir_r() function.”