Article View: be.comp.programming
Article #16413Re: open filepointers
From: Carl Declerck
Date: Sat, 06 May 2000 00:00
Date: Sat, 06 May 2000 00:00
68 lines
2868 bytes
2868 bytes
On 06 May 2000 15:49:25 +0200, Lieven Marchand <mal@bewoner.dma.be> wrote:
>From ~linux/Documentation/filesystems/proc.txt:
>
>[snip]
>However, there is still a per process limit of open files, which
>unfortunately >can't be changed that easily. It is set to 1024 by
>default. To change this you >have to edit the files limits.h and fs.h
>in the kernel source tree. Finally, >change the definition of NR_OPEN
>and recompile the kernel.
>
>Dus je eerste operatie is wel nuttig maar ulimit gaat weinig uithalen.
Nochtans :
# uname -rs
Linux 2.2.14-5.0smp
# cat fhtest.c
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
extern int errno;
int main (void) {
int i;
for (i = 0; i < 20480; i++)
if (open("fhtest.c", O_RDONLY) < 0) {
printf ("error at attempt %d: %s\n", i, strerror(errno));
exit (0);
}
return 0;
}
# echo 16384 > /proc/sys/fs/file-max
# ulimit -n 1024
# ./fhtest
error at attempt 1021: Too many open files
# ulimit -n 16384
error at attempt 16259: Too many open files in system
Dat maakt dus wel degelijk een verschil. :) Ook, uit fs.h:
/*
* It's silly to have NR_OPEN bigger than NR_FILE, but you can change
* the file limit at runtime and only root can increase the per-process
* nr_file rlimit, so it's safe to set up a ridiculously high absolute
* upper limit on files-per-process.
*
* Some programs (notably those using select()) may have to be
* recompiled to take full advantage of the new limits..
*/
/* Fixed constants first: */
#undef NR_OPEN
#define NR_OPEN (1024*1024) /* Absolute upper limit on fd num */
#define INR_OPEN 1024 /* Initial setting for nfile rlimits */
Kan het zijn dat die docs niet 100% up-to-date zijn?
carl.
--
now playing: yelworc -- blood in face
act silly and fall in love with a bat while holding a small coffin.
carl@weirdhenge.org ......... net.fiend ......... http://weirdhenge.org/~carl/
Technical Details
Message-ID:
<slrn8h8pc5.pu2.carl@porphyria.iguana.be>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<LCZP4.115265$uF1.251648@afrodite.telenet-ops.be> <39108237$0$12148@bru5-newsr2.be.uu.net> <3911b908$0$12150@bru5-newsr2.be.uu.net> <CqjQ4.130740$uF1.283256@afrodite.telenet-ops.be> <3912ecaf$0$12153@bru5-newsr2.be.uu.net> <slrn8h6api.im7.carl@porphyria.iguana.be> <39144013$0$11457@bru5-newsr1.be.uu.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcea4,c83c8b73fef218dc X-Google-Attributes: gidfcea4,public From: carl@weirdhenge.org (Carl Declerck) Subject: Re: open filepointers Date: 2000/05/06 Message-ID: <slrn8h8pc5.pu2.carl@porphyria.iguana.be> X-Deja-AN: 620040315 References: <LCZP4.115265$uF1.251648@afrodite.telenet-ops.be> <39108237$0$12148@bru5-newsr2.be.uu.net> <3911b908$0$12150@bru5-newsr2.be.uu.net> <CqjQ4.130740$uF1.283256@afrodite.telenet-ops.be> <3912ecaf$0$12153@bru5-newsr2.be.uu.net> <slrn8h6api.im7.carl@porphyria.iguana.be> <39144013$0$11457@bru5-newsr1.be.uu.net> X-Complaints-To: news@porphyria.iguana.be X-Trace: porphyria.iguana.be 957638022 26974 194.7.44.162 (6 May 2000 18:33:42 GMT) Organization: Sweet nectar for a thousand young User-Agent: slrn/0.9.6.2 (Linux) NNTP-Posting-Date: 6 May 2000 18:33:42 GMT Newsgroups: be.comp.programming