1/* Copyright (c) 2015 Red Hat, Inc. 2 * 3 * This program is free software: you can redistribute it and/or modify 4 * it under the terms of version 2 the GNU General Public License as 5 * published by the Free Software Foundation. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * 15 ***********************************************************************/ 16 17#ifndef __NS_COMMON_H__ 18#define __NS_COMMON_H__ 19#include <sched.h> 20#include "lapi/namespaces_constants.h" 21 22#define PROC_PATH "/proc" 23#define NS_TOTAL 6 24 25 26struct param { 27 const char *name; 28 int flag; 29}; 30 31struct param params[] = { 32 {"ipc", CLONE_NEWIPC}, 33 {"mnt", CLONE_NEWNS}, 34 {"net", CLONE_NEWNET}, 35 {"pid", CLONE_NEWPID}, 36 {"user", CLONE_NEWUSER}, 37 {"uts", CLONE_NEWUTS}, 38 {NULL, 0} 39}; 40 41 42struct param *get_param(const char *name) 43{ 44 int i; 45 46 for (i = 0; params[i].name; i++) { 47 if (!strcasecmp(params[i].name, name)) 48 return params + i; 49 } 50 51 return NULL; 52} 53 54 55#endif 56