On Sun, 11.11.12 10:51, Colin Guthrie ([email protected]) wrote: > > Yeah, that doc is long, inhibition is a surprisingly complex > > topic... That said the actuall code bits you need are tiny. For your > > usecase, just do this somewhere at the top of your service (in D-Bus > > pseudo code): > > > > fd = Inhibit("handle-power-key", "Power Key Handler", "I am handling the > > power key now!", "block"); > > > > And then you can just leak the fd this returns, if you want to handle > > the key during the entire runtime of your service, since the kernel will > > close the fd anyway if the process dies. > > Should your app use exec(), I guess you have to be somewhat careful > about CLOEXEC in this context tho'?
The C D-Bus bindings set O_CLOEXEC anyway, and so do the the GIO bindings AFAIK. Lennart -- Lennart Poettering - Red Hat, Inc. _______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
