1f08c3bdfSopenharmony_ci/* Copyright (c) 2015 Fujitsu Ltd.
2f08c3bdfSopenharmony_ci * Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
3f08c3bdfSopenharmony_ci *
4f08c3bdfSopenharmony_ci * This program is free software: you can redistribute it and/or modify
5f08c3bdfSopenharmony_ci * it under the terms of version 2 the GNU General Public License as
6f08c3bdfSopenharmony_ci * published by the Free Software Foundation.
7f08c3bdfSopenharmony_ci *
8f08c3bdfSopenharmony_ci * This program is distributed in the hope that it will be useful,
9f08c3bdfSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
10f08c3bdfSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11f08c3bdfSopenharmony_ci * GNU General Public License for more details.
12f08c3bdfSopenharmony_ci *
13f08c3bdfSopenharmony_ci * You should have received a copy of the GNU General Public License
14f08c3bdfSopenharmony_ci * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15f08c3bdfSopenharmony_ci *
16f08c3bdfSopenharmony_ci ***********************************************************************
17f08c3bdfSopenharmony_ci * Check for setns() availability, should be called before ns_exec.
18f08c3bdfSopenharmony_ci *
19f08c3bdfSopenharmony_ci */
20f08c3bdfSopenharmony_ci
21f08c3bdfSopenharmony_ci#include "test.h"
22f08c3bdfSopenharmony_ci#include "lapi/syscalls.h"
23f08c3bdfSopenharmony_ci
24f08c3bdfSopenharmony_cichar *TCID = "setns_check";
25f08c3bdfSopenharmony_ci
26f08c3bdfSopenharmony_ciint main(void)
27f08c3bdfSopenharmony_ci{
28f08c3bdfSopenharmony_ci	if (syscall(__NR_setns, -1, 0) == -1 && errno == ENOSYS)
29f08c3bdfSopenharmony_ci		tst_brkm(TCONF, NULL, "setns is not supported in the kernel");
30f08c3bdfSopenharmony_ci	else
31f08c3bdfSopenharmony_ci		return 0;
32f08c3bdfSopenharmony_ci}
33