Date: Thu, 6 Jun 1996 03:42:56 +1000 From: Bruce Evans <bde@zeta.org.au> To: freebsd-hackers@freebsd.org, jake@ibmpcug.co.uk Subject: Re: RLIMIT_NOFILE Message-ID: <199606051742.DAA27840@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606051742.DAA27840>
