1 /* Linux namespaces(7) support.
3 Copyright (C) 2015 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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/>. */
20 #ifndef LINUX_NAMESPACES_H
21 #define LINUX_NAMESPACES_H
23 /* Set to nonzero to enable debugging of Linux namespaces code. */
25 extern int debug_linux_namespaces;
27 /* Enumeration of Linux namespace types. */
31 /* IPC namespace: System V IPC, POSIX message queues. */
34 /* Mount namespace: mount points. */
37 /* Network namespace: network devices, stacks, ports, etc. */
40 /* PID namespace: process IDs. */
43 /* User namespace: user and group IDs. */
46 /* UTS namespace: hostname and NIS domain name. */
49 /* Number of Linux namespaces. */
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. */
59 extern int linux_ns_same (pid_t pid, enum linux_ns_type type);
61 /* Like gdb_open_cloexec, but in the mount namespace of process
64 extern int linux_mntns_open_cloexec (pid_t pid, const char *filename,
65 int flags, mode_t mode);
67 /* Like unlink(2), but in the mount namespace of process PID. */
69 extern int linux_mntns_unlink (pid_t pid, const char *filename);
71 /* Like readlink(2), but in the mount namespace of process PID. */
73 extern ssize_t linux_mntns_readlink (pid_t pid, const char *filename,
74 char *buf, size_t bufsiz);
76 #endif /* LINUX_NAMESPACES_H */