From 502ca32e2b63522a0ba088ede194215b98f432bc Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 18 May 2017 18:24:17 +0200 Subject: [PATCH] man: extend documentation on sd_bus_add_match a bit() Explain briefly how the concept of "sd_bus_slot" works. This recently came up on the mailing list, hence let's document this for the next time. --- man/sd_bus_add_match.xml | 43 +++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/man/sd_bus_add_match.xml b/man/sd_bus_add_match.xml index 8bcf7164a..2014141ae 100644 --- a/man/sd_bus_add_match.xml +++ b/man/sd_bus_add_match.xml @@ -73,26 +73,34 @@ Description - sd_bus_add_match() adds a match rule used to dispatch - incoming messages. The syntax of the rule passed in - match is described in the - D-Bus Specification. + sd_bus_add_match() installs a match rule for incoming messages received on the specified bus + connection object bus. The syntax of the match rule expression passed in + match is described in the D-Bus Specification. The specified handler + function callback is called for eaching incoming message matching the specified + expression, the userdata parameter is passed as-is to the callback function. - The message m passed to the callback is only - borrowed, that is, the callback should not call - sd_bus_message_unref3 - on it. If the callback wants to hold on to the message beyond the lifetime - of the callback, it needs to call - sd_bus_message_ref3 - to create a new reference. + On success, and if non-NULL, the slot return parameter will be set to + a slot object that may be used as a reference to the installed match, and may be utilized to remove it again at a + later time with + sd_bus_slot_unref3. If + specified as NULL the lifetime of the match is bound to the lifetime of the bus object itself, and the match + cannot be removed independently. - If an error occurs during the callback invocation, the callback should - return a negative error number. If it wants other callbacks that match the - same rule to be called, it should return 0. Otherwise it should return a + The message m passed to the callback is only borrowed, that is, the callback should not + call sd_bus_message_unref3 on + it. If the callback wants to hold on to the message beyond the lifetime of the callback, it needs to call + sd_bus_message_ref3 to create + a new reference. + + + + If an error occurs during the callback invocation, the callback should return a negative error number. If it + wants other callbacks that match the same rule to be called, it should return 0. Otherwise it should return a positive integer. @@ -101,9 +109,8 @@ Return Value - On success, sd_bus_add_match() returns 0 or a - positive integer. On failure, it returns a negative errno-style error - code. + On success, sd_bus_add_match() returns 0 or a positive integer. On failure, it returns a + negative errno-style error code. @@ -112,7 +119,7 @@ systemd1, - sd-bus3, + sd-bus3 -- 2.30.2