mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-26 20:20:06 +01:00
test: ptrace compatibility with *BSD
This commit is contained in:
parent
8cc4de5fc9
commit
d23074cec9
2 changed files with 9 additions and 3 deletions
|
|
@ -97,6 +97,12 @@ if cc.has_header('xlocale.h')
|
||||||
config_h.set('HAVE_XLOCALE_H', '1')
|
config_h.set('HAVE_XLOCALE_H', '1')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if not cc.has_header_symbol('sys/ptrace.h', 'PTRACE_ATTACH', prefix : prefix)
|
||||||
|
config_h.set('PTRACE_ATTACH', 'PT_ATTACH')
|
||||||
|
config_h.set('PTRACE_CONT', 'PT_CONTINUE')
|
||||||
|
config_h.set('PTRACE_DETACH', 'PT_DETACH')
|
||||||
|
endif
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
pkgconfig = import('pkgconfig')
|
pkgconfig = import('pkgconfig')
|
||||||
dep_udev = dependency('libudev')
|
dep_udev = dependency('libudev')
|
||||||
|
|
|
||||||
|
|
@ -3870,10 +3870,10 @@ is_debugger_attached(void)
|
||||||
|
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
int ppid = getppid();
|
int ppid = getppid();
|
||||||
if (ptrace(PTRACE_ATTACH, ppid, NULL, NULL) == 0) {
|
if (ptrace(PTRACE_ATTACH, ppid, NULL, 0) == 0) {
|
||||||
waitpid(ppid, NULL, 0);
|
waitpid(ppid, NULL, 0);
|
||||||
ptrace(PTRACE_CONT, NULL, NULL);
|
ptrace(PTRACE_CONT, ppid, NULL, 0);
|
||||||
ptrace(PTRACE_DETACH, ppid, NULL, NULL);
|
ptrace(PTRACE_DETACH, ppid, NULL, 0);
|
||||||
rc = 0;
|
rc = 0;
|
||||||
} else {
|
} else {
|
||||||
rc = 1;
|
rc = 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue