aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/core.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/plugins/core.c b/plugins/core.c
index c3ae284994..ccb770a485 100644
--- a/plugins/core.c
+++ b/plugins/core.c
@@ -527,6 +527,26 @@ void qemu_plugin_user_exit(void)
}
/*
+ * Helpers for *-user to ensure locks are sane across fork() events.
+ */
+
+void qemu_plugin_user_prefork_lock(void)
+{
+ qemu_rec_mutex_lock(&plugin.lock);
+}
+
+void qemu_plugin_user_postfork(bool is_child)
+{
+ if (is_child) {
+ /* should we just reset via plugin_init? */
+ qemu_rec_mutex_init(&plugin.lock);
+ } else {
+ qemu_rec_mutex_unlock(&plugin.lock);
+ }
+}
+
+
+/*
* Call this function after longjmp'ing to the main loop. It's possible that the
* last instruction of a TB might have used helpers, and therefore the
* "disable" instruction will never execute because it ended up as dead code.