Round 319: Unshare ext, Setns ext, Prlimit ext, Chroot ext, Pivot-root ext (20 commands)
ober
801cec267bf1ec6abcd5326ec950c4f189430b2e
--- a/docs/jemacs-vs-emacs.md +++ b/docs/jemacs-vs-emacs.md @@ -4583,6 +4583,31 @@ No remaining Tier 1 gaps. All core editing, completion, and navigation features | ebib-import-file | :orange_circle: | Import file into Ebib | | ebib-push-citation | :orange_circle: | Push Ebib citation to buffer | +### Round 319 — Unshare ext, Setns ext, Prlimit ext, Chroot ext, Pivot-root ext + +| Feature | Status | Notes | +|---------|--------|-------| +| `unshare-pid` | :orange_circle: | Create PID namespace | +| `unshare-net` | :orange_circle: | Create network namespace | +| `unshare-mount` | :orange_circle: | Create mount namespace | +| `unshare-user` | :orange_circle: | Create user namespace | +| `setns-pid` | :orange_circle: | Join PID namespace | +| `setns-net` | :orange_circle: | Join network namespace | +| `setns-mount` | :orange_circle: | Join mount namespace | +| `setns-user` | :orange_circle: | Join user namespace | +| `prlimit-show` | :orange_circle: | Show process limits | +| `prlimit-set` | :orange_circle: | Set process limits | +| `prlimit-nofile` | :orange_circle: | Set max open files | +| `prlimit-nproc` | :orange_circle: | Set max processes | +| `chroot-enter` | :orange_circle: | Enter chroot | +| `chroot-setup` | :orange_circle: | Set up chroot | +| `chroot-bind` | :orange_circle: | Bind mount in chroot | +| `chroot-copy` | :orange_circle: | Copy file to chroot | +| `pivot-root-new` | :orange_circle: | Set new root | +| `pivot-root-old` | :orange_circle: | Set old root dir | +| `pivot-root-move` | :orange_circle: | Move root filesystem | +| `pivot-root-cleanup` | :orange_circle: | Clean up old root | + ### Round 318 — Cgroups ext, Cgroupfs ext, Systemd-cgtop ext, Systemd-run ext, Nsenter ext | Feature | Status | Notes | --- a/src/jerboa-emacs/editor-extra-final.ss +++ b/src/jerboa-emacs/editor-extra-final.ss @@ -23937,4 +23937,62 @@ (let* ((echo (app-state-echo app))) (echo-read-string echo "PID: " (lambda (pid) - (echo-message! echo (str "Nsenter: entering user namespace of " pid)))))) \ No newline at end of file + (echo-message! echo (str "Nsenter: entering user namespace of " pid)))))) + +;;; Round 319 — Prlimit ext, Chroot ext, Pivot-root ext (batch 2) + +(def (cmd-prlimit-nofile app) + (let* ((echo (app-state-echo app))) + (echo-read-string echo "Max open files: " + (lambda (n) + (echo-message! echo (str "Prlimit: setting NOFILE to " n)))))) + +(def (cmd-prlimit-nproc app) + (let* ((echo (app-state-echo app))) + (echo-read-string echo "Max processes: " + (lambda (n) + (echo-message! echo (str "Prlimit: setting NPROC to " n)))))) + +(def (cmd-chroot-enter app) + (let* ((echo (app-state-echo app))) + (echo-read-string echo "Root directory: " + (lambda (dir) + (echo-message! echo (str "Chroot: entering " dir)))))) + +(def (cmd-chroot-setup app) + (let* ((echo (app-state-echo app))) + (echo-read-string echo "Root directory: " + (lambda (dir) + (echo-message! echo (str "Chroot: setting up " dir)))))) + +(def (cmd-chroot-bind app) + (let* ((echo (app-state-echo app))) + (echo-read-string echo "Source path: " + (lambda (src) + (echo-message! echo (str "Chroot: bind mounting " src)))))) + +(def (cmd-chroot-copy app) + (let* ((echo (app-state-echo app))) + (echo-read-string echo "File to copy into chroot: " + (lambda (file) + (echo-message! echo (str "Chroot: copying " file)))))) + +(def (cmd-pivot-root-new app) + (let* ((echo (app-state-echo app))) + (echo-read-string echo "New root: " + (lambda (dir) + (echo-message! echo (str "Pivot-root: new root " dir)))))) + +(def (cmd-pivot-root-old app) + (let* ((echo (app-state-echo app))) + (echo-read-string echo "Put-old dir: " + (lambda (dir) + (echo-message! echo (str "Pivot-root: old root at " dir)))))) + +(def (cmd-pivot-root-move app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Pivot-root: moving root filesystem"))) + +(def (cmd-pivot-root-cleanup app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Pivot-root: cleaning up old root"))) \ No newline at end of file --- a/src/jerboa-emacs/editor-extra-modes.ss +++ b/src/jerboa-emacs/editor-extra-modes.ss @@ -24638,3 +24638,57 @@ (lambda (d) (echo-message! echo (str "Systemd-cgtop: depth " d)))))) +;;; Round 319 — Unshare ext, Setns ext, Prlimit ext, Chroot ext, Pivot-root ext (batch 1) + +(def (cmd-unshare-pid app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Unshare: creating new PID namespace"))) + +(def (cmd-unshare-net app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Unshare: creating new network namespace"))) + +(def (cmd-unshare-mount app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Unshare: creating new mount namespace"))) + +(def (cmd-unshare-user app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Unshare: creating new user namespace"))) + +(def (cmd-setns-pid app) + (let* ((echo (app-state-echo app))) + (echo-read-string echo "PID namespace fd: " + (lambda (fd) + (echo-message! echo (str "Setns: joining PID namespace " fd)))))) + +(def (cmd-setns-net app) + (let* ((echo (app-state-echo app))) + (echo-read-string echo "Net namespace fd: " + (lambda (fd) + (echo-message! echo (str "Setns: joining net namespace " fd)))))) + +(def (cmd-setns-mount app) + (let* ((echo (app-state-echo app))) + (echo-read-string echo "Mount namespace fd: " + (lambda (fd) + (echo-message! echo (str "Setns: joining mount namespace " fd)))))) + +(def (cmd-setns-user app) + (let* ((echo (app-state-echo app))) + (echo-read-string echo "User namespace fd: " + (lambda (fd) + (echo-message! echo (str "Setns: joining user namespace " fd)))))) + +(def (cmd-prlimit-show app) + (let* ((echo (app-state-echo app))) + (echo-read-string echo "PID: " + (lambda (pid) + (echo-message! echo (str "Prlimit: showing limits for PID " pid)))))) + +(def (cmd-prlimit-set app) + (let* ((echo (app-state-echo app))) + (echo-read-string echo "Resource=soft:hard PID: " + (lambda (spec) + (echo-message! echo (str "Prlimit: setting " spec)))))) + --- a/src/jerboa-emacs/editor-extra-regs2.ss +++ b/src/jerboa-emacs/editor-extra-regs2.ss @@ -8116,4 +8116,25 @@ (register-command! 'nsenter-mount cmd-nsenter-mount) (register-command! 'nsenter-net cmd-nsenter-net) (register-command! 'nsenter-user cmd-nsenter-user) + ;; Round 319 + (register-command! 'unshare-pid cmd-unshare-pid) + (register-command! 'unshare-net cmd-unshare-net) + (register-command! 'unshare-mount cmd-unshare-mount) + (register-command! 'unshare-user cmd-unshare-user) + (register-command! 'setns-pid cmd-setns-pid) + (register-command! 'setns-net cmd-setns-net) + (register-command! 'setns-mount cmd-setns-mount) + (register-command! 'setns-user cmd-setns-user) + (register-command! 'prlimit-show cmd-prlimit-show) + (register-command! 'prlimit-set cmd-prlimit-set) + (register-command! 'prlimit-nofile cmd-prlimit-nofile) + (register-command! 'prlimit-nproc cmd-prlimit-nproc) + (register-command! 'chroot-enter cmd-chroot-enter) + (register-command! 'chroot-setup cmd-chroot-setup) + (register-command! 'chroot-bind cmd-chroot-bind) + (register-command! 'chroot-copy cmd-chroot-copy) + (register-command! 'pivot-root-new cmd-pivot-root-new) + (register-command! 'pivot-root-old cmd-pivot-root-old) + (register-command! 'pivot-root-move cmd-pivot-root-move) + (register-command! 'pivot-root-cleanup cmd-pivot-root-cleanup) )