diff options
author | Helmut Grohne <helmut@subdivi.de> | 2024-06-16 16:46:43 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2024-06-16 16:46:43 +0200 |
commit | 42c659f30f8d13bc5b6bcbe9203e83a9efa2b2a8 (patch) | |
tree | 55fc223b556ba1345ea46977049be174b8d99373 /linuxnamespaces | |
parent | d205525e1916e8b0fb9cfe95a32794daf514b75f (diff) | |
download | python-linuxnamespaces-42c659f30f8d13bc5b6bcbe9203e83a9efa2b2a8.tar.gz |
populate_dev: also provide /dev/shm
This is needed e.g. for Python's multiprocessing.SemLock.
Diffstat (limited to 'linuxnamespaces')
-rw-r--r-- | linuxnamespaces/__init__.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/linuxnamespaces/__init__.py b/linuxnamespaces/__init__.py index 43c1bc8..1b4ca07 100644 --- a/linuxnamespaces/__init__.py +++ b/linuxnamespaces/__init__.py @@ -407,7 +407,7 @@ def populate_dev( """ origdev = AtLocation(origroot) / "dev" newdev = AtLocation(newroot) / "dev" - directories = {"pts"} + directories = {"pts", "shm"} files = set() symlinks = { "fd": "/proc/self/fd", @@ -456,6 +456,12 @@ def populate_dev( for fn in directories: (newdev / fn).mkdir() (newdev / fn).chmod(0o755) + mount( + "tmpfs", + newdev / "shm", + "tmpfs", + MountFlags.NOSUID | MountFlags.NODEV, + ) for fn in files: (newdev / fn).mknod(stat.S_IFREG) for fn, target in symlinks.items(): |