'\" t .TH "SD_BUS_NEW" "3" "" "systemd 219" "sd_bus_new" .\" ----------------------------------------------------------------- .\" * 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_new, sd_bus_ref, sd_bus_unref \- Create a new bus object and create or destroy references to it .SH "SYNOPSIS" .sp .ft B .nf #include .fi .ft .HP \w'int\ sd_bus_new('u .BI "int sd_bus_new(sd_bus\ **" "bus" ");" .HP \w'sd_bus\ *sd_bus_ref('u .BI "sd_bus *sd_bus_ref(sd_bus\ *" "bus" ");" .HP \w'sd_bus\ *sd_bus_unref('u .BI "sd_bus *sd_bus_unref(sd_bus\ *" "bus" ");" .SH "DESCRIPTION" .PP \fBsd_bus_new()\fR creates a new bus object\&. This object is reference\-counted, and will be destroyed when all references are gone\&. Initially, the caller of this function owns the sole reference\&. .PP \fBsd_bus_ref()\fR creates a new reference to \fIbus\fR\&. This bus object will not be destroyed until \fBsd_bus_unref()\fR has been called as many times plus once more\&. Once the reference count has dropped to zero, \fIbus\fR cannot be used anymore, so further calls to \fBsd_bus_ref()\fR or \fBsd_bus_unref()\fR are illegal\&. .PP \fBsd_bus_unref()\fR destroys a reference to \fIbus\fR\&. .SH "RETURN VALUE" .PP On success, \fBsd_bus_new()\fR returns 0 or a positive integer\&. On failure, it returns a negative errno\-style error code\&. .PP \fBsd_bus_ref\fR always returns the argument\&. .PP \fBsd_bus_unref\fR always returns \fBNULL\fR\&. .SH "ERRORS" .PP Returned errors may indicate the following problems: .PP \fB\-ENOMEM\fR .RS 4 Memory allocation failed\&. .RE .SH "NOTES" .PP \fBsd_bus_new()\fR and other functions described here are available as a shared library, which can be compiled and linked to with the \fBlibsystemd\fR\ \&\fBpkg-config\fR(1) file\&. .SH "SEE ALSO" .PP \fBsystemd\fR(1), \fBsd-bus\fR(3), \fBsd_bus_open_user\fR(3), \fBsd_bus_open_system\fR(3), \fBsd_bus_default_user\fR(3), \fBsd_bus_default_system\fR(3)