2023-01-25 18:31:27 +02:00
|
|
|
#pragma once
|
2023-04-01 06:18:41 +03:00
|
|
|
///@file
|
2023-01-25 18:31:27 +02:00
|
|
|
|
2023-10-25 07:43:36 +03:00
|
|
|
#include <optional>
|
|
|
|
|
|
|
|
#include "types.hh"
|
|
|
|
|
2023-01-25 18:31:27 +02:00
|
|
|
namespace nix {
|
|
|
|
|
2023-10-25 07:43:36 +03:00
|
|
|
/**
|
|
|
|
* 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();
|
|
|
|
|
2023-01-27 17:52:31 +02:00
|
|
|
#if __linux__
|
|
|
|
|
2023-01-25 18:31:27 +02:00
|
|
|
bool userNamespacesSupported();
|
|
|
|
|
2023-02-10 15:38:14 +02:00
|
|
|
bool mountAndPidNamespacesSupported();
|
2023-01-27 16:25:56 +02:00
|
|
|
|
2023-01-27 17:52:31 +02:00
|
|
|
#endif
|
|
|
|
|
2023-01-25 18:31:27 +02:00
|
|
|
}
|