raster pushed a commit to branch master.
commit 5f4027dbca5dd9864caceaa89de4726a25e87f71
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date: Sun Aug 18 19:49:23 2013 +0900
save inhibit fd from systemd or fd is closed/lost and inhibit is lost!
---
src/bin/e_sys.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/bin/e_sys.c b/src/bin/e_sys.c
index 9c98c62..29c6a2f 100644
--- a/src/bin/e_sys.c
+++ b/src/bin/e_sys.c
@@ -50,6 +50,7 @@ static void _e_sys_systemd_hibernate(void);
static void _e_sys_systemd_exists_cb(void *data, const Eldbus_Message *m,
Eldbus_Pending *p);
static Eina_Bool systemd_works = EINA_FALSE;
+static int _e_sys_systemd_inhibit_fd = -1;
static const int E_LOGOUT_AUTO_TIME = 60;
static const int E_LOGOUT_WAIT_TIME = 15;
@@ -108,6 +109,11 @@ e_sys_shutdown(void)
eldbus_connection_unref(conn);
login1_manger_proxy = NULL;
}
+ if (_e_sys_systemd_inhibit_fd >= 0)
+ {
+ close(_e_sys_systemd_inhibit_fd);
+ _e_sys_systemd_inhibit_fd = -1;
+ }
eldbus_shutdown();
return 1;
}
@@ -289,6 +295,15 @@ e_sys_handlers_set(void (*suspend_func)(void),
}
static void
+_e_sys_systemd_inhibit_cb(void *data __UNUSED__, const Eldbus_Message *m,
Eldbus_Pending *p __UNUSED__)
+{
+ int fd = -1;
+ if (eldbus_message_error_get(m, NULL, NULL)) return;
+ if (!eldbus_message_arguments_get(m, "h", &fd))
+ _e_sys_systemd_inhibit_fd = fd;
+}
+
+static void
_e_sys_systemd_handle_inhibit(void)
{
Eldbus_Message *m;
@@ -305,7 +320,7 @@ _e_sys_systemd_handle_inhibit(void)
"Enlightenment", // who (string)
"Normal Execution", // why (string)
"block");
- eldbus_proxy_send(login1_manger_proxy, m, NULL, NULL, -1);
+ eldbus_proxy_send(login1_manger_proxy, m, _e_sys_systemd_inhibit_cb, NULL,
-1);
}
static void
--
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk