An easy way to support creating child processes inside their own namespaces
is to extend the syscall.SysProcAttr<http://tip.golang.org/src/pkg/syscall/exec_linux.go#L13>struct with the new flags and have
forkAndExecInChild(...)<http://tip.golang.org/src/pkg/syscall/exec_linux.go#L25>call SYS_UNSHARE between fork and exec.

type SysProcAttr struct {
Chroot string // Chroot.
Credential *Credential // Credential.
Ptrace bool // Enable tracing.
Setsid bool // Create session.
Setpgid bool // Set process group ID to new pid (SYSV
Setctty bool // Set controlling terminal to fd 0
Noctty bool // Detach fd 0 from controlling terminal
Pdeathsig Signal // Signal that the process will get when its
parent dies (Linux only)
+ Newipc bool // Create in new IPC namespace (Linux only)
+ Newnet bool // Create in new network namespace (Linux only)
+ Newns bool // Create in new mount namespace (Linux only)
+ Newpid bool // Create in new PID namespace (Linux only)
+ Newuts bool // Create in new UTS namespace (Linux only)

It's been said<https://groups.google.com/d/topic/golang-nuts/ZHzaQvjH4TA/discussion>this is much trickier than one might think with a threaded runtime. Since
I'm sure forkAndExecInChild() is careful to avoid those dangers, I'm hoping
this extension just takes advantage of that without introducing any new
ones. Does this sound reasonable?

You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
postedApr 13, '13 at 9:33a
activeApr 13, '13 at 9:33a

1 user in discussion

Vivek Sekhar: 1 post



site design / logo © 2022 Grokbase