From: Jonathan Lundell <jlundell@pobox.com>
To: Matt <madmatt@bits.bris.ac.uk>, linux-kernel@vger.kernel.org
Subject: Re: ioctl arg passing
Date: Mon, 23 Apr 2001 16:41:17 -0700 [thread overview]
Message-ID: <p05100300b70a6c8bddc9@[209.245.157.6]> (raw)
In-Reply-To: <Pine.LNX.4.21.0104232301270.8859-100000@bits.bris.ac.uk>
In-Reply-To: <Pine.LNX.4.21.0104232301270.8859-100000@bits.bris.ac.uk>
At 11:09 PM +0100 4/23/01, Matt wrote:
>| struct instruction_t {
>| __s16 code;
>| __s16 rxlen;
>| __s16 *rxbuf;
>| __s16 txlen;
>| __s16 *txbuf;
>| };
>
>So far, I now know I can grab stuff across the user <-> kernel divide as I
>planned. The only problem I'm left with, which was kindly pointed out to
>me, is a question of packing with respect to both kernel & user-space.
>
>Can anyone suggest a method of either assuring the above structure is
>always packed the same, or alterations so that the problem is
>minimised? Either splitting the one ioctl into many, etc.
struct instruction_t {
__s16 code;
__s16 rxlen;
__s16 txlen;
__s16 pad;
__s16 *rxbuf;
__s16 *txbuf;
};
This was it's always aligned and packed, regardless of compiler packing settings. This particular layout happens to work with 64-bit pointers as well.... (I'm assuming that __s16 is a signed 16-bit type).
You can move the pointers to the front, but it's not necessary in this case, so I tried to preserve some of your original ordering (code first, rx before tx).
--
/Jonathan Lundell.
next prev parent reply other threads:[~2001-04-23 23:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-23 16:06 Matt
2001-04-23 17:50 ` Ingo Oeser
2001-04-23 20:14 ` Matt
2001-04-23 20:17 ` rui.sousa
2001-04-23 20:34 ` Matt
2001-04-23 20:37 ` Mathieu Chouquet-Stringer
2001-04-23 21:11 ` [OFFTOPIC] " rui.sousa
2001-04-23 19:58 ` Matt
2001-04-23 21:33 ` Ingo Oeser
2001-04-23 22:09 ` Matt
2001-04-23 23:41 ` Jonathan Lundell [this message]
2001-04-23 18:29 Petr Vandrovec
2001-04-23 16:40 ` Alex Bligh - linux-kernel
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='p05100300b70a6c8bddc9@[209.245.157.6]' \
--to=jlundell@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=madmatt@bits.bris.ac.uk \
/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
all inboxes | Powered by JetHome®