setrlimit( RLIMIT_NOFILE, %rl); Solaris 2.6

setrlimit( RLIMIT_NOFILE, %rl); Solaris 2.6

Post by Barry Margoli » Wed, 15 Sep 1999 04:00:00



I've redirected followups to comp.unix.programmer, since this doesn't seem
specific to TCP/IP (the only relationship at all to TCP/IP is that it's
common for servers to need lots of open descriptors).



>How can I increase the max number of open file descriptors under Solaris
>2.6?

An unprivileged user can increase his limit up to the hard limit that the
sysadmin has configured for the system.

Quote:>The following code looks ok to me, but it doesn't work.

What error does it get?

Quote:>I also tried chmod +s.

Did you set the owner to root when you did that?

Quote:>The only way to increase the number of file descriptors is:

>root: ulimit -n 2048

>And my written web server must run in the root shell :-(
>(We use the Korn shell)

When you start the web server from one of the /etc/init.d scripts, you can
increase the limit then:

(ulimit -n 2048; <command to start web server>)

Quote:>Thank you very much for comments.

>Joerg

>#include <sys/sockio.h>
>#include <sys/time.h>
>#include <sys/resource.h>
>#include <unistd.h>

>int main( int argc, char* argv[] )
>{
>   struct rlimit rl;
>    int rc    = 0;
>    int errNo = 0;;

>    rc = getrlimit( RLIMIT_NOFILE, &rl );
>    if( rc < 0 )
>    {
>         cerr << "getrlimit( RLIMIT_NOFILE, &rl ): " << errno << endl;
>         exit( 1 );
>    }

>    cout << "current" << endl
>            << "rl.rlim_cur: " << rl.rlim_cur  << endl
>            << "rl.rlim_max: " << rl.rlim_max  << endl
>             << endl;

>    // set current soft limit to the hard limit;
>    rl.rlim_cur = rl.rlim_max;

>    rc = setrlimit( RLIMIT_NOFILE, &rl );
>    if( rc < 0 )
>    {
>         cerr << "setrlimit( RLIMIT_NOFILE, &rl ): " << errno << endl;
>         exit( 1 );
>    }

>    memset( &rl, 0, sizeof(rl) );

>    rc = getrlimit( RLIMIT_NOFILE, &rl );
>    if( rc < 0 )
>    {
>         cerr << "getrlimit( RLIMIT_NOFILE, &rl ): " << errno << endl;
>         exit( 1 );
>    }

>    cout << "new" << endl
>            << "rl.rlim_cur: " << rl.rlim_cur  << endl
>            << "rl.rlim_max: " << rl.rlim_max  << endl
>           << endl;

>   return 0;
>}

--

GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
 
 
 

1. can't read Solaris 2.6 x86 hard disk on Solaris 2.6 Ultra-1 ?!?

I was going to use this hard drive to move large files from my
Ultra to my Pentium PC for CD-R backup, but upon "boot -r" on
the Ultra I saw an error about "invalid geometry" on sd3, the
drive I had formatted on my PC to be ufs.  And now of course
I can't even "prtvtoc" this disk ("Unable to read Disk geometry"),
so mounting it is seemingly out of the question.

What's the problem?  Was I naive to assume the a ufs on a Solaris
system would be the same regardless of CPU type?  I really don't
want to use Ethernet to transmit potentially gigabytes of data
on a regular basis :-(...

Please reply via email (and post here, of course), as I don't
get a chance to keep up with the newsgroup as regularly as I
would wish.  Thanks.

--
--
Mark J. Kaufman             Sun Microsystems, San Diego

2. selecting and moving text in X windows

3. Upgrade from Solaris 2.6 with Volume Manager 2.6 to Solaris 8 with Volume Manager 3.2

4. Linux in mixed network environment

5. SunOS 5.6 vs Solaris 2.6 vs Solaris 7 vs Solaris 8

6. Can SunOS 4.1.2 (Solaris 1) server support dataless Solaris 2.1 clients?

7. FS: SOLARIS 7 SERVER, SOLARIS EASY ACCESS 2.0, SOLARIS 2.6 KIT

8. "Blue sky" Usenet

9. Trade: Solaris SysAdmin2 2.6 course for SysAdmin1 2.6 course

10. 2.5.1 -> 2.6 & DiskSuite [Was: Solaris 2.6 & Solstice DiskSuite 4.0]

11. where to find WU-FTPD 2.6 for sparc-solaris 2.6 (binary)?

12. Veritas 2.6 on Solaris 2.6 question. .

13. 2.6 FCS -> 2.6 5/98 upgrade fails because /usr moved to /usr:2.6