Skip to content

Commit e6160a7

Browse files
committed
Provide binding to tgkill
1 parent 7be3386 commit e6160a7

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/backend/linux_raw/runtime/syscalls.rs

+5
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ pub(crate) unsafe fn tkill(tid: Pid, sig: Signal) -> io::Result<()> {
174174
ret(syscall_readonly!(__NR_tkill, tid, sig))
175175
}
176176

177+
#[inline]
178+
pub(crate) unsafe fn tgkill(tid: Pid, sig: Signal) -> io::Result<()> {
179+
ret(syscall_readonly!(__NR_tgkill, tid, sig))
180+
}
181+
177182
#[inline]
178183
pub(crate) unsafe fn sigprocmask(how: How, new: Option<&Sigset>) -> io::Result<Sigset> {
179184
let mut old = MaybeUninit::<Sigset>::uninit();

src/runtime.rs

+17
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,23 @@ pub unsafe fn tkill(tid: Pid, sig: Signal) -> io::Result<()> {
434434
backend::runtime::syscalls::tkill(tid, sig)
435435
}
436436

437+
/// `tgkill(tid, sig)`—Send a signal to a thread group.
438+
///
439+
/// # Safety
440+
///
441+
/// You're on your own. And on top of all the troubles with signal handlers,
442+
/// this implementation is highly experimental.
443+
///
444+
/// # References
445+
/// - [Linux]
446+
///
447+
/// [Linux]: https://man7.org/linux/man-pages/man2/tgkill.2.html
448+
#[inline]
449+
pub unsafe fn tgkill(tid: Pid, sig: Signal) -> io::Result<()> {
450+
backend::runtime::syscalls::tgkill(tid, sig)
451+
}
452+
453+
437454
/// `rt_sigprocmask(how, set, oldset)`—Adjust the process signal mask.
438455
///
439456
/// # Safety

0 commit comments

Comments
 (0)