mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
syscall: document exact meaning of Ctty field
The Ctty field is a child descriptor number when Setctty is set, but a parent descriptor when Foreground is set. This is absurd but changing either behavior breaks existing programs. With this change we at least document how it works. For #29458 Change-Id: If9cf0a1a1e6ed0d4a4edae5043016d5b4ee3308b Reviewed-on: https://go-review.googlesource.com/c/go/+/229768 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
This commit is contained in:
parent
45d288718d
commit
07cb63aae5
4 changed files with 69 additions and 25 deletions
|
|
@ -15,11 +15,22 @@ type SysProcAttr struct {
|
||||||
Credential *Credential // Credential.
|
Credential *Credential // Credential.
|
||||||
Ptrace bool // Enable tracing.
|
Ptrace bool // Enable tracing.
|
||||||
Setsid bool // Create session.
|
Setsid bool // Create session.
|
||||||
Setpgid bool // Set process group ID to Pgid, or, if Pgid == 0, to new pid.
|
// Setpgid sets the process group ID of the child to Pgid,
|
||||||
Setctty bool // Set controlling terminal to fd Ctty
|
// or, if Pgid == 0, to the new child's process ID.
|
||||||
|
Setpgid bool
|
||||||
|
// Setctty sets the controlling terminal of the child to
|
||||||
|
// file descriptor Ctty. Ctty must be a descriptor number
|
||||||
|
// in the child process: an index into ProcAttr.Files.
|
||||||
|
// This is only meaningful if Setsid is true.
|
||||||
|
Setctty bool
|
||||||
Noctty bool // Detach fd 0 from controlling terminal
|
Noctty bool // Detach fd 0 from controlling terminal
|
||||||
Ctty int // Controlling TTY fd
|
Ctty int // Controlling TTY fd
|
||||||
Foreground bool // Place child's process group in foreground. (Implies Setpgid. Uses Ctty as fd of controlling TTY)
|
// Foreground places the child process group in the foreground.
|
||||||
|
// This implies Setpgid. The Ctty field must be set to
|
||||||
|
// the descriptor of the controlling TTY.
|
||||||
|
// Unlike Setctty, in this case Ctty must be a descriptor
|
||||||
|
// number in the parent process.
|
||||||
|
Foreground bool
|
||||||
Pgid int // Child's process group ID if Setpgid.
|
Pgid int // Child's process group ID if Setpgid.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,22 @@ type SysProcAttr struct {
|
||||||
Credential *Credential // Credential.
|
Credential *Credential // Credential.
|
||||||
Ptrace bool // Enable tracing.
|
Ptrace bool // Enable tracing.
|
||||||
Setsid bool // Create session.
|
Setsid bool // Create session.
|
||||||
Setpgid bool // Set process group ID to Pgid, or, if Pgid == 0, to new pid.
|
// Setpgid sets the process group ID of the child to Pgid,
|
||||||
Setctty bool // Set controlling terminal to fd Ctty
|
// or, if Pgid == 0, to the new child's process ID.
|
||||||
|
Setpgid bool
|
||||||
|
// Setctty sets the controlling terminal of the child to
|
||||||
|
// file descriptor Ctty. Ctty must be a descriptor number
|
||||||
|
// in the child process: an index into ProcAttr.Files.
|
||||||
|
// This is only meaningful if Setsid is true.
|
||||||
|
Setctty bool
|
||||||
Noctty bool // Detach fd 0 from controlling terminal
|
Noctty bool // Detach fd 0 from controlling terminal
|
||||||
Ctty int // Controlling TTY fd
|
Ctty int // Controlling TTY fd
|
||||||
Foreground bool // Place child's process group in foreground. (Implies Setpgid. Uses Ctty as fd of controlling TTY)
|
// Foreground places the child process group in the foreground.
|
||||||
|
// This implies Setpgid. The Ctty field must be set to
|
||||||
|
// the descriptor of the controlling TTY.
|
||||||
|
// Unlike Setctty, in this case Ctty must be a descriptor
|
||||||
|
// number in the parent process.
|
||||||
|
Foreground bool
|
||||||
Pgid int // Child's process group ID if Setpgid.
|
Pgid int // Child's process group ID if Setpgid.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,22 @@ type SysProcAttr struct {
|
||||||
Chroot string // Chroot.
|
Chroot string // Chroot.
|
||||||
Credential *Credential // Credential.
|
Credential *Credential // Credential.
|
||||||
Setsid bool // Create session.
|
Setsid bool // Create session.
|
||||||
Setpgid bool // Set process group ID to Pgid, or, if Pgid == 0, to new pid.
|
// Setpgid sets the process group ID of the child to Pgid,
|
||||||
Setctty bool // Set controlling terminal to fd Ctty
|
// or, if Pgid == 0, to the new child's process ID.
|
||||||
|
Setpgid bool
|
||||||
|
// Setctty sets the controlling terminal of the child to
|
||||||
|
// file descriptor Ctty. Ctty must be a descriptor number
|
||||||
|
// in the child process: an index into ProcAttr.Files.
|
||||||
|
// This is only meaningful if Setsid is true.
|
||||||
|
Setctty bool
|
||||||
Noctty bool // Detach fd 0 from controlling terminal
|
Noctty bool // Detach fd 0 from controlling terminal
|
||||||
Ctty int // Controlling TTY fd
|
Ctty int // Controlling TTY fd
|
||||||
Foreground bool // Place child's process group in foreground. (Implies Setpgid. Uses Ctty as fd of controlling TTY)
|
// Foreground places the child process group in the foreground.
|
||||||
|
// This implies Setpgid. The Ctty field must be set to
|
||||||
|
// the descriptor of the controlling TTY.
|
||||||
|
// Unlike Setctty, in this case Ctty must be a descriptor
|
||||||
|
// number in the parent process.
|
||||||
|
Foreground bool
|
||||||
Pgid int // Child's process group ID if Setpgid.
|
Pgid int // Child's process group ID if Setpgid.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,22 @@ type SysProcAttr struct {
|
||||||
// and don't call UnlockOSThread until done with PtraceSyscall calls.
|
// and don't call UnlockOSThread until done with PtraceSyscall calls.
|
||||||
Ptrace bool
|
Ptrace bool
|
||||||
Setsid bool // Create session.
|
Setsid bool // Create session.
|
||||||
Setpgid bool // Set process group ID to Pgid, or, if Pgid == 0, to new pid.
|
// Setpgid sets the process group ID of the child to Pgid,
|
||||||
Setctty bool // Set controlling terminal to fd Ctty (only meaningful if Setsid is set)
|
// or, if Pgid == 0, to the new child's process ID.
|
||||||
|
Setpgid bool
|
||||||
|
// Setctty sets the controlling terminal of the child to
|
||||||
|
// file descriptor Ctty. Ctty must be a descriptor number
|
||||||
|
// in the child process: an index into ProcAttr.Files.
|
||||||
|
// This is only meaningful if Setsid is true.
|
||||||
|
Setctty bool
|
||||||
Noctty bool // Detach fd 0 from controlling terminal
|
Noctty bool // Detach fd 0 from controlling terminal
|
||||||
Ctty int // Controlling TTY fd
|
Ctty int // Controlling TTY fd
|
||||||
Foreground bool // Place child's process group in foreground. (Implies Setpgid. Uses Ctty as fd of controlling TTY)
|
// Foreground places the child process group in the foreground.
|
||||||
|
// This implies Setpgid. The Ctty field must be set to
|
||||||
|
// the descriptor of the controlling TTY.
|
||||||
|
// Unlike Setctty, in this case Ctty must be a descriptor
|
||||||
|
// number in the parent process.
|
||||||
|
Foreground bool
|
||||||
Pgid int // Child's process group ID if Setpgid.
|
Pgid int // Child's process group ID if Setpgid.
|
||||||
Pdeathsig Signal // Signal that the process will get when its parent dies (Linux only)
|
Pdeathsig Signal // Signal that the process will get when its parent dies (Linux only)
|
||||||
Cloneflags uintptr // Flags for clone calls (Linux only)
|
Cloneflags uintptr // Flags for clone calls (Linux only)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue