Re: open file limits/ perl
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Re: open file limits/ perl




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Re: open file limits/ perl  
Jens Thoms Toerring


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-26-07 12:20 PM

Rainer Weikusat <rainer.weikusat@sncag.com> wrote:
> jt@toerring.de (Jens Thoms Toerring) writes: 
[vbcol=seagreen]
> It's weirder than that: On the system where I tried (Debian Stable/
> Linux 2.6.20-rc3), the first script below prints 1024 after having
> done a getrlimit-call and the second 131072, apparently pulling
> the number out of some hat.

> ---------------
> use POSIX;

> printf "%s\n", POSIX::sysconf(POSIX::_SC_OPEN_MAX);
> ---------------

> ---------------
> use POSIX qw(sysconf);

> printf "%s\n", POSIX::sysconf(POSIX::_SC_OPEN_MAX);
> ---------------

You're supposed to put an ampersand in front of the "constant":

POSIX::sysconf(&POSIX::_SC_OPEN_MAX)

If you do so the result in both cases is 1024 on my machine (which
is also what I get from 'ulimit -n'), otherwise I also get 1024 for
the first and 131072 for the second version. The reason seems to be
that all "constants" are actually constant functions (as I only found
mentioned in the Camel book). So if you import everything by default
(i.e. without the 'qw(sysconf)' or if you import both sysconf and
_SC_OPEN_MAX then your program knows that _SC_OPEN_MAX is actually
a (constant) function and treats it as such. Admittedly, that's all
a bit weird;-)
Regards, Jens
--
\   Jens Thoms Toerring  ___      jt@toerring.de
\__________________________      http://toerring.de





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 02:25 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register