Proposed patch for Samba-2.0.7 to allow Solaris open more than 1014 (or rlim_fd_max) files

David Boyce dsb at world.std.com
Fri Jan 26 01:03:47 GMT 2001


At 11:56 PM 1/25/01 +0100, Andy Polyakov wrote:
>Compiling with sfio doesn't solve all the problems. The remaining
>problem is that we don't know if library functions called by SAMBA call
>fopen and company. Linking with binary compatibility shim doesn't help
>as it would presumably suffer from the very same deficiency (or won't be
>binary compatible).

Please remember, as mentioned before, that this whole stdio/sfio/MAX_OPEN 
thing is a sidetrack from the real (setrlimit) discussion.

> > The reason for this is that smbd uses fopen to open the machine account 
> (mac)
> > file. fopen without sfio or in a 32-bit compilation environment is 
> limited to
> > 256 file descriptors. If an smbd process has > 256 files but < 1014
> > (rlim_fd_max) files open it can still fail to open the machine account 
> file.
>
>This is not 100% correct. It breaks when open(2) returns number larger
>than 255, not when you have more than 256 files opened.

Since open(2) is guaranteed to always return the lowest available file 
descriptor, this is a distinction without a difference IMHO (aside from the 
255/256 off-by-one error).

>See my
>http://lists.samba.org/pipermail/samba-ntdom/1999-August/019940.html for
>further information and a possible workaround.

This is a cute hack ... any idea why it didn't get rolled in? Was it just 
overlooked or did someone have a problem with it? I wish it was in there now.

> > If this patch is acceptable,
>
>I should also recommend -DUSE_POLL and -DFD_SETSIZE=2400 (or something),
>-DUSE_POLL effectively prevents SAMBA from using select (which is btw
>very similar front-end to poll anyway) and FD_SETSIZE scales up
>structures used by SAMBA itself. BTW, USE_POLL code read "struct pollfd
>pfd[256];" 256? Well, it means that we won't poll more that 256
>descriptors at the same time, not that we can't have more files
>opened... But it might feel better to declare FD_SETSIZE large... Or
>alloca maxfd structures

Do you mean HAVE_POLL? I don't see USE_POLL anywhere. HAVE_POLL is set by 
default on systems that have it; unfortunately I see no place where Samba 
looks at HAVE_POLL or uses poll(). The sys_select() function would be the 
obvious candidate but it doesn't, unless I'm missing some subtle macro. 
This is in current CVS 2.2.

-David Boyce







More information about the samba-technical mailing list