From 593ac3b7d90eae71b3ce399d3f168a03fed8dda2 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 19 Jan 2026 16:26:24 -0800 Subject: [PATCH] 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 --- libcontainer/process.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libcontainer/process.go b/libcontainer/process.go index 7fca1febc..25cabbe13 100644 --- a/libcontainer/process.go +++ b/libcontainer/process.go @@ -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 }