smbstatus fails with "Segmentation fault"

Arnold Troeger stssart at
Fri Jun 16 01:45:46 GMT 2000

David Collier-Brown wrote:

> Arnold Troeger wrote:
> | Yes, I did find a bug.  The problem is Samba 2.0.x and the 64 bit
> aspect
> | of Solaris 2.6 (Sparc, not Intel).  Specifically, it's the configure
> | script that compiles the program.  The configure script sets
> | -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64.  This evidently screws
> up
> | the offset calculations for identifying locks in the locking_shm.c
> | routines.
>         In that case, I'd look at the offset calculation that's
>         being screwed up!

The thing is, samba mostly works with large file support (without having
tried to read a large file that is).  The particular routine that choked
deals with share locking.  The SIGBUS error occurs when smbstatus scans
for share locks in the shm_share_forall procedure.  Specifically, the
program tries to get the pid of the locking process in

> | I have no idea why you would want to compile large file support into
> Samba
> | as neither Windows, nor Linux, can currently handle large files.
>         Large files are standard Unix, and are being phased in
>         by all vendors as we speak: it's a really bad idea to
>         try to compile them out, as you would be choosing to depend
>         on something that the vendors promise to remove!

True enough, although both IRIX and Solaris accomodate 32 bit
applications, and currently, the major client OSs for Samba are 32 bit.
I know Microsoft has plans for a 64 bit version of Windows and it would
be correct to plan for it's support.

> | Samba compiles with warning messages about shifting counts being too
> big
> | (ntrans.c, reply.c, trans2.c and util.c) when the large file support
> flags
> | are removed.  What's more, smbstatus now works.
>         Those warnings are the tip-off: we need to hunt down the
>         erroneous shifts and repair them.

I agree.  This is a problem that should be fixed.  I need to know more
about how the share locking works in order to be able to identify the
problem though.  I have the source code but if someone could describe the
algorithm for me, I would very much appreciate it.

> | Has anyone tried compiling Samba 2.0.7 in Solaris 8 for Sparc
> | architecture?  Does the 64 bit support work properly?
>         I can reproduce the segfault on a 64-bit Solaris 8, but
>         never saw it on my (former) 2.6 or 2.7 machines, or
>         Solaris 8 compiled in 32-bit mode.
>         Please note:
>                 Solaris 2.6 is a 32-bit os with 64-bit filesizes.
>                 Solaris 7 can be run as either a 32 or 64-bit os,
>                         and has 64-bit filesizes in either case.
>                 Solaris 8 ditto.
>         Sun compilers default to building 32-bit binaries for
>         any of those Solarii: these include 64-bit filesizes
>         defined as long longs.
>         Am I correct in thinking you're compiling with gcc in 32-bit
>         mode, or are you building a 64-bit samba application?
>         [Followups redirected to samba-technical at]

Actually, I've tried compiled Samba in both 32 and 64 bit mode with both
gcc and SparcWorks 4.2 cc.  Both modes work: in 32 bit mode everything
works, but I get the compiler errors, while in 64 bit mode everything but
smbstatus seems to work, and the compiler errors go away. ASAIK Sun's C
compiler will generate either 32 or 64 bit file sizes based on the value
of the two defines I mentioned above.  This is different from IRIX, in
that IRIX requires you to set a compile flag (-o32, -n32, -64) to tell it
what to do.  Has anyone tried 64 bit Samba in IRIX?

> --dave
> --
> David Collier-Brown,  | Always do right. This will gratify some people
> 185 Ellerslie Ave.,   | and astonish the rest.        -- Mark Twain
> Willowdale, Ontario   | //
> Work: (905) 415-2849 Home: (416) 223-8968 Email: davecb at

I would like to help resolve this problem in any way I can.  It's been a
while since I've done any serious programming though, and I have VERY
limited experience with Microsoft Windows.  I have Linux at home, and
IRIX, Solaris and Linux at work.

Arnold Troeger                          Unocal Thailand
"Microsoft Windows:  for when your machine is just too fast"

More information about the samba mailing list