'\" t .TH "SD_BUS_ADD_MATCH" "3" "" "systemd 232" "sd_bus_add_match" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" sd_bus_add_match \- Add a match rule for message dispatching .SH "SYNOPSIS" .sp .ft B .nf #include .fi .ft .HP \w'int\ sd_bus_add_match('u .BI "int sd_bus_add_match(sd_bus\ *" "bus" ", sd_bus_slot\ **" "slot" ", const\ char\ *" "match" ", sd_bus_message_handler_t\ " "callback" ", void\ *" "userdata" ");" .HP \w'typedef\ int\ (*sd_bus_message_handler_t)('u .BI "typedef int (*sd_bus_message_handler_t)(sd_bus_message\ *" "m" ", void\ *" "userdata" ", sd_bus_error\ *" "ret_error" ");" .SH "DESCRIPTION" .PP \fBsd_bus_add_match()\fR adds a match rule used to dispatch incoming messages\&. The syntax of the rule passed in \fImatch\fR is described in the \m[blue]\fBD\-Bus Specification\fR\m[]\&\s-2\u[1]\d\s+2\&. .PP The message \fIm\fR passed to the callback is only borrowed, that is, the callback should not call \fBsd_bus_message_unref\fR(3) on it\&. If the callback wants to hold on to the message beyond the lifetime of the callback, it needs to call \fBsd_bus_message_ref\fR(3) to create a new reference\&. .PP 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\&. .SH "RETURN VALUE" .PP On success, \fBsd_bus_add_match()\fR returns 0 or a positive integer\&. On failure, it returns a negative errno\-style error code\&. .SH "SEE ALSO" .PP \fBsystemd\fR(1), \fBsd-bus\fR(3), .SH "NOTES" .IP " 1." 4 D-Bus Specification .RS 4 \%https://dbus.freedesktop.org/doc/dbus-specification.html .RE