Commit | Line | Data |
---|---|---|
4b8b5e72 GB |
1 | /* Linux namespaces(7) support. |
2 | ||
b811d2c2 | 3 | Copyright (C) 2015-2020 Free Software Foundation, Inc. |
4b8b5e72 GB |
4 | |
5 | This file is part of GDB. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 3 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
19 | ||
1a5c2598 TT |
20 | #ifndef NAT_LINUX_NAMESPACES_H |
21 | #define NAT_LINUX_NAMESPACES_H | |
4b8b5e72 | 22 | |
491144b5 | 23 | /* Set to true to enable debugging of Linux namespaces code. */ |
4b8b5e72 | 24 | |
491144b5 | 25 | extern bool debug_linux_namespaces; |
4b8b5e72 GB |
26 | |
27 | /* Enumeration of Linux namespace types. */ | |
28 | ||
29 | enum linux_ns_type | |
30 | { | |
31 | /* IPC namespace: System V IPC, POSIX message queues. */ | |
32 | LINUX_NS_IPC, | |
33 | ||
34 | /* Mount namespace: mount points. */ | |
35 | LINUX_NS_MNT, | |
36 | ||
37 | /* Network namespace: network devices, stacks, ports, etc. */ | |
38 | LINUX_NS_NET, | |
39 | ||
40 | /* PID namespace: process IDs. */ | |
41 | LINUX_NS_PID, | |
42 | ||
43 | /* User namespace: user and group IDs. */ | |
44 | LINUX_NS_USER, | |
45 | ||
46 | /* UTS namespace: hostname and NIS domain name. */ | |
47 | LINUX_NS_UTS, | |
48 | ||
49 | /* Number of Linux namespaces. */ | |
50 | NUM_LINUX_NS_TYPES | |
51 | }; | |
52 | ||
53 | /* Return nonzero if process PID has the same TYPE namespace as the | |
54 | calling process, or if the kernel does not support TYPE namespaces | |
55 | (in which case there is only one TYPE namespace). Return zero if | |
56 | the kernel supports TYPE namespaces and the two processes have | |
57 | different TYPE namespaces. */ | |
58 | ||
59 | extern int linux_ns_same (pid_t pid, enum linux_ns_type type); | |
60 | ||
61 | /* Like gdb_open_cloexec, but in the mount namespace of process | |
62 | PID. */ | |
63 | ||
64 | extern int linux_mntns_open_cloexec (pid_t pid, const char *filename, | |
65 | int flags, mode_t mode); | |
66 | ||
67 | /* Like unlink(2), but in the mount namespace of process PID. */ | |
68 | ||
69 | extern int linux_mntns_unlink (pid_t pid, const char *filename); | |
70 | ||
71 | /* Like readlink(2), but in the mount namespace of process PID. */ | |
72 | ||
73 | extern ssize_t linux_mntns_readlink (pid_t pid, const char *filename, | |
74 | char *buf, size_t bufsiz); | |
75 | ||
1a5c2598 | 76 | #endif /* NAT_LINUX_NAMESPACES_H */ |