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