improved thread safety?
jelmer at samba.org
Sat Jan 19 17:13:41 GMT 2008
Am Samstag, den 19.01.2008, 11:43 -0500 schrieb David Collier-Brown:
> At the expense of writing you a long answer rather than a short one,
> samba 4 uses the following functions which are mt-unsafe on Solaris
> and other standard-compliant systems:
Thanks, this is very useful.
I've filed bugs about these two.
The calls to getopt() are not in code that uses threads or is used in
We do use this in library code (credentials code), but I'm not quite
sure how to fix this without using locks. There's only one prompt you
can display at the same time, anyway.
This is only used in the replacement code.
I don't see why this one would be thread-unsafe.
I've filed a bug about this one.
Using grep, I couldn't find any references to popen/pclose.
I'm not sure why this would be thread unsafe.
I'm not sure what to do about these. Are there any better alternatives?
This isn't used by any code that uses threads or any library code except
the fault handling.
> I have a tool which finds these, and it found 290 lines of them.
> such as:
> "GIT/v4-0-test/source/lib/replace/getaddrinfo.c", line 110: gethostbyaddr
> # gethostbyaddr
> # gethostbyaddr - network host database functions
> # MT-Level: MT-Unsafe
The code in lib/replace/ is meant to provide replacements for functions
on platforms that don't have them and may use thread-unsafe functions to
implement them. Other parts of Samba should not use thread-unsafe
functions but instead rely on the thread-safe functions provided by the
system or lib/replace.
> The non-comment lines are in error-message format, to make it
> easy to use vim or emacs to review them all, and see if the
> code around them uses locks or other techniques to make them
> survive multi-threading.
> Send me mail if you want data on mt-unsafe, non-posix, or
> 32-bit-only only code: the tool is really for porting, but
> can inspect for all sorts of other things.
Yeah, I would definitely be interested in that. Is this tool freely
available somewhere? It would be interesting to have it running as part
of the build process, testsuite or the buildfarm.
Jelmer Vernooij <jelmer at samba.org> - http://samba.org/~jelmer/
Jabber: jelmer at jabber.fsfe.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 307 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://lists.samba.org/archive/samba-technical/attachments/20080119/dec5e0bf/attachment.bin
More information about the samba-technical