Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Jun 1996 14:12:12 GMT
From:      James Raynard <fqueries@jraynard.demon.co.uk>
To:        trig@netlink.co.uk
Cc:        questions@freebsd.org
Subject:   Re: Max first parameter of a Select call?
Message-ID:  <199606191412.OAA20866@jraynard.demon.co.uk>
In-Reply-To: <m0uW4t2-000I5NC@netlink.co.uk> (trig@netlink.co.uk)

next in thread | previous in thread | raw e-mail | index | archive | help
I wrote:-

> In any case, the number of file descriptors a process can have open is
> limited by OPEN_MAX, which is 64 on FreeBSD:-

Sorry folks, that was complete Horlicks:-

$ cat temp.c
#include <unistd.h>
#include <stdio.h>

main() {
        int i = 1;

        for (;;) {
                if (dup(0) < 0) {
                        printf("dup failed with i = %d\n", i);
                        perror("dup");
                        break;
                }
                i++;
        }

        return 0;
}
$ gcc temp.c
$ ulimit -n    
64
$ ./a.out
dup failed with i = 61
dup: Too many open files
$ ulimit -n unlimited
$ ulimit -n           
360
$ ./a.out
dup failed with i = 357
dup: Too many open files
$ 

Next time, I'll try to look at the shell limits *before* posting 8-(

-- 
James Raynard, Edinburgh, Scotland
james@jraynard.demon.co.uk



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606191412.OAA20866>