From: Arnd Bergmann <arnd@arndb.de>
To: monstr@monstr.eu, linux-arch@vger.kernel.org
Cc: John Williams <john.williams@petalogix.com>,
linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>
Subject: Re: ipc64_perm - generic
Date: Mon, 25 May 2009 22:21:43 +0000 [thread overview]
Message-ID: <200905252221.44082.arnd@arndb.de> (raw)
In-Reply-To: <4A1AE972.9010905@monstr.eu>
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 <><
next parent reply other threads:[~2009-05-25 22:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4A1AE972.9010905@monstr.eu>
2009-05-25 22:21 ` Arnd Bergmann [this message]
2009-05-26 5:47 ` ipc64_perm - generic Michal Simek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200905252221.44082.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=john.williams@petalogix.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=monstr@monstr.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox