From owner-freebsd-hackers Wed Jun 5 08:25:06 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id IAA09334 for hackers-outgoing; Wed, 5 Jun 1996 08:25:06 -0700 (PDT) Received: from irene.pcug.co.uk (mmdf@Irene.PCUG.CO.UK [192.68.174.61]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id IAA09316 for ; Wed, 5 Jun 1996 08:25:01 -0700 (PDT) From: jake@ibmpcug.co.uk Received: from Kate.ibmPCUG.CO.UK by irene.pcug.co.uk id aa12658; 5 Jun 96 16:24 BST Subject: RLIMIT_NOFILE To: freebsd-hackers@freebsd.org Date: Wed, 5 Jun 1996 16:24:24 +0100 (BST) Reply-To: jake@ibmpcug.co.uk X-Organisation: The PC User Group, Harrow, UK X-Address: 84-88 Pinner Road, Harrow, HA1 4LF, UK X-Phone: +44 181 863 1191 X-Mailer: ELM [version 2.4 PL2] Content-Type: text Message-ID: <9606051624.aa27511@kate.ibmPCUG.CO.UK> Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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 > To: Jake Dias > Subject: RLIMIT_NOFILE > I ran this program: > #include > #include > #include > #include > #include > 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