sd-bus: rename sd_bus_get_owner_id() → sd_bus_get_bus_id()
The ID returned really doesn't identify the owner, but the bus instance, hence fix this misnaming. Also, update "busctl status" to show the ID in its output.
This commit is contained in:
parent
4a62c710b6
commit
5c3026927d
|
@ -625,7 +625,7 @@ static int process_driver(sd_bus *a, sd_bus *b, sd_bus_message *m, Policy *polic
|
||||||
if (!sd_bus_message_has_signature(m, ""))
|
if (!sd_bus_message_has_signature(m, ""))
|
||||||
return synthetic_reply_method_error(m, &SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_INVALID_ARGS, "Invalid parameters"));
|
return synthetic_reply_method_error(m, &SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_INVALID_ARGS, "Invalid parameters"));
|
||||||
|
|
||||||
r = sd_bus_get_owner_id(a, &server_id);
|
r = sd_bus_get_bus_id(a, &server_id);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return synthetic_reply_method_errno(m, r, NULL);
|
return synthetic_reply_method_errno(m, r, NULL);
|
||||||
|
|
||||||
|
@ -1354,7 +1354,7 @@ int main(int argc, char *argv[]) {
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = sd_bus_get_owner_id(a, &server_id);
|
r = sd_bus_get_bus_id(a, &server_id);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_error_errno(r, "Failed to get server ID: %m");
|
log_error_errno(r, "Failed to get server ID: %m");
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
|
@ -190,7 +190,7 @@ global:
|
||||||
sd_bus_unref;
|
sd_bus_unref;
|
||||||
sd_bus_is_open;
|
sd_bus_is_open;
|
||||||
sd_bus_can_send;
|
sd_bus_can_send;
|
||||||
sd_bus_get_owner_id;
|
sd_bus_get_bus_id;
|
||||||
sd_bus_get_owner_creds;
|
sd_bus_get_owner_creds;
|
||||||
sd_bus_get_description;
|
sd_bus_get_description;
|
||||||
sd_bus_send;
|
sd_bus_send;
|
||||||
|
|
|
@ -1177,11 +1177,16 @@ static int status(sd_bus *bus, char *argv[]) {
|
||||||
_SD_BUS_CREDS_ALL);
|
_SD_BUS_CREDS_ALL);
|
||||||
} else {
|
} else {
|
||||||
const char *scope;
|
const char *scope;
|
||||||
|
sd_id128_t bus_id;
|
||||||
|
|
||||||
r = sd_bus_get_scope(bus, &scope);
|
r = sd_bus_get_scope(bus, &scope);
|
||||||
if (r >= 0)
|
if (r >= 0)
|
||||||
printf("Scope=%s%s%s\n", ansi_highlight(), scope, ansi_highlight_off());
|
printf("Scope=%s%s%s\n", ansi_highlight(), scope, ansi_highlight_off());
|
||||||
|
|
||||||
|
r = sd_bus_get_bus_id(bus, &bus_id);
|
||||||
|
if (r >= 0)
|
||||||
|
printf("BusID=%s" SD_ID128_FORMAT_STR "%s\n", ansi_highlight(), SD_ID128_FORMAT_VAL(bus_id), ansi_highlight_off());
|
||||||
|
|
||||||
r = sd_bus_get_owner_creds(
|
r = sd_bus_get_owner_creds(
|
||||||
bus,
|
bus,
|
||||||
(arg_augment_creds ? SD_BUS_CREDS_AUGMENT : 0) | _SD_BUS_CREDS_ALL,
|
(arg_augment_creds ? SD_BUS_CREDS_AUGMENT : 0) | _SD_BUS_CREDS_ALL,
|
||||||
|
|
|
@ -1442,7 +1442,7 @@ _public_ int sd_bus_can_send(sd_bus *bus, char type) {
|
||||||
return bus_type_is_valid(type);
|
return bus_type_is_valid(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
_public_ int sd_bus_get_owner_id(sd_bus *bus, sd_id128_t *id) {
|
_public_ int sd_bus_get_bus_id(sd_bus *bus, sd_id128_t *id) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert_return(bus, -EINVAL);
|
assert_return(bus, -EINVAL);
|
||||||
|
|
|
@ -76,7 +76,7 @@ static int server_init(sd_bus **_bus) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = sd_bus_get_owner_id(bus, &id);
|
r = sd_bus_get_bus_id(bus, &id);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_error_errno(r, "Failed to get server ID: %m");
|
log_error_errno(r, "Failed to get server ID: %m");
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
|
@ -138,7 +138,7 @@ sd_bus *sd_bus_unref(sd_bus *bus);
|
||||||
|
|
||||||
int sd_bus_is_open(sd_bus *bus);
|
int sd_bus_is_open(sd_bus *bus);
|
||||||
int sd_bus_can_send(sd_bus *bus, char type);
|
int sd_bus_can_send(sd_bus *bus, char type);
|
||||||
int sd_bus_get_owner_id(sd_bus *bus, sd_id128_t *id);
|
int sd_bus_get_bus_id(sd_bus *bus, sd_id128_t *id);
|
||||||
int sd_bus_get_owner_creds(sd_bus *bus, uint64_t creds_mask, sd_bus_creds **ret);
|
int sd_bus_get_owner_creds(sd_bus *bus, uint64_t creds_mask, sd_bus_creds **ret);
|
||||||
int sd_bus_get_scope(sd_bus *bus, const char **scope);
|
int sd_bus_get_scope(sd_bus *bus, const char **scope);
|
||||||
int sd_bus_get_description(sd_bus *bus, const char **description);
|
int sd_bus_get_description(sd_bus *bus, const char **description);
|
||||||
|
|
Loading…
Reference in a new issue