Check whether a dbus caller is still alive

Lawrence D'Oliveiro ldo at geek-central.gen.nz
Mon Oct 2 00:03:30 UTC 2017


On Sun, 1 Oct 2017 22:28:07 +0100, David Llewellyn-Jones wrote:

> When you say 'get the client pid from the
> request message', do you mean get the client to send its pid as a
> parameter, or is there a way to extract the pid from the request?

OK, I misremembered how it actually works. You can get the sender
unique name from the message. Then ask the D-Bus daemon itself for the
process ID corresponding to this name, with the
GetConnectionUnixProcessID method request
<https://dbus.freedesktop.org/doc/dbus-specification.html>.

You can do the latter just once per request, then save the process ID
with your context for servicing that request and poll it periodically as
I described.


More information about the dbus mailing list