Message ID | 20240222-utest-fixes-v2-1-ba9cd06b41d3@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | utest: fix build with musl + clang >=15 | expand |
On Thu, 22 Feb 2024 11:12:44 +0100 Miko Larsson via B4 Relay <devnull+mikoxyzzz.gmail.com@kernel.org> wrote: > From: Miko Larsson <mikoxyzzz@gmail.com> > > This fixes the build with musl + clang >=15; musl doesn't define > PATH_MAX anywhere else, and clang >=15 doesn't allow implicit > declarations with >=c99. Without this, the build fails due to PATH_MAX > not being defined. > > We could include limits.h from the libc, but AFAIK the libc doesn't > necessarily have to define PATH_MAX, so it's safer to just include > linux/limits.h Actually, the way I handle PATH_MAX is to add: #ifndef PATH_MAX #define PATH_MAX 1024 #endif As it's not really used, but just a default value to be able to add any paths used in the tracefs directory, where 1024 is more than enough. -- Steve
On Thu, 22 Feb 2024 09:53:45 -0500 Steven Rostedt <rostedt@goodmis.org> wrote: > On Thu, 22 Feb 2024 11:12:44 +0100 > Miko Larsson via B4 Relay <devnull+mikoxyzzz.gmail.com@kernel.org> wrote: > > > From: Miko Larsson <mikoxyzzz@gmail.com> > > > > This fixes the build with musl + clang >=15; musl doesn't define > > PATH_MAX anywhere else, and clang >=15 doesn't allow implicit > > declarations with >=c99. Without this, the build fails due to PATH_MAX > > not being defined. > > > > We could include limits.h from the libc, but AFAIK the libc doesn't > > necessarily have to define PATH_MAX, so it's safer to just include > > linux/limits.h > > Actually, the way I handle PATH_MAX is to add: > > #ifndef PATH_MAX > #define PATH_MAX 1024 > #endif > > As it's not really used, but just a default value to be able to add any > paths used in the tracefs directory, where 1024 is more than enough. I'm going to apply your other two patches, but I created a patch with the added code above, and will be posting that shortly. -- Steve
On Thu Feb 22, 2024 at 5:04 PM CET, Steven Rostedt wrote: > I'm going to apply your other two patches, but I created a patch with the > added code above, and will be posting that shortly. Thanks!
diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c index 963fac7..70bcf3e 100644 --- a/utest/tracefs-utest.c +++ b/utest/tracefs-utest.c @@ -16,6 +16,8 @@ #include <kbuffer.h> #include <pthread.h> +#include <linux/limits.h> + #include <sys/mount.h> #include <sys/syscall.h>