-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Use pidfd_send_signal under the hood #4666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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: lifubang <[email protected]> Signed-off-by: Kir Kolyshkin <[email protected]>
c7ba051
to
71f1362
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Just curious, which go version is the min for this to use pidfd?
This is in Go 1.23 (see golang/go#62654 for a high-level overview). |
The gist of the implementation is in https://go-review.googlesource.com/c/go/+/570036; pidfd will be used when the kernel has all needed support (and it is not blocked by e.g. selinux) -- this means Linux v5.4 or so. |
71f1362
to
3058ed0
Compare
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 <[email protected]>
3058ed0
to
1afa1b8
Compare
This carries the first commit from #4517, and adds another patch on top of it.
The sole reason is to use pidfd_send_signal under the hood, if that's available.