* Re: [LTP] [PATCH v1 1/2] include/lapi/sched.h: move namespaces_constants.h's constant into here
2022-11-29 6:40 [LTP] [PATCH v1 1/2] include/lapi/sched.h: move namespaces_constants.h's constant into here Yang Xu
@ 2022-11-29 5:50 ` Li Wang
2022-11-29 6:41 ` [LTP] [PATCH v1 2/2] include/lapi/sched.h: Move lapi/clone.h " Yang Xu
2022-12-01 10:05 ` [LTP] [PATCH v1 1/2] include/lapi/sched.h: move namespaces_constants.h's constant " Richard Palethorpe
2 siblings, 0 replies; 7+ messages in thread
From: Li Wang @ 2022-11-29 5:50 UTC (permalink / raw)
To: Yang Xu; +Cc: ltp
[-- Attachment #1.1: Type: text/plain, Size: 20050 bytes --]
On Tue, Nov 29, 2022 at 1:40 PM Yang Xu <xuyang2018.jy@fujitsu.com> wrote:
> Kernel header doesn't have this namespaces_constants.h header file and
> it can be moved into lapi/sched. Also, lapi/clone.h have some duplicated
> CLONE_* constants, they should be moved into here too.
>
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
>
Reviewed-by: Li Wang <liwang@redhat.com>
---
> include/lapi/namespaces_constants.h | 34 ---------------
> include/lapi/sched.h | 41 +++++++++++++++++--
> lib/tst_net.c | 2 +-
> testcases/cve/cve-2017-16939.c | 2 +-
> testcases/cve/icmp_rate_limit01.c | 2 +-
> .../kernel/containers/libclone/libclone.h | 3 +-
> testcases/kernel/containers/mountns/mountns.h | 2 +-
> .../kernel/containers/netns/netns_netlink.c | 3 +-
> testcases/kernel/containers/pidns/pidns01.c | 2 +-
> testcases/kernel/containers/pidns/pidns02.c | 2 +-
> testcases/kernel/containers/pidns/pidns03.c | 2 +-
> testcases/kernel/containers/pidns/pidns12.c | 2 +-
> testcases/kernel/containers/pidns/pidns20.c | 2 +-
> testcases/kernel/containers/pidns/pidns32.c | 2 +-
> testcases/kernel/containers/share/ns_common.h | 2 +-
> testcases/kernel/containers/share/ns_create.c | 3 +-
> testcases/kernel/containers/share/ns_exec.c | 3 +-
> testcases/kernel/containers/sysvipc/common.h | 2 +-
> testcases/kernel/containers/timens/timens01.c | 2 +-
> testcases/kernel/containers/userns/common.h | 2 +-
> .../kernel/controllers/cgroup/cgroup_core02.c | 3 +-
> .../syscalls/clock_gettime/clock_gettime03.c | 2 +-
> .../clock_nanosleep/clock_nanosleep03.c | 2 +-
> testcases/kernel/syscalls/clone/clone09.c | 3 +-
> .../kernel/syscalls/fanotify/fanotify17.c | 3 +-
> .../kernel/syscalls/getxattr/getxattr05.c | 3 +-
> testcases/kernel/syscalls/ioctl/ioctl_ns01.c | 3 +-
> testcases/kernel/syscalls/ioctl/ioctl_ns05.c | 3 +-
> testcases/kernel/syscalls/ioctl/ioctl_ns06.c | 3 +-
> testcases/kernel/syscalls/setns/setns.h | 2 +-
> testcases/kernel/syscalls/sysinfo/sysinfo03.c | 2 +-
> testcases/kernel/syscalls/timerfd/timerfd04.c | 2 +-
> 32 files changed, 67 insertions(+), 79 deletions(-)
> delete mode 100644 include/lapi/namespaces_constants.h
>
> diff --git a/include/lapi/namespaces_constants.h
> b/include/lapi/namespaces_constants.h
> deleted file mode 100644
> index e34b0d6a8..000000000
> --- a/include/lapi/namespaces_constants.h
> +++ /dev/null
> @@ -1,34 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later
> -/*
> - * Copyright (c) 2015 Red Hat, Inc.
> - */
> -
> -#ifndef LAPI_NAMESPACES_CONSTANTS_H__
> -#define LAPI_NAMESPACES_CONSTANTS_H__
> -
> -#ifndef CLONE_NEWIPC
> -# define CLONE_NEWIPC 0x08000000
> -#endif
> -#ifndef CLONE_NEWNS
> -# define CLONE_NEWNS 0x00020000
> -#endif
> -#ifndef CLONE_NEWNET
> -# define CLONE_NEWNET 0x40000000
> -#endif
> -#ifndef CLONE_NEWPID
> -# define CLONE_NEWPID 0x20000000
> -#endif
> -#ifndef CLONE_NEWUSER
> -# define CLONE_NEWUSER 0x10000000
> -#endif
> -#ifndef CLONE_NEWCGROUP
> -# define CLONE_NEWCGROUP 0x02000000
> -#endif
> -#ifndef CLONE_NEWUTS
> -# define CLONE_NEWUTS 0x04000000
> -#endif
> -#ifndef CLONE_NEWTIME
> -# define CLONE_NEWTIME 0x00000080
> -#endif
> -
> -#endif /* LAPI_NAMESPACES_CONSTANTS_H__ */
> diff --git a/include/lapi/sched.h b/include/lapi/sched.h
> index 226d3109a..3b0b4be31 100644
> --- a/include/lapi/sched.h
> +++ b/include/lapi/sched.h
> @@ -8,6 +8,7 @@
> #define LAPI_SCHED_H__
>
> #include <sched.h>
> +#include <unistd.h>
> #include <stdint.h>
> #include <inttypes.h>
> #include "lapi/syscalls.h"
> @@ -47,19 +48,51 @@ static inline int sched_getattr(pid_t pid, struct
> sched_attr *attr,
> #endif
>
> #ifndef CLONE_VM
> -# define CLONE_VM 0x00000100
> +# define CLONE_VM 0x00000100
> #endif
>
> #ifndef CLONE_FS
> -# define CLONE_FS 0x00000200
> +# define CLONE_FS 0x00000200
> +#endif
> +
> +#ifndef CLONE_NEWNS
> +# define CLONE_NEWNS 0x00020000
> #endif
>
> #ifndef CLONE_SYSVSEM
> -# define CLONE_SYSVSEM 0x00040000
> +# define CLONE_SYSVSEM 0x00040000
> +#endif
> +
> +#ifndef CLONE_NEWCGROUP
> +# define CLONE_NEWCGROUP 0x02000000
> +#endif
> +
> +#ifndef CLONE_NEWUTS
> +# define CLONE_NEWUTS 0x04000000
> +#endif
> +
> +#ifndef CLONE_NEWIPC
> +# define CLONE_NEWIPC 0x08000000
> +#endif
> +
> +#ifndef CLONE_NEWUSER
> +# define CLONE_NEWUSER 0x10000000
> +#endif
> +
> +#ifndef CLONE_NEWPID
> +# define CLONE_NEWPID 0x20000000
> +#endif
> +
> +#ifndef CLONE_NEWNET
> +# define CLONE_NEWNET 0x40000000
> #endif
>
> #ifndef CLONE_IO
> -# define CLONE_IO 0x80000000
> +# define CLONE_IO 0x80000000
> +#endif
> +
> +#ifndef CLONE_NEWTIME
> +# define CLONE_NEWTIME 0x00000080
> #endif
>
> #endif /* LAPI_SCHED_H__ */
> diff --git a/lib/tst_net.c b/lib/tst_net.c
> index 61fc0ea76..a97e25b11 100644
> --- a/lib/tst_net.c
> +++ b/lib/tst_net.c
> @@ -14,7 +14,7 @@
> #include "tst_test.h"
> #include "tst_net.h"
> #include "tst_private.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> void tst_print_svar(const char *name, const char *val)
> {
> diff --git a/testcases/cve/cve-2017-16939.c
> b/testcases/cve/cve-2017-16939.c
> index eb5400c0c..e41fb274a 100644
> --- a/testcases/cve/cve-2017-16939.c
> +++ b/testcases/cve/cve-2017-16939.c
> @@ -25,7 +25,7 @@
> #include "tst_res_flags.h"
> #include "tst_safe_macros.h"
> #include "tst_safe_net.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define BUFSIZE 2048
>
> diff --git a/testcases/cve/icmp_rate_limit01.c
> b/testcases/cve/icmp_rate_limit01.c
> index 7a51aa0a4..8ee50a276 100644
> --- a/testcases/cve/icmp_rate_limit01.c
> +++ b/testcases/cve/icmp_rate_limit01.c
> @@ -34,7 +34,7 @@
> #include "lapi/if_addr.h"
> #include "tst_test.h"
> #include "tst_netdevice.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define DSTNET 0xfa444e00 /* 250.68.78.0 */
> #define SRCNET 0xfa444e40 /* 250.68.78.64 */
> diff --git a/testcases/kernel/containers/libclone/libclone.h
> b/testcases/kernel/containers/libclone/libclone.h
> index b8740f1bc..e92fdca02 100644
> --- a/testcases/kernel/containers/libclone/libclone.h
> +++ b/testcases/kernel/containers/libclone/libclone.h
> @@ -19,7 +19,6 @@
>
> #include <stdio.h>
> #include <stdlib.h>
> -#include <sched.h>
> #include <unistd.h>
> #include <string.h>
> #include <errno.h>
> @@ -28,7 +27,7 @@
> #include <signal.h>
> #include "lapi/syscalls.h"
> #include "test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define T_UNSHARE 0
> #define T_CLONE 1
> diff --git a/testcases/kernel/containers/mountns/mountns.h
> b/testcases/kernel/containers/mountns/mountns.h
> index 76b37b477..615f1a058 100644
> --- a/testcases/kernel/containers/mountns/mountns.h
> +++ b/testcases/kernel/containers/mountns/mountns.h
> @@ -8,7 +8,7 @@
> #define COMMON_H
>
> #include "tst_test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define DIRA "LTP_DIR_A"
> #define DIRB "LTP_DIR_B"
> diff --git a/testcases/kernel/containers/netns/netns_netlink.c
> b/testcases/kernel/containers/netns/netns_netlink.c
> index 6f60ff94e..e8df616e2 100644
> --- a/testcases/kernel/containers/netns/netns_netlink.c
> +++ b/testcases/kernel/containers/netns/netns_netlink.c
> @@ -33,11 +33,10 @@
> #include <stdio.h>
> #include <stdlib.h>
> #include <errno.h>
> -#include <sched.h>
>
> #include "tst_test.h"
> #include "tst_safe_macros.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define MAX_TRIES 1000
>
> diff --git a/testcases/kernel/containers/pidns/pidns01.c
> b/testcases/kernel/containers/pidns/pidns01.c
> index eba4b806b..5080b6fad 100644
> --- a/testcases/kernel/containers/pidns/pidns01.c
> +++ b/testcases/kernel/containers/pidns/pidns01.c
> @@ -15,7 +15,7 @@
> */
>
> #include "tst_test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> static int child_func(LTP_ATTRIBUTE_UNUSED void *arg)
> {
> diff --git a/testcases/kernel/containers/pidns/pidns02.c
> b/testcases/kernel/containers/pidns/pidns02.c
> index 9f3a46526..b8913d3f6 100644
> --- a/testcases/kernel/containers/pidns/pidns02.c
> +++ b/testcases/kernel/containers/pidns/pidns02.c
> @@ -14,7 +14,7 @@
> */
>
> #include "tst_test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> static int child_func(LTP_ATTRIBUTE_UNUSED void *arg)
> {
> diff --git a/testcases/kernel/containers/pidns/pidns03.c
> b/testcases/kernel/containers/pidns/pidns03.c
> index b9b38b5d9..122ba7891 100644
> --- a/testcases/kernel/containers/pidns/pidns03.c
> +++ b/testcases/kernel/containers/pidns/pidns03.c
> @@ -13,7 +13,7 @@
>
> #include <sys/mount.h>
> #include "tst_test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define PROCDIR "proc"
>
> diff --git a/testcases/kernel/containers/pidns/pidns12.c
> b/testcases/kernel/containers/pidns/pidns12.c
> index 0e6b17142..fb1ec90ca 100644
> --- a/testcases/kernel/containers/pidns/pidns12.c
> +++ b/testcases/kernel/containers/pidns/pidns12.c
> @@ -16,7 +16,7 @@
> #define _GNU_SOURCE 1
> #include <signal.h>
> #include "tst_test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> static volatile pid_t sig_pid = -1;
>
> diff --git a/testcases/kernel/containers/pidns/pidns20.c
> b/testcases/kernel/containers/pidns/pidns20.c
> index f1e239dde..9f369699a 100644
> --- a/testcases/kernel/containers/pidns/pidns20.c
> +++ b/testcases/kernel/containers/pidns/pidns20.c
> @@ -15,7 +15,7 @@
> #define _GNU_SOURCE 1
> #include <signal.h>
> #include "tst_test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> static volatile int signals;
> static volatile int last_signo;
> diff --git a/testcases/kernel/containers/pidns/pidns32.c
> b/testcases/kernel/containers/pidns/pidns32.c
> index 333e1fcad..3f7df788e 100644
> --- a/testcases/kernel/containers/pidns/pidns32.c
> +++ b/testcases/kernel/containers/pidns/pidns32.c
> @@ -15,7 +15,7 @@
>
> #include <sys/mman.h>
> #include "tst_test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define MAXNEST 32
>
> diff --git a/testcases/kernel/containers/share/ns_common.h
> b/testcases/kernel/containers/share/ns_common.h
> index 69e51ce71..0f85aceb4 100644
> --- a/testcases/kernel/containers/share/ns_common.h
> +++ b/testcases/kernel/containers/share/ns_common.h
> @@ -17,7 +17,7 @@
> #ifndef __NS_COMMON_H__
> #define __NS_COMMON_H__
> #include <sched.h>
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define PROC_PATH "/proc"
> #define NS_TOTAL 6
> diff --git a/testcases/kernel/containers/share/ns_create.c
> b/testcases/kernel/containers/share/ns_create.c
> index d4259f38b..3f09e71e0 100644
> --- a/testcases/kernel/containers/share/ns_create.c
> +++ b/testcases/kernel/containers/share/ns_create.c
> @@ -24,7 +24,6 @@
> */
>
> #define _GNU_SOURCE
> -#include <sched.h>
> #include <sys/syscall.h>
> #include <sys/types.h>
> #include <sys/stat.h>
> @@ -32,7 +31,7 @@
> #include <string.h>
> #include <errno.h>
> #include "test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
> #include "ns_common.h"
>
> char *TCID = "ns_create";
> diff --git a/testcases/kernel/containers/share/ns_exec.c
> b/testcases/kernel/containers/share/ns_exec.c
> index c492165f0..4abd1063b 100644
> --- a/testcases/kernel/containers/share/ns_exec.c
> +++ b/testcases/kernel/containers/share/ns_exec.c
> @@ -21,7 +21,6 @@
> */
>
> #define _GNU_SOURCE
> -#include <sched.h>
> #include <sys/syscall.h>
> #include <sys/types.h>
> #include <sys/wait.h>
> @@ -31,7 +30,7 @@
> #include <errno.h>
> #include "test.h"
> #include "lapi/syscalls.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
> #include "ns_common.h"
>
> char *TCID = "ns_exec";
> diff --git a/testcases/kernel/containers/sysvipc/common.h
> b/testcases/kernel/containers/sysvipc/common.h
> index 258d355d7..9b0fc16e9 100644
> --- a/testcases/kernel/containers/sysvipc/common.h
> +++ b/testcases/kernel/containers/sysvipc/common.h
> @@ -11,7 +11,7 @@
> #include <stdlib.h>
> #include "tst_test.h"
> #include "lapi/syscalls.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> enum {
> T_CLONE,
> diff --git a/testcases/kernel/containers/timens/timens01.c
> b/testcases/kernel/containers/timens/timens01.c
> index 3f6235ec3..3621b3446 100644
> --- a/testcases/kernel/containers/timens/timens01.c
> +++ b/testcases/kernel/containers/timens/timens01.c
> @@ -15,9 +15,9 @@
> */
>
> #define _GNU_SOURCE
> -#include "lapi/namespaces_constants.h"
> #include "lapi/posix_clocks.h"
> #include "tst_test.h"
> +#include "lapi/sched.h"
>
> static struct tcase {
> const char *desc;
> diff --git a/testcases/kernel/containers/userns/common.h
> b/testcases/kernel/containers/userns/common.h
> index d3bdcc53f..635d0f190 100644
> --- a/testcases/kernel/containers/userns/common.h
> +++ b/testcases/kernel/containers/userns/common.h
> @@ -8,7 +8,7 @@
> #define COMMON_H
>
> #include "tst_test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define UID_MAP 0
> #define GID_MAP 1
> diff --git a/testcases/kernel/controllers/cgroup/cgroup_core02.c
> b/testcases/kernel/controllers/cgroup/cgroup_core02.c
> index e6d599b36..1872a7dff 100644
> --- a/testcases/kernel/controllers/cgroup/cgroup_core02.c
> +++ b/testcases/kernel/controllers/cgroup/cgroup_core02.c
> @@ -24,14 +24,13 @@
> */
>
> #define _GNU_SOURCE
> -#include <sched.h>
> #include <stdlib.h>
> #include <stdio.h>
> #include <sys/types.h>
> #include <pwd.h>
> #include "tst_test.h"
> #include "tst_safe_file_at.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> static struct tst_cg_group *cg_child_a, *cg_child_b;
> static uid_t nobody_uid;
> diff --git a/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
> b/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
> index f185977d3..b02d22a14 100644
> --- a/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
> +++ b/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
> @@ -18,7 +18,7 @@
> #include "time64_variants.h"
> #include "tst_safe_clocks.h"
> #include "tst_timer.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> static struct tcase {
> int clk_id;
> diff --git a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c
> b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c
> index 5bd91fa61..dfc522278 100644
> --- a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c
> +++ b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c
> @@ -18,7 +18,7 @@
> #include "time64_variants.h"
> #include "tst_safe_clocks.h"
> #include "tst_timer.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define OFFSET_S 10
> #define SLEEP_US 100000
> diff --git a/testcases/kernel/syscalls/clone/clone09.c
> b/testcases/kernel/syscalls/clone/clone09.c
> index e9e584564..e4691f513 100644
> --- a/testcases/kernel/syscalls/clone/clone09.c
> +++ b/testcases/kernel/syscalls/clone/clone09.c
> @@ -4,14 +4,13 @@
> */
>
> #define _GNU_SOURCE
> -#include <sched.h>
> #include <stdlib.h>
> #include <errno.h>
>
> #include "tst_test.h"
> #include "clone_platform.h"
> #include "lapi/syscalls.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> static void *child_stack;
> static int sysctl_net = -1;
> diff --git a/testcases/kernel/syscalls/fanotify/fanotify17.c
> b/testcases/kernel/syscalls/fanotify/fanotify17.c
> index 7d74b2540..3ecb31b6e 100644
> --- a/testcases/kernel/syscalls/fanotify/fanotify17.c
> +++ b/testcases/kernel/syscalls/fanotify/fanotify17.c
> @@ -20,11 +20,10 @@
> #include <errno.h>
> #include <unistd.h>
> #include <sys/types.h>
> -#include <sched.h>
> #include <stdlib.h>
>
> #include "tst_test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #ifdef HAVE_SYS_FANOTIFY_H
> #include "fanotify.h"
> diff --git a/testcases/kernel/syscalls/getxattr/getxattr05.c
> b/testcases/kernel/syscalls/getxattr/getxattr05.c
> index 3e73cc567..28eb4cbcf 100644
> --- a/testcases/kernel/syscalls/getxattr/getxattr05.c
> +++ b/testcases/kernel/syscalls/getxattr/getxattr05.c
> @@ -20,7 +20,6 @@
> #include <errno.h>
> #include <unistd.h>
> #include <sys/types.h>
> -#include <sched.h>
> #include <stdlib.h>
>
> #ifdef HAVE_SYS_XATTR_H
> @@ -32,7 +31,7 @@
> #endif
>
> #include "tst_test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #if defined(HAVE_SYS_XATTR_H) && defined(HAVE_LIBACL)
>
> diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
> b/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
> index 95be877dc..06c81ba1b 100644
> --- a/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
> +++ b/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
> @@ -19,11 +19,10 @@
> #define _GNU_SOURCE
>
> #include <errno.h>
> -#include <sched.h>
> #include <stdlib.h>
> #include "tst_test.h"
> #include "lapi/ioctl_ns.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define STACK_SIZE (1024 * 1024)
>
> diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ns05.c
> b/testcases/kernel/syscalls/ioctl/ioctl_ns05.c
> index ae2f9da51..36e41c468 100644
> --- a/testcases/kernel/syscalls/ioctl/ioctl_ns05.c
> +++ b/testcases/kernel/syscalls/ioctl/ioctl_ns05.c
> @@ -18,11 +18,10 @@
>
> #include <errno.h>
> #include <stdio.h>
> -#include <sched.h>
> #include <stdlib.h>
> #include "tst_test.h"
> #include "lapi/ioctl_ns.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define STACK_SIZE (1024 * 1024)
>
> diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ns06.c
> b/testcases/kernel/syscalls/ioctl/ioctl_ns06.c
> index 393ba1437..45fc01ce7 100644
> --- a/testcases/kernel/syscalls/ioctl/ioctl_ns06.c
> +++ b/testcases/kernel/syscalls/ioctl/ioctl_ns06.c
> @@ -19,11 +19,10 @@
>
> #include <errno.h>
> #include <stdio.h>
> -#include <sched.h>
> #include <stdlib.h>
> #include "tst_test.h"
> #include "lapi/ioctl_ns.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define STACK_SIZE (1024 * 1024)
>
> diff --git a/testcases/kernel/syscalls/setns/setns.h
> b/testcases/kernel/syscalls/setns/setns.h
> index 46beef17f..45c759917 100644
> --- a/testcases/kernel/syscalls/setns/setns.h
> +++ b/testcases/kernel/syscalls/setns/setns.h
> @@ -4,7 +4,7 @@
> */
>
> #include <stdio.h>
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define NS_MAX 5
> static int ns_types[NS_MAX];
> diff --git a/testcases/kernel/syscalls/sysinfo/sysinfo03.c
> b/testcases/kernel/syscalls/sysinfo/sysinfo03.c
> index af7cb6421..6b8f0aef7 100644
> --- a/testcases/kernel/syscalls/sysinfo/sysinfo03.c
> +++ b/testcases/kernel/syscalls/sysinfo/sysinfo03.c
> @@ -14,9 +14,9 @@
> */
>
> #include <sys/sysinfo.h>
> -#include "lapi/namespaces_constants.h"
> #include "lapi/posix_clocks.h"
> #include "tst_test.h"
> +#include "lapi/sched.h"
>
> static int offsets[] = {
> 10,
> diff --git a/testcases/kernel/syscalls/timerfd/timerfd04.c
> b/testcases/kernel/syscalls/timerfd/timerfd04.c
> index eb7f98d5b..b24b4874e 100644
> --- a/testcases/kernel/syscalls/timerfd/timerfd04.c
> +++ b/testcases/kernel/syscalls/timerfd/timerfd04.c
> @@ -19,7 +19,7 @@
> #include "tst_safe_clocks.h"
> #include "tst_safe_timerfd.h"
> #include "tst_timer.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define SLEEP_US 40000
>
> --
> 2.23.0
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
>
--
Regards,
Li Wang
[-- Attachment #1.2: Type: text/html, Size: 24969 bytes --]
[-- Attachment #2: Type: text/plain, Size: 60 bytes --]
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH v1 2/2] include/lapi/sched.h: Move lapi/clone.h into here
2022-11-29 6:41 ` [LTP] [PATCH v1 2/2] include/lapi/sched.h: Move lapi/clone.h " Yang Xu
@ 2022-11-29 5:50 ` Li Wang
2022-12-01 10:06 ` Richard Palethorpe
1 sibling, 0 replies; 7+ messages in thread
From: Li Wang @ 2022-11-29 5:50 UTC (permalink / raw)
To: Yang Xu; +Cc: ltp
[-- Attachment #1.1: Type: text/plain, Size: 7840 bytes --]
On Tue, Nov 29, 2022 at 1:40 PM Yang Xu <xuyang2018.jy@fujitsu.com> wrote:
> Like namespaces_constants.h, kernel doesn't have
> clone.h header. We can also move it into here.
>
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
>
Reviewed-by: Li Wang <liwang@redhat.com>
> ---
> This patch has been verified on my ltp fork[1].
> [1]
> https://github.com/xuyang0410/ltp/actions/runs/3571298308/jobs/6003048080
> include/lapi/clone.h | 56 -------------------
> include/lapi/sched.h | 31 ++++++++++
> lib/tst_clone.c | 2 +-
> testcases/kernel/containers/pidns/pidns13.c | 2 +-
> testcases/kernel/containers/userns/userns08.c | 2 +-
> testcases/kernel/syscalls/clone3/clone301.c | 2 +-
> testcases/kernel/syscalls/clone3/clone302.c | 2 +-
> .../syscalls/close_range/close_range01.c | 2 +-
> .../syscalls/close_range/close_range02.c | 2 +-
> 9 files changed, 38 insertions(+), 63 deletions(-)
> delete mode 100644 include/lapi/clone.h
>
> diff --git a/include/lapi/clone.h b/include/lapi/clone.h
> deleted file mode 100644
> index 437d1376f..000000000
> --- a/include/lapi/clone.h
> +++ /dev/null
> @@ -1,56 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later
> -/*
> - * Copyright (c) 2020 Linaro Limited. All rights reserved.
> - * Author: Viresh Kumar <viresh.kumar@linaro.org>
> - */
> -
> -#ifndef LAPI_CLONE_H__
> -#define LAPI_CLONE_H__
> -
> -#include <sys/syscall.h>
> -#include <linux/types.h>
> -#include <sched.h>
> -#include <stdint.h>
> -
> -#include "config.h"
> -#include "lapi/syscalls.h"
> -
> -#ifndef HAVE_CLONE3
> -struct clone_args {
> - uint64_t __attribute__((aligned(8))) flags;
> - uint64_t __attribute__((aligned(8))) pidfd;
> - uint64_t __attribute__((aligned(8))) child_tid;
> - uint64_t __attribute__((aligned(8))) parent_tid;
> - uint64_t __attribute__((aligned(8))) exit_signal;
> - uint64_t __attribute__((aligned(8))) stack;
> - uint64_t __attribute__((aligned(8))) stack_size;
> - uint64_t __attribute__((aligned(8))) tls;
> -};
> -
> -static inline int clone3(struct clone_args *args, size_t size)
> -{
> - return tst_syscall(__NR_clone3, args, size);
> -}
> -#endif
> -
> -#ifndef CLONE_PIDFD
> -#define CLONE_PIDFD 0x00001000 /* set if a pidfd should be placed
> in parent */
> -#endif
> -
> -#ifndef CLONE_NEWUSER
> -# define CLONE_NEWUSER 0x10000000
> -#endif
> -
> -static inline void clone3_supported_by_kernel(void)
> -{
> - long ret;
> -
> - if ((tst_kvercmp(5, 3, 0)) < 0) {
> - /* Check if the syscall is backported on an older kernel */
> - ret = syscall(__NR_clone3, NULL, 0);
> - if (ret == -1 && errno == ENOSYS)
> - tst_brk(TCONF, "Test not supported on kernel
> version < v5.3");
> - }
> -}
> -
> -#endif /* LAPI_CLONE_H__ */
> diff --git a/include/lapi/sched.h b/include/lapi/sched.h
> index 3b0b4be31..1d22a9d7e 100644
> --- a/include/lapi/sched.h
> +++ b/include/lapi/sched.h
> @@ -11,6 +11,7 @@
> #include <unistd.h>
> #include <stdint.h>
> #include <inttypes.h>
> +#include "config.h"
> #include "lapi/syscalls.h"
>
> struct sched_attr {
> @@ -43,6 +44,32 @@ static inline int sched_getattr(pid_t pid, struct
> sched_attr *attr,
> return syscall(__NR_sched_getattr, pid, attr, size, flags);
> }
>
> +#ifndef HAVE_CLONE3
> +struct clone_args {
> + uint64_t __attribute__((aligned(8))) flags;
> + uint64_t __attribute__((aligned(8))) pidfd;
> + uint64_t __attribute__((aligned(8))) child_tid;
> + uint64_t __attribute__((aligned(8))) parent_tid;
> + uint64_t __attribute__((aligned(8))) exit_signal;
> + uint64_t __attribute__((aligned(8))) stack;
> + uint64_t __attribute__((aligned(8))) stack_size;
> + uint64_t __attribute__((aligned(8))) tls;
> +};
> +
> +static inline int clone3(struct clone_args *args, size_t size)
> +{
> + return tst_syscall(__NR_clone3, args, size);
> +}
> +#endif
> +
> +static inline void clone3_supported_by_kernel(void)
> +{
> + if ((tst_kvercmp(5, 3, 0)) < 0) {
> + /* Check if the syscall is backported on an older kernel */
> + tst_syscall(__NR_clone3, NULL, 0);
> + }
> +}
> +
> #ifndef SCHED_DEADLINE
> # define SCHED_DEADLINE 6
> #endif
> @@ -55,6 +82,10 @@ static inline int sched_getattr(pid_t pid, struct
> sched_attr *attr,
> # define CLONE_FS 0x00000200
> #endif
>
> +#ifndef CLONE_PIDFD
> +# define CLONE_PIDFD 0x00001000
> +#endif
> +
> #ifndef CLONE_NEWNS
> # define CLONE_NEWNS 0x00020000
> #endif
> diff --git a/lib/tst_clone.c b/lib/tst_clone.c
> index 07e7f0767..ecc84408c 100644
> --- a/lib/tst_clone.c
> +++ b/lib/tst_clone.c
> @@ -8,7 +8,7 @@
> #include <stddef.h>
>
> #include "tst_test.h"
> -#include "lapi/clone.h"
> +#include "lapi/sched.h"
>
> pid_t tst_clone(const struct tst_clone_args *tst_args)
> {
> diff --git a/testcases/kernel/containers/pidns/pidns13.c
> b/testcases/kernel/containers/pidns/pidns13.c
> index 39fd6df7f..6a155027c 100644
> --- a/testcases/kernel/containers/pidns/pidns13.c
> +++ b/testcases/kernel/containers/pidns/pidns13.c
> @@ -31,7 +31,7 @@
>
> #include "tst_test.h"
> #include "tst_clone.h"
> -#include "lapi/clone.h"
> +#include "lapi/sched.h"
>
> static int pipe_fd[2];
>
> diff --git a/testcases/kernel/containers/userns/userns08.c
> b/testcases/kernel/containers/userns/userns08.c
> index afdad6cad..2697d874b 100644
> --- a/testcases/kernel/containers/userns/userns08.c
> +++ b/testcases/kernel/containers/userns/userns08.c
> @@ -25,7 +25,7 @@
>
> #include "tst_test.h"
> #include "tst_clone.h"
> -#include "lapi/clone.h"
> +#include "lapi/sched.h"
> #include "tst_safe_file_at.h"
>
> static pid_t clone_newuser(void)
> diff --git a/testcases/kernel/syscalls/clone3/clone301.c
> b/testcases/kernel/syscalls/clone3/clone301.c
> index f7ef0b2d7..d0fadbc5d 100644
> --- a/testcases/kernel/syscalls/clone3/clone301.c
> +++ b/testcases/kernel/syscalls/clone3/clone301.c
> @@ -15,7 +15,7 @@
> #include <sys/wait.h>
>
> #include "tst_test.h"
> -#include "lapi/clone.h"
> +#include "lapi/sched.h"
> #include "lapi/pidfd.h"
>
> #define CHILD_SIGNAL SIGUSR1
> diff --git a/testcases/kernel/syscalls/clone3/clone302.c
> b/testcases/kernel/syscalls/clone3/clone302.c
> index 08d6417ce..b1b4ccebb 100644
> --- a/testcases/kernel/syscalls/clone3/clone302.c
> +++ b/testcases/kernel/syscalls/clone3/clone302.c
> @@ -14,7 +14,7 @@
> #include <stdlib.h>
>
> #include "tst_test.h"
> -#include "lapi/clone.h"
> +#include "lapi/sched.h"
>
> static struct clone_args *valid_args, *invalid_args;
> unsigned long stack;
> diff --git a/testcases/kernel/syscalls/close_range/close_range01.c
> b/testcases/kernel/syscalls/close_range/close_range01.c
> index 5e2de4d1e..30bb600b6 100644
> --- a/testcases/kernel/syscalls/close_range/close_range01.c
> +++ b/testcases/kernel/syscalls/close_range/close_range01.c
> @@ -28,7 +28,7 @@
> #include "tst_test.h"
> #include "tst_clone.h"
>
> -#include "lapi/clone.h"
> +#include "lapi/sched.h"
> #include "lapi/close_range.h"
>
> static int fd[3];
> diff --git a/testcases/kernel/syscalls/close_range/close_range02.c
> b/testcases/kernel/syscalls/close_range/close_range02.c
> index bd46936bb..aec899261 100644
> --- a/testcases/kernel/syscalls/close_range/close_range02.c
> +++ b/testcases/kernel/syscalls/close_range/close_range02.c
> @@ -18,7 +18,7 @@
> #include "tst_clone.h"
> #include "lapi/fcntl.h"
> #include "lapi/close_range.h"
> -#include "lapi/clone.h"
> +#include "lapi/sched.h"
>
> static int try_close_range(int fd, int flags)
> {
> --
> 2.23.0
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
>
--
Regards,
Li Wang
[-- Attachment #1.2: Type: text/html, Size: 10353 bytes --]
[-- Attachment #2: Type: text/plain, Size: 60 bytes --]
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
* [LTP] [PATCH v1 1/2] include/lapi/sched.h: move namespaces_constants.h's constant into here
@ 2022-11-29 6:40 Yang Xu
2022-11-29 5:50 ` Li Wang
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Yang Xu @ 2022-11-29 6:40 UTC (permalink / raw)
To: ltp
Kernel header doesn't have this namespaces_constants.h header file and
it can be moved into lapi/sched. Also, lapi/clone.h have some duplicated
CLONE_* constants, they should be moved into here too.
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
include/lapi/namespaces_constants.h | 34 ---------------
include/lapi/sched.h | 41 +++++++++++++++++--
lib/tst_net.c | 2 +-
testcases/cve/cve-2017-16939.c | 2 +-
testcases/cve/icmp_rate_limit01.c | 2 +-
.../kernel/containers/libclone/libclone.h | 3 +-
testcases/kernel/containers/mountns/mountns.h | 2 +-
.../kernel/containers/netns/netns_netlink.c | 3 +-
testcases/kernel/containers/pidns/pidns01.c | 2 +-
testcases/kernel/containers/pidns/pidns02.c | 2 +-
testcases/kernel/containers/pidns/pidns03.c | 2 +-
testcases/kernel/containers/pidns/pidns12.c | 2 +-
testcases/kernel/containers/pidns/pidns20.c | 2 +-
testcases/kernel/containers/pidns/pidns32.c | 2 +-
testcases/kernel/containers/share/ns_common.h | 2 +-
testcases/kernel/containers/share/ns_create.c | 3 +-
testcases/kernel/containers/share/ns_exec.c | 3 +-
testcases/kernel/containers/sysvipc/common.h | 2 +-
testcases/kernel/containers/timens/timens01.c | 2 +-
testcases/kernel/containers/userns/common.h | 2 +-
.../kernel/controllers/cgroup/cgroup_core02.c | 3 +-
.../syscalls/clock_gettime/clock_gettime03.c | 2 +-
.../clock_nanosleep/clock_nanosleep03.c | 2 +-
testcases/kernel/syscalls/clone/clone09.c | 3 +-
.../kernel/syscalls/fanotify/fanotify17.c | 3 +-
.../kernel/syscalls/getxattr/getxattr05.c | 3 +-
testcases/kernel/syscalls/ioctl/ioctl_ns01.c | 3 +-
testcases/kernel/syscalls/ioctl/ioctl_ns05.c | 3 +-
testcases/kernel/syscalls/ioctl/ioctl_ns06.c | 3 +-
testcases/kernel/syscalls/setns/setns.h | 2 +-
testcases/kernel/syscalls/sysinfo/sysinfo03.c | 2 +-
testcases/kernel/syscalls/timerfd/timerfd04.c | 2 +-
32 files changed, 67 insertions(+), 79 deletions(-)
delete mode 100644 include/lapi/namespaces_constants.h
diff --git a/include/lapi/namespaces_constants.h b/include/lapi/namespaces_constants.h
deleted file mode 100644
index e34b0d6a8..000000000
--- a/include/lapi/namespaces_constants.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2015 Red Hat, Inc.
- */
-
-#ifndef LAPI_NAMESPACES_CONSTANTS_H__
-#define LAPI_NAMESPACES_CONSTANTS_H__
-
-#ifndef CLONE_NEWIPC
-# define CLONE_NEWIPC 0x08000000
-#endif
-#ifndef CLONE_NEWNS
-# define CLONE_NEWNS 0x00020000
-#endif
-#ifndef CLONE_NEWNET
-# define CLONE_NEWNET 0x40000000
-#endif
-#ifndef CLONE_NEWPID
-# define CLONE_NEWPID 0x20000000
-#endif
-#ifndef CLONE_NEWUSER
-# define CLONE_NEWUSER 0x10000000
-#endif
-#ifndef CLONE_NEWCGROUP
-# define CLONE_NEWCGROUP 0x02000000
-#endif
-#ifndef CLONE_NEWUTS
-# define CLONE_NEWUTS 0x04000000
-#endif
-#ifndef CLONE_NEWTIME
-# define CLONE_NEWTIME 0x00000080
-#endif
-
-#endif /* LAPI_NAMESPACES_CONSTANTS_H__ */
diff --git a/include/lapi/sched.h b/include/lapi/sched.h
index 226d3109a..3b0b4be31 100644
--- a/include/lapi/sched.h
+++ b/include/lapi/sched.h
@@ -8,6 +8,7 @@
#define LAPI_SCHED_H__
#include <sched.h>
+#include <unistd.h>
#include <stdint.h>
#include <inttypes.h>
#include "lapi/syscalls.h"
@@ -47,19 +48,51 @@ static inline int sched_getattr(pid_t pid, struct sched_attr *attr,
#endif
#ifndef CLONE_VM
-# define CLONE_VM 0x00000100
+# define CLONE_VM 0x00000100
#endif
#ifndef CLONE_FS
-# define CLONE_FS 0x00000200
+# define CLONE_FS 0x00000200
+#endif
+
+#ifndef CLONE_NEWNS
+# define CLONE_NEWNS 0x00020000
#endif
#ifndef CLONE_SYSVSEM
-# define CLONE_SYSVSEM 0x00040000
+# define CLONE_SYSVSEM 0x00040000
+#endif
+
+#ifndef CLONE_NEWCGROUP
+# define CLONE_NEWCGROUP 0x02000000
+#endif
+
+#ifndef CLONE_NEWUTS
+# define CLONE_NEWUTS 0x04000000
+#endif
+
+#ifndef CLONE_NEWIPC
+# define CLONE_NEWIPC 0x08000000
+#endif
+
+#ifndef CLONE_NEWUSER
+# define CLONE_NEWUSER 0x10000000
+#endif
+
+#ifndef CLONE_NEWPID
+# define CLONE_NEWPID 0x20000000
+#endif
+
+#ifndef CLONE_NEWNET
+# define CLONE_NEWNET 0x40000000
#endif
#ifndef CLONE_IO
-# define CLONE_IO 0x80000000
+# define CLONE_IO 0x80000000
+#endif
+
+#ifndef CLONE_NEWTIME
+# define CLONE_NEWTIME 0x00000080
#endif
#endif /* LAPI_SCHED_H__ */
diff --git a/lib/tst_net.c b/lib/tst_net.c
index 61fc0ea76..a97e25b11 100644
--- a/lib/tst_net.c
+++ b/lib/tst_net.c
@@ -14,7 +14,7 @@
#include "tst_test.h"
#include "tst_net.h"
#include "tst_private.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
void tst_print_svar(const char *name, const char *val)
{
diff --git a/testcases/cve/cve-2017-16939.c b/testcases/cve/cve-2017-16939.c
index eb5400c0c..e41fb274a 100644
--- a/testcases/cve/cve-2017-16939.c
+++ b/testcases/cve/cve-2017-16939.c
@@ -25,7 +25,7 @@
#include "tst_res_flags.h"
#include "tst_safe_macros.h"
#include "tst_safe_net.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
#define BUFSIZE 2048
diff --git a/testcases/cve/icmp_rate_limit01.c b/testcases/cve/icmp_rate_limit01.c
index 7a51aa0a4..8ee50a276 100644
--- a/testcases/cve/icmp_rate_limit01.c
+++ b/testcases/cve/icmp_rate_limit01.c
@@ -34,7 +34,7 @@
#include "lapi/if_addr.h"
#include "tst_test.h"
#include "tst_netdevice.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
#define DSTNET 0xfa444e00 /* 250.68.78.0 */
#define SRCNET 0xfa444e40 /* 250.68.78.64 */
diff --git a/testcases/kernel/containers/libclone/libclone.h b/testcases/kernel/containers/libclone/libclone.h
index b8740f1bc..e92fdca02 100644
--- a/testcases/kernel/containers/libclone/libclone.h
+++ b/testcases/kernel/containers/libclone/libclone.h
@@ -19,7 +19,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <sched.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
@@ -28,7 +27,7 @@
#include <signal.h>
#include "lapi/syscalls.h"
#include "test.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
#define T_UNSHARE 0
#define T_CLONE 1
diff --git a/testcases/kernel/containers/mountns/mountns.h b/testcases/kernel/containers/mountns/mountns.h
index 76b37b477..615f1a058 100644
--- a/testcases/kernel/containers/mountns/mountns.h
+++ b/testcases/kernel/containers/mountns/mountns.h
@@ -8,7 +8,7 @@
#define COMMON_H
#include "tst_test.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
#define DIRA "LTP_DIR_A"
#define DIRB "LTP_DIR_B"
diff --git a/testcases/kernel/containers/netns/netns_netlink.c b/testcases/kernel/containers/netns/netns_netlink.c
index 6f60ff94e..e8df616e2 100644
--- a/testcases/kernel/containers/netns/netns_netlink.c
+++ b/testcases/kernel/containers/netns/netns_netlink.c
@@ -33,11 +33,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
-#include <sched.h>
#include "tst_test.h"
#include "tst_safe_macros.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
#define MAX_TRIES 1000
diff --git a/testcases/kernel/containers/pidns/pidns01.c b/testcases/kernel/containers/pidns/pidns01.c
index eba4b806b..5080b6fad 100644
--- a/testcases/kernel/containers/pidns/pidns01.c
+++ b/testcases/kernel/containers/pidns/pidns01.c
@@ -15,7 +15,7 @@
*/
#include "tst_test.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
static int child_func(LTP_ATTRIBUTE_UNUSED void *arg)
{
diff --git a/testcases/kernel/containers/pidns/pidns02.c b/testcases/kernel/containers/pidns/pidns02.c
index 9f3a46526..b8913d3f6 100644
--- a/testcases/kernel/containers/pidns/pidns02.c
+++ b/testcases/kernel/containers/pidns/pidns02.c
@@ -14,7 +14,7 @@
*/
#include "tst_test.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
static int child_func(LTP_ATTRIBUTE_UNUSED void *arg)
{
diff --git a/testcases/kernel/containers/pidns/pidns03.c b/testcases/kernel/containers/pidns/pidns03.c
index b9b38b5d9..122ba7891 100644
--- a/testcases/kernel/containers/pidns/pidns03.c
+++ b/testcases/kernel/containers/pidns/pidns03.c
@@ -13,7 +13,7 @@
#include <sys/mount.h>
#include "tst_test.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
#define PROCDIR "proc"
diff --git a/testcases/kernel/containers/pidns/pidns12.c b/testcases/kernel/containers/pidns/pidns12.c
index 0e6b17142..fb1ec90ca 100644
--- a/testcases/kernel/containers/pidns/pidns12.c
+++ b/testcases/kernel/containers/pidns/pidns12.c
@@ -16,7 +16,7 @@
#define _GNU_SOURCE 1
#include <signal.h>
#include "tst_test.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
static volatile pid_t sig_pid = -1;
diff --git a/testcases/kernel/containers/pidns/pidns20.c b/testcases/kernel/containers/pidns/pidns20.c
index f1e239dde..9f369699a 100644
--- a/testcases/kernel/containers/pidns/pidns20.c
+++ b/testcases/kernel/containers/pidns/pidns20.c
@@ -15,7 +15,7 @@
#define _GNU_SOURCE 1
#include <signal.h>
#include "tst_test.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
static volatile int signals;
static volatile int last_signo;
diff --git a/testcases/kernel/containers/pidns/pidns32.c b/testcases/kernel/containers/pidns/pidns32.c
index 333e1fcad..3f7df788e 100644
--- a/testcases/kernel/containers/pidns/pidns32.c
+++ b/testcases/kernel/containers/pidns/pidns32.c
@@ -15,7 +15,7 @@
#include <sys/mman.h>
#include "tst_test.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
#define MAXNEST 32
diff --git a/testcases/kernel/containers/share/ns_common.h b/testcases/kernel/containers/share/ns_common.h
index 69e51ce71..0f85aceb4 100644
--- a/testcases/kernel/containers/share/ns_common.h
+++ b/testcases/kernel/containers/share/ns_common.h
@@ -17,7 +17,7 @@
#ifndef __NS_COMMON_H__
#define __NS_COMMON_H__
#include <sched.h>
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
#define PROC_PATH "/proc"
#define NS_TOTAL 6
diff --git a/testcases/kernel/containers/share/ns_create.c b/testcases/kernel/containers/share/ns_create.c
index d4259f38b..3f09e71e0 100644
--- a/testcases/kernel/containers/share/ns_create.c
+++ b/testcases/kernel/containers/share/ns_create.c
@@ -24,7 +24,6 @@
*/
#define _GNU_SOURCE
-#include <sched.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -32,7 +31,7 @@
#include <string.h>
#include <errno.h>
#include "test.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
#include "ns_common.h"
char *TCID = "ns_create";
diff --git a/testcases/kernel/containers/share/ns_exec.c b/testcases/kernel/containers/share/ns_exec.c
index c492165f0..4abd1063b 100644
--- a/testcases/kernel/containers/share/ns_exec.c
+++ b/testcases/kernel/containers/share/ns_exec.c
@@ -21,7 +21,6 @@
*/
#define _GNU_SOURCE
-#include <sched.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/wait.h>
@@ -31,7 +30,7 @@
#include <errno.h>
#include "test.h"
#include "lapi/syscalls.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
#include "ns_common.h"
char *TCID = "ns_exec";
diff --git a/testcases/kernel/containers/sysvipc/common.h b/testcases/kernel/containers/sysvipc/common.h
index 258d355d7..9b0fc16e9 100644
--- a/testcases/kernel/containers/sysvipc/common.h
+++ b/testcases/kernel/containers/sysvipc/common.h
@@ -11,7 +11,7 @@
#include <stdlib.h>
#include "tst_test.h"
#include "lapi/syscalls.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
enum {
T_CLONE,
diff --git a/testcases/kernel/containers/timens/timens01.c b/testcases/kernel/containers/timens/timens01.c
index 3f6235ec3..3621b3446 100644
--- a/testcases/kernel/containers/timens/timens01.c
+++ b/testcases/kernel/containers/timens/timens01.c
@@ -15,9 +15,9 @@
*/
#define _GNU_SOURCE
-#include "lapi/namespaces_constants.h"
#include "lapi/posix_clocks.h"
#include "tst_test.h"
+#include "lapi/sched.h"
static struct tcase {
const char *desc;
diff --git a/testcases/kernel/containers/userns/common.h b/testcases/kernel/containers/userns/common.h
index d3bdcc53f..635d0f190 100644
--- a/testcases/kernel/containers/userns/common.h
+++ b/testcases/kernel/containers/userns/common.h
@@ -8,7 +8,7 @@
#define COMMON_H
#include "tst_test.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
#define UID_MAP 0
#define GID_MAP 1
diff --git a/testcases/kernel/controllers/cgroup/cgroup_core02.c b/testcases/kernel/controllers/cgroup/cgroup_core02.c
index e6d599b36..1872a7dff 100644
--- a/testcases/kernel/controllers/cgroup/cgroup_core02.c
+++ b/testcases/kernel/controllers/cgroup/cgroup_core02.c
@@ -24,14 +24,13 @@
*/
#define _GNU_SOURCE
-#include <sched.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <pwd.h>
#include "tst_test.h"
#include "tst_safe_file_at.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
static struct tst_cg_group *cg_child_a, *cg_child_b;
static uid_t nobody_uid;
diff --git a/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c b/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
index f185977d3..b02d22a14 100644
--- a/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
+++ b/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
@@ -18,7 +18,7 @@
#include "time64_variants.h"
#include "tst_safe_clocks.h"
#include "tst_timer.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
static struct tcase {
int clk_id;
diff --git a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c
index 5bd91fa61..dfc522278 100644
--- a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c
+++ b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c
@@ -18,7 +18,7 @@
#include "time64_variants.h"
#include "tst_safe_clocks.h"
#include "tst_timer.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
#define OFFSET_S 10
#define SLEEP_US 100000
diff --git a/testcases/kernel/syscalls/clone/clone09.c b/testcases/kernel/syscalls/clone/clone09.c
index e9e584564..e4691f513 100644
--- a/testcases/kernel/syscalls/clone/clone09.c
+++ b/testcases/kernel/syscalls/clone/clone09.c
@@ -4,14 +4,13 @@
*/
#define _GNU_SOURCE
-#include <sched.h>
#include <stdlib.h>
#include <errno.h>
#include "tst_test.h"
#include "clone_platform.h"
#include "lapi/syscalls.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
static void *child_stack;
static int sysctl_net = -1;
diff --git a/testcases/kernel/syscalls/fanotify/fanotify17.c b/testcases/kernel/syscalls/fanotify/fanotify17.c
index 7d74b2540..3ecb31b6e 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify17.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify17.c
@@ -20,11 +20,10 @@
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
-#include <sched.h>
#include <stdlib.h>
#include "tst_test.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
#ifdef HAVE_SYS_FANOTIFY_H
#include "fanotify.h"
diff --git a/testcases/kernel/syscalls/getxattr/getxattr05.c b/testcases/kernel/syscalls/getxattr/getxattr05.c
index 3e73cc567..28eb4cbcf 100644
--- a/testcases/kernel/syscalls/getxattr/getxattr05.c
+++ b/testcases/kernel/syscalls/getxattr/getxattr05.c
@@ -20,7 +20,6 @@
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
-#include <sched.h>
#include <stdlib.h>
#ifdef HAVE_SYS_XATTR_H
@@ -32,7 +31,7 @@
#endif
#include "tst_test.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
#if defined(HAVE_SYS_XATTR_H) && defined(HAVE_LIBACL)
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ns01.c b/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
index 95be877dc..06c81ba1b 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
@@ -19,11 +19,10 @@
#define _GNU_SOURCE
#include <errno.h>
-#include <sched.h>
#include <stdlib.h>
#include "tst_test.h"
#include "lapi/ioctl_ns.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
#define STACK_SIZE (1024 * 1024)
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ns05.c b/testcases/kernel/syscalls/ioctl/ioctl_ns05.c
index ae2f9da51..36e41c468 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_ns05.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_ns05.c
@@ -18,11 +18,10 @@
#include <errno.h>
#include <stdio.h>
-#include <sched.h>
#include <stdlib.h>
#include "tst_test.h"
#include "lapi/ioctl_ns.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
#define STACK_SIZE (1024 * 1024)
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ns06.c b/testcases/kernel/syscalls/ioctl/ioctl_ns06.c
index 393ba1437..45fc01ce7 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_ns06.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_ns06.c
@@ -19,11 +19,10 @@
#include <errno.h>
#include <stdio.h>
-#include <sched.h>
#include <stdlib.h>
#include "tst_test.h"
#include "lapi/ioctl_ns.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
#define STACK_SIZE (1024 * 1024)
diff --git a/testcases/kernel/syscalls/setns/setns.h b/testcases/kernel/syscalls/setns/setns.h
index 46beef17f..45c759917 100644
--- a/testcases/kernel/syscalls/setns/setns.h
+++ b/testcases/kernel/syscalls/setns/setns.h
@@ -4,7 +4,7 @@
*/
#include <stdio.h>
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
#define NS_MAX 5
static int ns_types[NS_MAX];
diff --git a/testcases/kernel/syscalls/sysinfo/sysinfo03.c b/testcases/kernel/syscalls/sysinfo/sysinfo03.c
index af7cb6421..6b8f0aef7 100644
--- a/testcases/kernel/syscalls/sysinfo/sysinfo03.c
+++ b/testcases/kernel/syscalls/sysinfo/sysinfo03.c
@@ -14,9 +14,9 @@
*/
#include <sys/sysinfo.h>
-#include "lapi/namespaces_constants.h"
#include "lapi/posix_clocks.h"
#include "tst_test.h"
+#include "lapi/sched.h"
static int offsets[] = {
10,
diff --git a/testcases/kernel/syscalls/timerfd/timerfd04.c b/testcases/kernel/syscalls/timerfd/timerfd04.c
index eb7f98d5b..b24b4874e 100644
--- a/testcases/kernel/syscalls/timerfd/timerfd04.c
+++ b/testcases/kernel/syscalls/timerfd/timerfd04.c
@@ -19,7 +19,7 @@
#include "tst_safe_clocks.h"
#include "tst_safe_timerfd.h"
#include "tst_timer.h"
-#include "lapi/namespaces_constants.h"
+#include "lapi/sched.h"
#define SLEEP_US 40000
--
2.23.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [LTP] [PATCH v1 2/2] include/lapi/sched.h: Move lapi/clone.h into here
2022-11-29 6:40 [LTP] [PATCH v1 1/2] include/lapi/sched.h: move namespaces_constants.h's constant into here Yang Xu
2022-11-29 5:50 ` Li Wang
@ 2022-11-29 6:41 ` Yang Xu
2022-11-29 5:50 ` Li Wang
2022-12-01 10:06 ` Richard Palethorpe
2022-12-01 10:05 ` [LTP] [PATCH v1 1/2] include/lapi/sched.h: move namespaces_constants.h's constant " Richard Palethorpe
2 siblings, 2 replies; 7+ messages in thread
From: Yang Xu @ 2022-11-29 6:41 UTC (permalink / raw)
To: ltp
Like namespaces_constants.h, kernel doesn't have
clone.h header. We can also move it into here.
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
This patch has been verified on my ltp fork[1].
[1]https://github.com/xuyang0410/ltp/actions/runs/3571298308/jobs/6003048080
include/lapi/clone.h | 56 -------------------
include/lapi/sched.h | 31 ++++++++++
lib/tst_clone.c | 2 +-
testcases/kernel/containers/pidns/pidns13.c | 2 +-
testcases/kernel/containers/userns/userns08.c | 2 +-
testcases/kernel/syscalls/clone3/clone301.c | 2 +-
testcases/kernel/syscalls/clone3/clone302.c | 2 +-
.../syscalls/close_range/close_range01.c | 2 +-
.../syscalls/close_range/close_range02.c | 2 +-
9 files changed, 38 insertions(+), 63 deletions(-)
delete mode 100644 include/lapi/clone.h
diff --git a/include/lapi/clone.h b/include/lapi/clone.h
deleted file mode 100644
index 437d1376f..000000000
--- a/include/lapi/clone.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Linaro Limited. All rights reserved.
- * Author: Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-#ifndef LAPI_CLONE_H__
-#define LAPI_CLONE_H__
-
-#include <sys/syscall.h>
-#include <linux/types.h>
-#include <sched.h>
-#include <stdint.h>
-
-#include "config.h"
-#include "lapi/syscalls.h"
-
-#ifndef HAVE_CLONE3
-struct clone_args {
- uint64_t __attribute__((aligned(8))) flags;
- uint64_t __attribute__((aligned(8))) pidfd;
- uint64_t __attribute__((aligned(8))) child_tid;
- uint64_t __attribute__((aligned(8))) parent_tid;
- uint64_t __attribute__((aligned(8))) exit_signal;
- uint64_t __attribute__((aligned(8))) stack;
- uint64_t __attribute__((aligned(8))) stack_size;
- uint64_t __attribute__((aligned(8))) tls;
-};
-
-static inline int clone3(struct clone_args *args, size_t size)
-{
- return tst_syscall(__NR_clone3, args, size);
-}
-#endif
-
-#ifndef CLONE_PIDFD
-#define CLONE_PIDFD 0x00001000 /* set if a pidfd should be placed in parent */
-#endif
-
-#ifndef CLONE_NEWUSER
-# define CLONE_NEWUSER 0x10000000
-#endif
-
-static inline void clone3_supported_by_kernel(void)
-{
- long ret;
-
- if ((tst_kvercmp(5, 3, 0)) < 0) {
- /* Check if the syscall is backported on an older kernel */
- ret = syscall(__NR_clone3, NULL, 0);
- if (ret == -1 && errno == ENOSYS)
- tst_brk(TCONF, "Test not supported on kernel version < v5.3");
- }
-}
-
-#endif /* LAPI_CLONE_H__ */
diff --git a/include/lapi/sched.h b/include/lapi/sched.h
index 3b0b4be31..1d22a9d7e 100644
--- a/include/lapi/sched.h
+++ b/include/lapi/sched.h
@@ -11,6 +11,7 @@
#include <unistd.h>
#include <stdint.h>
#include <inttypes.h>
+#include "config.h"
#include "lapi/syscalls.h"
struct sched_attr {
@@ -43,6 +44,32 @@ static inline int sched_getattr(pid_t pid, struct sched_attr *attr,
return syscall(__NR_sched_getattr, pid, attr, size, flags);
}
+#ifndef HAVE_CLONE3
+struct clone_args {
+ uint64_t __attribute__((aligned(8))) flags;
+ uint64_t __attribute__((aligned(8))) pidfd;
+ uint64_t __attribute__((aligned(8))) child_tid;
+ uint64_t __attribute__((aligned(8))) parent_tid;
+ uint64_t __attribute__((aligned(8))) exit_signal;
+ uint64_t __attribute__((aligned(8))) stack;
+ uint64_t __attribute__((aligned(8))) stack_size;
+ uint64_t __attribute__((aligned(8))) tls;
+};
+
+static inline int clone3(struct clone_args *args, size_t size)
+{
+ return tst_syscall(__NR_clone3, args, size);
+}
+#endif
+
+static inline void clone3_supported_by_kernel(void)
+{
+ if ((tst_kvercmp(5, 3, 0)) < 0) {
+ /* Check if the syscall is backported on an older kernel */
+ tst_syscall(__NR_clone3, NULL, 0);
+ }
+}
+
#ifndef SCHED_DEADLINE
# define SCHED_DEADLINE 6
#endif
@@ -55,6 +82,10 @@ static inline int sched_getattr(pid_t pid, struct sched_attr *attr,
# define CLONE_FS 0x00000200
#endif
+#ifndef CLONE_PIDFD
+# define CLONE_PIDFD 0x00001000
+#endif
+
#ifndef CLONE_NEWNS
# define CLONE_NEWNS 0x00020000
#endif
diff --git a/lib/tst_clone.c b/lib/tst_clone.c
index 07e7f0767..ecc84408c 100644
--- a/lib/tst_clone.c
+++ b/lib/tst_clone.c
@@ -8,7 +8,7 @@
#include <stddef.h>
#include "tst_test.h"
-#include "lapi/clone.h"
+#include "lapi/sched.h"
pid_t tst_clone(const struct tst_clone_args *tst_args)
{
diff --git a/testcases/kernel/containers/pidns/pidns13.c b/testcases/kernel/containers/pidns/pidns13.c
index 39fd6df7f..6a155027c 100644
--- a/testcases/kernel/containers/pidns/pidns13.c
+++ b/testcases/kernel/containers/pidns/pidns13.c
@@ -31,7 +31,7 @@
#include "tst_test.h"
#include "tst_clone.h"
-#include "lapi/clone.h"
+#include "lapi/sched.h"
static int pipe_fd[2];
diff --git a/testcases/kernel/containers/userns/userns08.c b/testcases/kernel/containers/userns/userns08.c
index afdad6cad..2697d874b 100644
--- a/testcases/kernel/containers/userns/userns08.c
+++ b/testcases/kernel/containers/userns/userns08.c
@@ -25,7 +25,7 @@
#include "tst_test.h"
#include "tst_clone.h"
-#include "lapi/clone.h"
+#include "lapi/sched.h"
#include "tst_safe_file_at.h"
static pid_t clone_newuser(void)
diff --git a/testcases/kernel/syscalls/clone3/clone301.c b/testcases/kernel/syscalls/clone3/clone301.c
index f7ef0b2d7..d0fadbc5d 100644
--- a/testcases/kernel/syscalls/clone3/clone301.c
+++ b/testcases/kernel/syscalls/clone3/clone301.c
@@ -15,7 +15,7 @@
#include <sys/wait.h>
#include "tst_test.h"
-#include "lapi/clone.h"
+#include "lapi/sched.h"
#include "lapi/pidfd.h"
#define CHILD_SIGNAL SIGUSR1
diff --git a/testcases/kernel/syscalls/clone3/clone302.c b/testcases/kernel/syscalls/clone3/clone302.c
index 08d6417ce..b1b4ccebb 100644
--- a/testcases/kernel/syscalls/clone3/clone302.c
+++ b/testcases/kernel/syscalls/clone3/clone302.c
@@ -14,7 +14,7 @@
#include <stdlib.h>
#include "tst_test.h"
-#include "lapi/clone.h"
+#include "lapi/sched.h"
static struct clone_args *valid_args, *invalid_args;
unsigned long stack;
diff --git a/testcases/kernel/syscalls/close_range/close_range01.c b/testcases/kernel/syscalls/close_range/close_range01.c
index 5e2de4d1e..30bb600b6 100644
--- a/testcases/kernel/syscalls/close_range/close_range01.c
+++ b/testcases/kernel/syscalls/close_range/close_range01.c
@@ -28,7 +28,7 @@
#include "tst_test.h"
#include "tst_clone.h"
-#include "lapi/clone.h"
+#include "lapi/sched.h"
#include "lapi/close_range.h"
static int fd[3];
diff --git a/testcases/kernel/syscalls/close_range/close_range02.c b/testcases/kernel/syscalls/close_range/close_range02.c
index bd46936bb..aec899261 100644
--- a/testcases/kernel/syscalls/close_range/close_range02.c
+++ b/testcases/kernel/syscalls/close_range/close_range02.c
@@ -18,7 +18,7 @@
#include "tst_clone.h"
#include "lapi/fcntl.h"
#include "lapi/close_range.h"
-#include "lapi/clone.h"
+#include "lapi/sched.h"
static int try_close_range(int fd, int flags)
{
--
2.23.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH v1 1/2] include/lapi/sched.h: move namespaces_constants.h's constant into here
2022-11-29 6:40 [LTP] [PATCH v1 1/2] include/lapi/sched.h: move namespaces_constants.h's constant into here Yang Xu
2022-11-29 5:50 ` Li Wang
2022-11-29 6:41 ` [LTP] [PATCH v1 2/2] include/lapi/sched.h: Move lapi/clone.h " Yang Xu
@ 2022-12-01 10:05 ` Richard Palethorpe
2022-12-02 2:30 ` xuyang2018.jy
2 siblings, 1 reply; 7+ messages in thread
From: Richard Palethorpe @ 2022-12-01 10:05 UTC (permalink / raw)
To: Yang Xu; +Cc: ltp
Yang Xu <xuyang2018.jy@fujitsu.com> writes:
> Kernel header doesn't have this namespaces_constants.h header file and
> it can be moved into lapi/sched. Also, lapi/clone.h have some duplicated
> CLONE_* constants, they should be moved into here too.
Good.
>
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Acked-by: Richard Palethorpe <rpalethorpe@suse.com>
> ---
> include/lapi/namespaces_constants.h | 34 ---------------
> include/lapi/sched.h | 41 +++++++++++++++++--
> lib/tst_net.c | 2 +-
> testcases/cve/cve-2017-16939.c | 2 +-
> testcases/cve/icmp_rate_limit01.c | 2 +-
> .../kernel/containers/libclone/libclone.h | 3 +-
> testcases/kernel/containers/mountns/mountns.h | 2 +-
> .../kernel/containers/netns/netns_netlink.c | 3 +-
> testcases/kernel/containers/pidns/pidns01.c | 2 +-
> testcases/kernel/containers/pidns/pidns02.c | 2 +-
> testcases/kernel/containers/pidns/pidns03.c | 2 +-
> testcases/kernel/containers/pidns/pidns12.c | 2 +-
> testcases/kernel/containers/pidns/pidns20.c | 2 +-
> testcases/kernel/containers/pidns/pidns32.c | 2 +-
> testcases/kernel/containers/share/ns_common.h | 2 +-
> testcases/kernel/containers/share/ns_create.c | 3 +-
> testcases/kernel/containers/share/ns_exec.c | 3 +-
> testcases/kernel/containers/sysvipc/common.h | 2 +-
> testcases/kernel/containers/timens/timens01.c | 2 +-
> testcases/kernel/containers/userns/common.h | 2 +-
> .../kernel/controllers/cgroup/cgroup_core02.c | 3 +-
> .../syscalls/clock_gettime/clock_gettime03.c | 2 +-
> .../clock_nanosleep/clock_nanosleep03.c | 2 +-
> testcases/kernel/syscalls/clone/clone09.c | 3 +-
> .../kernel/syscalls/fanotify/fanotify17.c | 3 +-
> .../kernel/syscalls/getxattr/getxattr05.c | 3 +-
> testcases/kernel/syscalls/ioctl/ioctl_ns01.c | 3 +-
> testcases/kernel/syscalls/ioctl/ioctl_ns05.c | 3 +-
> testcases/kernel/syscalls/ioctl/ioctl_ns06.c | 3 +-
> testcases/kernel/syscalls/setns/setns.h | 2 +-
> testcases/kernel/syscalls/sysinfo/sysinfo03.c | 2 +-
> testcases/kernel/syscalls/timerfd/timerfd04.c | 2 +-
> 32 files changed, 67 insertions(+), 79 deletions(-)
> delete mode 100644 include/lapi/namespaces_constants.h
>
> diff --git a/include/lapi/namespaces_constants.h b/include/lapi/namespaces_constants.h
> deleted file mode 100644
> index e34b0d6a8..000000000
> --- a/include/lapi/namespaces_constants.h
> +++ /dev/null
> @@ -1,34 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later
> -/*
> - * Copyright (c) 2015 Red Hat, Inc.
> - */
> -
> -#ifndef LAPI_NAMESPACES_CONSTANTS_H__
> -#define LAPI_NAMESPACES_CONSTANTS_H__
> -
> -#ifndef CLONE_NEWIPC
> -# define CLONE_NEWIPC 0x08000000
> -#endif
> -#ifndef CLONE_NEWNS
> -# define CLONE_NEWNS 0x00020000
> -#endif
> -#ifndef CLONE_NEWNET
> -# define CLONE_NEWNET 0x40000000
> -#endif
> -#ifndef CLONE_NEWPID
> -# define CLONE_NEWPID 0x20000000
> -#endif
> -#ifndef CLONE_NEWUSER
> -# define CLONE_NEWUSER 0x10000000
> -#endif
> -#ifndef CLONE_NEWCGROUP
> -# define CLONE_NEWCGROUP 0x02000000
> -#endif
> -#ifndef CLONE_NEWUTS
> -# define CLONE_NEWUTS 0x04000000
> -#endif
> -#ifndef CLONE_NEWTIME
> -# define CLONE_NEWTIME 0x00000080
> -#endif
> -
> -#endif /* LAPI_NAMESPACES_CONSTANTS_H__ */
> diff --git a/include/lapi/sched.h b/include/lapi/sched.h
> index 226d3109a..3b0b4be31 100644
> --- a/include/lapi/sched.h
> +++ b/include/lapi/sched.h
> @@ -8,6 +8,7 @@
> #define LAPI_SCHED_H__
>
> #include <sched.h>
> +#include <unistd.h>
> #include <stdint.h>
> #include <inttypes.h>
> #include "lapi/syscalls.h"
> @@ -47,19 +48,51 @@ static inline int sched_getattr(pid_t pid, struct sched_attr *attr,
> #endif
>
> #ifndef CLONE_VM
> -# define CLONE_VM 0x00000100
> +# define CLONE_VM 0x00000100
> #endif
>
> #ifndef CLONE_FS
> -# define CLONE_FS 0x00000200
> +# define CLONE_FS 0x00000200
> +#endif
> +
> +#ifndef CLONE_NEWNS
> +# define CLONE_NEWNS 0x00020000
> #endif
>
> #ifndef CLONE_SYSVSEM
> -# define CLONE_SYSVSEM 0x00040000
> +# define CLONE_SYSVSEM 0x00040000
> +#endif
> +
> +#ifndef CLONE_NEWCGROUP
> +# define CLONE_NEWCGROUP 0x02000000
> +#endif
> +
> +#ifndef CLONE_NEWUTS
> +# define CLONE_NEWUTS 0x04000000
> +#endif
> +
> +#ifndef CLONE_NEWIPC
> +# define CLONE_NEWIPC 0x08000000
> +#endif
> +
> +#ifndef CLONE_NEWUSER
> +# define CLONE_NEWUSER 0x10000000
> +#endif
> +
> +#ifndef CLONE_NEWPID
> +# define CLONE_NEWPID 0x20000000
> +#endif
> +
> +#ifndef CLONE_NEWNET
> +# define CLONE_NEWNET 0x40000000
> #endif
>
> #ifndef CLONE_IO
> -# define CLONE_IO 0x80000000
> +# define CLONE_IO 0x80000000
> +#endif
> +
> +#ifndef CLONE_NEWTIME
> +# define CLONE_NEWTIME 0x00000080
> #endif
>
> #endif /* LAPI_SCHED_H__ */
> diff --git a/lib/tst_net.c b/lib/tst_net.c
> index 61fc0ea76..a97e25b11 100644
> --- a/lib/tst_net.c
> +++ b/lib/tst_net.c
> @@ -14,7 +14,7 @@
> #include "tst_test.h"
> #include "tst_net.h"
> #include "tst_private.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> void tst_print_svar(const char *name, const char *val)
> {
> diff --git a/testcases/cve/cve-2017-16939.c b/testcases/cve/cve-2017-16939.c
> index eb5400c0c..e41fb274a 100644
> --- a/testcases/cve/cve-2017-16939.c
> +++ b/testcases/cve/cve-2017-16939.c
> @@ -25,7 +25,7 @@
> #include "tst_res_flags.h"
> #include "tst_safe_macros.h"
> #include "tst_safe_net.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define BUFSIZE 2048
>
> diff --git a/testcases/cve/icmp_rate_limit01.c b/testcases/cve/icmp_rate_limit01.c
> index 7a51aa0a4..8ee50a276 100644
> --- a/testcases/cve/icmp_rate_limit01.c
> +++ b/testcases/cve/icmp_rate_limit01.c
> @@ -34,7 +34,7 @@
> #include "lapi/if_addr.h"
> #include "tst_test.h"
> #include "tst_netdevice.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define DSTNET 0xfa444e00 /* 250.68.78.0 */
> #define SRCNET 0xfa444e40 /* 250.68.78.64 */
> diff --git a/testcases/kernel/containers/libclone/libclone.h b/testcases/kernel/containers/libclone/libclone.h
> index b8740f1bc..e92fdca02 100644
> --- a/testcases/kernel/containers/libclone/libclone.h
> +++ b/testcases/kernel/containers/libclone/libclone.h
> @@ -19,7 +19,6 @@
>
> #include <stdio.h>
> #include <stdlib.h>
> -#include <sched.h>
> #include <unistd.h>
> #include <string.h>
> #include <errno.h>
> @@ -28,7 +27,7 @@
> #include <signal.h>
> #include "lapi/syscalls.h"
> #include "test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define T_UNSHARE 0
> #define T_CLONE 1
> diff --git a/testcases/kernel/containers/mountns/mountns.h b/testcases/kernel/containers/mountns/mountns.h
> index 76b37b477..615f1a058 100644
> --- a/testcases/kernel/containers/mountns/mountns.h
> +++ b/testcases/kernel/containers/mountns/mountns.h
> @@ -8,7 +8,7 @@
> #define COMMON_H
>
> #include "tst_test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define DIRA "LTP_DIR_A"
> #define DIRB "LTP_DIR_B"
> diff --git a/testcases/kernel/containers/netns/netns_netlink.c b/testcases/kernel/containers/netns/netns_netlink.c
> index 6f60ff94e..e8df616e2 100644
> --- a/testcases/kernel/containers/netns/netns_netlink.c
> +++ b/testcases/kernel/containers/netns/netns_netlink.c
> @@ -33,11 +33,10 @@
> #include <stdio.h>
> #include <stdlib.h>
> #include <errno.h>
> -#include <sched.h>
>
> #include "tst_test.h"
> #include "tst_safe_macros.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define MAX_TRIES 1000
>
> diff --git a/testcases/kernel/containers/pidns/pidns01.c b/testcases/kernel/containers/pidns/pidns01.c
> index eba4b806b..5080b6fad 100644
> --- a/testcases/kernel/containers/pidns/pidns01.c
> +++ b/testcases/kernel/containers/pidns/pidns01.c
> @@ -15,7 +15,7 @@
> */
>
> #include "tst_test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> static int child_func(LTP_ATTRIBUTE_UNUSED void *arg)
> {
> diff --git a/testcases/kernel/containers/pidns/pidns02.c b/testcases/kernel/containers/pidns/pidns02.c
> index 9f3a46526..b8913d3f6 100644
> --- a/testcases/kernel/containers/pidns/pidns02.c
> +++ b/testcases/kernel/containers/pidns/pidns02.c
> @@ -14,7 +14,7 @@
> */
>
> #include "tst_test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> static int child_func(LTP_ATTRIBUTE_UNUSED void *arg)
> {
> diff --git a/testcases/kernel/containers/pidns/pidns03.c b/testcases/kernel/containers/pidns/pidns03.c
> index b9b38b5d9..122ba7891 100644
> --- a/testcases/kernel/containers/pidns/pidns03.c
> +++ b/testcases/kernel/containers/pidns/pidns03.c
> @@ -13,7 +13,7 @@
>
> #include <sys/mount.h>
> #include "tst_test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define PROCDIR "proc"
>
> diff --git a/testcases/kernel/containers/pidns/pidns12.c b/testcases/kernel/containers/pidns/pidns12.c
> index 0e6b17142..fb1ec90ca 100644
> --- a/testcases/kernel/containers/pidns/pidns12.c
> +++ b/testcases/kernel/containers/pidns/pidns12.c
> @@ -16,7 +16,7 @@
> #define _GNU_SOURCE 1
> #include <signal.h>
> #include "tst_test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> static volatile pid_t sig_pid = -1;
>
> diff --git a/testcases/kernel/containers/pidns/pidns20.c b/testcases/kernel/containers/pidns/pidns20.c
> index f1e239dde..9f369699a 100644
> --- a/testcases/kernel/containers/pidns/pidns20.c
> +++ b/testcases/kernel/containers/pidns/pidns20.c
> @@ -15,7 +15,7 @@
> #define _GNU_SOURCE 1
> #include <signal.h>
> #include "tst_test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> static volatile int signals;
> static volatile int last_signo;
> diff --git a/testcases/kernel/containers/pidns/pidns32.c b/testcases/kernel/containers/pidns/pidns32.c
> index 333e1fcad..3f7df788e 100644
> --- a/testcases/kernel/containers/pidns/pidns32.c
> +++ b/testcases/kernel/containers/pidns/pidns32.c
> @@ -15,7 +15,7 @@
>
> #include <sys/mman.h>
> #include "tst_test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define MAXNEST 32
>
> diff --git a/testcases/kernel/containers/share/ns_common.h b/testcases/kernel/containers/share/ns_common.h
> index 69e51ce71..0f85aceb4 100644
> --- a/testcases/kernel/containers/share/ns_common.h
> +++ b/testcases/kernel/containers/share/ns_common.h
> @@ -17,7 +17,7 @@
> #ifndef __NS_COMMON_H__
> #define __NS_COMMON_H__
> #include <sched.h>
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define PROC_PATH "/proc"
> #define NS_TOTAL 6
> diff --git a/testcases/kernel/containers/share/ns_create.c b/testcases/kernel/containers/share/ns_create.c
> index d4259f38b..3f09e71e0 100644
> --- a/testcases/kernel/containers/share/ns_create.c
> +++ b/testcases/kernel/containers/share/ns_create.c
> @@ -24,7 +24,6 @@
> */
>
> #define _GNU_SOURCE
> -#include <sched.h>
> #include <sys/syscall.h>
> #include <sys/types.h>
> #include <sys/stat.h>
> @@ -32,7 +31,7 @@
> #include <string.h>
> #include <errno.h>
> #include "test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
> #include "ns_common.h"
>
> char *TCID = "ns_create";
> diff --git a/testcases/kernel/containers/share/ns_exec.c b/testcases/kernel/containers/share/ns_exec.c
> index c492165f0..4abd1063b 100644
> --- a/testcases/kernel/containers/share/ns_exec.c
> +++ b/testcases/kernel/containers/share/ns_exec.c
> @@ -21,7 +21,6 @@
> */
>
> #define _GNU_SOURCE
> -#include <sched.h>
> #include <sys/syscall.h>
> #include <sys/types.h>
> #include <sys/wait.h>
> @@ -31,7 +30,7 @@
> #include <errno.h>
> #include "test.h"
> #include "lapi/syscalls.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
> #include "ns_common.h"
>
> char *TCID = "ns_exec";
> diff --git a/testcases/kernel/containers/sysvipc/common.h b/testcases/kernel/containers/sysvipc/common.h
> index 258d355d7..9b0fc16e9 100644
> --- a/testcases/kernel/containers/sysvipc/common.h
> +++ b/testcases/kernel/containers/sysvipc/common.h
> @@ -11,7 +11,7 @@
> #include <stdlib.h>
> #include "tst_test.h"
> #include "lapi/syscalls.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> enum {
> T_CLONE,
> diff --git a/testcases/kernel/containers/timens/timens01.c b/testcases/kernel/containers/timens/timens01.c
> index 3f6235ec3..3621b3446 100644
> --- a/testcases/kernel/containers/timens/timens01.c
> +++ b/testcases/kernel/containers/timens/timens01.c
> @@ -15,9 +15,9 @@
> */
>
> #define _GNU_SOURCE
> -#include "lapi/namespaces_constants.h"
> #include "lapi/posix_clocks.h"
> #include "tst_test.h"
> +#include "lapi/sched.h"
>
> static struct tcase {
> const char *desc;
> diff --git a/testcases/kernel/containers/userns/common.h b/testcases/kernel/containers/userns/common.h
> index d3bdcc53f..635d0f190 100644
> --- a/testcases/kernel/containers/userns/common.h
> +++ b/testcases/kernel/containers/userns/common.h
> @@ -8,7 +8,7 @@
> #define COMMON_H
>
> #include "tst_test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define UID_MAP 0
> #define GID_MAP 1
> diff --git a/testcases/kernel/controllers/cgroup/cgroup_core02.c b/testcases/kernel/controllers/cgroup/cgroup_core02.c
> index e6d599b36..1872a7dff 100644
> --- a/testcases/kernel/controllers/cgroup/cgroup_core02.c
> +++ b/testcases/kernel/controllers/cgroup/cgroup_core02.c
> @@ -24,14 +24,13 @@
> */
>
> #define _GNU_SOURCE
> -#include <sched.h>
> #include <stdlib.h>
> #include <stdio.h>
> #include <sys/types.h>
> #include <pwd.h>
> #include "tst_test.h"
> #include "tst_safe_file_at.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> static struct tst_cg_group *cg_child_a, *cg_child_b;
> static uid_t nobody_uid;
> diff --git a/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c b/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
> index f185977d3..b02d22a14 100644
> --- a/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
> +++ b/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
> @@ -18,7 +18,7 @@
> #include "time64_variants.h"
> #include "tst_safe_clocks.h"
> #include "tst_timer.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> static struct tcase {
> int clk_id;
> diff --git a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c
> index 5bd91fa61..dfc522278 100644
> --- a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c
> +++ b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c
> @@ -18,7 +18,7 @@
> #include "time64_variants.h"
> #include "tst_safe_clocks.h"
> #include "tst_timer.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define OFFSET_S 10
> #define SLEEP_US 100000
> diff --git a/testcases/kernel/syscalls/clone/clone09.c b/testcases/kernel/syscalls/clone/clone09.c
> index e9e584564..e4691f513 100644
> --- a/testcases/kernel/syscalls/clone/clone09.c
> +++ b/testcases/kernel/syscalls/clone/clone09.c
> @@ -4,14 +4,13 @@
> */
>
> #define _GNU_SOURCE
> -#include <sched.h>
> #include <stdlib.h>
> #include <errno.h>
>
> #include "tst_test.h"
> #include "clone_platform.h"
> #include "lapi/syscalls.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> static void *child_stack;
> static int sysctl_net = -1;
> diff --git a/testcases/kernel/syscalls/fanotify/fanotify17.c b/testcases/kernel/syscalls/fanotify/fanotify17.c
> index 7d74b2540..3ecb31b6e 100644
> --- a/testcases/kernel/syscalls/fanotify/fanotify17.c
> +++ b/testcases/kernel/syscalls/fanotify/fanotify17.c
> @@ -20,11 +20,10 @@
> #include <errno.h>
> #include <unistd.h>
> #include <sys/types.h>
> -#include <sched.h>
> #include <stdlib.h>
>
> #include "tst_test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #ifdef HAVE_SYS_FANOTIFY_H
> #include "fanotify.h"
> diff --git a/testcases/kernel/syscalls/getxattr/getxattr05.c b/testcases/kernel/syscalls/getxattr/getxattr05.c
> index 3e73cc567..28eb4cbcf 100644
> --- a/testcases/kernel/syscalls/getxattr/getxattr05.c
> +++ b/testcases/kernel/syscalls/getxattr/getxattr05.c
> @@ -20,7 +20,6 @@
> #include <errno.h>
> #include <unistd.h>
> #include <sys/types.h>
> -#include <sched.h>
> #include <stdlib.h>
>
> #ifdef HAVE_SYS_XATTR_H
> @@ -32,7 +31,7 @@
> #endif
>
> #include "tst_test.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #if defined(HAVE_SYS_XATTR_H) && defined(HAVE_LIBACL)
>
> diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ns01.c b/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
> index 95be877dc..06c81ba1b 100644
> --- a/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
> +++ b/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
> @@ -19,11 +19,10 @@
> #define _GNU_SOURCE
>
> #include <errno.h>
> -#include <sched.h>
> #include <stdlib.h>
> #include "tst_test.h"
> #include "lapi/ioctl_ns.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define STACK_SIZE (1024 * 1024)
>
> diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ns05.c b/testcases/kernel/syscalls/ioctl/ioctl_ns05.c
> index ae2f9da51..36e41c468 100644
> --- a/testcases/kernel/syscalls/ioctl/ioctl_ns05.c
> +++ b/testcases/kernel/syscalls/ioctl/ioctl_ns05.c
> @@ -18,11 +18,10 @@
>
> #include <errno.h>
> #include <stdio.h>
> -#include <sched.h>
> #include <stdlib.h>
> #include "tst_test.h"
> #include "lapi/ioctl_ns.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define STACK_SIZE (1024 * 1024)
>
> diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ns06.c b/testcases/kernel/syscalls/ioctl/ioctl_ns06.c
> index 393ba1437..45fc01ce7 100644
> --- a/testcases/kernel/syscalls/ioctl/ioctl_ns06.c
> +++ b/testcases/kernel/syscalls/ioctl/ioctl_ns06.c
> @@ -19,11 +19,10 @@
>
> #include <errno.h>
> #include <stdio.h>
> -#include <sched.h>
> #include <stdlib.h>
> #include "tst_test.h"
> #include "lapi/ioctl_ns.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define STACK_SIZE (1024 * 1024)
>
> diff --git a/testcases/kernel/syscalls/setns/setns.h b/testcases/kernel/syscalls/setns/setns.h
> index 46beef17f..45c759917 100644
> --- a/testcases/kernel/syscalls/setns/setns.h
> +++ b/testcases/kernel/syscalls/setns/setns.h
> @@ -4,7 +4,7 @@
> */
>
> #include <stdio.h>
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define NS_MAX 5
> static int ns_types[NS_MAX];
> diff --git a/testcases/kernel/syscalls/sysinfo/sysinfo03.c b/testcases/kernel/syscalls/sysinfo/sysinfo03.c
> index af7cb6421..6b8f0aef7 100644
> --- a/testcases/kernel/syscalls/sysinfo/sysinfo03.c
> +++ b/testcases/kernel/syscalls/sysinfo/sysinfo03.c
> @@ -14,9 +14,9 @@
> */
>
> #include <sys/sysinfo.h>
> -#include "lapi/namespaces_constants.h"
> #include "lapi/posix_clocks.h"
> #include "tst_test.h"
> +#include "lapi/sched.h"
>
> static int offsets[] = {
> 10,
> diff --git a/testcases/kernel/syscalls/timerfd/timerfd04.c b/testcases/kernel/syscalls/timerfd/timerfd04.c
> index eb7f98d5b..b24b4874e 100644
> --- a/testcases/kernel/syscalls/timerfd/timerfd04.c
> +++ b/testcases/kernel/syscalls/timerfd/timerfd04.c
> @@ -19,7 +19,7 @@
> #include "tst_safe_clocks.h"
> #include "tst_safe_timerfd.h"
> #include "tst_timer.h"
> -#include "lapi/namespaces_constants.h"
> +#include "lapi/sched.h"
>
> #define SLEEP_US 40000
>
> --
> 2.23.0
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH v1 2/2] include/lapi/sched.h: Move lapi/clone.h into here
2022-11-29 6:41 ` [LTP] [PATCH v1 2/2] include/lapi/sched.h: Move lapi/clone.h " Yang Xu
2022-11-29 5:50 ` Li Wang
@ 2022-12-01 10:06 ` Richard Palethorpe
1 sibling, 0 replies; 7+ messages in thread
From: Richard Palethorpe @ 2022-12-01 10:06 UTC (permalink / raw)
To: Yang Xu; +Cc: ltp
Yang Xu <xuyang2018.jy@fujitsu.com> writes:
> Like namespaces_constants.h, kernel doesn't have
> clone.h header. We can also move it into here.
>
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Acked-by: Richard Palethorpe <rpalethorpe@suse.com>
> ---
> This patch has been verified on my ltp fork[1].
> [1]https://github.com/xuyang0410/ltp/actions/runs/3571298308/jobs/6003048080
> include/lapi/clone.h | 56 -------------------
> include/lapi/sched.h | 31 ++++++++++
> lib/tst_clone.c | 2 +-
> testcases/kernel/containers/pidns/pidns13.c | 2 +-
> testcases/kernel/containers/userns/userns08.c | 2 +-
> testcases/kernel/syscalls/clone3/clone301.c | 2 +-
> testcases/kernel/syscalls/clone3/clone302.c | 2 +-
> .../syscalls/close_range/close_range01.c | 2 +-
> .../syscalls/close_range/close_range02.c | 2 +-
> 9 files changed, 38 insertions(+), 63 deletions(-)
> delete mode 100644 include/lapi/clone.h
>
> diff --git a/include/lapi/clone.h b/include/lapi/clone.h
> deleted file mode 100644
> index 437d1376f..000000000
> --- a/include/lapi/clone.h
> +++ /dev/null
> @@ -1,56 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later
> -/*
> - * Copyright (c) 2020 Linaro Limited. All rights reserved.
> - * Author: Viresh Kumar <viresh.kumar@linaro.org>
> - */
> -
> -#ifndef LAPI_CLONE_H__
> -#define LAPI_CLONE_H__
> -
> -#include <sys/syscall.h>
> -#include <linux/types.h>
> -#include <sched.h>
> -#include <stdint.h>
> -
> -#include "config.h"
> -#include "lapi/syscalls.h"
> -
> -#ifndef HAVE_CLONE3
> -struct clone_args {
> - uint64_t __attribute__((aligned(8))) flags;
> - uint64_t __attribute__((aligned(8))) pidfd;
> - uint64_t __attribute__((aligned(8))) child_tid;
> - uint64_t __attribute__((aligned(8))) parent_tid;
> - uint64_t __attribute__((aligned(8))) exit_signal;
> - uint64_t __attribute__((aligned(8))) stack;
> - uint64_t __attribute__((aligned(8))) stack_size;
> - uint64_t __attribute__((aligned(8))) tls;
> -};
> -
> -static inline int clone3(struct clone_args *args, size_t size)
> -{
> - return tst_syscall(__NR_clone3, args, size);
> -}
> -#endif
> -
> -#ifndef CLONE_PIDFD
> -#define CLONE_PIDFD 0x00001000 /* set if a pidfd should be placed in parent */
> -#endif
> -
> -#ifndef CLONE_NEWUSER
> -# define CLONE_NEWUSER 0x10000000
> -#endif
> -
> -static inline void clone3_supported_by_kernel(void)
> -{
> - long ret;
> -
> - if ((tst_kvercmp(5, 3, 0)) < 0) {
> - /* Check if the syscall is backported on an older kernel */
> - ret = syscall(__NR_clone3, NULL, 0);
> - if (ret == -1 && errno == ENOSYS)
> - tst_brk(TCONF, "Test not supported on kernel version < v5.3");
> - }
> -}
> -
> -#endif /* LAPI_CLONE_H__ */
> diff --git a/include/lapi/sched.h b/include/lapi/sched.h
> index 3b0b4be31..1d22a9d7e 100644
> --- a/include/lapi/sched.h
> +++ b/include/lapi/sched.h
> @@ -11,6 +11,7 @@
> #include <unistd.h>
> #include <stdint.h>
> #include <inttypes.h>
> +#include "config.h"
> #include "lapi/syscalls.h"
>
> struct sched_attr {
> @@ -43,6 +44,32 @@ static inline int sched_getattr(pid_t pid, struct sched_attr *attr,
> return syscall(__NR_sched_getattr, pid, attr, size, flags);
> }
>
> +#ifndef HAVE_CLONE3
> +struct clone_args {
> + uint64_t __attribute__((aligned(8))) flags;
> + uint64_t __attribute__((aligned(8))) pidfd;
> + uint64_t __attribute__((aligned(8))) child_tid;
> + uint64_t __attribute__((aligned(8))) parent_tid;
> + uint64_t __attribute__((aligned(8))) exit_signal;
> + uint64_t __attribute__((aligned(8))) stack;
> + uint64_t __attribute__((aligned(8))) stack_size;
> + uint64_t __attribute__((aligned(8))) tls;
> +};
> +
> +static inline int clone3(struct clone_args *args, size_t size)
> +{
> + return tst_syscall(__NR_clone3, args, size);
> +}
> +#endif
> +
> +static inline void clone3_supported_by_kernel(void)
> +{
> + if ((tst_kvercmp(5, 3, 0)) < 0) {
> + /* Check if the syscall is backported on an older kernel */
> + tst_syscall(__NR_clone3, NULL, 0);
> + }
> +}
> +
> #ifndef SCHED_DEADLINE
> # define SCHED_DEADLINE 6
> #endif
> @@ -55,6 +82,10 @@ static inline int sched_getattr(pid_t pid, struct sched_attr *attr,
> # define CLONE_FS 0x00000200
> #endif
>
> +#ifndef CLONE_PIDFD
> +# define CLONE_PIDFD 0x00001000
> +#endif
> +
> #ifndef CLONE_NEWNS
> # define CLONE_NEWNS 0x00020000
> #endif
> diff --git a/lib/tst_clone.c b/lib/tst_clone.c
> index 07e7f0767..ecc84408c 100644
> --- a/lib/tst_clone.c
> +++ b/lib/tst_clone.c
> @@ -8,7 +8,7 @@
> #include <stddef.h>
>
> #include "tst_test.h"
> -#include "lapi/clone.h"
> +#include "lapi/sched.h"
>
> pid_t tst_clone(const struct tst_clone_args *tst_args)
> {
> diff --git a/testcases/kernel/containers/pidns/pidns13.c b/testcases/kernel/containers/pidns/pidns13.c
> index 39fd6df7f..6a155027c 100644
> --- a/testcases/kernel/containers/pidns/pidns13.c
> +++ b/testcases/kernel/containers/pidns/pidns13.c
> @@ -31,7 +31,7 @@
>
> #include "tst_test.h"
> #include "tst_clone.h"
> -#include "lapi/clone.h"
> +#include "lapi/sched.h"
>
> static int pipe_fd[2];
>
> diff --git a/testcases/kernel/containers/userns/userns08.c b/testcases/kernel/containers/userns/userns08.c
> index afdad6cad..2697d874b 100644
> --- a/testcases/kernel/containers/userns/userns08.c
> +++ b/testcases/kernel/containers/userns/userns08.c
> @@ -25,7 +25,7 @@
>
> #include "tst_test.h"
> #include "tst_clone.h"
> -#include "lapi/clone.h"
> +#include "lapi/sched.h"
> #include "tst_safe_file_at.h"
>
> static pid_t clone_newuser(void)
> diff --git a/testcases/kernel/syscalls/clone3/clone301.c b/testcases/kernel/syscalls/clone3/clone301.c
> index f7ef0b2d7..d0fadbc5d 100644
> --- a/testcases/kernel/syscalls/clone3/clone301.c
> +++ b/testcases/kernel/syscalls/clone3/clone301.c
> @@ -15,7 +15,7 @@
> #include <sys/wait.h>
>
> #include "tst_test.h"
> -#include "lapi/clone.h"
> +#include "lapi/sched.h"
> #include "lapi/pidfd.h"
>
> #define CHILD_SIGNAL SIGUSR1
> diff --git a/testcases/kernel/syscalls/clone3/clone302.c b/testcases/kernel/syscalls/clone3/clone302.c
> index 08d6417ce..b1b4ccebb 100644
> --- a/testcases/kernel/syscalls/clone3/clone302.c
> +++ b/testcases/kernel/syscalls/clone3/clone302.c
> @@ -14,7 +14,7 @@
> #include <stdlib.h>
>
> #include "tst_test.h"
> -#include "lapi/clone.h"
> +#include "lapi/sched.h"
>
> static struct clone_args *valid_args, *invalid_args;
> unsigned long stack;
> diff --git a/testcases/kernel/syscalls/close_range/close_range01.c b/testcases/kernel/syscalls/close_range/close_range01.c
> index 5e2de4d1e..30bb600b6 100644
> --- a/testcases/kernel/syscalls/close_range/close_range01.c
> +++ b/testcases/kernel/syscalls/close_range/close_range01.c
> @@ -28,7 +28,7 @@
> #include "tst_test.h"
> #include "tst_clone.h"
>
> -#include "lapi/clone.h"
> +#include "lapi/sched.h"
> #include "lapi/close_range.h"
>
> static int fd[3];
> diff --git a/testcases/kernel/syscalls/close_range/close_range02.c b/testcases/kernel/syscalls/close_range/close_range02.c
> index bd46936bb..aec899261 100644
> --- a/testcases/kernel/syscalls/close_range/close_range02.c
> +++ b/testcases/kernel/syscalls/close_range/close_range02.c
> @@ -18,7 +18,7 @@
> #include "tst_clone.h"
> #include "lapi/fcntl.h"
> #include "lapi/close_range.h"
> -#include "lapi/clone.h"
> +#include "lapi/sched.h"
>
> static int try_close_range(int fd, int flags)
> {
> --
> 2.23.0
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH v1 1/2] include/lapi/sched.h: move namespaces_constants.h's constant into here
2022-12-01 10:05 ` [LTP] [PATCH v1 1/2] include/lapi/sched.h: move namespaces_constants.h's constant " Richard Palethorpe
@ 2022-12-02 2:30 ` xuyang2018.jy
0 siblings, 0 replies; 7+ messages in thread
From: xuyang2018.jy @ 2022-12-02 2:30 UTC (permalink / raw)
To: rpalethorpe@suse.de, Li Wang; +Cc: ltp@lists.linux.it
Hi Li, Richard
Thanks for your review, merged this patchset!
Best Regards
Yang Xu
>
> Yang Xu <xuyang2018.jy@fujitsu.com> writes:
>
>> Kernel header doesn't have this namespaces_constants.h header file and
>> it can be moved into lapi/sched. Also, lapi/clone.h have some duplicated
>> CLONE_* constants, they should be moved into here too.
>
> Good.
>
>>
>> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
>
> Acked-by: Richard Palethorpe <rpalethorpe@suse.com>
>
>> ---
>> include/lapi/namespaces_constants.h | 34 ---------------
>> include/lapi/sched.h | 41 +++++++++++++++++--
>> lib/tst_net.c | 2 +-
>> testcases/cve/cve-2017-16939.c | 2 +-
>> testcases/cve/icmp_rate_limit01.c | 2 +-
>> .../kernel/containers/libclone/libclone.h | 3 +-
>> testcases/kernel/containers/mountns/mountns.h | 2 +-
>> .../kernel/containers/netns/netns_netlink.c | 3 +-
>> testcases/kernel/containers/pidns/pidns01.c | 2 +-
>> testcases/kernel/containers/pidns/pidns02.c | 2 +-
>> testcases/kernel/containers/pidns/pidns03.c | 2 +-
>> testcases/kernel/containers/pidns/pidns12.c | 2 +-
>> testcases/kernel/containers/pidns/pidns20.c | 2 +-
>> testcases/kernel/containers/pidns/pidns32.c | 2 +-
>> testcases/kernel/containers/share/ns_common.h | 2 +-
>> testcases/kernel/containers/share/ns_create.c | 3 +-
>> testcases/kernel/containers/share/ns_exec.c | 3 +-
>> testcases/kernel/containers/sysvipc/common.h | 2 +-
>> testcases/kernel/containers/timens/timens01.c | 2 +-
>> testcases/kernel/containers/userns/common.h | 2 +-
>> .../kernel/controllers/cgroup/cgroup_core02.c | 3 +-
>> .../syscalls/clock_gettime/clock_gettime03.c | 2 +-
>> .../clock_nanosleep/clock_nanosleep03.c | 2 +-
>> testcases/kernel/syscalls/clone/clone09.c | 3 +-
>> .../kernel/syscalls/fanotify/fanotify17.c | 3 +-
>> .../kernel/syscalls/getxattr/getxattr05.c | 3 +-
>> testcases/kernel/syscalls/ioctl/ioctl_ns01.c | 3 +-
>> testcases/kernel/syscalls/ioctl/ioctl_ns05.c | 3 +-
>> testcases/kernel/syscalls/ioctl/ioctl_ns06.c | 3 +-
>> testcases/kernel/syscalls/setns/setns.h | 2 +-
>> testcases/kernel/syscalls/sysinfo/sysinfo03.c | 2 +-
>> testcases/kernel/syscalls/timerfd/timerfd04.c | 2 +-
>> 32 files changed, 67 insertions(+), 79 deletions(-)
>> delete mode 100644 include/lapi/namespaces_constants.h
>>
>> diff --git a/include/lapi/namespaces_constants.h b/include/lapi/namespaces_constants.h
>> deleted file mode 100644
>> index e34b0d6a8..000000000
>> --- a/include/lapi/namespaces_constants.h
>> +++ /dev/null
>> @@ -1,34 +0,0 @@
>> -// SPDX-License-Identifier: GPL-2.0-or-later
>> -/*
>> - * Copyright (c) 2015 Red Hat, Inc.
>> - */
>> -
>> -#ifndef LAPI_NAMESPACES_CONSTANTS_H__
>> -#define LAPI_NAMESPACES_CONSTANTS_H__
>> -
>> -#ifndef CLONE_NEWIPC
>> -# define CLONE_NEWIPC 0x08000000
>> -#endif
>> -#ifndef CLONE_NEWNS
>> -# define CLONE_NEWNS 0x00020000
>> -#endif
>> -#ifndef CLONE_NEWNET
>> -# define CLONE_NEWNET 0x40000000
>> -#endif
>> -#ifndef CLONE_NEWPID
>> -# define CLONE_NEWPID 0x20000000
>> -#endif
>> -#ifndef CLONE_NEWUSER
>> -# define CLONE_NEWUSER 0x10000000
>> -#endif
>> -#ifndef CLONE_NEWCGROUP
>> -# define CLONE_NEWCGROUP 0x02000000
>> -#endif
>> -#ifndef CLONE_NEWUTS
>> -# define CLONE_NEWUTS 0x04000000
>> -#endif
>> -#ifndef CLONE_NEWTIME
>> -# define CLONE_NEWTIME 0x00000080
>> -#endif
>> -
>> -#endif /* LAPI_NAMESPACES_CONSTANTS_H__ */
>> diff --git a/include/lapi/sched.h b/include/lapi/sched.h
>> index 226d3109a..3b0b4be31 100644
>> --- a/include/lapi/sched.h
>> +++ b/include/lapi/sched.h
>> @@ -8,6 +8,7 @@
>> #define LAPI_SCHED_H__
>>
>> #include <sched.h>
>> +#include <unistd.h>
>> #include <stdint.h>
>> #include <inttypes.h>
>> #include "lapi/syscalls.h"
>> @@ -47,19 +48,51 @@ static inline int sched_getattr(pid_t pid, struct sched_attr *attr,
>> #endif
>>
>> #ifndef CLONE_VM
>> -# define CLONE_VM 0x00000100
>> +# define CLONE_VM 0x00000100
>> #endif
>>
>> #ifndef CLONE_FS
>> -# define CLONE_FS 0x00000200
>> +# define CLONE_FS 0x00000200
>> +#endif
>> +
>> +#ifndef CLONE_NEWNS
>> +# define CLONE_NEWNS 0x00020000
>> #endif
>>
>> #ifndef CLONE_SYSVSEM
>> -# define CLONE_SYSVSEM 0x00040000
>> +# define CLONE_SYSVSEM 0x00040000
>> +#endif
>> +
>> +#ifndef CLONE_NEWCGROUP
>> +# define CLONE_NEWCGROUP 0x02000000
>> +#endif
>> +
>> +#ifndef CLONE_NEWUTS
>> +# define CLONE_NEWUTS 0x04000000
>> +#endif
>> +
>> +#ifndef CLONE_NEWIPC
>> +# define CLONE_NEWIPC 0x08000000
>> +#endif
>> +
>> +#ifndef CLONE_NEWUSER
>> +# define CLONE_NEWUSER 0x10000000
>> +#endif
>> +
>> +#ifndef CLONE_NEWPID
>> +# define CLONE_NEWPID 0x20000000
>> +#endif
>> +
>> +#ifndef CLONE_NEWNET
>> +# define CLONE_NEWNET 0x40000000
>> #endif
>>
>> #ifndef CLONE_IO
>> -# define CLONE_IO 0x80000000
>> +# define CLONE_IO 0x80000000
>> +#endif
>> +
>> +#ifndef CLONE_NEWTIME
>> +# define CLONE_NEWTIME 0x00000080
>> #endif
>>
>> #endif /* LAPI_SCHED_H__ */
>> diff --git a/lib/tst_net.c b/lib/tst_net.c
>> index 61fc0ea76..a97e25b11 100644
>> --- a/lib/tst_net.c
>> +++ b/lib/tst_net.c
>> @@ -14,7 +14,7 @@
>> #include "tst_test.h"
>> #include "tst_net.h"
>> #include "tst_private.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> void tst_print_svar(const char *name, const char *val)
>> {
>> diff --git a/testcases/cve/cve-2017-16939.c b/testcases/cve/cve-2017-16939.c
>> index eb5400c0c..e41fb274a 100644
>> --- a/testcases/cve/cve-2017-16939.c
>> +++ b/testcases/cve/cve-2017-16939.c
>> @@ -25,7 +25,7 @@
>> #include "tst_res_flags.h"
>> #include "tst_safe_macros.h"
>> #include "tst_safe_net.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> #define BUFSIZE 2048
>>
>> diff --git a/testcases/cve/icmp_rate_limit01.c b/testcases/cve/icmp_rate_limit01.c
>> index 7a51aa0a4..8ee50a276 100644
>> --- a/testcases/cve/icmp_rate_limit01.c
>> +++ b/testcases/cve/icmp_rate_limit01.c
>> @@ -34,7 +34,7 @@
>> #include "lapi/if_addr.h"
>> #include "tst_test.h"
>> #include "tst_netdevice.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> #define DSTNET 0xfa444e00 /* 250.68.78.0 */
>> #define SRCNET 0xfa444e40 /* 250.68.78.64 */
>> diff --git a/testcases/kernel/containers/libclone/libclone.h b/testcases/kernel/containers/libclone/libclone.h
>> index b8740f1bc..e92fdca02 100644
>> --- a/testcases/kernel/containers/libclone/libclone.h
>> +++ b/testcases/kernel/containers/libclone/libclone.h
>> @@ -19,7 +19,6 @@
>>
>> #include <stdio.h>
>> #include <stdlib.h>
>> -#include <sched.h>
>> #include <unistd.h>
>> #include <string.h>
>> #include <errno.h>
>> @@ -28,7 +27,7 @@
>> #include <signal.h>
>> #include "lapi/syscalls.h"
>> #include "test.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> #define T_UNSHARE 0
>> #define T_CLONE 1
>> diff --git a/testcases/kernel/containers/mountns/mountns.h b/testcases/kernel/containers/mountns/mountns.h
>> index 76b37b477..615f1a058 100644
>> --- a/testcases/kernel/containers/mountns/mountns.h
>> +++ b/testcases/kernel/containers/mountns/mountns.h
>> @@ -8,7 +8,7 @@
>> #define COMMON_H
>>
>> #include "tst_test.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> #define DIRA "LTP_DIR_A"
>> #define DIRB "LTP_DIR_B"
>> diff --git a/testcases/kernel/containers/netns/netns_netlink.c b/testcases/kernel/containers/netns/netns_netlink.c
>> index 6f60ff94e..e8df616e2 100644
>> --- a/testcases/kernel/containers/netns/netns_netlink.c
>> +++ b/testcases/kernel/containers/netns/netns_netlink.c
>> @@ -33,11 +33,10 @@
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <errno.h>
>> -#include <sched.h>
>>
>> #include "tst_test.h"
>> #include "tst_safe_macros.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> #define MAX_TRIES 1000
>>
>> diff --git a/testcases/kernel/containers/pidns/pidns01.c b/testcases/kernel/containers/pidns/pidns01.c
>> index eba4b806b..5080b6fad 100644
>> --- a/testcases/kernel/containers/pidns/pidns01.c
>> +++ b/testcases/kernel/containers/pidns/pidns01.c
>> @@ -15,7 +15,7 @@
>> */
>>
>> #include "tst_test.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> static int child_func(LTP_ATTRIBUTE_UNUSED void *arg)
>> {
>> diff --git a/testcases/kernel/containers/pidns/pidns02.c b/testcases/kernel/containers/pidns/pidns02.c
>> index 9f3a46526..b8913d3f6 100644
>> --- a/testcases/kernel/containers/pidns/pidns02.c
>> +++ b/testcases/kernel/containers/pidns/pidns02.c
>> @@ -14,7 +14,7 @@
>> */
>>
>> #include "tst_test.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> static int child_func(LTP_ATTRIBUTE_UNUSED void *arg)
>> {
>> diff --git a/testcases/kernel/containers/pidns/pidns03.c b/testcases/kernel/containers/pidns/pidns03.c
>> index b9b38b5d9..122ba7891 100644
>> --- a/testcases/kernel/containers/pidns/pidns03.c
>> +++ b/testcases/kernel/containers/pidns/pidns03.c
>> @@ -13,7 +13,7 @@
>>
>> #include <sys/mount.h>
>> #include "tst_test.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> #define PROCDIR "proc"
>>
>> diff --git a/testcases/kernel/containers/pidns/pidns12.c b/testcases/kernel/containers/pidns/pidns12.c
>> index 0e6b17142..fb1ec90ca 100644
>> --- a/testcases/kernel/containers/pidns/pidns12.c
>> +++ b/testcases/kernel/containers/pidns/pidns12.c
>> @@ -16,7 +16,7 @@
>> #define _GNU_SOURCE 1
>> #include <signal.h>
>> #include "tst_test.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> static volatile pid_t sig_pid = -1;
>>
>> diff --git a/testcases/kernel/containers/pidns/pidns20.c b/testcases/kernel/containers/pidns/pidns20.c
>> index f1e239dde..9f369699a 100644
>> --- a/testcases/kernel/containers/pidns/pidns20.c
>> +++ b/testcases/kernel/containers/pidns/pidns20.c
>> @@ -15,7 +15,7 @@
>> #define _GNU_SOURCE 1
>> #include <signal.h>
>> #include "tst_test.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> static volatile int signals;
>> static volatile int last_signo;
>> diff --git a/testcases/kernel/containers/pidns/pidns32.c b/testcases/kernel/containers/pidns/pidns32.c
>> index 333e1fcad..3f7df788e 100644
>> --- a/testcases/kernel/containers/pidns/pidns32.c
>> +++ b/testcases/kernel/containers/pidns/pidns32.c
>> @@ -15,7 +15,7 @@
>>
>> #include <sys/mman.h>
>> #include "tst_test.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> #define MAXNEST 32
>>
>> diff --git a/testcases/kernel/containers/share/ns_common.h b/testcases/kernel/containers/share/ns_common.h
>> index 69e51ce71..0f85aceb4 100644
>> --- a/testcases/kernel/containers/share/ns_common.h
>> +++ b/testcases/kernel/containers/share/ns_common.h
>> @@ -17,7 +17,7 @@
>> #ifndef __NS_COMMON_H__
>> #define __NS_COMMON_H__
>> #include <sched.h>
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> #define PROC_PATH "/proc"
>> #define NS_TOTAL 6
>> diff --git a/testcases/kernel/containers/share/ns_create.c b/testcases/kernel/containers/share/ns_create.c
>> index d4259f38b..3f09e71e0 100644
>> --- a/testcases/kernel/containers/share/ns_create.c
>> +++ b/testcases/kernel/containers/share/ns_create.c
>> @@ -24,7 +24,6 @@
>> */
>>
>> #define _GNU_SOURCE
>> -#include <sched.h>
>> #include <sys/syscall.h>
>> #include <sys/types.h>
>> #include <sys/stat.h>
>> @@ -32,7 +31,7 @@
>> #include <string.h>
>> #include <errno.h>
>> #include "test.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>> #include "ns_common.h"
>>
>> char *TCID = "ns_create";
>> diff --git a/testcases/kernel/containers/share/ns_exec.c b/testcases/kernel/containers/share/ns_exec.c
>> index c492165f0..4abd1063b 100644
>> --- a/testcases/kernel/containers/share/ns_exec.c
>> +++ b/testcases/kernel/containers/share/ns_exec.c
>> @@ -21,7 +21,6 @@
>> */
>>
>> #define _GNU_SOURCE
>> -#include <sched.h>
>> #include <sys/syscall.h>
>> #include <sys/types.h>
>> #include <sys/wait.h>
>> @@ -31,7 +30,7 @@
>> #include <errno.h>
>> #include "test.h"
>> #include "lapi/syscalls.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>> #include "ns_common.h"
>>
>> char *TCID = "ns_exec";
>> diff --git a/testcases/kernel/containers/sysvipc/common.h b/testcases/kernel/containers/sysvipc/common.h
>> index 258d355d7..9b0fc16e9 100644
>> --- a/testcases/kernel/containers/sysvipc/common.h
>> +++ b/testcases/kernel/containers/sysvipc/common.h
>> @@ -11,7 +11,7 @@
>> #include <stdlib.h>
>> #include "tst_test.h"
>> #include "lapi/syscalls.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> enum {
>> T_CLONE,
>> diff --git a/testcases/kernel/containers/timens/timens01.c b/testcases/kernel/containers/timens/timens01.c
>> index 3f6235ec3..3621b3446 100644
>> --- a/testcases/kernel/containers/timens/timens01.c
>> +++ b/testcases/kernel/containers/timens/timens01.c
>> @@ -15,9 +15,9 @@
>> */
>>
>> #define _GNU_SOURCE
>> -#include "lapi/namespaces_constants.h"
>> #include "lapi/posix_clocks.h"
>> #include "tst_test.h"
>> +#include "lapi/sched.h"
>>
>> static struct tcase {
>> const char *desc;
>> diff --git a/testcases/kernel/containers/userns/common.h b/testcases/kernel/containers/userns/common.h
>> index d3bdcc53f..635d0f190 100644
>> --- a/testcases/kernel/containers/userns/common.h
>> +++ b/testcases/kernel/containers/userns/common.h
>> @@ -8,7 +8,7 @@
>> #define COMMON_H
>>
>> #include "tst_test.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> #define UID_MAP 0
>> #define GID_MAP 1
>> diff --git a/testcases/kernel/controllers/cgroup/cgroup_core02.c b/testcases/kernel/controllers/cgroup/cgroup_core02.c
>> index e6d599b36..1872a7dff 100644
>> --- a/testcases/kernel/controllers/cgroup/cgroup_core02.c
>> +++ b/testcases/kernel/controllers/cgroup/cgroup_core02.c
>> @@ -24,14 +24,13 @@
>> */
>>
>> #define _GNU_SOURCE
>> -#include <sched.h>
>> #include <stdlib.h>
>> #include <stdio.h>
>> #include <sys/types.h>
>> #include <pwd.h>
>> #include "tst_test.h"
>> #include "tst_safe_file_at.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> static struct tst_cg_group *cg_child_a, *cg_child_b;
>> static uid_t nobody_uid;
>> diff --git a/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c b/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
>> index f185977d3..b02d22a14 100644
>> --- a/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
>> +++ b/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
>> @@ -18,7 +18,7 @@
>> #include "time64_variants.h"
>> #include "tst_safe_clocks.h"
>> #include "tst_timer.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> static struct tcase {
>> int clk_id;
>> diff --git a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c
>> index 5bd91fa61..dfc522278 100644
>> --- a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c
>> +++ b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c
>> @@ -18,7 +18,7 @@
>> #include "time64_variants.h"
>> #include "tst_safe_clocks.h"
>> #include "tst_timer.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> #define OFFSET_S 10
>> #define SLEEP_US 100000
>> diff --git a/testcases/kernel/syscalls/clone/clone09.c b/testcases/kernel/syscalls/clone/clone09.c
>> index e9e584564..e4691f513 100644
>> --- a/testcases/kernel/syscalls/clone/clone09.c
>> +++ b/testcases/kernel/syscalls/clone/clone09.c
>> @@ -4,14 +4,13 @@
>> */
>>
>> #define _GNU_SOURCE
>> -#include <sched.h>
>> #include <stdlib.h>
>> #include <errno.h>
>>
>> #include "tst_test.h"
>> #include "clone_platform.h"
>> #include "lapi/syscalls.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> static void *child_stack;
>> static int sysctl_net = -1;
>> diff --git a/testcases/kernel/syscalls/fanotify/fanotify17.c b/testcases/kernel/syscalls/fanotify/fanotify17.c
>> index 7d74b2540..3ecb31b6e 100644
>> --- a/testcases/kernel/syscalls/fanotify/fanotify17.c
>> +++ b/testcases/kernel/syscalls/fanotify/fanotify17.c
>> @@ -20,11 +20,10 @@
>> #include <errno.h>
>> #include <unistd.h>
>> #include <sys/types.h>
>> -#include <sched.h>
>> #include <stdlib.h>
>>
>> #include "tst_test.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> #ifdef HAVE_SYS_FANOTIFY_H
>> #include "fanotify.h"
>> diff --git a/testcases/kernel/syscalls/getxattr/getxattr05.c b/testcases/kernel/syscalls/getxattr/getxattr05.c
>> index 3e73cc567..28eb4cbcf 100644
>> --- a/testcases/kernel/syscalls/getxattr/getxattr05.c
>> +++ b/testcases/kernel/syscalls/getxattr/getxattr05.c
>> @@ -20,7 +20,6 @@
>> #include <errno.h>
>> #include <unistd.h>
>> #include <sys/types.h>
>> -#include <sched.h>
>> #include <stdlib.h>
>>
>> #ifdef HAVE_SYS_XATTR_H
>> @@ -32,7 +31,7 @@
>> #endif
>>
>> #include "tst_test.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> #if defined(HAVE_SYS_XATTR_H) && defined(HAVE_LIBACL)
>>
>> diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ns01.c b/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
>> index 95be877dc..06c81ba1b 100644
>> --- a/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
>> +++ b/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
>> @@ -19,11 +19,10 @@
>> #define _GNU_SOURCE
>>
>> #include <errno.h>
>> -#include <sched.h>
>> #include <stdlib.h>
>> #include "tst_test.h"
>> #include "lapi/ioctl_ns.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> #define STACK_SIZE (1024 * 1024)
>>
>> diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ns05.c b/testcases/kernel/syscalls/ioctl/ioctl_ns05.c
>> index ae2f9da51..36e41c468 100644
>> --- a/testcases/kernel/syscalls/ioctl/ioctl_ns05.c
>> +++ b/testcases/kernel/syscalls/ioctl/ioctl_ns05.c
>> @@ -18,11 +18,10 @@
>>
>> #include <errno.h>
>> #include <stdio.h>
>> -#include <sched.h>
>> #include <stdlib.h>
>> #include "tst_test.h"
>> #include "lapi/ioctl_ns.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> #define STACK_SIZE (1024 * 1024)
>>
>> diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ns06.c b/testcases/kernel/syscalls/ioctl/ioctl_ns06.c
>> index 393ba1437..45fc01ce7 100644
>> --- a/testcases/kernel/syscalls/ioctl/ioctl_ns06.c
>> +++ b/testcases/kernel/syscalls/ioctl/ioctl_ns06.c
>> @@ -19,11 +19,10 @@
>>
>> #include <errno.h>
>> #include <stdio.h>
>> -#include <sched.h>
>> #include <stdlib.h>
>> #include "tst_test.h"
>> #include "lapi/ioctl_ns.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> #define STACK_SIZE (1024 * 1024)
>>
>> diff --git a/testcases/kernel/syscalls/setns/setns.h b/testcases/kernel/syscalls/setns/setns.h
>> index 46beef17f..45c759917 100644
>> --- a/testcases/kernel/syscalls/setns/setns.h
>> +++ b/testcases/kernel/syscalls/setns/setns.h
>> @@ -4,7 +4,7 @@
>> */
>>
>> #include <stdio.h>
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> #define NS_MAX 5
>> static int ns_types[NS_MAX];
>> diff --git a/testcases/kernel/syscalls/sysinfo/sysinfo03.c b/testcases/kernel/syscalls/sysinfo/sysinfo03.c
>> index af7cb6421..6b8f0aef7 100644
>> --- a/testcases/kernel/syscalls/sysinfo/sysinfo03.c
>> +++ b/testcases/kernel/syscalls/sysinfo/sysinfo03.c
>> @@ -14,9 +14,9 @@
>> */
>>
>> #include <sys/sysinfo.h>
>> -#include "lapi/namespaces_constants.h"
>> #include "lapi/posix_clocks.h"
>> #include "tst_test.h"
>> +#include "lapi/sched.h"
>>
>> static int offsets[] = {
>> 10,
>> diff --git a/testcases/kernel/syscalls/timerfd/timerfd04.c b/testcases/kernel/syscalls/timerfd/timerfd04.c
>> index eb7f98d5b..b24b4874e 100644
>> --- a/testcases/kernel/syscalls/timerfd/timerfd04.c
>> +++ b/testcases/kernel/syscalls/timerfd/timerfd04.c
>> @@ -19,7 +19,7 @@
>> #include "tst_safe_clocks.h"
>> #include "tst_safe_timerfd.h"
>> #include "tst_timer.h"
>> -#include "lapi/namespaces_constants.h"
>> +#include "lapi/sched.h"
>>
>> #define SLEEP_US 40000
>>
>> --
>> 2.23.0
>
>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-12-02 2:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-29 6:40 [LTP] [PATCH v1 1/2] include/lapi/sched.h: move namespaces_constants.h's constant into here Yang Xu
2022-11-29 5:50 ` Li Wang
2022-11-29 6:41 ` [LTP] [PATCH v1 2/2] include/lapi/sched.h: Move lapi/clone.h " Yang Xu
2022-11-29 5:50 ` Li Wang
2022-12-01 10:06 ` Richard Palethorpe
2022-12-01 10:05 ` [LTP] [PATCH v1 1/2] include/lapi/sched.h: move namespaces_constants.h's constant " Richard Palethorpe
2022-12-02 2:30 ` xuyang2018.jy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox