mirror of
https://github.com/systemd/systemd.git
synced 2025-02-28 05:57:33 +03:00
libsystemd-bus: factor out DBus bits out of sd_bus_get_owner()
Just a preparation for upcoming kdbus support.
This commit is contained in:
parent
fa6ccbf423
commit
c931748d20
@ -260,7 +260,7 @@ _public_ int sd_bus_list_names(sd_bus *bus, char ***l) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
_public_ int sd_bus_get_owner(
|
||||
static int sd_bus_get_owner_dbus(
|
||||
sd_bus *bus,
|
||||
const char *name,
|
||||
uint64_t mask,
|
||||
@ -273,13 +273,6 @@ _public_ int sd_bus_get_owner(
|
||||
pid_t pid = 0;
|
||||
int r;
|
||||
|
||||
assert_return(bus, -EINVAL);
|
||||
assert_return(name, -EINVAL);
|
||||
assert_return(mask <= _SD_BUS_CREDS_MAX, -ENOTSUP);
|
||||
assert_return(mask == 0 || creds, -EINVAL);
|
||||
assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
|
||||
assert_return(!bus_pid_changed(bus), -ECHILD);
|
||||
|
||||
/* Only query the owner if the caller wants to know it or if
|
||||
* the caller just wants to check whether a name exists */
|
||||
if (owner || mask == 0) {
|
||||
@ -594,6 +587,23 @@ static int add_name_change_match(sd_bus *bus,
|
||||
return 0;
|
||||
}
|
||||
|
||||
_public_ int sd_bus_get_owner(
|
||||
sd_bus *bus,
|
||||
const char *name,
|
||||
uint64_t mask,
|
||||
char **owner,
|
||||
sd_bus_creds **creds) {
|
||||
|
||||
assert_return(bus, -EINVAL);
|
||||
assert_return(name, -EINVAL);
|
||||
assert_return(mask <= _SD_BUS_CREDS_MAX, -ENOTSUP);
|
||||
assert_return(mask == 0 || creds, -EINVAL);
|
||||
assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
|
||||
assert_return(!bus_pid_changed(bus), -ECHILD);
|
||||
|
||||
return sd_bus_get_owner_dbus(bus, name, mask, owner, creds);
|
||||
}
|
||||
|
||||
int bus_add_match_internal(
|
||||
sd_bus *bus,
|
||||
const char *match,
|
||||
|
Loading…
x
Reference in New Issue
Block a user