🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #83875

Re: File descriptor limits.

#83875
From: D. Stussy
Date: Thu, 17 Feb 2011 23:35
51 lines
3279 bytes
"Miquel van Smoorenburg" <miquels@netscum.invalid> wrote in message
news:4d5d37ad$0$41113$e4fe514c@news.xs4all.nl...
> In article <87lj1g4a0y.fsf@araminta.anjou.terraraq.org.uk>,
> Richard Kettlewell  <rjk@greenend.org.uk> wrote:
> >On many platforms it's sufficient to rebuild your program with an
> >explicit, larger, definition for FD_SETSIZE; rebuilding the whole Libc
> >is not required.
> >
> >Glibc makes this unusually awkward, for some reason, unconditionally
> >using an internal __FD_SETSIZE and explicitly ignoring any attempts to
> >override it.
>
> #define LARGE_FD_SETSIZE 4096
>
> /*
>  * Cannot increase FD_SETSIZE on Linux, but we can increase __FD_SETSIZE
>  * with glibc 2.2 and 2.3 at least. We do this by including
>  * bits/types.h which defines __FD_SETSIZE first (before any other
include),
>  * then we redefine __FD_SETSIZE. Ofcourse a user program may NEVER
>  * include bits/whatever.h directly, so this is a dirty hack!
>  */
> #if LARGE_FD_SETSIZE > 1024
> #  ifdef __linux__
> #    include <features.h>
> #    if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
> #      include <bits/types.h>
> #      undef __FD_SETSIZE
> #      define __FD_SETSIZE LARGE_FD_SETSIZE
> #    endif
> #  else
>      /* Works on most BSDs */
> #    define FD_SETSIZE LARGE_FD_SETSIZE
> #  endif
> #endif
>
> #include <sys/time.h>
> #include <sys/types.h>
> #include <unistd.h>


Thanks for the replies.  However, I took a different approach:  I re-did
the spool to have half-as-many CNFS buffers which are twice-as-large as
what I had before, and that reduced the number so that I have enough free
descriptors available so as not to hit the limit.

I also complained at kernel.org by requesting an "enhancement" type-bug - #
29342, and suggested that the limit be based on the actual resource
available ("ulimit -n") as opposed to hard-coded in a define.

Technical Details
Message-ID: <ijkbb3$612$1@snarked.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!news.glorb.com!news.snarked.org!pool-71-106-210-121.lsanca.dsl-w.verizon.net!not-for-mail
References: <ijc6vh$12l$1@snarked.org> <ijd9rf$vl6$2@selene.doeblitz.net> <87lj1g4a0y.fsf@araminta.anjou.terraraq.org.uk> <4d5d37ad$0$41113$e4fe514c@news.xs4all.nl>

Show Full Headers
Complete Article Headers
Message-ID: <ijkbb3$612$1@snarked.org>
Subject: Re: File descriptor limits.
Date: Thu, 17 Feb 2011 15:35:01 -0800
From: "D. Stussy" <spam+newsgroups@bde-arc.ampr.org>
References: <ijc6vh$12l$1@snarked.org> <ijd9rf$vl6$2@selene.doeblitz.net> <87lj1g4a0y.fsf@araminta.anjou.terraraq.org.uk> <4d5d37ad$0$41113$e4fe514c@news.xs4all.nl>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!news.glorb.com!news.snarked.org!pool-71-106-210-121.lsanca.dsl-w.verizon.net!not-for-mail
Newsgroups: news.software.nntp
Lines: 51
Reply-To: "D. Stussy" <replies@newsgroups.kd6lvw.ampr.org>
Injection-Date: Thu, 17 Feb 2011 23:34:59 +0000 (UTC)
Injection-Info: snarked.org;
 posting-host="pool-71-106-210-121.lsanca.dsl-w.verizon.net:71.106.210.121";
 logging-data="6178"; mail-complaints-to="newsmaster+complaints@snarked.org"
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1478
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478
X-Original-Bytes: 3029