lxc / lxcfs

FUSE filesystem for LXC
https://linuxcontainers.org/lxcfs
Other
1.04k stars 251 forks source link

proc_loadavg.c: Fix incompatible integer to pointer conversion #610

Closed listout closed 1 year ago

listout commented 1 year ago

Newer compiler like Clang 16 and GCC 14 have certain error enabled by default, namely -Werror=incompatible-function-pointer-types. Which resutls in build error such as:

proc_loadavg.c:606:10: error: incompatible integer to pointer conversion returning int from a function with result type pthread_t

My patch supresses the error for now, but a proper fix would be better. Fist discovered on Gentoo linux (bug #894348).

Bug: https://bugs.gentoo.org/894348 Closes: https://github.com/lxc/lxcfs/issues/561

stgraber commented 1 year ago

@brauner @mihalicyn what do you think we should do to clean that up properly?

mihalicyn commented 1 year ago

Ugh, strictly speaking we can't rely on the fact that pthread_t is a numeric type. In some pthreads implementations it can be a structure type.

IMHO this fix is good enough to be merged to make our Gentoo friends happy. But I have to rework that and add and export a new liblxcfs function like int load_daemon_v2(pthread_t *threadid, int load_use) (direct analogy with pthread_create).

Christian?

listout commented 1 year ago

Gentoo friends happy.

Hey! Just wanted to note that it's not just Gentoo, rather all new compiler (as I mentioned GCC14 and Clang 16). :)

mihalicyn commented 1 year ago

Hey! Just wanted to note that it's not just Gentoo, rather all new compiler (as I mentioned GCC14 and Clang 16). :)

haha, sure! But Gentoo of course the first in the line of distros in terms of having a new versions of compilers and stuff (and Fedora?) ;-)