mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
libct: use pointers for Process methods
The Process type is quite big (currently 368 bytes on a 64 bit Linux) and using non-pointer receivers in its methods results in copying which is totally unnecessary. Change the methods to use pointer receivers. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -127,7 +127,7 @@ type Process struct {
|
||||
|
||||
// Wait waits for the process to exit.
|
||||
// Wait releases any resources associated with the Process
|
||||
func (p Process) Wait() (*os.ProcessState, error) {
|
||||
func (p *Process) Wait() (*os.ProcessState, error) {
|
||||
if p.ops == nil {
|
||||
return nil, errInvalidProcess
|
||||
}
|
||||
@@ -135,7 +135,7 @@ func (p Process) Wait() (*os.ProcessState, error) {
|
||||
}
|
||||
|
||||
// Pid returns the process ID
|
||||
func (p Process) Pid() (int, error) {
|
||||
func (p *Process) Pid() (int, error) {
|
||||
// math.MinInt32 is returned here, because it's invalid value
|
||||
// for the kill() system call.
|
||||
if p.ops == nil {
|
||||
@@ -145,7 +145,7 @@ func (p Process) Pid() (int, error) {
|
||||
}
|
||||
|
||||
// Signal sends a signal to the Process.
|
||||
func (p Process) Signal(sig os.Signal) error {
|
||||
func (p *Process) Signal(sig os.Signal) error {
|
||||
if p.ops == nil {
|
||||
return errInvalidProcess
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user