chiark / gitweb /
Prep v233.2: Mask unneeded functions and definitions in src/shared
[elogind.git] / src / shared / nsflags.h
1 #pragma once
2
3 /***
4   This file is part of systemd.
5
6   Copyright 2016 Lennart Poettering
7
8   systemd is free software; you can redistribute it and/or modify it
9   under the terms of the GNU Lesser General Public License as published by
10   the Free Software Foundation; either version 2.1 of the License, or
11   (at your option) any later version.
12
13   systemd is distributed in the hope that it will be useful, but
14   WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16   Lesser General Public License for more details.
17
18   You should have received a copy of the GNU Lesser General Public License
19   along with systemd; If not, see <http://www.gnu.org/licenses/>.
20 ***/
21
22 #include <sched.h>
23
24 #include "missing.h"
25
26 /* The combination of all namespace flags defined by the kernel. The right type for this isn't clear. setns() and
27  * unshare() expect these flags to be passed as (signed) "int", while clone() wants them as "unsigned long". The latter
28  * is definitely more appropriate for a flags parameter, and also the larger type of the two, hence let's stick to that
29  * here. */
30 #define NAMESPACE_FLAGS_ALL                                             \
31         ((unsigned long) (CLONE_NEWCGROUP|                              \
32                           CLONE_NEWIPC|                                 \
33                           CLONE_NEWNET|                                 \
34                           CLONE_NEWNS|                                  \
35                           CLONE_NEWPID|                                 \
36                           CLONE_NEWUSER|                                \
37                           CLONE_NEWUTS))
38
39 const char* namespace_flag_to_string(unsigned long flag);
40 unsigned long namespace_flag_from_string(const char *name);
41 #if 0 /// UNNEEDED by elogind
42 int namespace_flag_from_string_many(const char *name, unsigned long *ret);
43 #endif // 0
44 int namespace_flag_to_string_many(unsigned long flags, char **ret);
45
46 struct namespace_flag_map {
47         unsigned long flag;
48         const char *name;
49 };
50
51 extern const struct namespace_flag_map namespace_flag_map[];