aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/namespaces.hh
diff options
context:
space:
mode:
authorjade <lix@jade.fyi>2024-05-30 02:33:05 +0000
committerGerrit Code Review <gerrit@lix-systems>2024-05-30 02:33:05 +0000
commit562ff516ab27b8e98490646dd30ac96e7e2c36bb (patch)
tree1798a20b33da0101bd91acf7da26c891f0cda620 /src/libutil/namespaces.hh
parentc71f21da3ac4d95ef9a42a26416ccee71639dbd6 (diff)
parenta39ba22ff7112cd3984bbf28d8610d84dd525a0f (diff)
Merge changes from topic "libutil-split" into main
* changes: util.hh: Delete remaining file and clean up headers util.hh: Move nativeSystem to local-derivation-goal.cc util.hh: Move stuff to types.hh util.cc: Delete remaining file util.{hh,cc}: Move ignoreException to error.{hh,cc} util.{hh,cc}: Split out namespaces.{hh,cc} util.{hh,cc}: Split out users.{hh,cc} util.{hh,cc}: Split out strings.{hh,cc} util.{hh,cc}: Split out unix-domain-socket.{hh,cc} util.{hh,cc}: Split out child.{hh,cc} util.{hh,cc}: Split out current-process.{hh,cc} util.{hh,cc}: Split out processes.{hh,cc} util.{hh,cc}: Split out file-descriptor.{hh,cc} util.{hh,cc}: Split out file-system.{hh,cc} util.{hh,cc}: Split out terminal.{hh,cc} util.{hh,cc}: Split out environment-variables.{hh,cc}
Diffstat (limited to 'src/libutil/namespaces.hh')
-rw-r--r--src/libutil/namespaces.hh20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libutil/namespaces.hh b/src/libutil/namespaces.hh
index 0b7eeb66c..3a920e665 100644
--- a/src/libutil/namespaces.hh
+++ b/src/libutil/namespaces.hh
@@ -3,6 +3,26 @@
namespace nix {
+/**
+ * Save the current mount namespace. Ignored if called more than
+ * once.
+ */
+void saveMountNamespace();
+
+/**
+ * Restore the mount namespace saved by saveMountNamespace(). Ignored
+ * if saveMountNamespace() was never called.
+ */
+void restoreMountNamespace();
+
+/**
+ * Cause this thread to not share any FS attributes with the main
+ * thread, because this causes setns() in restoreMountNamespace() to
+ * fail.
+ */
+void unshareFilesystem();
+
+
#if __linux__
bool userNamespacesSupported();