libsmbclient and smb_opendir: problem with workgroup

Derrell.Lipman at Derrell.Lipman at
Mon Jun 14 21:08:47 GMT 2004

"Christopher R. Hertel" <crh at> writes:

>> > A timeout might be a reasonable thing to consider.
>> Argh.  That timeout stuff in the code has problems.  
> Then we're probably best off trying to figure out and fix the problems.
>> The extra pipe that's created in lib/select.c in implementing the timeout
>> (and presumably eliminating a race condition) does not seem to be reliable;
>> i.e. it still blocks indefinitely on occasion, requiring a kill.  I'd sure
>> rather not add more uses of sys_select() if at all possible...  In
>> principle, a timeout might be a reasonable thing to consider.
> There should, generally, only be need of one, and I tend to write to
> poll() rather than select() when possible.  I'll have to take a look when 
> I get some time.

At the libsmbclient level, we don't really have a choice in what underlying
system calls are used (without re-implementing other samba library code).  In
this case, there are a number of functions in namequery.c (IIRC) that do the
various queries, and these are the ones which call the low-level functions
such as the sys_select() interface in lib/select.c.

As a side note... The determination of whether to use poll() or select() is
really one of which OS is in use.  BSD derivatives have a select() system call
and (unless it's changed recently or my memory fails me) poll() is implemented
as a library call on top of select().  SysIII, SYSV derivatives have poll() as
the system call and may or may not provide select() as a library call.  Linux
provides both as system calls (with poll() added as of version 2.1.23).  The
decision to use poll() or select() should usually be based on which one is a
native system call.  I'm not sure whether that's done in samba, though.  I
don't recall ever seeing use of poll() anyplace.

>> All right.  Again, though, before I go and change a working (but
>> unsatisfactory, you're telling me) implementation, I'd like to pow-wow with
>> all of the various powers that be so we all come to consensus.
> Fair enough.

Anyone reading this...  If you've been involved in libsmbclient and/or
browsing, and feel you should be part of the pow-wow, please chime in!

Chris...  So you, me, and Richard at a minimum.  You likely know the
developers and their tasks / accomplishments / interests far better than I.
Who else might be interested or should be involved, i.e. should be invited to



More information about the samba-technical mailing list