FW: RE: [cciug] linking Samba with SFIO
Greg Dickie
greg at discreet.com
Wed Dec 13 12:03:52 GMT 2000
FYI,
I think there are quite a few of us using samba and clearcase and I can't
see that it would be a bad thing to stick some kind of SFIO support in there
but I know squat about autoconf. Would it be possible atsome point?
Thanks,
Greg
-----FW: <4.3.2.7.2.20001208181333.00c00a00 at world.std.com>-----
Date: Tue, 12 Dec 2000 20:56:15 -0500
Sender: owner-cciug at rational.com
From: David Boyce <dsb at world.std.com>
To: cciug at rational.com
Subject: RE: [cciug] linking Samba with SFIO
My previous message on this subject was wrong and I apologize to anyone who
may have acted on it. The Samba it produces works, mostly, but isn't
correctly linked with sfio and thus doesn't have the fix for the number of
open file descriptors. I'm going to explain the background, again mostly
for the archives, though hopefully Rational or Linuxcare will supply some
data about using sfio when Samba becomes supported.
My impression from reading the docs as well as prior experience was that
you need "-I<sfio-area>/include" at compile time and "-L<sfio-area>/lib
-lstdio -lsfio" at link time. But this version dumped core immediately and
I concluded it was wrong - but it wasn't. Since the sfio doc is minimal and
unclear I tried various other permutations and found that a simple -lsfio
produced a working executable. Furthermore the executable produced was
bigger than without -lsfio and "what smbd" showed an sfio what-string, so I
figured it had to be right. But really all this version does is drag in a
few symbols from sfio while the important ones
(fopen/fread/fclose/FILE/etc) from libc.
It turns out the reason the original, correct link line dumps core is that,
on Solaris 2.6 and above, the configure script detects explicit largefile
support in libc in the form of functions fopen64() et al. It then turns on
the macro HAVE_EXPLICIT_LARGEFILE_SUPPORT in include/config.h, which causes
Samba's sys_fopen() function to call fopen64(). But since sfio doesn't
offer these interfaces, when you add "-lstdio -lsfio" to the link line
these symbols still fall through and get resolved in libc. Meanwhile the
symbols sfio *does* offer, notably the FILE struct, are resolved from
libsfio. So you have libc functions operating on sfio data structures and
core dumps arrive early and often. I find that when I comment out the
setting of HAVE_EXPLICIT_LARGEFILE_SUPPORT and recompile the result works
correctly.
This leaves open a number of questions, though, such as:
-> Why didn't this some up in earlier revs of Samba (maybe the configure
script didn't detect largefile support back then).
-> Are there other misconfigurations because sfio isn't seen at configure
time but is at llink time (who knows). Is there a way to tell configure
about sfio?
-> Is this fix trading largefile support for >256 file descriptors or does
sfio handle large files through the fopen() et al interfaces (no idea, I
haven't looked into the sfio code). I wouldn't expect this to present a
problem even if true; you might need largefile support for strings.db on
the vob server but most CC shops won't be serving out elements with
versions >2GB through Samba.
-> Are there similar problems on HP, IRIX, etc. (haven't tried).
In addition to the largefile issue, when compiling with gcc on Solaris you
need another patch to include/smb.h. This is a fix that's already in Samba
2.2alpha but not in 2.0.7. All the patches I made are in the attachment,
though of course the Makefile patch shouldn't be taken literally: you need
to use your own <sfio-area> path.
This may not be the final word on the subject. It might be necessary to go
to the Samba team, Rational, and/or Linuxcare and find out how they plan to
deal with this Samba bug that primarily affects ClearCase, but this seems
to work ok so far.
For anyone who cares and doesn't know the background of the Samba/sfio
issue, it's here:
http://clearcase.rational.com/cciug_archive/hypermail/199909/0519.html.
-David Boyce
> 1. Downloaded Samba 2.0.7 from http://www.samba.org, unpacked it to
> <samba-basedir> and configure'd it.
> 2. Downloaded SFIO from
> http://www.research.att.com/sw/tools/sfio/. I took
> the latest (SFIO 2000) version in tar format.
> 3. Unpacked SFIO into the subdir <samba-basedir>/source/sfio.
> 4. Built SFIO according to its README (basically, added
> <samba-basedir>/source/sfio/bin to PATH so 'iffe' is found
> and ran make).
> 5. Made the following by-hand modification to the generated
> Samba Makefile:
>
> % diff Makefile.orig Makefile
> 11c11
> < LIBS=-lsec -lgen -lsocket -lnsl -ldl
> ---
> > LIBS=-lsec -lgen -lsocket -lnsl -ldl -Lsfio/lib -lsfio
>
> 6. Built and installed Samba as usual.
>
> As you can see it's quite straightforward. The problem is
> that SFIO isn't
> well documented so it takes a while to work out which combination of
> compatibility libraries and headers to use. As it turns out
> the above is
> all that's needed. This was on a Solaris 2.6 machine, BTW.
--------------End of forwarded message-------------------------
---------------------------------------------------------------------
Greg Dickie
just a guy
greg at discreet.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: samba-sfio-cfg.tar
Type: application/x-tar
Size: 10240 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20001213/4f15f7bf/samba-sfio-cfg.tar
-------------- next part --------------
More information about the samba-technical
mailing list