* Re: ipc64_perm - generic
[not found] <4A1AE972.9010905@monstr.eu>
@ 2009-05-25 22:21 ` Arnd Bergmann
2009-05-26 5:47 ` Michal Simek
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2009-05-25 22:21 UTC (permalink / raw)
To: monstr, linux-arch; +Cc: John Williams, linux-kernel, Arnd Bergmann
On Monday 25 May 2009 18:54:42 Michal Simek wrote:
>
> Hi Arnd, cc: John
>
> From asm-generic/posix_types.h
>
> 17 #ifndef __kernel_mode_t
> 18 typedef unsigned int __kernel_mode_t;
> 19 #endif
>
> This structure is not aligned properly because of pad2.
>
> 19 struct ipc64_perm {
> 20 __kernel_key_t key;
> 21 __kernel_uid32_t uid;
> 22 __kernel_gid32_t gid;
> 23 __kernel_uid32_t cuid;
> 24 __kernel_gid32_t cgid;
> 25 __kernel_mode_t mode;
> 26 unsigned short __pad1;
> 27 unsigned short seq;
> 28 unsigned short __pad2;
> 29 unsigned long __unused1;
> 30 unsigned long __unused2;
> 31 };
>
> I think we should remove __pad1.
> What do you think?
Right, well spotted.
I'd like to keep the struct ipc64_perm compatible with most architectures, so
maybe we can play a little trick here:
> Here is proposed struct.
> struct ipc64_perm {
> __kernel_key_t key;
> __kernel_uid32_t uid;
> __kernel_gid32_t gid;
> __kernel_uid32_t cuid;
> __kernel_gid32_t cgid;
> __kernel_mode_t mode;
+ unsigned char __pad1[4 - sizeof(__kernel_mode_t)];
> unsigned short seq;
> unsigned short __pad2;
> unsigned long __unused1;
> unsigned long __unused2;
> };
If that's too much of a hack, we could also change the default __kernel_mode_t
in asm-generic/posix_types.h to unsigned short, which it is on all 32-bit architectures
except mips and xtensa. For some reason, all 64 bit architechtures use unsigned
int for mode_t, but I couldn't find out why. Glibc uses unsigned int externally.
Arnd <><
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: ipc64_perm - generic
2009-05-25 22:21 ` ipc64_perm - generic Arnd Bergmann
@ 2009-05-26 5:47 ` Michal Simek
0 siblings, 0 replies; 2+ messages in thread
From: Michal Simek @ 2009-05-26 5:47 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linux-arch, John Williams, linux-kernel
Arnd Bergmann wrote:
> On Monday 25 May 2009 18:54:42 Michal Simek wrote:
>> Hi Arnd, cc: John
>>
>> From asm-generic/posix_types.h
>>
>> 17 #ifndef __kernel_mode_t
>> 18 typedef unsigned int __kernel_mode_t;
>> 19 #endif
>>
>> This structure is not aligned properly because of pad2.
>>
>> 19 struct ipc64_perm {
>> 20 __kernel_key_t key;
>> 21 __kernel_uid32_t uid;
>> 22 __kernel_gid32_t gid;
>> 23 __kernel_uid32_t cuid;
>> 24 __kernel_gid32_t cgid;
>> 25 __kernel_mode_t mode;
>> 26 unsigned short __pad1;
>> 27 unsigned short seq;
>> 28 unsigned short __pad2;
>> 29 unsigned long __unused1;
>> 30 unsigned long __unused2;
>> 31 };
>>
>> I think we should remove __pad1.
>> What do you think?
>
> Right, well spotted.
>
> I'd like to keep the struct ipc64_perm compatible with most architectures, so
> maybe we can play a little trick here:
>
>> Here is proposed struct.
>> struct ipc64_perm {
>> __kernel_key_t key;
>> __kernel_uid32_t uid;
>> __kernel_gid32_t gid;
>> __kernel_uid32_t cuid;
>> __kernel_gid32_t cgid;
>> __kernel_mode_t mode;
>
> + unsigned char __pad1[4 - sizeof(__kernel_mode_t)];
>
>> unsigned short seq;
>> unsigned short __pad2;
>> unsigned long __unused1;
>> unsigned long __unused2;
>> };
>
> If that's too much of a hack, we could also change the default __kernel_mode_t
> in asm-generic/posix_types.h to unsigned short, which it is on all 32-bit architectures
> except mips and xtensa. For some reason, all 64 bit architechtures use unsigned
> int for mode_t, but I couldn't find out why. Glibc uses unsigned int externally.
Is it this final solution (that above) or we just change kernel_mode_t to short?
Michal
>
> Arnd <><
--
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-05-26 5:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <4A1AE972.9010905@monstr.eu>
2009-05-25 22:21 ` ipc64_perm - generic Arnd Bergmann
2009-05-26 5:47 ` Michal Simek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox