summaryrefslogtreecommitdiff
path: root/src/sim/drain.hh
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas@sandberg.pp.se>2015-11-26 10:03:43 +0000
committerAndreas Sandberg <andreas@sandberg.pp.se>2015-11-26 10:03:43 +0000
commit738d71f6a93e2da9ef5bb1490f2b94f9541735e3 (patch)
treecb51f78224317fc4724af5dd6ec7890850b367b5 /src/sim/drain.hh
parent5383e1ada49b59daf4ff8703076923d4ccb6207d (diff)
downloadgem5-738d71f6a93e2da9ef5bb1490f2b94f9541735e3.tar.xz
sim: Add support for notifying Drainable objects of a fork
When forking a gem5 process, some objects need to clean up resources (mainly file descriptions) shared between the child and the parent of the fork. This changeset adds the notifyFork() method to Drainable, which is called in the child process. Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se> [sascha.bischoff@arm.com: Rebased patches onto a newer gem5 version] Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com> Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Diffstat (limited to 'src/sim/drain.hh')
-rw-r--r--src/sim/drain.hh14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/sim/drain.hh b/src/sim/drain.hh
index 31dbc97af..370217bd6 100644
--- a/src/sim/drain.hh
+++ b/src/sim/drain.hh
@@ -275,6 +275,20 @@ class Drainable
/** Return the current drain state of an object. */
DrainState drainState() const { return _drainState; }
+ /**
+ * Notify a child process of a fork.
+ *
+ * When calling fork in gem5, we need to ensure that resources
+ * shared between the parent and the child are consistent. This
+ * method is intended to be overloaded to handle that. For
+ * example, an object could use this method to re-open input files
+ * to get a separate file description with a private file offset.
+ *
+ * This method is only called in the child of the fork. The call
+ * takes place in a drained system.
+ */
+ virtual void notifyFork() {};
+
private:
/** DrainManager interface to request a drain operation */
DrainState dmDrain();