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?
sysadmin has configured for the system.
What error does it get?Quote:>The following code looks ok to me, but it doesn't work.
Did you set the owner to root when you did that?Quote:>I also tried chmod +s.
When you start the web server from one of the /etc/init.d scripts, you canQuote:>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)
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.