diff --git a/NEWS b/NEWS
index fb0c096462..3ee2381191 100644
--- a/NEWS
+++ b/NEWS
@@ -123,8 +123,9 @@ CHANGES WITH 248:
systemctl --user -M lennart@ start quux
- * sd-bus also gained a convenience function sd_bus_reply() to call
- sd_bus_send() with an existing reply message.
+ * sd-bus also gained a convenience function sd_bus_message_send() to
+ simplify invocations of sd_bus_send(), taking only a single
+ parameter: the message to send.
* sd-event allows rate limits to be set on event sources, for dealing
with high-priority event sources that might starve out others. See
diff --git a/man/rules/meson.build b/man/rules/meson.build
index c8e589e0f0..763863afef 100644
--- a/man/rules/meson.build
+++ b/man/rules/meson.build
@@ -405,17 +405,14 @@ manpages = [
'sd_bus_reply_method_errorf',
'sd_bus_reply_method_errorfv'],
''],
- ['sd_bus_reply_method_return',
- '3',
- ['sd_bus_reply', 'sd_bus_reply_method_returnv'],
- ''],
+ ['sd_bus_reply_method_return', '3', ['sd_bus_reply_method_returnv'], ''],
['sd_bus_request_name',
'3',
['sd_bus_release_name',
'sd_bus_release_name_async',
'sd_bus_request_name_async'],
''],
- ['sd_bus_send', '3', ['sd_bus_send_to'], ''],
+ ['sd_bus_send', '3', ['sd_bus_message_send', 'sd_bus_send_to'], ''],
['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'], ''],
diff --git a/man/sd-bus.xml b/man/sd-bus.xml
index bfe07e88ca..9224f28129 100644
--- a/man/sd-bus.xml
+++ b/man/sd-bus.xml
@@ -54,9 +54,9 @@
sd_bus_call_method3,
sd_bus_call_method_async3,
sd_bus_can_send3,
+sd_bus_close3,
sd_bus_creds_get_pid3,
sd_bus_creds_new_from_pid3,
-sd_bus_close3,
sd_bus_default3,
sd_bus_emit_interfaces_added3,
sd_bus_emit_interfaces_added_strv3,
@@ -83,19 +83,19 @@
sd_bus_get_fd3,
sd_bus_get_method_call_timeout3,
sd_bus_get_n_queued_read3,
-sd_bus_get_name_machine_id3,
sd_bus_get_name_creds3,
+sd_bus_get_name_machine_id3,
sd_bus_get_owner_creds3,
sd_bus_get_property3,
-sd_bus_get_property_trivial3,
sd_bus_get_property_string3,
sd_bus_get_property_strv3,
+sd_bus_get_property_trivial3,
sd_bus_get_scope3,
sd_bus_get_tid3,
sd_bus_get_unique_name3,
sd_bus_interface_name_is_valid3,
-sd_bus_is_monitor3,
sd_bus_is_bus_client3,
+sd_bus_is_monitor3,
sd_bus_is_server3,
sd_bus_list_names3,
sd_bus_message_append3,
@@ -128,12 +128,13 @@
sd_bus_message_read_array3,
sd_bus_message_read_basic3,
sd_bus_message_read_strv3,
+sd_bus_message_reply3,
sd_bus_message_rewind3,
sd_bus_message_seal3,
sd_bus_message_set_allow_interactive_authorization3,
sd_bus_message_set_destination3,
-sd_bus_message_set_sender3,
sd_bus_message_set_expect_reply3,
+sd_bus_message_set_sender3,
sd_bus_message_skip3,
sd_bus_message_verify_type3,
sd_bus_negotiate_fds3,
@@ -142,9 +143,8 @@
sd_bus_process3,
sd_bus_query_sender_creds3,
sd_bus_query_sender_privilege3,
-sd_bus_reply_method_return3,
sd_bus_reply_method_error3,
-sd_bus_reply3,
+sd_bus_reply_method_return3,
sd_bus_request_name3,
sd_bus_send3,
sd_bus_send_to3,
diff --git a/man/sd_bus_reply_method_return.xml b/man/sd_bus_reply_method_return.xml
index cf1e422a38..b9003e8293 100644
--- a/man/sd_bus_reply_method_return.xml
+++ b/man/sd_bus_reply_method_return.xml
@@ -19,7 +19,6 @@
sd_bus_reply_method_return
sd_bus_reply_method_returnv
- sd_bus_reply
Reply to a D-Bus method call
@@ -41,12 +40,6 @@
const char *types
va_list ap
-
-
- int sd_bus_reply
- const sd_bus_message *call
- sd_bus_message *m
-
@@ -59,12 +52,6 @@
sd_bus_message_append3.
If no reply is expected to call, this function succeeds without sending a
reply.
-
- sd_bus_reply() takes a complete bus message object created with either
- sd_bus_message_new_method_return3
- or
- sd_bus_message_new_method_error3
- and sends it as a reply to the call message.
diff --git a/man/sd_bus_send.xml b/man/sd_bus_send.xml
index c4c623a1e8..02ba3b8104 100644
--- a/man/sd_bus_send.xml
+++ b/man/sd_bus_send.xml
@@ -19,6 +19,7 @@
sd_bus_send
sd_bus_send_to
+ sd_bus_message_send
Queue a D-Bus message for transfer
@@ -41,6 +42,11 @@
const char *destination
uint64_t *cookie
+
+
+ int sd_bus_message_send
+ sd_bus_message *m
+
@@ -76,6 +82,10 @@
call fails.
sd_bus_process3 should
be invoked to write out any queued message data to the transport.
+
+ sd_bus_message_send() is the same as sd_bus_send() but
+ without the first and last argument. It's equivalent to
+ sd_bus_message_send(sd_bus_message_get_bus(m), m, NULL).
diff --git a/src/libsystemd/libsystemd.sym b/src/libsystemd/libsystemd.sym
index fbe9803d42..78454acbc0 100644
--- a/src/libsystemd/libsystemd.sym
+++ b/src/libsystemd/libsystemd.sym
@@ -740,7 +740,7 @@ global:
LIBSYSTEMD_248 {
global:
sd_bus_open_user_machine;
- sd_bus_reply;
+ sd_bus_message_send;
sd_event_source_set_ratelimit;
sd_event_source_get_ratelimit;
diff --git a/src/libsystemd/sd-bus/bus-convenience.c b/src/libsystemd/sd-bus/bus-convenience.c
index 08f61ecc15..a36aeb238e 100644
--- a/src/libsystemd/sd-bus/bus-convenience.c
+++ b/src/libsystemd/sd-bus/bus-convenience.c
@@ -9,6 +9,14 @@
#include "bus-type.h"
#include "string-util.h"
+_public_ int sd_bus_message_send(sd_bus_message *reply) {
+ assert_return(reply, -EINVAL);
+ assert_return(reply->bus, -EINVAL);
+ assert_return(!bus_pid_changed(reply->bus), -ECHILD);
+
+ return sd_bus_send(reply->bus, reply, NULL);
+}
+
_public_ int sd_bus_emit_signalv(
sd_bus *bus,
const char *path,
@@ -198,7 +206,7 @@ _public_ int sd_bus_reply_method_returnv(
return r;
}
- return sd_bus_reply(call, m);
+ return sd_bus_message_send(m);
}
_public_ int sd_bus_reply_method_return(
@@ -239,7 +247,7 @@ _public_ int sd_bus_reply_method_error(
if (r < 0)
return r;
- return sd_bus_reply(call, m);
+ return sd_bus_message_send(m);
}
_public_ int sd_bus_reply_method_errorfv(
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index 1f7e71c66e..6b1f25cc02 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -2604,20 +2604,6 @@ _public_ int sd_bus_get_timeout(sd_bus *bus, uint64_t *timeout_usec) {
}
}
-int sd_bus_reply(const sd_bus_message *call, sd_bus_message *reply) {
- assert_return(call, -EINVAL);
- assert_return(call->sealed, -EPERM);
- assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
- assert_return(call->bus, -EINVAL);
- assert_return(!bus_pid_changed(call->bus), -ECHILD);
- assert_return(reply, -EINVAL);
- assert_return(
- IN_SET(reply->header->type, SD_BUS_MESSAGE_METHOD_RETURN, SD_BUS_MESSAGE_METHOD_ERROR),
- -EINVAL);
-
- return sd_bus_send(call->bus, reply, NULL);
-}
-
static int process_timeout(sd_bus *bus) {
_cleanup_(sd_bus_error_free) sd_bus_error error_buffer = SD_BUS_ERROR_NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message* m = NULL;
diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h
index 1829861397..a07a76170c 100644
--- a/src/systemd/sd-bus.h
+++ b/src/systemd/sd-bus.h
@@ -201,7 +201,6 @@ int sd_bus_send(sd_bus *bus, sd_bus_message *m, uint64_t *cookie);
int sd_bus_send_to(sd_bus *bus, sd_bus_message *m, const char *destination, uint64_t *cookie);
int sd_bus_call(sd_bus *bus, sd_bus_message *m, uint64_t usec, sd_bus_error *ret_error, sd_bus_message **reply);
int sd_bus_call_async(sd_bus *bus, sd_bus_slot **slot, sd_bus_message *m, sd_bus_message_handler_t callback, void *userdata, uint64_t usec);
-int sd_bus_reply(const sd_bus_message *call, sd_bus_message *reply);
int sd_bus_get_fd(sd_bus *bus);
int sd_bus_get_events(sd_bus *bus);
@@ -355,6 +354,7 @@ int sd_bus_get_name_machine_id(sd_bus *bus, const char *name, sd_id128_t *machin
/* Convenience calls */
+int sd_bus_message_send(sd_bus_message *m);
int sd_bus_call_methodv(sd_bus *bus, const char *destination, const char *path, const char *interface, const char *member, sd_bus_error *ret_error, sd_bus_message **reply, const char *types, va_list ap);
int sd_bus_call_method(sd_bus *bus, const char *destination, const char *path, const char *interface, const char *member, sd_bus_error *ret_error, sd_bus_message **reply, const char *types, ...);
int sd_bus_call_method_asyncv(sd_bus *bus, sd_bus_slot **slot, const char *destination, const char *path, const char *interface, const char *member, sd_bus_message_handler_t callback, void *userdata, const char *types, va_list ap);