libsmbclient threadsafeness

Igor Belyi sambauser at
Thu Oct 21 03:58:22 GMT 2004

Michael B Allen wrote:

>Igor Belyi said:
>>Well.. I was refering to 'errno' which is used as an error reason in
>>convert_string_allocate and as an error indicator in smb_iconv(). Global
>>variables are not very friendly in multithreaded environment.
>No, errno is a per-thread variable. Technically I believe _REENTRANT must
>be defined but virtually a C library implementations implement errno as a
>macro for a function that retrieves errno from a per-thread location. IOW
>errno is thread safe.

Hm.. You're right.. I'm living in the past. :o( It is precompiled into 
(*__errno_location ()) on Debian. Ok, it's good to know. :)

Then I also don't see any thread related issues with 
pull_ascii_fstring(). But, I guess you will need to go through all 
functions this way to make sure of their thread-awareness since 
libsmbclient in Samba3 hasn't been thought very carefuly from the 
threading point of view.

Good luck,

More information about the samba-technical mailing list