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:
Kir Kolyshkin
2026-01-19 16:26:24 -08:00
parent 6cd91f665e
commit 593ac3b7d9
+3 -3
View File
@@ -127,7 +127,7 @@ type Process struct {
// Wait waits for the process to exit. // Wait waits for the process to exit.
// Wait releases any resources associated with the Process // 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 { if p.ops == nil {
return nil, errInvalidProcess return nil, errInvalidProcess
} }
@@ -135,7 +135,7 @@ func (p Process) Wait() (*os.ProcessState, error) {
} }
// Pid returns the process ID // 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 // math.MinInt32 is returned here, because it's invalid value
// for the kill() system call. // for the kill() system call.
if p.ops == nil { if p.ops == nil {
@@ -145,7 +145,7 @@ func (p Process) Pid() (int, error) {
} }
// Signal sends a signal to the Process. // 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 { if p.ops == nil {
return errInvalidProcess return errInvalidProcess
} }