diff options
author | Austin Clements <austin@google.com> | 2018-01-26 13:44:28 -0500 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2018-01-26 18:54:04 +0000 |
commit | 3ee8c3cc0b1053f4122f0e20d657b8255ad6a102 (patch) | |
tree | c1d740d034e71b55916153b2270006587c136765 | |
parent | b5b35be2b8a73b404290f7d0d4c14912a707f9a0 (diff) | |
download | go-3ee8c3cc0b1053f4122f0e20d657b8255ad6a102.tar.gz go-3ee8c3cc0b1053f4122f0e20d657b8255ad6a102.zip |
os: document inheritance of thread state over exec
Fixes #23570.
Change-Id: I462ada2960d710c2c94dc22a59d292703d83f612
Reviewed-on: https://go-review.googlesource.com/90255
Reviewed-by: Russ Cox <rsc@golang.org>
-rw-r--r-- | src/os/exec.go | 5 | ||||
-rw-r--r-- | src/os/exec/exec.go | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/os/exec.go b/src/os/exec.go index b3f60b62d0..a7f8710b95 100644 --- a/src/os/exec.go +++ b/src/os/exec.go @@ -88,6 +88,11 @@ func FindProcess(pid int) (*Process, error) { // specified by name, argv and attr. The argv slice will become os.Args in the // new process, so it normally starts with the program name. // +// If the calling goroutine has locked the operating system thread +// with runtime.LockOSThread and modified any inheritable OS-level +// thread state (for example, Linux or Plan 9 name spaces), the new +// process will inherit the caller's thread state. +// // StartProcess is a low-level interface. The os/exec package provides // higher-level interfaces. // diff --git a/src/os/exec/exec.go b/src/os/exec/exec.go index 8a49fe3b58..5ef9540141 100644 --- a/src/os/exec/exec.go +++ b/src/os/exec/exec.go @@ -293,6 +293,11 @@ func (c *Cmd) closeDescriptors(closers []io.Closer) { // // If the command starts but does not complete successfully, the error is of // type *ExitError. Other error types may be returned for other situations. +// +// If the calling goroutine has locked the operating system thread +// with runtime.LockOSThread and modified any inheritable OS-level +// thread state (for example, Linux or Plan 9 name spaces), the new +// process will inherit the caller's thread state. func (c *Cmd) Run() error { if err := c.Start(); err != nil { return err |