]> Cypherpunks repositories - gostls13.git/commitdiff
os: document inheritance of thread state over exec
authorAustin Clements <austin@google.com>
Fri, 26 Jan 2018 18:44:28 +0000 (13:44 -0500)
committerAustin Clements <austin@google.com>
Fri, 26 Jan 2018 18:54:04 +0000 (18:54 +0000)
Fixes #23570.

Change-Id: I462ada2960d710c2c94dc22a59d292703d83f612
Reviewed-on: https://go-review.googlesource.com/90255
Reviewed-by: Russ Cox <rsc@golang.org>
src/os/exec.go
src/os/exec/exec.go

index b3f60b62d0379b9653490a948b8df09bee95e6ad..a7f8710b955db572679762e03ee3c99ec8a69fe5 100644 (file)
@@ -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.
 //
index 8a49fe3b58eb68889225e8395360348859f0beae..5ef9540141ef0e7bba36b6b97bc3e1c7de81b92c 100644 (file)
@@ -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