MAX limit of file descriptor
Gaurav Jain
gjainroorkee at gmail.com
Sat Feb 9 12:09:21 EST 2013
Reference:
http://www.kernel.org/doc/man-pages/online/pages/man2/setrlimit.2.html
On Sat, Feb 9, 2013 at 6:08 PM, Gaurav Jain <gjainroorkee at gmail.com> wrote:
> I believe you can achieve the 'effect' of setting the maximum number of
> open file descriptors to 'infinite' by using the following (untested code!):
>
> <snip>
> #include <sys/time.h>
> #include <sys/resource.h>
>
> struct rlimit rlim;
> rlim.rlim_cur = RLIM_INFINTY;
> rlim.rlim_max = RLIM_INFINITY;
>
> int ret = setrlimit(RLIMIT_NOFILE, &rlim);
> </snip>
>
> Note that what Peter pointed out is more or less correct. You can't *actually
> *have infinite file descriptors. The above code just ensures that the
> kernel won't perform any checks on the number of open file descriptors. So,
> if you hit a real resource limit; like no more memory left for opening
> files, you would still get an error. My feeling is that this isn't a wise
> thing to do. It's always better to know a precise number of the upper limit
> rather than an arbitrarily large number.
>
> ~ Gaurav
>
>
> On Sat, Feb 9, 2013 at 4:49 PM, Peter Teoh <htmldeveloper at gmail.com>wrote:
>
>> i can only make a general statement, may not be always true/false:
>>
>> in the kernel almost EVERYTHING HAS TO BE FINITE....and this is cater for
>> the fact that
>>
>> but at the userspace or application level, u can design structures to be
>> infinite. eg, I used python for large number calculation, and so far it
>> has not limits, but I am sure at the representation level, there is
>> one....but because i don't know the datastructure used, i don't know the
>> limits.
>>
>>
>> On Sat, Feb 9, 2013 at 1:10 PM, horseriver <horserivers at gmail.com> wrote:
>>
>>> hi:)
>>>
>>> In one process ,what is the max number of opening file descriptor ?
>>> Can it be set to infinite ?
>>>
>>> In network programing ,what is the essential for the maximum of
>>> connections
>>> dealed per second
>>>
>>> thanks!
>>>
>>> _______________________________________________
>>> Kernelnewbies mailing list
>>> Kernelnewbies at kernelnewbies.org
>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>>
>>
>>
>>
>> --
>> Regards,
>> Peter Teoh
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>>
>
>
> --
> Gaurav Jain
> Associate Software Engineer
> VxVM Escalations Team, SAMG
> Symantec Software India Pvt. Ltd.
>
>
>
--
Gaurav Jain
Associate Software Engineer
VxVM Escalations Team, SAMG
Symantec Software India Pvt. Ltd.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130209/171ddb86/attachment.html
More information about the Kernelnewbies
mailing list