From 59a77060e023a6e13bfeee4c73a7d8725c093825 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 11 Apr 2020 21:57:28 +0200 Subject: [PATCH 1/2] sd-bus: Use pointer syntax for sd_bus_set_exec argv parameter --- src/libsystemd/sd-bus/sd-bus.c | 2 +- src/systemd/sd-bus.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c index 78e18e3b94c..366f36645a1 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c @@ -284,7 +284,7 @@ _public_ int sd_bus_set_fd(sd_bus *bus, int input_fd, int output_fd) { return 0; } -_public_ int sd_bus_set_exec(sd_bus *bus, const char *path, char *const argv[]) { +_public_ int sd_bus_set_exec(sd_bus *bus, const char *path, char *const *argv) { _cleanup_strv_free_ char **a = NULL; int r; diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h index cd307dbd566..6f72e4b3b25 100644 --- a/src/systemd/sd-bus.h +++ b/src/systemd/sd-bus.h @@ -143,7 +143,7 @@ int sd_bus_new(sd_bus **ret); int sd_bus_set_address(sd_bus *bus, const char *address); int sd_bus_set_fd(sd_bus *bus, int input_fd, int output_fd); -int sd_bus_set_exec(sd_bus *bus, const char *path, char *const argv[]); +int sd_bus_set_exec(sd_bus *bus, const char *path, char *const *argv); int sd_bus_get_address(sd_bus *bus, const char **address); int sd_bus_set_bus_client(sd_bus *bus, int b); int sd_bus_is_bus_client(sd_bus *bus); From 3415b0cc8a4d69a0a314f407ed334c1b90f7944c Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 11 Apr 2020 21:57:36 +0200 Subject: [PATCH 2/2] sd-bus: Add sd_bus_set_exec docs --- man/rules/meson.build | 2 +- man/sd_bus_set_address.xml | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/man/rules/meson.build b/man/rules/meson.build index 16e0ffca3f7..aa9271a2a04 100644 --- a/man/rules/meson.build +++ b/man/rules/meson.build @@ -342,7 +342,7 @@ manpages = [ 'sd_bus_request_name_async'], ''], ['sd_bus_send', '3', [], ''], - ['sd_bus_set_address', '3', ['sd_bus_get_address'], ''], + ['sd_bus_set_address', '3', ['sd_bus_get_address', 'sd_bus_set_exec'], ''], ['sd_bus_set_close_on_exit', '3', ['sd_bus_get_close_on_exit'], ''], ['sd_bus_set_connected_signal', '3', ['sd_bus_get_connected_signal'], ''], ['sd_bus_set_description', diff --git a/man/sd_bus_set_address.xml b/man/sd_bus_set_address.xml index b022741ff49..8404da53f1e 100644 --- a/man/sd_bus_set_address.xml +++ b/man/sd_bus_set_address.xml @@ -19,6 +19,7 @@ sd_bus_set_address sd_bus_get_address + sd_bus_set_exec Set or query the address of the bus connection @@ -30,15 +31,21 @@ int sd_bus_set_address sd_bus *bus - const char* address + const char *address int sd_bus_get_address sd_bus *bus - const char** address + const char **address + + int sd_bus_set_exec + sd_bus *bus + const char *path + char *const *argv + @@ -68,13 +75,13 @@ the rest is optional. family may be either or . - + An executable to spawn specified as unixexec:guid=guid,path=path,argv1=argument,argv2=argument,.... The path= key must be present, while guid= is optional. - + A machine (container) to connect to specified as x-machine-unix:guid=guid,machine=machine,pid=pid. @@ -104,6 +111,11 @@ automatically by sd_bus_open3 and similar calls, based on environment variables or built-in defaults. + + sd_bus_set_exec is a shorthand function for setting a + unixexec address that spawns the given executable with the given arguments. + If argv is NULL, the given executable is spawned + without any extra arguments.