This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: RFC: All glibc machine maintainers: Is " RLIM_INFINITY as((__rlim_t) -1)" OK?
On Fri, May 18, 2012 at 8:37 PM, David Miller <davem@davemloft.net> wrote:
> From: "H.J. Lu" <hjl.tools@gmail.com>
> Date: Fri, 18 May 2012 19:47:06 -0700
>
>> On Fri, May 18, 2012 at 6:35 PM, Chris Metcalf <cmetcalf@tilera.com> wrote:
>>> Note that ((rlim_t) -1) is wrong for RLIM_INFINITY anyway; it would have to
>>> be (((rlim_t) -1) >> 1), I think.
>>>
>>
>> The current one has
>>
>> #ifndef __USE_FILE_OFFSET64
>> # define RLIM_INFINITY ((unsigned long int)(~0UL))
>> #else
>> # define RLIM_INFINITY 0xffffffffffffffffuLL
>> #endif
>>
>>
>> Why ((rlim_t) -1) ?is wrong? ?BTW, x32 rlim_t is 64-bit.
>
> It looks like, besides sparc, mips and alpha in the glibc-ports tree
> also override RLIM_INFINITY to something which is effectively -1 >> 1
So kernel has
include/asm-generic/resource.h:#ifndef RLIM_INFINITY
include/asm-generic/resource.h:# define RLIM_INFINITY (~0UL)
and many ports override it. ((rlim_t) -1) is OK then.
--
H.J.