mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
os: move pub fn debugger_present() bool{
to platform-specific files (better ptrace portability handling) (#17373)
This commit is contained in:
13
vlib/os/debugger_linux.c.v
Normal file
13
vlib/os/debugger_linux.c.v
Normal file
@ -0,0 +1,13 @@
|
||||
module os
|
||||
|
||||
#include <sys/ptrace.h>
|
||||
|
||||
fn C.ptrace(u32, u32, voidptr, voidptr) u64
|
||||
|
||||
// debugger_present returns a bool indicating if the process is being debugged
|
||||
[inline]
|
||||
pub fn debugger_present() bool {
|
||||
// check if the parent could trace its process,
|
||||
// if not a debugger must be present
|
||||
return C.ptrace(C.PTRACE_TRACEME, 0, 1, 0) == -1
|
||||
}
|
Reference in New Issue
Block a user