feat: add process termination codes and SYS_ABORT; whole-process abort() from any thread in libc and montauk-rt
This commit is contained in:
1 parent
f8b8f9610f
commit
278b208258
15 files changed
+126
-37
No files matched your search
@@ -18,16 +18,12 @@ pub fn id() -> u32 {
|
||||
unsafe { sys::syscall0(sys::SYS_GETPID) as u32 }
|
||||
}
|
||||
|
||||
/// Terminate the whole process from any thread.
|
||||
/// Terminate the whole process from any thread. Waiters see exit code
|
||||
/// TerminatedAborted (256 + SIGABRT).
|
||||
pub fn abort() -> ! {
|
||||
unsafe {
|
||||
if crate::thread::current_id() == id() {
|
||||
sys::syscall1(sys::SYS_EXIT, 134);
|
||||
} else {
|
||||
// Sibling: SYS_EXIT would end only this thread. Self-kill flags
|
||||
// every thread; park here until the kernel reaps us.
|
||||
sys::syscall1(sys::SYS_KILL, id() as u64);
|
||||
}
|
||||
sys::syscall0(sys::SYS_ABORT);
|
||||
// Not reached. No panic here: the panic handler calls abort().
|
||||
loop {
|
||||
sys::syscall0(sys::SYS_YIELD);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user