samba shares access issue in Solaris from a MT program
Sean McGrath - Sun Microsystems Ireland
sean.mcgrath at Sun.COM
Tue Sep 28 16:35:30 GMT 2004
Really needs the change in configure/autoconf, something like:
$ diff -u configure configure.new
--- configure Wed Sep 22 16:29:40 2004
+++ configure.new Tue Sep 28 17:35:10 2004
@@ -3553,7 +3553,8 @@
rm -fr conftest.c
case "$ac_cv_gcc_compiler_version_number" in
*"gcc version 2.6"*|*"gcc version 2.7"*)
- CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
+ CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE -D_REENTRANT"
+ LDFLAGS="$LDFLAGS -lthread"
cat >>confdefs.h <<\_ACEOF
#define _LARGEFILE64_SOURCE 1
@@ -3561,7 +3562,8 @@
;;
*)
- CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+ CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_REENTRANT"
+ LDFLAGS="$LDFLAGS -lthread"
cat >>confdefs.h <<\_ACEOF
#define _LARGEFILE64_SOURCE 1
@@ -3575,7 +3577,8 @@
;;
esac
else
- CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+ CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_REENTRANT"
+ LDFLAGS="$LDFLAGS -lthread"
cat >>confdefs.h <<\_ACEOF
#define _LARGEFILE64_SOURCE 1
Perhaps. Though as Dave suggests, the configure guru can correct this :)
Sean.
.
David Collier-Brown stated:
< 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.
< >
<
--
Sean.
.
More information about the samba-technical
mailing list