mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
namespace: don't create needless namespaces
A non-zero Path field for a namespace says that a process should attach to an existing namespace, so the process can be forked without the flag for this namespace. Signed-off-by: Andrey Vagin <avagin@openvz.org>
This commit is contained in:
+4
-1
@@ -36,9 +36,12 @@ func newInitPipe() (parent *os.File, child *os.File, err error) {
|
||||
}
|
||||
|
||||
// GetNamespaceFlags parses the container's Namespaces options to set the correct
|
||||
// flags on clone, unshare, and setns
|
||||
// flags on clone, unshare. This functions returns flags only for new namespaces.
|
||||
func GetNamespaceFlags(namespaces libcontainer.Namespaces) (flag int) {
|
||||
for _, v := range namespaces {
|
||||
if v.Path != "" {
|
||||
continue
|
||||
}
|
||||
flag |= namespaceInfo[v.Type]
|
||||
}
|
||||
return flag
|
||||
|
||||
Reference in New Issue
Block a user