Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jun 1996 16:24:24 +0100 (BST)
From:      jake@ibmpcug.co.uk
To:        freebsd-hackers@freebsd.org
Subject:   RLIMIT_NOFILE 
Message-ID:   <9606051624.aa27511@kate.ibmPCUG.CO.UK>

next in thread | raw e-mail | index | archive | help
Hello Hackers,

Is getrlimit really broken?

SunOS deprecates usage of getdtablesize in favour of getrlimit(2)
so changing the order of the ifdef to check for getdtablesize somehow
first is not the proper thing to do, although it would work across
all systems I believe.

Fix getrlimit I say!

Any takers?

I am not on the list just wanted to highlight this problem.
regards, jake

> Date: Wed, 5 Jun 1996 15:49:42 +0100 (BST)
> From: Philip Hazel <ph10@cus.cam.ac.uk>
> To: Jake Dias <jake@ibmpcug.co.uk>
> Subject: RLIMIT_NOFILE

> I ran this program:

> #include <sys/types.h>
> #include <sys/time.h>
> #include <sys/resource.h>
> #include <errno.h>
> #include <stdio.h>

> int main(void)
> {
> struct rlimit lim;

> #ifdef  RLIMIT_NOFILE
>   if (getrlimit(RLIMIT_NOFILE, &lim) == 0)
>     printf("getrlimit: max=%d cur=%d\n", lim.rlim_max, lim.rlim_cur);
>   else printf("getrlimit failed: %s\n", strerror(errno));
> #else
>   printf("getdtablesize = %d\n", getdtablesize());
> #endif

> return 0;
> }   

> on several machines. I got:

> Solaris 2.4: getrlimit: max=1024 cur=64
> FreeBSD:     getrlimit: max=-1 cur=2147483647
> NetBSD:      getrlimit: max=-1 cur=2147483647
> Ultrix:      getdtablesize = 64
> Linux:       getdtablesize = 256
> HP-UX:       getrlimit: max=1024 cur=60
> BSDI:        getrlimit: max=9830 cur=0
> OSF1:        getrlimit: max=4096 cur=4096
> SunOS4:      getrlimit: max=256 cur=64

> --
> Philip Hazel                   University Computing Service,
> ph10@cus.cam.ac.uk             New Museums Site, Cambridge CB2 3QG,
> P.Hazel@ucs.cam.ac.uk          England.  Phone: +44 1223 334714

-- 
Jake Dias                jake@pcug.co.uk               ...!ibmpcug!jake
My PGP Key? - finger jake@pcug.co.uk or email with Subject: get pgp key



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