Skip to content

Commit

Permalink
libct: replace unix.Kill with os.Process.Signal
Browse files Browse the repository at this point in the history
Because we should switch to unix.PidFDSendSignal in new kernels, it has
been supported in go runtime. We don't need to add fall back to
unix.Kill code here.

Signed-off-by: lfbzhm <[email protected]>
  • Loading branch information
lifubang committed Nov 9, 2024
1 parent 3a09973 commit 7824bc5
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions libcontainer/process_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,7 @@ func (p *setnsProcess) startTime() (uint64, error) {
}

func (p *setnsProcess) signal(sig os.Signal) error {
s, ok := sig.(unix.Signal)
if !ok {
return errors.New("os: unsupported signal type")
}
return unix.Kill(p.pid(), s)
return p.cmd.Process.Signal(sig)
}

func (p *setnsProcess) start() (retErr error) {
Expand Down Expand Up @@ -838,11 +834,7 @@ func (p *initProcess) createNetworkInterfaces() error {
}

func (p *initProcess) signal(sig os.Signal) error {
s, ok := sig.(unix.Signal)
if !ok {
return errors.New("os: unsupported signal type")
}
return unix.Kill(p.pid(), s)
return p.cmd.Process.Signal(sig)
}

func (p *initProcess) setExternalDescriptors(newFds []string) {
Expand Down

0 comments on commit 7824bc5

Please sign in to comment.