From owner-freebsd-hackers Wed Jun 5 10:47:04 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id KAA19700 for hackers-outgoing; Wed, 5 Jun 1996 10:47:04 -0700 (PDT) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id KAA19695 for ; Wed, 5 Jun 1996 10:47:01 -0700 (PDT) Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.12/8.6.9) id DAA27840; Thu, 6 Jun 1996 03:42:56 +1000 Date: Thu, 6 Jun 1996 03:42:56 +1000 From: Bruce Evans Message-Id: <199606051742.DAA27840@godzilla.zeta.org.au> To: freebsd-hackers@freebsd.org, jake@ibmpcug.co.uk Subject: Re: RLIMIT_NOFILE Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >Is getrlimit really broken? No. >> #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 Script started on Thu Jun 6 03:39:42 1996 ttyv0:bde@alphplex:/tmp> cc -c -Wall z.c z.c: In function `main': z.c:13: warning: int format, different type arg (arg 2) z.c:13: warning: int format, different type arg (arg 3) z.c:14: warning: implicit declaration of function `strerror' z.c:14: warning: format argument is not a pointer (arg 2) ttyv0:bde@alphplex:/tmp> exit Script done on Thu Jun 6 03:39:52 1996 lim.rlim_max and lim.rlim_cur have type long long so thay can not be printed using %d. >> FreeBSD: getrlimit: max=-1 cur=2147483647 >> NetBSD: getrlimit: max=-1 cur=2147483647 lim.rlim_max is actually 0x7fffffffffffffff. The low 32 bits of it look like -1. The high 32 bits of it leak into the next %d. Bruce