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

Andy Polyakov appro at
Thu Jan 25 22:56:35 GMT 2001

> To get the full benefit, you will also need to either
> a) compile with sfio (which requires some additional changes to
>    source/include/smb.h and source/include/config.h -- from David Boyce
>    <dsb at

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).

> 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. See my for
further information and a possible workaround.

> 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

Cheers. Andy.

More information about the samba-technical mailing list