<div dir="ltr">We deploy a solution like this, where we have a 'main' binary of the application and a 'startup' binary (it's sort of the app-as-a-service paradigm too).<br><br>The main binary resides in libexec, whereas the startup binary is normally accessible trough $PATH. When the user invokes the startup binary and the main app already runs (D-Bus name exists), it does nothing, otherwise it starts the main binary using D-Bus activation, and already starts checking in a NameOwnerChanged callback whether its bus name was acquired and lost; by this means we are able to track application crashes during D-Bus activation.<br>
<br>Once the main app has started, it emits a StartupComplete signal on the bus, by which the 'startup' binary knows the app has successfully started, and it (the startup binary) can now further proceed (this is implemented using a GLib mainloop running until the StartupComplete signal has been received, or, as already described, the bus name had been acquired, but lost before the StartupComplete signal could be emitted/received).<br>
<br>Once the startup binary knows the main binary is running it will, depending on CLI arguments, perform further actions on one of the app's interfaces (it's a media player so possible actions are play files, or asking it to quit).<br>
<br>Furthermore, a 'sentinel' process is started, which watches the main app and checks on its status; this is meant to provide a gdb backtrace in case of a crash, although we weren't able to make this work successfully yet; the sentinel is also able to detect a crash in case the bus name of the main app is lost, but a ShutdownComplete signal, which it emits on a clean exit, has not been received yet.<br>
<br>Reference:<br><a href="http://hg.backtrace.info/hgwebdir.cgi/mpx/file/1cc4ad52d52b/remote/mpx.cc">http://hg.backtrace.info/hgwebdir.cgi/mpx/file/1cc4ad52d52b/remote/mpx.cc</a><br><br><div class="gmail_quote">2008/8/8 Soh Kam Yung <span dir="ltr"><<a href="mailto:sohkamyung@gmail.com">sohkamyung@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">On Thu, Aug 7, 2008 at 6:19 PM, Thiago Macieira <<a href="mailto:thiago@kde.org">thiago@kde.org</a>> wrote:<br>
> On Thursday 07 August 2008 11:53:52 Soh Kam Yung wrote:<br>
>><br>
</div><div class="Ih2E3d">>> Just to be certain, by unique ID, you mean the return value from<br>
>> dbus_message_get_sender()?<br>
><br>
> I meant "the unique ID that the bus gives your connection when you connect<br>
> (the response to the Hello call)", which can be obtained via<br>
> dbus_bus_get_unique_name().<br>
><br>
> That's the definition of it.<br>
><br>
> But dbus_message_get_sender() returns that too, on *received* messages.<br>
><br>
<br>
</div>Thanks for the clarifications.<br>
<div><div></div><div class="Wj3C7c"><br>
Regards,<br>
Kam-Yung<br>
--<br>
Soh Kam Yung<br>
my Google Reader Shared links:<br>
(<a href="http://www.google.com/reader/shared/16851815156817689753" target="_blank">http://www.google.com/reader/shared/16851815156817689753</a>)<br>
my Google Reader Shared SFAS links:<br>
(<a href="http://www.google.com/reader/shared/user/16851815156817689753/label/sfas" target="_blank">http://www.google.com/reader/shared/user/16851815156817689753/label/sfas</a>)<br>
_______________________________________________<br>
dbus mailing list<br>
<a href="mailto:dbus@lists.freedesktop.org">dbus@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/dbus" target="_blank">http://lists.freedesktop.org/mailman/listinfo/dbus</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Please note that according to the German law on data retention,<br>information on every electronic information exchange with me is<br>retained for a period of six months.<br>
[Bitte beachten Sie, dass dem Gesetz zur Vorratsdatenspeicherung zufolge<br>jeder elektronische Kontakt mit mir sechs Monate lang gespeichert wird.]<br>
</div>