Max open file limit

Rajat Sharma fs.rajat at gmail.com
Wed Dec 5 07:00:10 EST 2012


Well this is not really a limit on number of files, rather a memory
allocation optimization for fd_array. The limit you are looking for is:

int sysctl_nr_open __read_mostly = 1024*1024;

$ cat /proc/sys/fs/nr_open
1048576

-Rajat


On Wed, Dec 5, 2012 at 4:38 PM, Vijay Chauhan <kernel.vijay at gmail.com>wrote:

> Hello,
>
> How many files a process can open at a time? Is it configurable?
>
> I found following in the kernel code:
>
> ..
>   .max_fds        = NR_OPEN_DEFAULT,
> ..
> ..
> #define NR_OPEN_DEFAULT BITS_PER_LONG
> ..
> ..
> #ifdef __KERNEL__
> #define BITS_PER_LONG 32
> ..
>
> But I can open more than 32 files in my user space program.
>
> Thank you,
> Vijay
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20121205/9d16180c/attachment.html 


More information about the Kernelnewbies mailing list