* [LTP] [PATCH v3 0/2] Build fixes
@ 2024-04-25 15:55 Petr Vorel
2024-04-25 15:55 ` [LTP] [PATCH v3 1/2] lapi/fs: Replace loff_t with long long Petr Vorel
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Petr Vorel @ 2024-04-25 15:55 UTC (permalink / raw)
To: ltp
changes v2->v3
* Use just long long instead of define _GNU_SOURCE (Jan)
Tested:
https://github.com/pevik/ltp/actions/runs/8835557594
Ideally I'd like to merge tomorrow.
Kind regards,
Petr
Petr Vorel (2):
lapi/fs: Replace loff_t with long long
lapi: getrandom05: Add getrandom() fallback
configure.ac | 1 +
include/lapi/fs.h | 6 +++---
include/lapi/getrandom.h | 15 +++++++++++++--
testcases/kernel/syscalls/getrandom/getrandom05.c | 3 ++-
4 files changed, 19 insertions(+), 6 deletions(-)
--
2.43.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread* [LTP] [PATCH v3 1/2] lapi/fs: Replace loff_t with long long 2024-04-25 15:55 [LTP] [PATCH v3 0/2] Build fixes Petr Vorel @ 2024-04-25 15:55 ` Petr Vorel 2024-04-25 15:55 ` [LTP] [PATCH v3 2/2] lapi: getrandom05: Add getrandom() fallback Petr Vorel 2024-04-25 16:06 ` [LTP] [PATCH v3 0/2] Build fixes Jan Stancek 2 siblings, 0 replies; 5+ messages in thread From: Petr Vorel @ 2024-04-25 15:55 UTC (permalink / raw) To: ltp loff_t in tst_max_lfs_filesize() would require define _GNU_SOURCE. Replace with long long to avoid this. This fixes build error on musl (alpine): In file included from unlink09.c:18: ../../../../include/lapi/fs.h:58:15: error: unknown type name 'loff_t' 58 | static inline loff_t tst_max_lfs_filesize(void) Fixes: 2cf78f47a ("unlink: Add error tests for EPERM and EROFS") Suggested-by: Jan Stancek <jstancek@redhat.com> Signed-off-by: Petr Vorel <pvorel@suse.cz> --- changes v2->v3 * Use just long long instead of define _GNU_SOURCE (Jan) Later I move this out of LAPI header, but now let's fix the CI. Kind regards, Petr include/lapi/fs.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/lapi/fs.h b/include/lapi/fs.h index c19ee821d..635979b02 100644 --- a/include/lapi/fs.h +++ b/include/lapi/fs.h @@ -55,13 +55,13 @@ * 64 bit: macro taken from kernel from include/linux/fs.h * 32 bit: own implementation */ -static inline loff_t tst_max_lfs_filesize(void) +static inline long long tst_max_lfs_filesize(void) { #ifdef TST_ABI64 - return (loff_t)LLONG_MAX; + return LLONG_MAX; #else long page_size = getpagesize(); - loff_t ret = ULONG_MAX; + long long ret = ULONG_MAX; while (page_size >>= 1) ret <<= 1; -- 2.43.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [LTP] [PATCH v3 2/2] lapi: getrandom05: Add getrandom() fallback 2024-04-25 15:55 [LTP] [PATCH v3 0/2] Build fixes Petr Vorel 2024-04-25 15:55 ` [LTP] [PATCH v3 1/2] lapi/fs: Replace loff_t with long long Petr Vorel @ 2024-04-25 15:55 ` Petr Vorel 2024-04-25 16:06 ` [LTP] [PATCH v3 0/2] Build fixes Jan Stancek 2 siblings, 0 replies; 5+ messages in thread From: Petr Vorel @ 2024-04-25 15:55 UTC (permalink / raw) To: ltp Fix missing getrandom() support detection on glibc < 2.25 and musl < 1.1.20. Add m4 check and use lapi header in getrandom05 to fix error: getrandom05.c:16:24: fatal error: sys/random.h: No such file or directory #include <sys/random.h> on openSUSE Leap 42.2 (glibc 2.22, kernel 4.4). NOTE: getrandom() requires Linux >= 3.17, which is not supported. While it'd be quite easy to check (it would require e.g. AC_LINK_IFELSE() check), I skipped that, because we are going to drop kernel 3.10 support. Fixes: d9280782d ("getrandom: Add negative tests for getrandom") Signed-off-by: Petr Vorel <pvorel@suse.cz> --- The same as in v1 and v2. configure.ac | 1 + include/lapi/getrandom.h | 15 +++++++++++++-- testcases/kernel/syscalls/getrandom/getrandom05.c | 3 ++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 1d7e862d8..15a5847fa 100644 --- a/configure.ac +++ b/configure.ac @@ -76,6 +76,7 @@ AC_CHECK_HEADERS_ONCE([ \ sys/inotify.h \ sys/pidfd.h sys/prctl.h \ + sys/random.h \ sys/shm.h \ sys/timerfd.h \ sys/ustat.h \ diff --git a/include/lapi/getrandom.h b/include/lapi/getrandom.h index c654ca1ac..706ef9b8f 100644 --- a/include/lapi/getrandom.h +++ b/include/lapi/getrandom.h @@ -8,10 +8,14 @@ #include "config.h" -#if HAVE_LINUX_RANDOM_H -#include <linux/random.h> +#ifdef HAVE_SYS_RANDOM_H +# include <sys/random.h> +#elif HAVE_LINUX_RANDOM_H +# include <linux/random.h> #endif +#include "lapi/syscalls.h" + /* * Flags for getrandom(2) * @@ -27,4 +31,11 @@ # define GRND_RANDOM 0x0002 #endif +#ifndef HAVE_SYS_RANDOM_H +static inline int getrandom(void *buf, size_t buflen, unsigned int flags) +{ + return tst_syscall(SYS_getrandom, buf, buflen, flags); +} +#endif + #endif /* LAPI_GETRANDOM_H__ */ diff --git a/testcases/kernel/syscalls/getrandom/getrandom05.c b/testcases/kernel/syscalls/getrandom/getrandom05.c index 1a9614330..92098deb7 100644 --- a/testcases/kernel/syscalls/getrandom/getrandom05.c +++ b/testcases/kernel/syscalls/getrandom/getrandom05.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (c) 2024 FUJITSU LIMITED. All Rights Reserved. + * Copyright (c) Linux Test Project, 2024 * Author: Yang Xu <xuyang2018.jy@fujitsu.com> */ @@ -13,8 +14,8 @@ * - EINVAL when flag is invalid */ -#include <sys/random.h> #include "tst_test.h" +#include "lapi/getrandom.h" static char buff_efault[64]; static char buff_einval[64]; -- 2.43.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH v3 0/2] Build fixes 2024-04-25 15:55 [LTP] [PATCH v3 0/2] Build fixes Petr Vorel 2024-04-25 15:55 ` [LTP] [PATCH v3 1/2] lapi/fs: Replace loff_t with long long Petr Vorel 2024-04-25 15:55 ` [LTP] [PATCH v3 2/2] lapi: getrandom05: Add getrandom() fallback Petr Vorel @ 2024-04-25 16:06 ` Jan Stancek 2024-04-25 21:03 ` Petr Vorel 2 siblings, 1 reply; 5+ messages in thread From: Jan Stancek @ 2024-04-25 16:06 UTC (permalink / raw) To: Petr Vorel; +Cc: ltp On Thu, Apr 25, 2024 at 5:55 PM Petr Vorel <pvorel@suse.cz> wrote: > > changes v2->v3 > * Use just long long instead of define _GNU_SOURCE (Jan) > > Tested: > https://github.com/pevik/ltp/actions/runs/8835557594 Thanks for trying this other approach, even as short-term fix, it will hopefully at least give us more time to think about addressing other instances of _GNU_SOURCE related issues. > > Ideally I'd like to merge tomorrow. Acked-by: Jan Stancek <jstancek@redhat.com> > > Kind regards, > Petr > > Petr Vorel (2): > lapi/fs: Replace loff_t with long long > lapi: getrandom05: Add getrandom() fallback > > configure.ac | 1 + > include/lapi/fs.h | 6 +++--- > include/lapi/getrandom.h | 15 +++++++++++++-- > testcases/kernel/syscalls/getrandom/getrandom05.c | 3 ++- > 4 files changed, 19 insertions(+), 6 deletions(-) > > -- > 2.43.0 > -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH v3 0/2] Build fixes 2024-04-25 16:06 ` [LTP] [PATCH v3 0/2] Build fixes Jan Stancek @ 2024-04-25 21:03 ` Petr Vorel 0 siblings, 0 replies; 5+ messages in thread From: Petr Vorel @ 2024-04-25 21:03 UTC (permalink / raw) To: Jan Stancek; +Cc: ltp Hi Jan, > On Thu, Apr 25, 2024 at 5:55 PM Petr Vorel <pvorel@suse.cz> wrote: > > changes v2->v3 > > * Use just long long instead of define _GNU_SOURCE (Jan) > > Tested: > > https://github.com/pevik/ltp/actions/runs/8835557594 > Thanks for trying this other approach, even as short-term fix, it will hopefully > at least give us more time to think about addressing other > instances of _GNU_SOURCE related issues. > > Ideally I'd like to merge tomorrow. > Acked-by: Jan Stancek <jstancek@redhat.com> Thanks a lot for your suggestions, merged! Kind regards, Petr -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-04-25 21:03 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-04-25 15:55 [LTP] [PATCH v3 0/2] Build fixes Petr Vorel 2024-04-25 15:55 ` [LTP] [PATCH v3 1/2] lapi/fs: Replace loff_t with long long Petr Vorel 2024-04-25 15:55 ` [LTP] [PATCH v3 2/2] lapi: getrandom05: Add getrandom() fallback Petr Vorel 2024-04-25 16:06 ` [LTP] [PATCH v3 0/2] Build fixes Jan Stancek 2024-04-25 21:03 ` Petr Vorel
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox