signals: replace unix.Kill with process.Signal

This way, given a recent Go and Linux version, pidfd_send_signal will
be used under the hood.

Keep unix.Signal and unix.SignalName for logging (it is way more
readable than what os.Signal.String() provides).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2025-03-07 13:10:54 -08:00
parent 346c80d714
commit 1afa1b8662

View File

@@ -114,7 +114,7 @@ func (h *signalHandler) forward(process *libcontainer.Process, tty *tty, detach
default:
us := s.(unix.Signal)
logrus.Debugf("forwarding signal %d (%s) to %d", int(us), unix.SignalName(us), pid1)
if err := unix.Kill(pid1, us); err != nil {
if err := process.Signal(s); err != nil {
logrus.Error(err)
}
}