[haiku-development] Re: How to increase files limit?

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 24 Apr 2010 17:41:39 +0200

On 2010-04-24 at 17:22:01 [+0200], Ingo Weinhold <ingo_weinhold@xxxxxx> wrote:
> On 2010-04-24 at 15:25:40 [+0200], Ingo Weinhold <ingo_weinhold@xxxxxx>
> wrote:
> > On 2010-04-24 at 14:43:59 [+0200], Andreas Färber <andreas.faerber@xxxxxx>
> > wrote:
> > > I've been playing with Subversion 1.7.0 (r936039, r937623) and for non-
> > > trivial stuff keep getting errors like this:
> > > 
> > > svn: Can't open '/tmp/svn-tempfile.2.tmp': Too many open files
> > > svn: unable to open database file
> > > 
> > > This is reproducible by running:
> > > 
> > > svn co svn://anonsvn.mono-project.com/source/trunk/mcs
> > > 
> > > As well as by subsequent `svn cleanup` and `svn up`, or by `svn
> > > upgrade` on a previous repository. With 1.6.x this didn't occur, so I
> > > suspect this is related to their upgrade of the repository format and/
> > > or their use of SQLite (here 3.6.23.1).
> > > 
> > > On Linux it would be possible to do something like `echo 1024 > /proc/
> > > sys/kernel/file-max` or `ulimit -n 1024`. On Haiku the latter results
> > > in:
> > > sh: ulimit: cannot modify limit: Operation not allowed
> > > How can we achieve the equivalent on Haiku? Is there something like
> > > NR_FILE defined in the kernel?
> > 
> > Haiku supports setrlimit() and RLIMIT_NOFILE, but not all RLIMIT_*
> > constants. bash's config.h doesn't define HAVE_RESOURCE, which is why
> > setrlimit() isn't used at all. Defining it may or may not work.
> 
> Now I see, config-bot.h defines HAVE_RESOURCE. Very inventive.
> 
> 
> On 2010-04-24 at 16:37:08 [+0200], Jérôme Duval <korli@xxxxxxxxxxxxxxxx>
> wrote:
> > 2010/4/24 Andreas Färber <andreas.faerber@xxxxxx>:
> > > On Linux it would be possible to do something like `echo 1024 >
> > > /proc/sys/kernel/file-max` or `ulimit -n 1024`. On Haiku the latter
> > > results
> > > in:
> > > sh: ulimit: cannot modify limit: Operation not allowed
> > > How can we achieve the equivalent on Haiku? Is there something like
> > > NR_FILE
> > > defined in the kernel?
> > 
> > ulimit has a soft value and a hard value. On Haiku, the hard limit is
> > 8192 and fixed, hence the Operation not allowed message.
> > You can however set the soft value with `ulimit -Sn 1024`.
> 
> The specs for setrlimit() say that the appropriate privileges are required
> to raise the hard limit. Interestingly enough "ulimit -n ..." works fine
> under Linux when run as a normal user. I suspect we're doing something 
> wrong.

Forgot my comments regarding the patch:

Index: build/jam/ImageRules
===================================================================
--- build/jam/ImageRules        (revision 36442)
+++ build/jam/ImageRules        (working copy)
@@ -605,6 +607,17 @@
[...]
+                       local isGCCAgnostic = [ on $(archiveFile)
+                               return $(ARCHIVE_IS_GCC_AGNOSTIC) ] ;
+                       # NOTE: passing "true" thru init script causes the 
variable to be
+                       # resolved as a build system file, eg
+                       # objects/haiku/x86/release/bin/coreutils/src/true

The reason for this is that parameters to actions should only be targets 
(they are treated as such by jam), not any other kind of parameters. I see 
that is already incorrect for $(extractedSubDir). Non-target parameters 
should be passed via on-target variables (on the generated target). E.g. in 
this case:

ARCHIVE_IS_GCC_AGNOSTIC on $(dummyTarget) = $(isGCCAgnostic:E=false) ;


Index: build/scripts/build_haiku_image
===================================================================
--- build/scripts/build_haiku_image     (revision 36442)
+++ build/scripts/build_haiku_image     (working copy)
[...]
+createSymlinksForHybrid()
+{
+       echo 'createSymlinksForHybrid ...'
+       for srcPathLib in $@; do
+               aLib=`echo $srcPathLib | sed -e "s:.*/::"`

basename

+               destLinkTarget="../$aLib"
+               srcPath=`echo $srcPathLib | sed -e "s:${aLib}::"`

dirname

+               destLinkDir="${srcPath}${gccAltDir}"                    
+               mkdir -p $destLinkDir
+               ln -sf -t $destLinkDir $destLinkTarget
+       done
+}

Other than that (and the debug code and the 80 column limit) the changes look 
OK.

CU, Ingo

Other related posts: