[systemd-devel] sd_bus_process semantics

Mathis MARION mamarion1 at silabs.com
Mon Jul 25 10:21:06 UTC 2022


I looked a bit into the source code:

This part is responsible for storing the message processed in *ret:

static int process_running(sd_bus *bus, sd_bus_message **ret) {
[...]
         r = process_message(bus, m);
         if (r != 0)
                 goto null_message;

         if (ret) {
                 r = sd_bus_message_rewind(m, true);
                 if (r < 0)
                         return r;

                 *ret = TAKE_PTR(m);
                 return 1;
         }
[...]
null_message:
         if (r >= 0 && ret)
                 *ret = NULL;

         return r;
}

static int process_message(sd_bus *bus, sd_bus_message *m) {
[...]
         r = process_hello(bus, m);
         if (r != 0)
                 goto finish;
[...]
         r = process_builtin(bus, m);
         if (r != 0)
                 goto finish;

         r = bus_process_object(bus, m);

finish:
         bus->current_message = NULL;
         return r;
}

My analysis might be flawed since I am still new to sd-bus, but to me it
seems like 'process_message' should return 0 on success, but since
'bus_process_object' returns 0 on failure it does not quite work as
intended.


More information about the systemd-devel mailing list