summaryrefslogtreecommitdiff
path: root/daemons/dmeventd/dmeventd.c
diff options
context:
space:
mode:
Diffstat (limited to 'daemons/dmeventd/dmeventd.c')
-rw-r--r--daemons/dmeventd/dmeventd.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 69fe3930c..885aa9de4 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -282,6 +282,13 @@ static void _lib_put(struct dso_data *data)
dlclose(data->dso_handle);
UNLINK_DSO(data);
_free_dso_data(data);
+
+ /* Close control device if there is no plugin in-use */
+ if (dm_list_empty(&_dso_registry)) {
+ DEBUGLOG("Unholding control device.");
+ dm_hold_control_dev(0);
+ dm_lib_release();
+ }
}
}
@@ -344,6 +351,12 @@ static struct dso_data *_load_dso(struct message_data *data)
goto_bad;
}
+ /* Keep control device open until last user closes */
+ if (dm_list_empty(&_dso_registry)) {
+ DEBUGLOG("Holding control device open.");
+ dm_hold_control_dev(1);
+ }
+
/*
* Keep handle to close the library once
* we've got no references to it any more.