From b04c56f57e40cf69d1b3fd0982ebaf2bbf27df40 Mon Sep 17 00:00:00 2001 From: Matthieu Volat Date: Sun, 6 Nov 2016 16:36:46 +0100 Subject: [PATCH] Allow to use BSD ptrace(). --- src/mc/Client.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mc/Client.cpp b/src/mc/Client.cpp index 7d326ff873..e2f389d046 100644 --- a/src/mc/Client.cpp +++ b/src/mc/Client.cpp @@ -67,7 +67,15 @@ Client* Client::initialize() client_ = std::unique_ptr(new simgrid::mc::Client(fd)); // Wait for the model-checker: - if (ptrace(PTRACE_TRACEME, 0, nullptr, nullptr) == -1 || raise(SIGSTOP) != 0) + errno = 0; +#if defined __linux__ + ptrace(PTRACE_TRACEME, 0, nullptr, nullptr); +#elif defined BSD + ptrace(PT_TRACE_ME, 0, nullptr, 0); +#else +# error "ptrace not declared on this platform" +#endif + if(errno != 0 || raise(SIGSTOP) != 0) xbt_die("Could not wait for the model-checker"); client_->handleMessages(); -- 2.20.1