[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMe9rOo-g+RomUQziagrGUZKwZJwkQ3uRW0Tk3bH9uaxv5ejbw@mail.gmail.com>
Date: Thu, 17 May 2012 20:47:37 -0700
From: "H.J. Lu" <hjl.tools@...il.com>
To: "H. Peter Anvin" <hpa@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
torvalds@...ux-foundation.org, mingo@...nel.org,
tglx@...utronix.de, Paul Mundt <lethal@...ux-sh.org>
Subject: Re: [PATCH 08/10] Use __kernel_ulong_t in struct msqid64_ds
On Thu, May 17, 2012 at 8:43 PM, H.J. Lu <hjl.tools@...il.com> wrote:
> On Thu, May 17, 2012 at 8:39 PM, H.J. Lu <hjl.tools@...il.com> wrote:
>> On Thu, May 17, 2012 at 8:21 PM, H. Peter Anvin <hpa@...nel.org> wrote:
>>> On 05/17/2012 04:51 PM, H. Peter Anvin wrote:
>>>>
>>>> This patch and the one before it seems to have another problem: we
>>>> currently define __BITS_PER_LONG as:
>>>>
>>>> #ifdef __x86_64__
>>>> # define __BITS_PER_LONG 64
>>>> #else
>>>> # define __BITS_PER_LONG 32
>>>> #endif
>>>>
>>>
>>> H.J., do you see any problem *other* than this wretched struct
>>> msqid64_ds with changing the above from __x86_64__ to
>>>
>>> #if defined(__x86_64__) && !defined(__ILP32__)
>>>
>>> ... in the above?
>>>
>>> As far as struct msqid64_ds, I think we can fix it simply because x86
>>> is the only compat-aware architecture which has to deal with it.
>>>
>>> (Incidentally, if sh is ever expanded to 64 bits, it will have a problem
>>> in the bigendian configuration...)
>>
>> That will be wrong. __BITS_PER_LONG defines # bits of long
>> as seen by kernel. We don't use it in user space. Remember
>> x32 uses the identical interface as x86-64. So
>>
>> #ifdef __x86_64__
>> # define __BITS_PER_LONG 64
>> #else
>> # define __BITS_PER_LONG 32
>> #endif
>>
>> struct msqid64_ds {
>> struct ipc64_perm msg_perm;
>> __kernel_time_t msg_stime; /* last msgsnd time */
>> #if __BITS_PER_LONG != 64
>> unsigned long __unused1;
>> #endif
>> __kernel_time_t msg_rtime; /* last msgrcv time */
>> #if __BITS_PER_LONG != 64
>> unsigned long __unused2;
>> #endif
>> __kernel_time_t msg_ctime; /* last change time */
>> #if __BITS_PER_LONG != 64
>> unsigned long __unused3;
>> #endif
>>
>> are absolutely correct for x32. You can think
>>
>> #if __BITS_PER_LONG != 64
>>
>> as
>>
>> #ifndef __x86_64__
>>
>> which is used in glibc.
>>
>
> Now I remembered. Here is another patch. Here
>
> #if __BITS_PER_LONG == 64
>
> means
>
> #ifdef __x86_64__
>
> Change __BITS_PER_LONG to __BITS_PER_LONG_AS_SEEN_BY_KERNEL
> may avoid this confusion.
>
Or __BITS_PER_NATURAL_WORD.
--
H.J.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists