From: Kyle Moffett <mrmacman_g4@mac.com>
To: linux-os@analogic.com
Cc: Grzegorz Kulewski <kangur@polcom.net>,
Adrian Bunk <bunk@stusta.de>, Renate Meijer <kleuske@xs4all.nl>,
Al Viro <viro@parcelfarce.linux.theplanet.co.uk>,
Andreas Schwab <schwab@suse.de>,
Kenneth Johansson <ken@kenjo.org>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Linux kernel <linux-kernel@vger.kernel.org>,
Dag Arne Osvik <da@osvik.no>
Subject: Re: Use of C99 int types
Date: Tue, 5 Apr 2005 17:47:05 -0400 [thread overview]
Message-ID: <32e408a1593b89b3ad08ea3d4b34ecc4@mac.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0504050803590.15387@chaos.analogic.com>
On Apr 05, 2005, at 08:18, Richard B. Johnson wrote:
> One cannot just use 'int' or 'long', in particular when interfacing
> with an operating system. For example, look at the socket interface
> code. Parameters are put into an array of longs and a pointer to
> this array is passed to the socket interface. It's a mess when
> converting this code to 64-bit world.
Exactly
> If originally one used a structure of the correct POSIX integer
> types, and a pointer to the structure was passed, then absolutely
> nothing in the source-code would have to be changed at all when
> compiling that interface for a 64-bit machine.
But you _can't_ use the POSIX integer types. When compiling the
kernel, if you use the types, you must define them in the kernel
headers. On the other hand, when compiling userspace stuff, you
_can't_ have them defined in the kernel headers because libc also
defines them. The solution is to use __{s,u}{8,16,32,64}, which
are _only_ defined by the kernel, not by libc or gcc, and can be
therefore used in the ABI.
> The continual short-cuts, with the continual "special-case"
> hacks is what makes porting difficult. That's what the POSIX
> types was supposed to help prevent.
Except the POSIX types themselves are not usable for the boundary
code for the reasons of double definition. Google for Linus'
posts on this topic a couple months ago.
> That's why I think if there was a stdint.h file in the kernel,
> when people were performing maintenance or porting their code,
> they could start using those types.
The types _are_ available from the kernel headers, but only when
compiling with __KERNEL__, to avoid conflicts from the libc
definitions.
Cheers,
Kyle Moffett
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCM/CS/IT/U d- s++: a18 C++++>$ UB/L/X/*++++(+)>$ P+++(++++)>$
L++++(+++) E W++(+) N+++(++) o? K? w--- O? M++ V? PS+() PE+(-) Y+
PGP+++ t+(+++) 5 X R? tv-(--) b++++(++) DI+ D+ G e->++++$ h!*()>++$ r
!y?(-)
------END GEEK CODE BLOCK------
next prev parent reply other threads:[~2005-04-05 21:51 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-03 11:55 Use of C99 int types Dag Arne Osvik
2005-04-03 12:05 ` Stephen Rothwell
2005-04-03 12:30 ` Dag Arne Osvik
2005-04-03 13:27 ` Andreas Schwab
2005-04-03 22:48 ` Dag Arne Osvik
2005-04-03 23:05 ` Al Viro
2005-04-03 23:17 ` Grzegorz Kulewski
2005-04-03 23:20 ` Dag Arne Osvik
2005-04-04 0:05 ` Adrian Bunk
2005-04-03 18:13 ` Al Viro
2005-04-03 23:03 ` Dag Arne Osvik
2005-04-04 3:08 ` Herbert Xu
2005-04-04 8:42 ` Dag Arne Osvik
2005-04-03 19:23 ` Renate Meijer
2005-04-03 20:25 ` Kenneth Johansson
2005-04-03 22:08 ` Kyle Moffett
2005-04-04 10:05 ` Renate Meijer
2005-04-04 10:50 ` Dag Arne Osvik
2005-04-04 20:30 ` Renate Meijer
2005-04-04 20:57 ` Al Viro
2005-04-04 21:25 ` Richard B. Johnson
2005-04-04 21:49 ` Kyle Moffett
2005-04-05 9:23 ` Renate Meijer
2005-04-05 11:27 ` Kyle Moffett
[not found] ` <09142f748cc6ad2bf4fffab7a5519226@xs4all.nl>
2005-04-05 22:11 ` Kyle Moffett
[not found] ` <eb65bccddde63541ae4b7b2d6c4c32d3@xs4all.nl>
2005-04-06 21:11 ` Kyle Moffett
2005-04-07 11:28 ` Renate Meijer
2005-04-05 12:18 ` Richard B. Johnson
2005-04-05 21:47 ` Kyle Moffett [this message]
2005-04-05 8:49 ` Renate Meijer
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=32e408a1593b89b3ad08ea3d4b34ecc4@mac.com \
--to=mrmacman_g4@mac.com \
--cc=bunk@stusta.de \
--cc=da@osvik.no \
--cc=kangur@polcom.net \
--cc=ken@kenjo.org \
--cc=kleuske@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-os@analogic.com \
--cc=schwab@suse.de \
--cc=sfr@canb.auug.org.au \
--cc=viro@parcelfarce.linux.theplanet.co.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