From: David Laight <David.Laight@ACULAB.COM>
To: 'David Howells' <dhowells@redhat.com>, Cyril Hrubis <chrubis@suse.cz>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-api@vger.kernel.org" <linux-api@vger.kernel.org>,
"ltp@lists.linux.it" <ltp@lists.linux.it>,
"libc-alpha@sourceware.org" <libc-alpha@sourceware.org>,
"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
"arnd@arndb.de" <arnd@arndb.de>
Subject: RE: [PATCH] uapi: Make __{u,s}64 match {u,}int64_t in userspace
Date: Tue, 23 Nov 2021 16:58:30 +0000 [thread overview]
Message-ID: <ff8fc4470c8f45678e546cafe9980eff@AcuMS.aculab.com> (raw)
In-Reply-To: <1618289.1637686052@warthog.procyon.org.uk>
From: David Howells
> Sent: 23 November 2021 16:48
>
> Cyril Hrubis <chrubis@suse.cz> wrote:
>
> > This changes the __u64 and __s64 in userspace on 64bit platforms from
> > long long (unsigned) int to just long (unsigned) int in order to match
> > the uint64_t and int64_t size in userspace.
That is a massive UAPI change you can't do.
> Can you guarantee this won't break anything in userspace? Granted the types
> *ought* to be the same size, but anyone who's written code on the basis that
> these are "(unsigned) long long int" may suddenly get a bunch of warnings
> where they didn't before from the C compiler. Anyone using C++, say, may find
> their code no longer compiles because overloaded function matching no longer
> finds a correct match.
Indeed
> Also, whilst your point about PRIu64 and PRId64 modifiers in printf() is a
> good one, it doesn't help someone whose compiler doesn't support that (I don't
> know if anyone's likely to encounter such these days). At the moment, I think
> a user can assume that %llu will work correctly both on 32-bit and 64-bit on
> all arches, but you're definitely breaking that assumption.
PRIu64 (etc) don't require compiler support, just the correct header file.
I'm pretty sure that portable user code needs to allow for int64_t being
either 'long' or 'long long' on 64bit architectures.
(Indeed 'long' may not even be 64bit.)
On 32bit int32_t can definitely be either 'int' of 'long' at whim.
I'm not sure anyone has tried a 64bit long with a 128bit long-long.
But the C language might lead you to do that.
Of course, fully portable code has to allow for char, short, int and long
all being the same size!
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2021-11-23 16:59 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-22 16:43 [PATCH] uapi: Make __{u,s}64 match {u,}int64_t in userspace Cyril Hrubis
2021-11-22 16:51 ` Alejandro Colomar (mailing lists)
2021-11-22 20:48 ` Arnd Bergmann
2021-11-23 9:14 ` Cyril Hrubis
2021-11-23 14:18 ` Arnd Bergmann
2021-11-23 19:50 ` Florian Weimer
2021-11-24 10:17 ` Alejandro Colomar (man-pages)
2021-11-22 22:19 ` Zack Weinberg
2021-11-23 9:15 ` Cyril Hrubis
2021-12-02 15:34 ` Rich Felker
2021-12-02 23:29 ` Rich Felker
2021-12-02 23:43 ` Adhemerval Zanella
2021-12-03 0:10 ` Zack Weinberg
2021-12-03 12:32 ` Adhemerval Zanella
2021-12-03 12:54 ` Alejandro Colomar (man-pages)
2021-11-23 16:47 ` David Howells
2021-11-23 16:58 ` David Laight [this message]
2021-11-29 11:58 ` Cyril Hrubis
2021-11-29 14:34 ` Arnd Bergmann
2021-12-02 14:55 ` Zack Weinberg
2021-12-02 15:01 ` David Howells
2021-12-02 20:48 ` Zack Weinberg
2021-12-08 15:33 ` Cyril Hrubis
2022-06-17 12:13 ` Ping: " Alejandro Colomar
2022-06-17 15:04 ` Cyril Hrubis
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=ff8fc4470c8f45678e546cafe9980eff@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=arnd@arndb.de \
--cc=chrubis@suse.cz \
--cc=dhowells@redhat.com \
--cc=libc-alpha@sourceware.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ltp@lists.linux.it \
/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;
as well as URLs for NNTP newsgroup(s).