mirror of
https://git.proxmox.com/git/systemd
synced 2025-06-03 17:51:42 +00:00
128 lines
4.0 KiB
Groff
128 lines
4.0 KiB
Groff
'\" t
|
|
.TH "SD_BUS_REQUEST_NAME" "3" "" "systemd 219" "sd_bus_request_name"
|
|
.\" -----------------------------------------------------------------
|
|
.\" * 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_request_name, sd_bus_release_name \- Request or release a well\-known name on a bus
|
|
.SH "SYNOPSIS"
|
|
.sp
|
|
.ft B
|
|
.nf
|
|
#include <systemd/sd\-bus\&.h>
|
|
.fi
|
|
.ft
|
|
.HP \w'int\ sd_bus_request_name('u
|
|
.BI "int sd_bus_request_name(sd_bus\ *" "bus" ", const\ char\ *" "name" ", uint64_t\ " "flags" ");"
|
|
.HP \w'int\ sd_bus_release_name('u
|
|
.BI "int sd_bus_release_name(sd_bus\ *" "bus" ", const\ char\ *" "name" ");"
|
|
.SH "DESCRIPTION"
|
|
.PP
|
|
\fBsd_bus_request_name()\fR
|
|
requests a well\-known name on a bus\&. It takes a bus connection, a valid bus name and a flags parameter\&. The flags parameter is a combination of the following flags:
|
|
.PP
|
|
\fISD_BUS_NAME_ALLOW_REPLACEMENT\fR
|
|
.RS 4
|
|
After acquiring the name successfully, permit other peers to take over the name when they try to acquire it with the
|
|
\fISD_BUS_NAME_REPLACE_EXISTING\fR
|
|
flag set\&. If
|
|
\fISD_BUS_NAME_ALLOW_REPLACEMENT\fR
|
|
is not set on the original request, such a request by other peers will be denied\&.
|
|
.RE
|
|
.PP
|
|
\fISD_BUS_NAME_REPLACE_EXISTING\fR
|
|
.RS 4
|
|
Take over the name if it is already acquired by another peer, and that other peer has permitted takeover by setting
|
|
\fISD_BUS_NAME_ALLOW_REPLACEMENT\fR
|
|
while acquiring it\&.
|
|
.RE
|
|
.PP
|
|
\fISD_BUS_NAME_QUEUE\fR
|
|
.RS 4
|
|
Queue the acquisition of the name when the name is already taken\&.
|
|
.RE
|
|
.PP
|
|
\fBsd_bus_release_name()\fR
|
|
releases an acquired well\-known name\&. It takes a bus connection and a valid bus name as parameters\&.
|
|
.SH "RETURN VALUE"
|
|
.PP
|
|
On success, these calls return 0 or a positive integer\&. On failure, these calls return a negative errno\-style error code\&.
|
|
.PP
|
|
If
|
|
\fISD_BUS_NAME_QUEUE\fR
|
|
is specified,
|
|
\fBsd_bus_request_name()\fR
|
|
will return 0 when the name is already taken by another peer and the client has been added to the queue for the name\&. In that case, the caller can subscribe to
|
|
"NameOwnerChanged"
|
|
signals to be notified when the name is successfully acquired\&.
|
|
\fBsd_bus_request_name()\fR
|
|
returns > 0 when the name has immediately been acquired successfully\&.
|
|
.SH "ERRORS"
|
|
.PP
|
|
Returned errors may indicate the following problems:
|
|
.PP
|
|
\fB\-EALREADY\fR
|
|
.RS 4
|
|
The caller already is the owner of the specified name\&.
|
|
.RE
|
|
.PP
|
|
\fB\-EEXIST\fR
|
|
.RS 4
|
|
The name has already been acquired by a different peer, and SD_BUS_NAME_REPLACE_EXISTING was not specified or the other peer did not specify SD_BUS_NAME_ALLOW_REPLACEMENT while acquiring the name\&.
|
|
.RE
|
|
.PP
|
|
\fB\-ESRCH\fR
|
|
.RS 4
|
|
It was attempted to release a name that is currently not registered on the bus\&.
|
|
.RE
|
|
.PP
|
|
\fB\-EADDRINUSE\fR
|
|
.RS 4
|
|
It was attempted to release a name that is owned by a different peer on the bus\&.
|
|
.RE
|
|
.PP
|
|
\fB\-EINVAL\fR
|
|
.RS 4
|
|
A specified parameter is invalid\&.
|
|
.RE
|
|
.PP
|
|
\fB\-ENOTCONN\fR
|
|
.RS 4
|
|
The bus connection has been disconnected\&.
|
|
.RE
|
|
.PP
|
|
\fB\-ECHILD\fR
|
|
.RS 4
|
|
The bus connection has been created in a different process than the current one\&.
|
|
.RE
|
|
.SH "NOTES"
|
|
.PP
|
|
The
|
|
\fBsd_bus_acquire_name()\fR
|
|
and
|
|
\fBsd_bus_release_name()\fR
|
|
interfaces 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_new\fR(3)
|