[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3d18d50a-b96f-befc-d905-c9f68f7542ab@gmail.com>
Date: Tue, 21 Jun 2022 15:01:24 +0200
From: Alejandro Colomar <alx.manpages@...il.com>
To: Cyril Hrubis <chrubis@...e.cz>, linux-kernel@...r.kernel.org
Cc: linux-arch@...r.kernel.org, libc-alpha@...rceware.org,
linux-api@...r.kernel.org, dhowells@...hat.com,
David.Laight@...lab.com, zack@...folio.org, ltp@...ts.linux.it,
linux-man <linux-man@...r.kernel.org>
Subject: Re: [PATCH v3] uapi: Make __{u,s}64 match {u,}int64_t in userspace
On 6/21/22 14:03, Cyril Hrubis 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 for C code.
>
> We cannot make the change for C++ since that would be non-backwards
> compatible change and may cause possible regressions and even
> compilation failures, e.g. overloaded function may no longer find a
> correct match.
>
> This allows us to use the kernel structure definitions in userspace in C
> code. For example we can use PRIu64 and PRId64 modifiers in printf() to
> print structure membere. Morever with this there would be no need to
> redefine these structures in an libc implementations as it is done now.
>
> Consider for example the newly added statx() syscall. If we use the
> header from uapi we will get warnings when attempting to print it's
> members as:
>
> printf("%" PRIu64 "\n", stx.stx_size);
>
> We get:
>
> warning: format '%lu' expects argument of type 'long unsigned int',
> but argument 5 has type '__u64' {aka 'long long unsigned int'}
>
> Signed-off-by: Cyril Hrubis <chrubis@...e.cz>
Acked-by: Alejandro Colomar <alx.manpages@...il.com>
> ---
> include/uapi/asm-generic/types.h | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> v2: Make sure we do not break C++ applications
> v3: Update commit message to explain C++ exclusion
>
> diff --git a/include/uapi/asm-generic/types.h b/include/uapi/asm-generic/types.h
> index dfaa50d99d8f..11e468a39d1e 100644
Powered by blists - more mailing lists