tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: maximum limit of files open with O_EXLOCK



On Sat, Jun 19, 2021 at 07:59:06AM +0000, RVP wrote:
> On Sat, 19 Jun 2021, nia wrote:
> 
> > There seems to be a limit somewhere that causes open() to return ENOMEM
> > when 1000+ files are opened with O_EXLOCK, this is independent of any
> > "open file" limits.
> > 
> 
> Seems tied to ulimit -n:
> 
> /tmp# ulimit -n
> 1024
> /tmp# ./t; rm -f XXX[0-9]*
> bleh 1021: Too many open files

No, the error is ENOMEM ("Cannot allocate memory"), not EMFILE
("Too many open files"). That would be too easy. You're running
the program as root, where the limit on locks doesn't apply.

The Zig developer found the kernel limit:
https://nxr.netbsd.org/xref/src/sys/kern/vfs_lockf.c#116

but it doesn't seem to be adjustable through sysctl.
I wonder if it should be.


Home | Main Index | Thread Index | Old Index