[LTP] [PATCH 1/1] containers: Remove setns_check
Richard Palethorpe
rpalethorpe@suse.de
Fri Jan 20 15:05:53 CET 2023
Petr Vorel <pvorel@suse.cz> writes:
> setns_check.c was used to verify __NR_setns support.
> It was added in Linux 3.0 and SYSCALL_DEFINE2(setns, int, fd, int,
> flags) is not guarded by any configuration variable.
>
> => safe to remove the helper.
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
Reviewed-by: Richard Palethorpe <rpalethorpe@suse.com>
> ---
> doc/namespaces-helper-tools.txt | 2 --
> .../kernel/containers/netns/netns_lib.sh | 3 --
> .../kernel/containers/netns/netns_sysfs.sh | 5 ---
> testcases/kernel/containers/share/.gitignore | 1 -
> .../kernel/containers/share/setns_check.c | 32 -------------------
> 5 files changed, 43 deletions(-)
> delete mode 100644 testcases/kernel/containers/share/setns_check.c
>
> diff --git a/doc/namespaces-helper-tools.txt b/doc/namespaces-helper-tools.txt
> index 6990e0155a..81eec4d6ca 100644
> --- a/doc/namespaces-helper-tools.txt
> +++ b/doc/namespaces-helper-tools.txt
> @@ -14,8 +14,6 @@ located in ltp/testcases/kernel/containers/share directory and include:
> ** PID of the daemonized child process is printed on the stdout
> ** the new namespace(s) is(are) maintained by the daemonized child process
> ** namespace(s) can be removed by killing the daemonized process
> -* setns_check
> -** check for setns() availability, should be called before using ns_exec
> * ns_exec
> ** enters the namespace(s) of a process specified by a PID
> ** then executes the indicated program inside that namespace(s)
> diff --git a/testcases/kernel/containers/netns/netns_lib.sh b/testcases/kernel/containers/netns/netns_lib.sh
> index 79e90336a8..039631e9f6 100755
> --- a/testcases/kernel/containers/netns/netns_lib.sh
> +++ b/testcases/kernel/containers/netns/netns_lib.sh
> @@ -72,9 +72,6 @@ netns_setup()
> if [ "$NS_EXEC" = "ip" ]; then
> netns_ip_setup
> else
> - setns_check
> - [ $? -eq 32 ] && tst_brk TCONF "setns not supported"
> -
> NS_TYPE="net"
> netns_ns_exec_setup
> fi
> diff --git a/testcases/kernel/containers/netns/netns_sysfs.sh b/testcases/kernel/containers/netns/netns_sysfs.sh
> index 1792427210..34ef3b8eef 100755
> --- a/testcases/kernel/containers/netns/netns_sysfs.sh
> +++ b/testcases/kernel/containers/netns/netns_sysfs.sh
> @@ -18,11 +18,6 @@ do_setup()
> DUMMYDEV_HOST="dummy_test0"
> DUMMYDEV="dummy_test1"
>
> - setns_check
> - if [ $? -eq 32 ]; then
> - tst_brk TCONF "setns not supported"
> - fi
> -
> NS_HANDLE=$(ns_create $NS_TYPE)
> if [ $? -eq 1 ]; then
> tst_res TINFO "$NS_HANDLE"
> diff --git a/testcases/kernel/containers/share/.gitignore b/testcases/kernel/containers/share/.gitignore
> index 06615d9ea2..0d5ecf069d 100644
> --- a/testcases/kernel/containers/share/.gitignore
> +++ b/testcases/kernel/containers/share/.gitignore
> @@ -1,4 +1,3 @@
> /ns_ifmove
> /ns_create
> /ns_exec
> -/setns_check
> diff --git a/testcases/kernel/containers/share/setns_check.c b/testcases/kernel/containers/share/setns_check.c
> deleted file mode 100644
> index 75aad17f3a..0000000000
> --- a/testcases/kernel/containers/share/setns_check.c
> +++ /dev/null
> @@ -1,32 +0,0 @@
> -/* Copyright (c) 2015 Fujitsu Ltd.
> - * Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
> - *
> - * This program is free software: you can redistribute it and/or modify
> - * it under the terms of version 2 the GNU General Public License as
> - * published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program. If not, see <http://www.gnu.org/licenses/>.
> - *
> - ***********************************************************************
> - * Check for setns() availability, should be called before ns_exec.
> - *
> - */
> -
> -#include "test.h"
> -#include "lapi/syscalls.h"
> -
> -char *TCID = "setns_check";
> -
> -int main(void)
> -{
> - if (syscall(__NR_setns, -1, 0) == -1 && errno == ENOSYS)
> - tst_brkm(TCONF, NULL, "setns is not supported in the kernel");
> - else
> - return 0;
> -}
> --
> 2.39.0
--
Thank you,
Richard.
More information about the ltp
mailing list