[LTP] [PATCH 1/1] m4: Remove (custom) check for <linux/random.h>
Jan Stancek
jstancek@redhat.com
Mon Mar 17 16:03:27 CET 2025
On Mon, Mar 17, 2025 at 3:07 PM Petr Vorel <pvorel@suse.cz> wrote:
>
> Header support is normally done with AC_CHECK_HEADERS_ONCE builtin.
> <linux/random.h> was added in kernel git from the beginning (2.6.12)
> no need to check for it.
>
> getrandom() syscall is supported since kernel 3.17 (check for its
> support, which was relevant at the time is done by tst_syscall()).
>
> NOTE: whole check is done for getrandom() libc wrapper support (used in
> include/lapi/getrandom.h), which was added in glibc 2.25, musl 1.1.20
> and uclibc-ng v1.0.2 (but until v1.0.50 required _GNU_SOURCE).
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
Acked-by: Jan Stancek <jstancek@redhat.com>
> ---
> Tested:
> https://github.com/pevik/ltp/actions/runs/13901359040
>
> configure.ac | 1 -
> include/lapi/getrandom.h | 2 +-
> m4/ltp-linuxrandom.m4 | 19 -------------------
> 3 files changed, 1 insertion(+), 21 deletions(-)
> delete mode 100644 m4/ltp-linuxrandom.m4
>
> diff --git a/configure.ac b/configure.ac
> index 0f2b6f3329..6582ba8b0f 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -376,7 +376,6 @@ LTP_CHECK_FORTIFY_SOURCE
> LTP_CHECK_KERNEL_DEVEL
> LTP_CHECK_KEYUTILS_SUPPORT
> LTP_CHECK_LIBMNL
> -LTP_CHECK_LINUXRANDOM
> LTP_CHECK_SELINUX
> LTP_CHECK_SYNC_ADD_AND_FETCH
> LTP_CHECK_SYSCALL_EVENTFD
> diff --git a/include/lapi/getrandom.h b/include/lapi/getrandom.h
> index 706ef9b8ff..8d5b90ee93 100644
> --- a/include/lapi/getrandom.h
> +++ b/include/lapi/getrandom.h
> @@ -10,7 +10,7 @@
>
> #ifdef HAVE_SYS_RANDOM_H
> # include <sys/random.h>
> -#elif HAVE_LINUX_RANDOM_H
> +#else
> # include <linux/random.h>
> #endif
>
> diff --git a/m4/ltp-linuxrandom.m4 b/m4/ltp-linuxrandom.m4
> deleted file mode 100644
> index 4f6b9d1355..0000000000
> --- a/m4/ltp-linuxrandom.m4
> +++ /dev/null
> @@ -1,19 +0,0 @@
> -dnl SPDX-License-Identifier: GPL-2.0-or-later
> -dnl Copyright (c) Linux Test Project, 2015
> -
> -AC_DEFUN([LTP_CHECK_LINUXRANDOM],[
> - AC_MSG_CHECKING([for linux/random.h])
> - AC_COMPILE_IFELSE([AC_LANG_SOURCE([
> -
> -#include <linux/random.h>
> -int main(void) {
> - return 0;
> -}])],[has_linux_random_h="yes"])
> -
> -if test "x$has_linux_random_h" = xyes; then
> - AC_DEFINE(HAVE_LINUX_RANDOM_H,1,[Define to 1 if having a valid linux/random.h])
> - AC_MSG_RESULT(yes)
> -else
> - AC_MSG_RESULT(no)
> -fi
> -])
> --
> 2.48.1
>
More information about the ltp
mailing list