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

David Boyce dsb at
Thu Jan 25 04:41:14 GMT 2001

At 03:10 PM 1/24/01 -0500, David Collier-Brown wrote:
>Eric Boehm wrote:
> > I would like to submit the following patch to source/lib/util.c to allow
> > Samba under Solaris to open more than 1014 files -- or whatever the kernel
> > variable rlim_fd_max is set to.
> > 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.
>         Fopen is used numerous times, via sys_fopen,
>         or I'd suggest we just not use fopen at all...

Yes, when I last checked two years ago sys_fopen() was used in ~56 places. 
Which is unfortunate as it leads to a subtle bug but I don't think any 
Samba developer is so bored as to rewrite all of Samba to use low-level IO. 
It's easier to link with sfio or build in 64-bit mode and solve the problem 
that way, as Eric says. BUT! The point of his message was orthogonal to 
fopen(), sys_fopen(), and sfio. He mentioned them only in passing and I'd 
hate to see his thread get sidetracked on that topic.

The point of the patch is to allow Samba to raise the hard fd limit on 
systems which allow it and when appropriate privileges are held. This gives 
a new degree of freedom to the administrator and allows for a significant 
performance enhancement in some uses (specifically with ClearCase). I don't 
see any downside to it; if the OS refuses to allow the hard limit to be 
raised it just falls back to existing behavior. The default behavior 
remains unchanged but now, if you explicitly ask for a feature and the 
underlying OS supports it, you're no longer artificially prevented from 
getting at it - and that seems good.

-David Boyce

More information about the samba-technical mailing list