From a844d6ba059b98ad6a5317e85a9c69402353b0a9 Mon Sep 17 00:00:00 2001 From: adfaure Date: Thu, 11 Aug 2016 10:50:28 +0200 Subject: [PATCH 1/1] [s4u] add Actor::getPPid and this_actor::getPPid() --- include/simgrid/s4u/Actor.hpp | 7 +++++++ src/s4u/s4u_actor.cpp | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/include/simgrid/s4u/Actor.hpp b/include/simgrid/s4u/Actor.hpp index 5fbd5f8e20..a858bdf078 100644 --- a/include/simgrid/s4u/Actor.hpp +++ b/include/simgrid/s4u/Actor.hpp @@ -223,6 +223,8 @@ public: s4u::Host *getHost(); /** Retrieves the PID of that actor */ int getPid(); + /** Retrieves the PPID of that actor */ + int getPpid(); /** If set to true, the actor will automatically restart when its host reboots */ void setAutoRestart(bool autorestart); @@ -305,6 +307,11 @@ namespace this_actor { * Return the PID of the current actor. */ XBT_PUBLIC(int) getPid(); + + /** + * Return the PPID of the current actor. + */ + int getPpid(); }; diff --git a/src/s4u/s4u_actor.cpp b/src/s4u/s4u_actor.cpp index d14a9bfb0c..444fa6cbc9 100644 --- a/src/s4u/s4u_actor.cpp +++ b/src/s4u/s4u_actor.cpp @@ -74,6 +74,10 @@ int Actor::getPid(){ return pimpl_->pid; } +int Actor::getPpid() { + return pimpl_->ppid; +} + void Actor::setKillTime(double time) { simcall_process_set_kill_time(pimpl_,time); } @@ -158,6 +162,10 @@ int getPid() { return SIMIX_process_self()->pid; } +int getPpid() { + return SIMIX_process_self()->ppid; +} + } } } -- 2.20.1