Thread (23 messages) 23 messages, 9 authors, 2022-06-17

Re: [PATCH] uapi: Make __{u,s}64 match {u,}int64_t in userspace

From: Zack Weinberg <hidden>
Date: 2021-12-02 14:55:52
Also in: linux-arch, lkml, ltp

On Mon, Nov 29, 2021, at 9:34 AM, Arnd Bergmann wrote:
On Mon, Nov 29, 2021 at 12:58 PM Cyril Hrubis [off-list ref] wrote:
quoted
What about guarding the change with __STDINT_COMPATIBLE_TYPES__
In user space, I don't see a compelling need for backward compatibility?  User space's expectation is that the types are *already* the same and we (glibc) regularly get bug reports because they aren't.

I could be persuaded otherwise with an example of a program for which changing
__s64 from 'long long' to 'long' would break *binary* backward compatibility, or
similarly for __u64.
I don't think we can include stdint.h here, the entire point of the custom
kernel types is to ensure the other kernel headers can use these types
without relying on libc headers.
If __KERNEL__ is not defined, though, there should be no issue, right?

From user space's perspective, it's an ongoing source of problems whenever __uN isn't exactly the same "underlying type" as uintN_t, same for __sN and intN_t.  We would really like it if the uapi headers, when included from user space, deferred to the C library for the definitions of these types.

<stdint.h> does define a lot of things beyond just the fixed-width types, and it defines names in the application namespace (i.e. with no __ prefix).  Perhaps we could come to some agreement on a private header, provided by libcs, that *only* defined __{u,}int{8,16,32,64}_t.  glibc already has <bits/types.h> which promises
to define only __-prefix names, but it defines a lot of other types as well (__dev_t, __uid_t, __pid_t, __time_t, etc etc etc).

zw
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help