samba shares access issue in Solaris from a MT program

David Collier-Brown davec-b at rogers.com
Tue Sep 28 16:24:21 GMT 2004


  Oh Duh!  That's exactly what it is, and it's exactly wrong (;-))

   The -D_REENTRANT needs to be on the compilation of the main
members of LIBSMBCLIENT_OBJ, which are
	libsmb/libsmbclient.o
	libsmb/libsmb_compat.o and
	libsmb/libsmb_cache.o
if all the errno references are confined to them.

--dave


Narayana Pattipati wrote:
> Hi Dave,
> 
> On Tue, 2004-09-28 at 21:02, David Collier-Brown wrote:
> 
>>---
>>bin/libsmbclient.so: $(LIBSMBCLIENT_PICOBJS)
>>	@echo Linking libsmbclient shared library $@
>>	@$(SHLD) $(LDSHFLAGS) -o $@ $(LIBSMBCLIENT_PICOBJS) \
>>		$(LDFLAGS) $(DYNEXP) $(LIBS) \
>>           	$(KRB5LIBS) $(LDAP_LIBS) \
>>		-h `basename $@`.$(LIBSMBCLIENT_MAJOR)
>>
>>to
>>---
>>bin/libsmbclient.so: $(LIBSMBCLIENT_PICOBJS)
>>	@echo Linking libsmbclient shared library $@
>>	@$(SHLD) $(LDSHFLAGS) -D_REENTRANT \
>>		-o $@ $(LIBSMBCLIENT_PICOBJS) \
>>		$(LDFLAGS) $(DYNEXP) $(LIBS) \
>>           	$(KRB5LIBS) $(LDAP_LIBS) -lthread \
>>		-h `basename $@`.$(LIBSMBCLIENT_MAJOR)
>>
>>... for Solaris versions up to 9. On Solaris 10, you don't
>>need to add -lthread, as it was folded into the standard
>>c library.
> 
> 
> If I not wrong, this change is trying to add -D_REENTRANT flag during
> linking time. This may not work. I tried it with a small test program,
> which did not work. I guess we need to use this flag during compilation
> time.
> 
> May be Sean can give exact details.
> 
> Regards,
> Narayana
> 
> 
>>   Who's the configure guru on the team? (:-))
>>
>>--dave
>>
>>David Collier-Brown wrote:
>>
>>>On Fri, 24 Sep 2004, Narayana Pattipati wrote:
>>>
>>>
>>>>[Nice description of problem redacted.]
>>>>
>>>>
>>>>
>>>>>If samba is build with "-mt" flags, then the errno will be pointed
>>>>>to __errno() macro, instead of global errno, and thread executing samba
>>>>>code will be able to access correct errno.
>>>>>
>>>>>I have few open questions based on this:
>>>>>a) I read from samba site that its not MT safe. But since the code 
>>>>>runs in
>>>>>  one thread only, is it OK to build samba with "-mt" compiler flags ?
>>>>>  What would be the side effects if samba is build with -mt compiler
>>>>>  flags ?
>>>
>>>
>>>
>>>Richard Sharpe wrote:D>
>>>
>>>>I cannot see any problems with this, off my head.
>>>
>>>
>>>    From my experience with the compiler/linkers
>>>    on Sun, the only substantiative change is the
>>>    use of a thread-aware errno mechanism. If the
>>>    program is unthreaded, the errno will work
>>>    normally even with -mt specified.
>>>
>>>    Of course, it is the responsibility of the
>>>    caller to protect the library against concurrent
>>>    calls via locking, but that and -mt are what
>>>    we've used in the past to make non-thread-safe
>>>    libraries usable.
>>>
>>>    I'd like to suggest that the configure script
>>>    be changed to add -mt to the solaris linker
>>>    options for Solaris (only).
>>>    
>>>--dave
>>>ps: would you like this submitted via bugzilla,for your records?
>>>-- 
>>>David Collier-Brown,  | Always do right. This will gratify
>>>davecb at spamcop.net    | some people and astonish the rest
>>>                      |                      -- Mark Twain
>>>
>>>
>>
>>
> 
> 
> 
> 
> Confidentiality Notice 
> 
> The information contained in this electronic message and any attachments to this message are intended
> for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
> you are not the intended recipient, please notify the sender at Wipro or Mailadmin at wipro.com immediately
> and destroy all copies of this message and any attachments.
> 




More information about the samba-technical mailing list