<div dir="ltr">I believe you can achieve the &#39;effect&#39; of setting the maximum number of open file descriptors to &#39;infinite&#39; by using the following (untested code!):<div><br></div><div style>&lt;snip&gt;</div>
<div style>#include &lt;sys/time.h&gt;</div><div style>#include &lt;sys/resource.h&gt;</div><div style><br></div><div style>struct rlimit rlim;</div><div style>rlim.rlim_cur = RLIM_INFINTY;</div><div style>rlim.rlim_max = RLIM_INFINITY;</div>
<div style><br></div><div style>int ret = setrlimit(RLIMIT_NOFILE, &amp;rlim);</div><div style>&lt;/snip&gt;</div><div style><br></div><div style>Note that what Peter pointed out is more or less correct. You can&#39;t <i>actually </i>have infinite file descriptors. The above code just ensures that the kernel won&#39;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&#39;t a wise thing to do. It&#39;s always better to know a precise number of the upper limit rather than an arbitrarily large number. </div>
<div style><br></div><div style>~ Gaurav</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Feb 9, 2013 at 4:49 PM, Peter Teoh <span dir="ltr">&lt;<a href="mailto:htmldeveloper@gmail.com" target="_blank">htmldeveloper@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">i can only make a general statement, may not be always true/false:<div><br></div><div>in the kernel almost EVERYTHING HAS TO BE FINITE....and this is cater for the fact that </div>
<div><br></div><div>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&#39;t know the datastructure used, i don&#39;t know the limits.   <div>
<div class="h5"><br>

<br><div class="gmail_quote">On Sat, Feb 9, 2013 at 1:10 PM, horseriver <span dir="ltr">&lt;<a href="mailto:horserivers@gmail.com" target="_blank">horserivers@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


hi:)<br>
<br>
   In one process ,what is the max number of opening file descriptor ?<br>
   Can it be set to infinite ?<br>
<br>
   In network programing ,what is the essential for  the maximum of connections<br>
   dealed per second<br>
<br>
thanks!<br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br>Regards,<br>Peter Teoh
</font></span></div>
<br>_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><font face="arial, helvetica, sans-serif">Gaurav Jain</font><div><font face="arial, helvetica, sans-serif">Associate Software Engineer</font></div>
<div><font face="arial, helvetica, sans-serif">VxVM Escalations Team, SAMG<br></font></div><div><font face="arial, helvetica, sans-serif">Symantec Software India Pvt. Ltd.</font></div><div><font face="arial, helvetica, sans-serif"><br>
<br></font></div></div>
</div>