From 19fe49f62cc916f1237ea92a04fc80ee75285dde Mon Sep 17 00:00:00 2001 From: Federico Date: Tue, 25 Apr 2017 09:32:24 +0200 Subject: [PATCH] Export sd_bus_message_append_ap. It is renamed to sd_bus_message_appendv to follow systemd naming conventions. (#5753) Moreover, man page for sd_bus_message_append is updated with reference to new exposed function. Makefile-man is updated too, to reflect new alias. --- Makefile-man.am | 15 +++++---------- man/sd_bus_message_append.xml | 21 +++++++++++++++++++-- src/libsystemd/libsystemd.sym | 5 +++++ src/libsystemd/sd-bus/bus-convenience.c | 10 +++++----- src/libsystemd/sd-bus/bus-message.c | 12 ++++++------ src/libsystemd/sd-bus/bus-message.h | 2 -- src/systemd/sd-bus.h | 1 + 7 files changed, 41 insertions(+), 25 deletions(-) diff --git a/Makefile-man.am b/Makefile-man.am index d5626411a5..f436361074 100644 --- a/Makefile-man.am +++ b/Makefile-man.am @@ -326,6 +326,7 @@ MANPAGES_ALIAS += \ man/sd_bus_message_append_array_space.3 \ man/sd_bus_message_append_string_iovec.3 \ man/sd_bus_message_append_string_space.3 \ + man/sd_bus_message_appendv.3 \ man/sd_bus_message_get_realtime_usec.3 \ man/sd_bus_message_get_reply_cookie.3 \ man/sd_bus_message_get_seqnum.3 \ @@ -685,6 +686,7 @@ man/sd_bus_message_append_array_memfd.3: man/sd_bus_message_append_array.3 man/sd_bus_message_append_array_space.3: man/sd_bus_message_append_array.3 man/sd_bus_message_append_string_iovec.3: man/sd_bus_message_append_string_memfd.3 man/sd_bus_message_append_string_space.3: man/sd_bus_message_append_string_memfd.3 +man/sd_bus_message_appendv.3: man/sd_bus_message_append.3 man/sd_bus_message_get_realtime_usec.3: man/sd_bus_message_get_monotonic_usec.3 man/sd_bus_message_get_reply_cookie.3: man/sd_bus_message_get_cookie.3 man/sd_bus_message_get_seqnum.3: man/sd_bus_message_get_monotonic_usec.3 @@ -1322,6 +1324,9 @@ man/sd_bus_message_append_string_iovec.html: man/sd_bus_message_append_string_me man/sd_bus_message_append_string_space.html: man/sd_bus_message_append_string_memfd.html $(html-alias) +man/sd_bus_message_appendv.html: man/sd_bus_message_append.html + $(html-alias) + man/sd_bus_message_get_realtime_usec.html: man/sd_bus_message_get_monotonic_usec.html $(html-alias) @@ -2600,16 +2605,6 @@ man/systemd-user-sessions.html: man/systemd-user-sessions.service.html endif -if HAVE_PYTHON -MANPAGES += \ - man/systemd.directives.7 \ - man/systemd.index.7 -MANPAGES_ALIAS += \ - # - - -endif - if HAVE_SYSV_COMPAT MANPAGES += \ man/systemd-sysv-generator.8 diff --git a/man/sd_bus_message_append.xml b/man/sd_bus_message_append.xml index 132ce66434..2c28ee7154 100644 --- a/man/sd_bus_message_append.xml +++ b/man/sd_bus_message_append.xml @@ -45,6 +45,7 @@ sd_bus_message_append + sd_bus_message_appendv Attach fields to a D-Bus message based on a type string @@ -60,6 +61,14 @@ const char *types + + + int sd_bus_message_appendv + sd_bus_message *m + const char *types + va_list ap + + @@ -109,6 +118,14 @@ values for each entry matching the element type of the dictionary entries. + The sd_bus_message_appendv() is equivalent to + the function sd_bus_message_append(), + except that it is called with a va_list instead of + a variable number of arguments. This function does not call the + va_end() macro. Because it invokes the + va_arg() macro, the value of ap + is undefined after the call. + For further details on the D-Bus type system, please consult the D-Bus @@ -238,8 +255,8 @@ sd_bus_message_append(m, "ynqiuxtd", y, n, q, i, u, x, t, d); Return Value - On success, this call returns 0 or a positive - integer. On failure, this call returns a negative + On success, these functions return 0 or a positive + integer. On failure, these functions return a negative errno-style error code. diff --git a/src/libsystemd/libsystemd.sym b/src/libsystemd/libsystemd.sym index c1135ffa22..92cb790d49 100644 --- a/src/libsystemd/libsystemd.sym +++ b/src/libsystemd/libsystemd.sym @@ -517,3 +517,8 @@ global: sd_id128_get_machine_app_specific; sd_is_socket_sockaddr; } LIBSYSTEMD_232; + +LIBSYSTEMD_234 { +global: + sd_bus_message_appendv; +} LIBSYSTEMD_233; diff --git a/src/libsystemd/sd-bus/bus-convenience.c b/src/libsystemd/sd-bus/bus-convenience.c index 2d06bf541f..04158cae4d 100644 --- a/src/libsystemd/sd-bus/bus-convenience.c +++ b/src/libsystemd/sd-bus/bus-convenience.c @@ -48,7 +48,7 @@ _public_ int sd_bus_emit_signal( va_list ap; va_start(ap, types); - r = bus_message_append_ap(m, types, ap); + r = sd_bus_message_appendv(m, types, ap); va_end(ap); if (r < 0) return r; @@ -85,7 +85,7 @@ _public_ int sd_bus_call_method_async( va_list ap; va_start(ap, types); - r = bus_message_append_ap(m, types, ap); + r = sd_bus_message_appendv(m, types, ap); va_end(ap); if (r < 0) return r; @@ -123,7 +123,7 @@ _public_ int sd_bus_call_method( va_list ap; va_start(ap, types); - r = bus_message_append_ap(m, types, ap); + r = sd_bus_message_appendv(m, types, ap); va_end(ap); if (r < 0) goto fail; @@ -162,7 +162,7 @@ _public_ int sd_bus_reply_method_return( va_list ap; va_start(ap, types); - r = bus_message_append_ap(m, types, ap); + r = sd_bus_message_appendv(m, types, ap); va_end(ap); if (r < 0) return r; @@ -493,7 +493,7 @@ _public_ int sd_bus_set_property( goto fail; va_start(ap, type); - r = bus_message_append_ap(m, type, ap); + r = sd_bus_message_appendv(m, type, ap); va_end(ap); if (r < 0) goto fail; diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c index 5cec804e32..da6fd3b896 100644 --- a/src/libsystemd/sd-bus/bus-message.c +++ b/src/libsystemd/sd-bus/bus-message.c @@ -2341,7 +2341,7 @@ static int type_stack_pop(TypeStack *stack, unsigned max, unsigned *i, const cha return 1; } -int bus_message_append_ap( +_public_ int sd_bus_message_appendv( sd_bus_message *m, const char *types, va_list ap) { @@ -2351,10 +2351,10 @@ int bus_message_append_ap( unsigned stack_ptr = 0; int r; - assert(m); - - if (!types) - return 0; + assert_return(m, -EINVAL); + assert_return(types, -EINVAL); + assert_return(!m->sealed, -EPERM); + assert_return(!m->poisoned, -ESTALE); n_array = (unsigned) -1; n_struct = strlen(types); @@ -2555,7 +2555,7 @@ _public_ int sd_bus_message_append(sd_bus_message *m, const char *types, ...) { assert_return(!m->poisoned, -ESTALE); va_start(ap, types); - r = bus_message_append_ap(m, types, ap); + r = sd_bus_message_appendv(m, types, ap); va_end(ap); return r; diff --git a/src/libsystemd/sd-bus/bus-message.h b/src/libsystemd/sd-bus/bus-message.h index 4710c106b9..a59aa73833 100644 --- a/src/libsystemd/sd-bus/bus-message.h +++ b/src/libsystemd/sd-bus/bus-message.h @@ -220,8 +220,6 @@ int bus_message_from_malloc( int bus_message_get_arg(sd_bus_message *m, unsigned i, const char **str); int bus_message_get_arg_strv(sd_bus_message *m, unsigned i, char ***strv); -int bus_message_append_ap(sd_bus_message *m, const char *types, va_list ap); - int bus_message_parse_fields(sd_bus_message *m); struct bus_body_part *message_append_part(sd_bus_message *m); diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h index c47459c9ad..2b6aeb7989 100644 --- a/src/systemd/sd-bus.h +++ b/src/systemd/sd-bus.h @@ -266,6 +266,7 @@ int sd_bus_message_set_destination(sd_bus_message *m, const char *destination); int sd_bus_message_set_priority(sd_bus_message *m, int64_t priority); int sd_bus_message_append(sd_bus_message *m, const char *types, ...); +int sd_bus_message_appendv(sd_bus_message *m, const char *types, va_list ap); int sd_bus_message_append_basic(sd_bus_message *m, char type, const void *p); int sd_bus_message_append_array(sd_bus_message *m, char type, const void *ptr, size_t size); int sd_bus_message_append_array_space(sd_bus_message *m, char type, size_t size, void **ptr);