Index: sandbox/linux/services/namespace_utils.h |
diff --git a/sandbox/linux/services/namespace_utils.h b/sandbox/linux/services/namespace_utils.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..61c3f1307d71edec5368190d1164f35de5b02cf2 |
--- /dev/null |
+++ b/sandbox/linux/services/namespace_utils.h |
@@ -0,0 +1,34 @@ |
+// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
jln (very slow on Chromium)
2015/01/14 00:46:37
Not (c) after "Copyright" anymore
rickyz (no longer on Chrome)
2015/01/23 01:20:19
Done.
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef SANDBOX_LINUX_SERVICES_NAMESPACE_UTILS_H_ |
+#define SANDBOX_LINUX_SERVICES_NAMESPACE_UTILS_H_ |
+ |
+#include <sys/types.h> |
+ |
+#include "base/macros.h" |
+#include "base/template_util.h" |
+#include "sandbox/sandbox_export.h" |
+ |
jln (very slow on Chromium)
2015/01/14 00:46:37
Please, add a little bit of documentation about wh
rickyz (no longer on Chrome)
2015/01/23 01:20:19
Not the best comment, since the class is a little
|
+namespace sandbox { |
+ |
+class SANDBOX_EXPORT NamespaceUtils { |
+ public: |
+ COMPILE_ASSERT((base::is_same<uid_t, gid_t>::value), UidAndGidAreSameType); |
+ // generic_id_t can be used for either uid_t or gid_t. |
+ typedef uid_t generic_id_t; |
+ |
+ // Write a uid or gid mapping from |id| to |id| in |map_file|. |
+ static bool WriteToIdMapFile(const char* map_file, generic_id_t id); |
+ |
+ // Returns true if the namespace type |type| is supported. |type| must be one |
+ // of CLONE_NEWIPC, CLONE_NEWNET, CLONE_NEWNS, CLONE_NEWPID, CLONE_NEWUSER, or |
+ // CLONE_NEWUTS. This relies on access to /proc, so it will not work from |
+ // within a chroot. |
+ static bool SupportsLinuxNamespace(int type); |
+}; |
jln (very slow on Chromium)
2015/01/14 00:46:37
DISALLOW_IMPLICIT_CONSTRUCTORS
rickyz (no longer on Chrome)
2015/01/23 01:20:17
Done.
|
+ |
+} // namespace sandbox |
+ |
+#endif // SANDBOX_LINUX_SERVICES_NAMESPACE_UTILS_H_ |