[systemd-commits] 6 commits - Makefile.am man/pam_systemd.xml src/efi-boot-generator src/libsystemd-bus src/login src/machine
Zbigniew JÄdrzejewski-Szmek
zbyszek at kemper.freedesktop.org
Wed Nov 6 21:15:50 CET 2013
Makefile.am | 229 ++++++++++++++++--------
man/pam_systemd.xml | 7
src/efi-boot-generator/efi-boot-generator.c | 37 +---
src/libsystemd-bus/bus-control.c | 16 -
src/libsystemd-bus/bus-convenience.c | 20 +-
src/libsystemd-bus/bus-error.c | 20 +-
src/libsystemd-bus/bus-message.c | 150 +++++++++-------
src/libsystemd-bus/bus-objects.c | 52 +++--
src/libsystemd-bus/libsystemd-bus.sym | 197 +++++++++++++++++++++
src/libsystemd-bus/libsystemd-event.sym | 57 ++++++
src/libsystemd-bus/sd-bus.c | 98 ++++++----
src/libsystemd-bus/sd-event.c | 86 +++++----
src/libsystemd-bus/sd-memfd.c | 24 +-
src/login/pam-module.c | 257 ++++++++++------------------
src/machine/machinectl.c | 12 -
15 files changed, 784 insertions(+), 478 deletions(-)
New commits:
commit ffcfcb6b2c068a5869cffad8a59d72b888bcb940
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Tue Nov 5 00:01:12 2013 -0500
pam_systemd: port to libsystemd-bus
diff --git a/Makefile.am b/Makefile.am
index e55cecc..afae87a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4010,7 +4010,6 @@ pam_systemd_la_SOURCES = \
pam_systemd_la_CFLAGS = \
$(AM_CFLAGS) \
$(PAM_CFLAGS) \
- $(DBUS_CFLAGS) \
-fvisibility=hidden
pam_systemd_la_LDFLAGS = \
@@ -4023,9 +4022,9 @@ pam_systemd_la_LDFLAGS = \
pam_systemd_la_LIBADD = \
libsystemd-audit.la \
- libsystemd-dbus.la \
+ libsystemd-bus.la \
libsystemd-shared.la \
- libsystemd-daemon-internal.la \
+ libsystemd-daemon.la \
$(RT_LIBS) \
$(PAM_LIBS)
diff --git a/src/login/pam-module.c b/src/login/pam-module.c
index 3b6b163..3667425 100644
--- a/src/login/pam-module.c
+++ b/src/login/pam-module.c
@@ -36,7 +36,7 @@
#include "audit.h"
#include "macro.h"
#include "strv.h"
-#include "dbus-common.h"
+#include "bus-util.h"
#include "def.h"
#include "socket-util.h"
#include "fileio.h"
@@ -181,19 +181,17 @@ _public_ PAM_EXTERN int pam_sm_open_session(
struct passwd *pw;
bool debug = false;
const char *username, *id, *object_path, *runtime_path, *service = NULL, *tty = NULL, *display = NULL, *remote_user = NULL, *remote_host = NULL, *seat = NULL, *type = NULL, *class = NULL, *class_pam = NULL, *cvtnr = NULL;
- DBusError error;
uint32_t uid, pid;
- DBusMessageIter iter, sub;
int session_fd = -1;
- DBusConnection *bus = NULL;
- DBusMessage *m = NULL, *reply = NULL;
- dbus_bool_t remote, existing;
- int r;
+ bool remote, existing;
uint32_t vtnr = 0;
+ int r;
- assert(handle);
+ _cleanup_bus_unref_ sd_bus *bus = NULL;
+ _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
+ _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
- dbus_error_init(&error);
+ assert(handle);
if (debug)
pam_syslog(handle, LOG_INFO, "pam-systemd initializing");
@@ -224,50 +222,27 @@ _public_ PAM_EXTERN int pam_sm_open_session(
if (streq_ptr(service, "systemd-user")) {
_cleanup_free_ char *p = NULL, *rt = NULL;
- if (asprintf(&p, "/run/systemd/users/%lu", (unsigned long) pw->pw_uid) < 0) {
- r = PAM_BUF_ERR;
- goto finish;
- }
+ if (asprintf(&p, "/run/systemd/users/%lu", (unsigned long) pw->pw_uid) < 0)
+ return PAM_BUF_ERR;
r = parse_env_file(p, NEWLINE,
"RUNTIME", &rt,
NULL);
- if (r < 0 && r != -ENOENT) {
- r = PAM_SESSION_ERR;
- goto finish;
- }
+ if (r < 0 && r != -ENOENT)
+ return PAM_SESSION_ERR;
if (rt) {
r = pam_misc_setenv(handle, "XDG_RUNTIME_DIR", rt, 0);
if (r != PAM_SUCCESS) {
pam_syslog(handle, LOG_ERR, "Failed to set runtime dir.");
- goto finish;
+ return r;
}
}
- r = PAM_SUCCESS;
- goto finish;
- }
-
- dbus_connection_set_change_sigpipe(FALSE);
-
- bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error);
- if (!bus) {
- pam_syslog(handle, LOG_ERR, "Failed to connect to system bus: %s", bus_error_message(&error));
- r = PAM_SESSION_ERR;
- goto finish;
+ return PAM_SUCCESS;
}
- m = dbus_message_new_method_call(
- "org.freedesktop.login1",
- "/org/freedesktop/login1",
- "org.freedesktop.login1.Manager",
- "CreateSession");
- if (!m) {
- pam_syslog(handle, LOG_ERR, "Could not allocate create session message.");
- r = PAM_BUF_ERR;
- goto finish;
- }
+ /* Otherwise, we ask logind to create a session for us */
uid = pw->pw_uid;
pid = getpid();
@@ -342,32 +317,12 @@ _public_ PAM_EXTERN int pam_sm_open_session(
!streq(remote_host, "localhost") &&
!streq(remote_host, "localhost.localdomain");
- if (!dbus_message_append_args(m,
- DBUS_TYPE_UINT32, &uid,
- DBUS_TYPE_UINT32, &pid,
- DBUS_TYPE_STRING, &service,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &class,
- DBUS_TYPE_STRING, &seat,
- DBUS_TYPE_UINT32, &vtnr,
- DBUS_TYPE_STRING, &tty,
- DBUS_TYPE_STRING, &display,
- DBUS_TYPE_BOOLEAN, &remote,
- DBUS_TYPE_STRING, &remote_user,
- DBUS_TYPE_STRING, &remote_host,
- DBUS_TYPE_INVALID)) {
- pam_syslog(handle, LOG_ERR, "Could not attach parameters to message.");
- r = PAM_BUF_ERR;
- goto finish;
- }
-
- dbus_message_iter_init_append(m, &iter);
+ /* Talk to logind over the message bug */
- if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "(sv)", &sub) ||
- !dbus_message_iter_close_container(&iter, &sub)) {
- pam_syslog(handle, LOG_ERR, "Could not attach parameters to message.");
- r = PAM_BUF_ERR;
- goto finish;
+ r = sd_bus_open_system(&bus);
+ if (r < 0) {
+ pam_syslog(handle, LOG_ERR, "Failed to connect to system bus: %s", strerror(-r));
+ return PAM_SESSION_ERR;
}
if (debug)
@@ -375,23 +330,47 @@ _public_ PAM_EXTERN int pam_sm_open_session(
"uid=%u pid=%u service=%s type=%s class=%s seat=%s vtnr=%u tty=%s display=%s remote=%s remote_user=%s remote_host=%s",
uid, pid, service, type, class, seat, vtnr, tty, display, yes_no(remote), remote_user, remote_host);
- reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error);
- if (!reply) {
- pam_syslog(handle, LOG_ERR, "Failed to create session: %s", bus_error_message(&error));
- r = PAM_SESSION_ERR;
- goto finish;
+ r = sd_bus_call_method(bus,
+ "org.freedesktop.login1",
+ "/org/freedesktop/login1",
+ "org.freedesktop.login1.Manager",
+ "CreateSession",
+ &error,
+ &reply,
+ "uussssussbssa(sv)",
+ uid,
+ pid,
+ service,
+ type,
+ class,
+ seat,
+ vtnr,
+ tty,
+ display,
+ remote,
+ remote_user,
+ remote_host,
+ 0);
+ if (r < 0) {
+ pam_syslog(handle, LOG_ERR, "Failed to communicate with systemd-logind: %s", strerror(-r));
+ if (error.name || error.message)
+ pam_syslog(handle, LOG_ERR, "systemd-logind returned %s: %s",
+ error.name ?: "unknown error",
+ error.message ?: "no message");
+ return PAM_SYSTEM_ERR;
}
- if (!dbus_message_get_args(reply, &error,
- DBUS_TYPE_STRING, &id,
- DBUS_TYPE_OBJECT_PATH, &object_path,
- DBUS_TYPE_STRING, &runtime_path,
- DBUS_TYPE_UNIX_FD, &session_fd,
- DBUS_TYPE_STRING, &seat,
- DBUS_TYPE_UINT32, &vtnr,
- DBUS_TYPE_BOOLEAN, &existing,
- DBUS_TYPE_INVALID)) {
- pam_syslog(handle, LOG_ERR, "Failed to parse message: %s", bus_error_message(&error));
+ r = sd_bus_message_read(reply,
+ "soshsub",
+ &id,
+ &object_path,
+ &runtime_path,
+ &session_fd,
+ &seat,
+ &vtnr,
+ &existing);
+ if (r < 0) {
+ pam_syslog(handle, LOG_ERR, "Failed to parse message: %s", strerror(-r));
r = PAM_SESSION_ERR;
goto finish;
}
@@ -436,35 +415,20 @@ _public_ PAM_EXTERN int pam_sm_open_session(
r = pam_set_data(handle, "systemd.existing", INT_TO_PTR(!!existing), NULL);
if (r != PAM_SUCCESS) {
pam_syslog(handle, LOG_ERR, "Failed to install existing flag.");
- return r;
+ goto finish;
}
if (session_fd >= 0) {
r = pam_set_data(handle, "systemd.session-fd", INT_TO_PTR(session_fd+1), NULL);
if (r != PAM_SUCCESS) {
pam_syslog(handle, LOG_ERR, "Failed to install session fd.");
- return r;
+ goto finish;
}
}
- session_fd = -1;
-
- r = PAM_SUCCESS;
+ return PAM_SUCCESS;
finish:
- dbus_error_free(&error);
-
- if (bus) {
- dbus_connection_close(bus);
- dbus_connection_unref(bus);
- }
-
- if (m)
- dbus_message_unref(m);
-
- if (reply)
- dbus_message_unref(reply);
-
if (session_fd >= 0)
close_nointr_nofail(session_fd);
@@ -478,14 +442,13 @@ _public_ PAM_EXTERN int pam_sm_close_session(
const void *p = NULL, *existing = NULL;
const char *id;
- DBusConnection *bus = NULL;
- DBusMessage *m = NULL, *reply = NULL;
- DBusError error;
int r;
- assert(handle);
+ _cleanup_bus_unref_ sd_bus *bus = NULL;
+ _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
+ _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
- dbus_error_init(&error);
+ assert(handle);
/* Only release session if it wasn't pre-existing when we
* tried to create it */
@@ -499,35 +462,31 @@ _public_ PAM_EXTERN int pam_sm_close_session(
* that it doesn't just go and slaughter us
* immediately after closing the fd */
- bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error);
- if (!bus) {
- pam_syslog(handle, LOG_ERR, "Failed to connect to system bus: %s", bus_error_message(&error));
+ r = sd_bus_open_system(&bus);
+ if (r < 0) {
+ pam_syslog(handle, LOG_ERR,
+ "Failed to connect to system bus: %s", strerror(-r));
r = PAM_SESSION_ERR;
goto finish;
}
- m = dbus_message_new_method_call(
- "org.freedesktop.login1",
- "/org/freedesktop/login1",
- "org.freedesktop.login1.Manager",
- "ReleaseSession");
- if (!m) {
- pam_syslog(handle, LOG_ERR, "Could not allocate release session message.");
- r = PAM_BUF_ERR;
- goto finish;
- }
-
- if (!dbus_message_append_args(m,
- DBUS_TYPE_STRING, &id,
- DBUS_TYPE_INVALID)) {
- pam_syslog(handle, LOG_ERR, "Could not attach parameters to message.");
- r = PAM_BUF_ERR;
- goto finish;
- }
+ r = sd_bus_call_method(bus,
+ "org.freedesktop.login1",
+ "/org/freedesktop/login1",
+ "org.freedesktop.login1.Manager",
+ "ReleaseSession",
+ &error,
+ NULL,
+ "s",
+ id);
+ if (r < 0) {
+ pam_syslog(handle, LOG_ERR,
+ "Failed to release session: %s", strerror(-r));
+ if (error.name || error.message)
+ pam_syslog(handle, LOG_ERR, "systemd-logind returned %s: %s",
+ error.name ?: "unknown error",
+ error.message ?: "no message");
- reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error);
- if (!reply) {
- pam_syslog(handle, LOG_ERR, "Failed to release session: %s", bus_error_message(&error));
r = PAM_SESSION_ERR;
goto finish;
}
@@ -540,18 +499,5 @@ finish:
if (p)
close_nointr(PTR_TO_INT(p) - 1);
- dbus_error_free(&error);
-
- if (bus) {
- dbus_connection_close(bus);
- dbus_connection_unref(bus);
- }
-
- if (m)
- dbus_message_unref(m);
-
- if (reply)
- dbus_message_unref(reply);
-
return r;
}
commit 05a049cc44d1c7eadfab104eea15b13f0207ab40
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Thu Oct 31 00:58:25 2013 -0400
systemd_pam: treat debug as debug=1 and parse all params
systemd_pam would ignore all params after the first invalid one.
Instead ignore just this one, and parse the rest. There's just
one now, but as a matter of principle ;)
Also, allow debug as an alias for debug=1, and don't treat
invalid debug= options as fatal.
diff --git a/man/pam_systemd.xml b/man/pam_systemd.xml
index 0e25a4a..d3edc32 100644
--- a/man/pam_systemd.xml
+++ b/man/pam_systemd.xml
@@ -131,10 +131,11 @@
</varlistentry>
<varlistentry>
- <term><option>debug=</option></term>
+ <term><option>debug<optional>=</optional></option></term>
- <listitem><para>Takes a boolean
- argument. If yes, the module will log
+ <listitem><para>Takes an optional
+ boolean argument. If yes or without
+ the argument, the module will log
debugging information as it
operates.</para></listitem>
</varlistentry>
diff --git a/src/login/pam-module.c b/src/login/pam-module.c
index 81ec15f..3b6b163 100644
--- a/src/login/pam-module.c
+++ b/src/login/pam-module.c
@@ -51,30 +51,26 @@ static int parse_argv(pam_handle_t *handle,
assert(argc >= 0);
assert(argc == 0 || argv);
- for (i = 0; i < (unsigned) argc; i++) {
- int k;
-
+ for (i = 0; i < (unsigned) argc; i++)
if (startswith(argv[i], "class=")) {
-
if (class)
*class = argv[i] + 6;
- } else if (startswith(argv[i], "debug=")) {
- k = parse_boolean(argv[i] + 6);
+ } else if (streq(argv[i], "debug")) {
+ if (debug)
+ *debug = true;
- if (k < 0) {
- pam_syslog(handle, LOG_ERR, "Failed to parse debug= argument.");
- return k;
- }
+ } else if (startswith(argv[i], "debug=")) {
+ int k;
- if (debug)
+ k = parse_boolean(argv[i] + 6);
+ if (k < 0)
+ pam_syslog(handle, LOG_WARNING, "Failed to parse debug= argument, ignoring.");
+ else if (debug)
*debug = k;
- } else {
+ } else
pam_syslog(handle, LOG_WARNING, "Unknown parameter '%s', ignoring", argv[i]);
- return 0;
- }
- }
return 0;
}
@@ -226,7 +222,7 @@ _public_ PAM_EXTERN int pam_sm_open_session(
pam_get_item(handle, PAM_SERVICE, (const void**) &service);
if (streq_ptr(service, "systemd-user")) {
- char *p, *rt = NULL;
+ _cleanup_free_ char *p = NULL, *rt = NULL;
if (asprintf(&p, "/run/systemd/users/%lu", (unsigned long) pw->pw_uid) < 0) {
r = PAM_BUF_ERR;
@@ -236,18 +232,13 @@ _public_ PAM_EXTERN int pam_sm_open_session(
r = parse_env_file(p, NEWLINE,
"RUNTIME", &rt,
NULL);
- free(p);
-
if (r < 0 && r != -ENOENT) {
r = PAM_SESSION_ERR;
- free(rt);
goto finish;
}
if (rt) {
r = pam_misc_setenv(handle, "XDG_RUNTIME_DIR", rt, 0);
- free(rt);
-
if (r != PAM_SUCCESS) {
pam_syslog(handle, LOG_ERR, "Failed to set runtime dir.");
goto finish;
commit f7262a9f282fb3bea713458638cad7e79119c1e2
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Wed Nov 6 02:47:39 2013 -0500
bus: add public libsystemd-event
diff --git a/Makefile.am b/Makefile.am
index 016ce5e..e55cecc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -63,6 +63,10 @@ LIBSYSTEMD_BUS_CURRENT=0
LIBSYSTEMD_BUS_REVISION=0
LIBSYSTEMD_BUS_AGE=0
+LIBSYSTEMD_EVENT_CURRENT=0
+LIBSYSTEMD_EVENT_REVISION=0
+LIBSYSTEMD_EVENT_AGE=0
+
# Dirs of external packages
dbuspolicydir=@dbuspolicydir@
dbussessionservicedir=@dbussessionservicedir@
@@ -1948,12 +1952,28 @@ EXTRA_DIST += \
src/libsystemd-daemon/libsystemd-daemon.sym
# ------------------------------------------------------------------------------
+libsystemd_event_la_SOURCES = \
+ src/libsystemd-bus/sd-event.c \
+ src/systemd/sd-event.h \
+ src/libsystemd-bus/event-util.h
+
+libsystemd_event_la_LDFLAGS = \
+ $(AM_LDFLAGS) \
+ -version-info $(LIBSYSTEMD_EVENT_CURRENT):$(LIBSYSTEMD_EVENT_REVISION):$(LIBSYSTEMD_EVENT_AGE) \
+ -Wl,--version-script=$(top_srcdir)/src/libsystemd-bus/libsystemd-event.sym
+
+lib_LTLIBRARIES += \
+ libsystemd-event.la
+
+libsystemd_event_la_LIBADD = \
+ libsystemd-id128-internal.la \
+ libsystemd-shared.la
+
libsystemd_bus_la_SOURCES = \
src/systemd/sd-bus.h \
src/systemd/sd-bus-protocol.h \
src/systemd/sd-bus-vtable.h \
src/systemd/sd-memfd.h \
- src/systemd/sd-event.h \
src/libsystemd-bus/sd-bus.c \
src/libsystemd-bus/bus-control.c \
src/libsystemd-bus/bus-control.h \
@@ -1984,15 +2004,14 @@ libsystemd_bus_la_SOURCES = \
src/libsystemd-bus/bus-convenience.c \
src/libsystemd-bus/kdbus.h \
src/libsystemd-bus/sd-memfd.c \
- src/libsystemd-bus/sd-event.c \
src/libsystemd-bus/bus-util.c \
- src/libsystemd-bus/bus-util.h \
- src/libsystemd-bus/event-util.h
+ src/libsystemd-bus/bus-util.h
libsystemd_bus_la_LIBADD = \
libsystemd-id128-internal.la \
libsystemd-shared.la \
- libsystemd-daemon.la
+ libsystemd-daemon.la \
+ libsystemd-event.la
libsystemd_bus_la_CFLAGS = \
$(AM_CFLAGS) \
@@ -2007,7 +2026,8 @@ lib_LTLIBRARIES += \
libsystemd-bus.la
libsystemd_bus_internal_la_SOURCES = \
- $(libsystemd_bus_la_SOURCES)
+ $(libsystemd_bus_la_SOURCES) \
+ $(libsystemd_event_la_SOURCES)
libsystemd_bus_internal_la_CFLAGS = \
$(libsystemd_bus_la_CFLAGS)
@@ -3247,7 +3267,7 @@ systemd_socket_proxyd_SOURCES = \
systemd_socket_proxyd_LDADD = \
libsystemd-logs.la \
- libsystemd-bus-internal.la \
+ libsystemd-bus.la \
libsystemd-journal-internal.la \
libsystemd-id128-internal.la \
libsystemd-shared.la \
diff --git a/src/libsystemd-bus/libsystemd-event.sym b/src/libsystemd-bus/libsystemd-event.sym
new file mode 100644
index 0000000..d5b47ce
--- /dev/null
+++ b/src/libsystemd-bus/libsystemd-event.sym
@@ -0,0 +1,57 @@
+/***
+ This file is part of systemd.
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+***/
+
+LIBSYSTEMD_EVENT_209 {
+global:
+ sd_event_new;
+ sd_event_ref;
+ sd_event_unref;
+
+ sd_event_add_io;
+ sd_event_add_monotonic;
+ sd_event_add_realtime;
+ sd_event_add_signal;
+ sd_event_add_child;
+ sd_event_add_defer;
+ sd_event_add_quit;
+
+ sd_event_run;
+ sd_event_loop;
+
+ sd_event_get_state;
+ sd_event_get_quit;
+ sd_event_request_quit;
+ sd_event_get_now_realtime;
+ sd_event_get_now_monotonic;
+ sd_event_get;
+
+ sd_event_source_ref;
+ sd_event_source_unref;
+
+ sd_event_source_set_prepare;
+ sd_event_source_get_pending;
+ sd_event_source_get_priority;
+ sd_event_source_set_priority;
+ sd_event_source_get_enabled;
+ sd_event_source_set_enabled;
+ sd_event_source_get_userdata;
+ sd_event_source_get_io_fd;
+ sd_event_source_get_io_events;
+ sd_event_source_set_io_events;
+ sd_event_source_get_io_revents;
+ sd_event_source_get_time;
+ sd_event_source_set_time;
+ sd_event_source_set_time_accuracy;
+ sd_event_source_get_time_accuracy;
+ sd_event_source_get_signal;
+ sd_event_source_get_child_pid;
+
+local:
+ *;
+};
diff --git a/src/libsystemd-bus/sd-event.c b/src/libsystemd-bus/sd-event.c
index b3a6c5b..9c641c9 100644
--- a/src/libsystemd-bus/sd-event.c
+++ b/src/libsystemd-bus/sd-event.c
@@ -330,7 +330,7 @@ static void event_free(sd_event *e) {
free(e);
}
-int sd_event_new(sd_event** ret) {
+_public_ int sd_event_new(sd_event** ret) {
sd_event *e;
int r;
@@ -367,7 +367,7 @@ fail:
return r;
}
-sd_event* sd_event_ref(sd_event *e) {
+_public_ sd_event* sd_event_ref(sd_event *e) {
assert_return(e, NULL);
assert(e->n_ref >= 1);
@@ -376,7 +376,7 @@ sd_event* sd_event_ref(sd_event *e) {
return e;
}
-sd_event* sd_event_unref(sd_event *e) {
+_public_ sd_event* sd_event_unref(sd_event *e) {
assert_return(e, NULL);
assert(e->n_ref >= 1);
@@ -556,7 +556,7 @@ static sd_event_source *source_new(sd_event *e, EventSourceType type) {
return s;
}
-int sd_event_add_io(
+_public_ int sd_event_add_io(
sd_event *e,
int fd,
uint32_t events,
@@ -712,11 +712,23 @@ fail:
return r;
}
-int sd_event_add_monotonic(sd_event *e, uint64_t usec, uint64_t accuracy, sd_time_handler_t callback, void *userdata, sd_event_source **ret) {
+_public_ int sd_event_add_monotonic(sd_event *e,
+ uint64_t usec,
+ uint64_t accuracy,
+ sd_time_handler_t callback,
+ void *userdata,
+ sd_event_source **ret) {
+
return event_add_time_internal(e, SOURCE_MONOTONIC, &e->monotonic_fd, CLOCK_MONOTONIC, &e->monotonic_earliest, &e->monotonic_latest, usec, accuracy, callback, userdata, ret);
}
-int sd_event_add_realtime(sd_event *e, uint64_t usec, uint64_t accuracy, sd_time_handler_t callback, void *userdata, sd_event_source **ret) {
+_public_ int sd_event_add_realtime(sd_event *e,
+ uint64_t usec,
+ uint64_t accuracy,
+ sd_time_handler_t callback,
+ void *userdata,
+ sd_event_source **ret) {
+
return event_add_time_internal(e, SOURCE_REALTIME, &e->realtime_fd, CLOCK_REALTIME, &e->realtime_earliest, &e->monotonic_latest, usec, accuracy, callback, userdata, ret);
}
@@ -752,7 +764,7 @@ static int event_update_signal_fd(sd_event *e) {
return 0;
}
-int sd_event_add_signal(
+_public_ int sd_event_add_signal(
sd_event *e,
int sig,
sd_signal_handler_t callback,
@@ -801,7 +813,7 @@ int sd_event_add_signal(
return 0;
}
-int sd_event_add_child(
+_public_ int sd_event_add_child(
sd_event *e,
pid_t pid,
int options,
@@ -862,7 +874,7 @@ int sd_event_add_child(
return 0;
}
-int sd_event_add_defer(
+_public_ int sd_event_add_defer(
sd_event *e,
sd_defer_handler_t callback,
void *userdata,
@@ -895,7 +907,7 @@ int sd_event_add_defer(
return 0;
}
-int sd_event_add_quit(
+_public_ int sd_event_add_quit(
sd_event *e,
sd_quit_handler_t callback,
void *userdata,
@@ -935,7 +947,7 @@ int sd_event_add_quit(
return 0;
}
-sd_event_source* sd_event_source_ref(sd_event_source *s) {
+_public_ sd_event_source* sd_event_source_ref(sd_event_source *s) {
assert_return(s, NULL);
assert(s->n_ref >= 1);
@@ -944,7 +956,7 @@ sd_event_source* sd_event_source_ref(sd_event_source *s) {
return s;
}
-sd_event_source* sd_event_source_unref(sd_event_source *s) {
+_public_ sd_event_source* sd_event_source_unref(sd_event_source *s) {
assert_return(s, NULL);
assert(s->n_ref >= 1);
@@ -956,13 +968,13 @@ sd_event_source* sd_event_source_unref(sd_event_source *s) {
return NULL;
}
-sd_event *sd_event_get(sd_event_source *s) {
+_public_ sd_event *sd_event_get(sd_event_source *s) {
assert_return(s, NULL);
return s->event;
}
-int sd_event_source_get_pending(sd_event_source *s) {
+_public_ int sd_event_source_get_pending(sd_event_source *s) {
assert_return(s, -EINVAL);
assert_return(s->type != SOURCE_QUIT, -EDOM);
assert_return(s->event->state != SD_EVENT_FINISHED, -ESTALE);
@@ -971,7 +983,7 @@ int sd_event_source_get_pending(sd_event_source *s) {
return s->pending;
}
-int sd_event_source_get_io_fd(sd_event_source *s) {
+_public_ int sd_event_source_get_io_fd(sd_event_source *s) {
assert_return(s, -EINVAL);
assert_return(s->type == SOURCE_IO, -EDOM);
assert_return(!event_pid_changed(s->event), -ECHILD);
@@ -979,7 +991,7 @@ int sd_event_source_get_io_fd(sd_event_source *s) {
return s->io.fd;
}
-int sd_event_source_get_io_events(sd_event_source *s, uint32_t* events) {
+_public_ int sd_event_source_get_io_events(sd_event_source *s, uint32_t* events) {
assert_return(s, -EINVAL);
assert_return(events, -EINVAL);
assert_return(s->type == SOURCE_IO, -EDOM);
@@ -989,7 +1001,7 @@ int sd_event_source_get_io_events(sd_event_source *s, uint32_t* events) {
return 0;
}
-int sd_event_source_set_io_events(sd_event_source *s, uint32_t events) {
+_public_ int sd_event_source_set_io_events(sd_event_source *s, uint32_t events) {
int r;
assert_return(s, -EINVAL);
@@ -1012,7 +1024,7 @@ int sd_event_source_set_io_events(sd_event_source *s, uint32_t events) {
return 0;
}
-int sd_event_source_get_io_revents(sd_event_source *s, uint32_t* revents) {
+_public_ int sd_event_source_get_io_revents(sd_event_source *s, uint32_t* revents) {
assert_return(s, -EINVAL);
assert_return(revents, -EINVAL);
assert_return(s->type == SOURCE_IO, -EDOM);
@@ -1023,7 +1035,7 @@ int sd_event_source_get_io_revents(sd_event_source *s, uint32_t* revents) {
return 0;
}
-int sd_event_source_get_signal(sd_event_source *s) {
+_public_ int sd_event_source_get_signal(sd_event_source *s) {
assert_return(s, -EINVAL);
assert_return(s->type == SOURCE_SIGNAL, -EDOM);
assert_return(!event_pid_changed(s->event), -ECHILD);
@@ -1031,14 +1043,14 @@ int sd_event_source_get_signal(sd_event_source *s) {
return s->signal.sig;
}
-int sd_event_source_get_priority(sd_event_source *s, int *priority) {
+_public_ int sd_event_source_get_priority(sd_event_source *s, int *priority) {
assert_return(s, -EINVAL);
assert_return(!event_pid_changed(s->event), -ECHILD);
return s->priority;
}
-int sd_event_source_set_priority(sd_event_source *s, int priority) {
+_public_ int sd_event_source_set_priority(sd_event_source *s, int priority) {
assert_return(s, -EINVAL);
assert_return(s->event->state != SD_EVENT_FINISHED, -ESTALE);
assert_return(!event_pid_changed(s->event), -ECHILD);
@@ -1060,7 +1072,7 @@ int sd_event_source_set_priority(sd_event_source *s, int priority) {
return 0;
}
-int sd_event_source_get_enabled(sd_event_source *s, int *m) {
+_public_ int sd_event_source_get_enabled(sd_event_source *s, int *m) {
assert_return(s, -EINVAL);
assert_return(m, -EINVAL);
assert_return(!event_pid_changed(s->event), -ECHILD);
@@ -1069,7 +1081,7 @@ int sd_event_source_get_enabled(sd_event_source *s, int *m) {
return 0;
}
-int sd_event_source_set_enabled(sd_event_source *s, int m) {
+_public_ int sd_event_source_set_enabled(sd_event_source *s, int m) {
int r;
assert_return(s, -EINVAL);
@@ -1201,7 +1213,7 @@ int sd_event_source_set_enabled(sd_event_source *s, int m) {
return 0;
}
-int sd_event_source_get_time(sd_event_source *s, uint64_t *usec) {
+_public_ int sd_event_source_get_time(sd_event_source *s, uint64_t *usec) {
assert_return(s, -EINVAL);
assert_return(usec, -EINVAL);
assert_return(s->type == SOURCE_REALTIME || s->type == SOURCE_MONOTONIC, -EDOM);
@@ -1211,7 +1223,7 @@ int sd_event_source_get_time(sd_event_source *s, uint64_t *usec) {
return 0;
}
-int sd_event_source_set_time(sd_event_source *s, uint64_t usec) {
+_public_ int sd_event_source_set_time(sd_event_source *s, uint64_t usec) {
assert_return(s, -EINVAL);
assert_return(usec != (uint64_t) -1, -EINVAL);
assert_return(s->type == SOURCE_REALTIME || s->type == SOURCE_MONOTONIC, -EDOM);
@@ -1234,7 +1246,7 @@ int sd_event_source_set_time(sd_event_source *s, uint64_t usec) {
return 0;
}
-int sd_event_source_get_time_accuracy(sd_event_source *s, uint64_t *usec) {
+_public_ int sd_event_source_get_time_accuracy(sd_event_source *s, uint64_t *usec) {
assert_return(s, -EINVAL);
assert_return(usec, -EINVAL);
assert_return(s->type == SOURCE_REALTIME || s->type == SOURCE_MONOTONIC, -EDOM);
@@ -1244,7 +1256,7 @@ int sd_event_source_get_time_accuracy(sd_event_source *s, uint64_t *usec) {
return 0;
}
-int sd_event_source_set_time_accuracy(sd_event_source *s, uint64_t usec) {
+_public_ int sd_event_source_set_time_accuracy(sd_event_source *s, uint64_t usec) {
assert_return(s, -EINVAL);
assert_return(usec != (uint64_t) -1, -EINVAL);
assert_return(s->type == SOURCE_REALTIME || s->type == SOURCE_MONOTONIC, -EDOM);
@@ -1267,7 +1279,7 @@ int sd_event_source_set_time_accuracy(sd_event_source *s, uint64_t usec) {
return 0;
}
-int sd_event_source_get_child_pid(sd_event_source *s, pid_t *pid) {
+_public_ int sd_event_source_get_child_pid(sd_event_source *s, pid_t *pid) {
assert_return(s, -EINVAL);
assert_return(pid, -EINVAL);
assert_return(s->type == SOURCE_CHILD, -EDOM);
@@ -1277,7 +1289,7 @@ int sd_event_source_get_child_pid(sd_event_source *s, pid_t *pid) {
return 0;
}
-int sd_event_source_set_prepare(sd_event_source *s, sd_prepare_handler_t callback) {
+_public_ int sd_event_source_set_prepare(sd_event_source *s, sd_prepare_handler_t callback) {
int r;
assert_return(s, -EINVAL);
@@ -1309,7 +1321,7 @@ int sd_event_source_set_prepare(sd_event_source *s, sd_prepare_handler_t callbac
return 0;
}
-void* sd_event_source_get_userdata(sd_event_source *s) {
+_public_ void* sd_event_source_get_userdata(sd_event_source *s) {
assert_return(s, NULL);
return s->userdata;
@@ -1702,7 +1714,7 @@ static sd_event_source* event_next_pending(sd_event *e) {
return p;
}
-int sd_event_run(sd_event *e, uint64_t timeout) {
+_public_ int sd_event_run(sd_event *e, uint64_t timeout) {
struct epoll_event ev_queue[EPOLL_QUEUE_MAX];
sd_event_source *p;
int r, i, m;
@@ -1789,7 +1801,7 @@ finish:
return r;
}
-int sd_event_loop(sd_event *e) {
+_public_ int sd_event_loop(sd_event *e) {
int r;
assert_return(e, -EINVAL);
@@ -1811,21 +1823,21 @@ finish:
return r;
}
-int sd_event_get_state(sd_event *e) {
+_public_ int sd_event_get_state(sd_event *e) {
assert_return(e, -EINVAL);
assert_return(!event_pid_changed(e), -ECHILD);
return e->state;
}
-int sd_event_get_quit(sd_event *e) {
+_public_ int sd_event_get_quit(sd_event *e) {
assert_return(e, -EINVAL);
assert_return(!event_pid_changed(e), -ECHILD);
return e->quit_requested;
}
-int sd_event_request_quit(sd_event *e) {
+_public_ int sd_event_request_quit(sd_event *e) {
assert_return(e, -EINVAL);
assert_return(e->state != SD_EVENT_FINISHED, -ESTALE);
assert_return(!event_pid_changed(e), -ECHILD);
@@ -1834,7 +1846,7 @@ int sd_event_request_quit(sd_event *e) {
return 0;
}
-int sd_event_get_now_realtime(sd_event *e, uint64_t *usec) {
+_public_ int sd_event_get_now_realtime(sd_event *e, uint64_t *usec) {
assert_return(e, -EINVAL);
assert_return(usec, -EINVAL);
assert_return(dual_timestamp_is_set(&e->timestamp), -ENODATA);
@@ -1844,7 +1856,7 @@ int sd_event_get_now_realtime(sd_event *e, uint64_t *usec) {
return 0;
}
-int sd_event_get_now_monotonic(sd_event *e, uint64_t *usec) {
+_public_ int sd_event_get_now_monotonic(sd_event *e, uint64_t *usec) {
assert_return(e, -EINVAL);
assert_return(usec, -EINVAL);
assert_return(dual_timestamp_is_set(&e->timestamp), -ENODATA);
commit d9f644e2cdc81089f76314ee1a264895ca391371
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Wed Nov 6 02:33:42 2013 -0500
bus: export libsystemd-bus as a public library
Old static libsystemd-bus.la becomes libsystemd-bus-internal.la.
memfd functions are also exported in the same library.
(Best viewed with --color-words -U0).
diff --git a/Makefile.am b/Makefile.am
index ed61884..016ce5e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -59,6 +59,10 @@ LIBSYSTEMD_JOURNAL_CURRENT=11
LIBSYSTEMD_JOURNAL_REVISION=3
LIBSYSTEMD_JOURNAL_AGE=11
+LIBSYSTEMD_BUS_CURRENT=0
+LIBSYSTEMD_BUS_REVISION=0
+LIBSYSTEMD_BUS_AGE=0
+
# Dirs of external packages
dbuspolicydir=@dbuspolicydir@
dbussessionservicedir=@dbussessionservicedir@
@@ -1477,7 +1481,10 @@ systemd_analyze_CFLAGS = \
systemd_analyze_LDADD = \
libsystemd-shared.la \
- libsystemd-bus.la
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon.la \
+ libsystemd-shared.la
# ------------------------------------------------------------------------------
systemd_initctl_SOURCES = \
@@ -1488,9 +1495,10 @@ systemd_initctl_CFLAGS = \
$(DBUS_CFLAGS)
systemd_initctl_LDADD = \
- libsystemd-shared.la \
- libsystemd-daemon.la \
- libsystemd-bus.la
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon-internal.la \
+ libsystemd-shared.la
# ------------------------------------------------------------------------------
systemd_update_utmp_SOURCES = \
@@ -1502,8 +1510,10 @@ systemd_update_utmp_CFLAGS = \
$(AUDIT_CFLAGS)
systemd_update_utmp_LDADD = \
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon-internal.la \
libsystemd-shared.la \
- libsystemd-bus.la \
$(AUDIT_LIBS)
# ------------------------------------------------------------------------------
@@ -1656,8 +1666,10 @@ systemd_fsck_CFLAGS = \
$(DBUS_CFLAGS)
systemd_fsck_LDADD = \
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon-internal.la \
libsystemd-shared.la \
- libsystemd-bus.la \
libudev.la
# ------------------------------------------------------------------------------
@@ -1785,8 +1797,10 @@ systemd_cgroups_agent_SOURCES = \
src/cgroups-agent/cgroups-agent.c
systemd_cgroups_agent_LDADD = \
- libsystemd-shared.la \
- libsystemd-bus.la
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon-internal.la \
+ libsystemd-shared.la
# ------------------------------------------------------------------------------
systemctl_SOURCES = \
@@ -1853,10 +1867,10 @@ systemd_nspawn_SOURCES = \
systemd_nspawn_LDADD = \
libsystemd-label.la \
libsystemd-capability.la \
- libsystemd-shared.la \
- libsystemd-daemon.la \
+ libsystemd-bus-internal.la \
libsystemd-id128-internal.la \
- libsystemd-bus.la
+ libsystemd-shared.la \
+ libsystemd-daemon.la
# ------------------------------------------------------------------------------
systemd_run_SOURCES = \
@@ -1865,10 +1879,10 @@ systemd_run_SOURCES = \
systemd_run_LDADD = \
libsystemd-label.la \
libsystemd-capability.la \
+ libsystemd-bus-internal.la \
libsystemd-shared.la \
libsystemd-daemon.la \
- libsystemd-id128-internal.la \
- libsystemd-bus.la
+ libsystemd-id128-internal.la
# ------------------------------------------------------------------------------
systemd_stdio_bridge_SOURCES = \
@@ -1984,9 +1998,23 @@ libsystemd_bus_la_CFLAGS = \
$(AM_CFLAGS) \
-pthread
-noinst_LTLIBRARIES += \
+libsystemd_bus_la_LDFLAGS = \
+ $(AM_LDFLAGS) \
+ -version-info $(LIBSYSTEMD_BUS_CURRENT):$(LIBSYSTEMD_BUS_REVISION):$(LIBSYSTEMD_BUS_AGE) \
+ -Wl,--version-script=$(top_srcdir)/src/libsystemd-bus/libsystemd-bus.sym
+
+lib_LTLIBRARIES += \
libsystemd-bus.la
+libsystemd_bus_internal_la_SOURCES = \
+ $(libsystemd_bus_la_SOURCES)
+
+libsystemd_bus_internal_la_CFLAGS = \
+ $(libsystemd_bus_la_CFLAGS)
+
+noinst_LTLIBRARIES += \
+ libsystemd-bus-internal.la
+
tests += \
test-bus-marshal \
test-bus-signature \
@@ -2009,8 +2037,10 @@ test_bus_marshal_SOURCES = \
src/libsystemd-bus/test-bus-marshal.c
test_bus_marshal_LDADD = \
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
libsystemd-shared.la \
- libsystemd-bus.la \
+ libsystemd-daemon.la \
$(GLIB_LIBS) \
$(DBUS_LIBS)
@@ -2024,7 +2054,7 @@ test_bus_signature_SOURCES = \
test_bus_signature_LDADD = \
libsystemd-shared.la \
- libsystemd-bus.la
+ libsystemd-bus-internal.la
test_bus_chat_SOURCES = \
src/libsystemd-bus/test-bus-chat.c
@@ -2034,9 +2064,10 @@ test_bus_chat_CFLAGS = \
-pthread
test_bus_chat_LDADD = \
- libsystemd-shared.la \
- libsystemd-bus.la \
- libsystemd-id128-internal.la
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon-internal.la \
+ libsystemd-shared.la
test_bus_server_SOURCES = \
src/libsystemd-bus/test-bus-server.c
@@ -2046,9 +2077,10 @@ test_bus_server_CFLAGS = \
-pthread
test_bus_server_LDADD = \
- libsystemd-shared.la \
- libsystemd-bus.la \
- libsystemd-id128-internal.la
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon-internal.la \
+ libsystemd-shared.la
test_bus_objects_SOURCES = \
src/libsystemd-bus/test-bus-objects.c
@@ -2058,77 +2090,87 @@ test_bus_objects_CFLAGS = \
-pthread
test_bus_objects_LDADD = \
- libsystemd-shared.la \
- libsystemd-bus.la \
- libsystemd-id128-internal.la
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon-internal.la \
+ libsystemd-shared.la
test_bus_match_SOURCES = \
src/libsystemd-bus/test-bus-match.c
test_bus_match_LDADD = \
- libsystemd-shared.la \
- libsystemd-bus.la \
- libsystemd-id128-internal.la
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon-internal.la \
+ libsystemd-shared.la
test_bus_kernel_SOURCES = \
src/libsystemd-bus/test-bus-kernel.c
test_bus_kernel_LDADD = \
- libsystemd-shared.la \
- libsystemd-bus.la \
- libsystemd-id128-internal.la
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon-internal.la \
+ libsystemd-shared.la
test_bus_kernel_bloom_SOURCES = \
src/libsystemd-bus/test-bus-kernel-bloom.c
test_bus_kernel_bloom_LDADD = \
- libsystemd-shared.la \
- libsystemd-bus.la \
- libsystemd-id128-internal.la
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon-internal.la \
+ libsystemd-shared.la
test_bus_kernel_benchmark_SOURCES = \
src/libsystemd-bus/test-bus-kernel-benchmark.c
test_bus_kernel_benchmark_LDADD = \
- libsystemd-shared.la \
- libsystemd-bus.la \
- libsystemd-id128-internal.la
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon-internal.la \
+ libsystemd-shared.la
test_bus_memfd_SOURCES = \
src/libsystemd-bus/test-bus-memfd.c
test_bus_memfd_LDADD = \
libsystemd-shared.la \
- libsystemd-bus.la
+ libsystemd-bus-internal.la
test_bus_zero_copy_SOURCES = \
src/libsystemd-bus/test-bus-zero-copy.c
test_bus_zero_copy_LDADD = \
- libsystemd-shared.la \
- libsystemd-bus.la
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon-internal.la \
+ libsystemd-shared.la
test_bus_introspect_SOURCES = \
src/libsystemd-bus/test-bus-introspect.c
test_bus_introspect_LDADD = \
libsystemd-shared.la \
- libsystemd-bus.la
+ libsystemd-bus-internal.la
test_event_SOURCES = \
src/libsystemd-bus/test-event.c
test_event_LDADD = \
- libsystemd-shared.la \
- libsystemd-bus.la \
- libsystemd-id128-internal.la
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon-internal.la \
+ libsystemd-shared.la
busctl_SOURCES = \
src/libsystemd-bus/busctl.c
busctl_LDADD = \
- libsystemd-shared.la \
- libsystemd-bus.la
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon-internal.la \
+ libsystemd-shared.la
# ------------------------------------------------------------------------------
if ENABLE_GTK_DOC
@@ -3204,12 +3246,12 @@ systemd_socket_proxyd_SOURCES = \
src/socket-proxy/socket-proxyd.c
systemd_socket_proxyd_LDADD = \
- libsystemd-shared.la \
libsystemd-logs.la \
+ libsystemd-bus-internal.la \
libsystemd-journal-internal.la \
libsystemd-id128-internal.la \
- libsystemd-daemon.la \
- libsystemd-bus.la
+ libsystemd-shared.la \
+ libsystemd-daemon.la
# ------------------------------------------------------------------------------
if ENABLE_COREDUMP
@@ -3495,9 +3537,10 @@ systemd_hostnamed_SOURCES = \
systemd_hostnamed_LDADD = \
libsystemd-label.la \
- libsystemd-shared.la \
- libsystemd-daemon.la \
- libsystemd-bus.la
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon-internal.la \
+ libsystemd-shared.la
rootlibexec_PROGRAMS += \
systemd-hostnamed
@@ -3521,9 +3564,10 @@ hostnamectl_SOURCES = \
src/hostname/hostnamectl.c
hostnamectl_LDADD = \
- libsystemd-shared.la \
- libsystemd-bus.la \
- libsystemd-id128-internal.la
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon-internal.la \
+ libsystemd-shared.la
bin_PROGRAMS += \
hostnamectl
@@ -3549,9 +3593,10 @@ systemd_localed_SOURCES = \
systemd_localed_LDADD = \
libsystemd-label.la \
- libsystemd-shared.la \
- libsystemd-daemon.la \
- libsystemd-bus.la
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon-internal.la \
+ libsystemd-shared.la
nodist_systemunit_DATA += \
units/systemd-localed.service
@@ -3584,9 +3629,10 @@ localectl_SOURCES = \
src/locale/localectl.c
localectl_LDADD = \
- libsystemd-shared.la \
- libsystemd-bus.la \
- libsystemd-id128-internal.la
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon-internal.la \
+ libsystemd-shared.la
bin_PROGRAMS += \
localectl
@@ -3612,8 +3658,10 @@ systemd_timedated_SOURCES = \
systemd_timedated_LDADD = \
libsystemd-label.la \
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon-internal.la \
libsystemd-shared.la \
- libsystemd-daemon.la \
libsystemd-bus.la
rootlibexec_PROGRAMS += \
@@ -3646,8 +3694,10 @@ timedatectl_CFLAGS = \
$(DBUS_CFLAGS)
timedatectl_LDADD = \
- libsystemd-shared.la \
- libsystemd-bus.la
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon-internal.la \
+ libsystemd-shared.la
bin_PROGRAMS += \
timedatectl
@@ -3708,7 +3758,7 @@ libsystemd_machine_core_la_LIBADD = \
libsystemd-audit.la \
libsystemd-shared.la \
libsystemd-daemon.la \
- libsystemd-bus.la \
+ libsystemd-bus-internal.la \
libsystemd-id128-internal.la \
libudev.la
@@ -3723,8 +3773,10 @@ machinectl_CFLAGS = \
$(DBUS_CFLAGS)
machinectl_LDADD = \
- libsystemd-shared.la \
- libsystemd-bus.la
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon-internal.la \
+ libsystemd-shared.la
rootbin_PROGRAMS += \
machinectl
@@ -3806,7 +3858,7 @@ libsystemd_logind_core_la_LIBADD = \
libsystemd-shared.la \
libsystemd-daemon.la \
libsystemd-id128-internal.la \
- libsystemd-bus.la \
+ libsystemd-bus-internal.la \
libudev.la
if HAVE_ACL
@@ -3861,8 +3913,10 @@ systemd_inhibit_CFLAGS = \
$(DBUS_CFLAGS)
systemd_inhibit_LDADD = \
- libsystemd-shared.la \
- libsystemd-bus.la
+ libsystemd-bus-internal.la \
+ libsystemd-id128-internal.la \
+ libsystemd-daemon-internal.la \
+ libsystemd-shared.la
rootbin_PROGRAMS += \
systemd-inhibit
diff --git a/src/libsystemd-bus/bus-control.c b/src/libsystemd-bus/bus-control.c
index 836570d..4b43331 100644
--- a/src/libsystemd-bus/bus-control.c
+++ b/src/libsystemd-bus/bus-control.c
@@ -35,7 +35,7 @@
#include "bus-bloom.h"
#include "bus-util.h"
-int sd_bus_get_unique_name(sd_bus *bus, const char **unique) {
+_public_ int sd_bus_get_unique_name(sd_bus *bus, const char **unique) {
int r;
if (!bus)
@@ -53,7 +53,7 @@ int sd_bus_get_unique_name(sd_bus *bus, const char **unique) {
return 0;
}
-int sd_bus_request_name(sd_bus *bus, const char *name, int flags) {
+_public_ int sd_bus_request_name(sd_bus *bus, const char *name, int flags) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
uint32_t ret;
int r;
@@ -111,7 +111,7 @@ int sd_bus_request_name(sd_bus *bus, const char *name, int flags) {
}
}
-int sd_bus_release_name(sd_bus *bus, const char *name) {
+_public_ int sd_bus_release_name(sd_bus *bus, const char *name) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
uint32_t ret;
int r;
@@ -166,7 +166,7 @@ int sd_bus_release_name(sd_bus *bus, const char *name) {
return ret;
}
-int sd_bus_list_names(sd_bus *bus, char ***l) {
+_public_ int sd_bus_list_names(sd_bus *bus, char ***l) {
_cleanup_bus_message_unref_ sd_bus_message *reply1 = NULL, *reply2 = NULL;
char **x = NULL;
int r;
@@ -220,7 +220,7 @@ int sd_bus_list_names(sd_bus *bus, char ***l) {
return 0;
}
-int sd_bus_get_owner(sd_bus *bus, const char *name, char **owner) {
+_public_ int sd_bus_get_owner(sd_bus *bus, const char *name, char **owner) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
const char *found;
int r;
@@ -264,7 +264,7 @@ int sd_bus_get_owner(sd_bus *bus, const char *name, char **owner) {
return 0;
}
-int sd_bus_get_owner_uid(sd_bus *bus, const char *name, uid_t *uid) {
+_public_ int sd_bus_get_owner_uid(sd_bus *bus, const char *name, uid_t *uid) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
uint32_t u;
int r;
@@ -301,7 +301,7 @@ int sd_bus_get_owner_uid(sd_bus *bus, const char *name, uid_t *uid) {
return 0;
}
-int sd_bus_get_owner_pid(sd_bus *bus, const char *name, pid_t *pid) {
+_public_ int sd_bus_get_owner_pid(sd_bus *bus, const char *name, pid_t *pid) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
uint32_t u;
int r;
@@ -538,7 +538,7 @@ int bus_remove_match_internal(
return 0;
}
-int sd_bus_get_owner_machine_id(sd_bus *bus, const char *name, sd_id128_t *machine) {
+_public_ int sd_bus_get_owner_machine_id(sd_bus *bus, const char *name, sd_id128_t *machine) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
const char *mid;
int r;
diff --git a/src/libsystemd-bus/bus-convenience.c b/src/libsystemd-bus/bus-convenience.c
index 7c98242..0ccc259 100644
--- a/src/libsystemd-bus/bus-convenience.c
+++ b/src/libsystemd-bus/bus-convenience.c
@@ -25,7 +25,7 @@
#include "bus-util.h"
#include "bus-type.h"
-int sd_bus_emit_signal(
+_public_ int sd_bus_emit_signal(
sd_bus *bus,
const char *path,
const char *interface,
@@ -56,7 +56,7 @@ int sd_bus_emit_signal(
return sd_bus_send(bus, m, NULL);
}
-int sd_bus_call_method(
+_public_ int sd_bus_call_method(
sd_bus *bus,
const char *destination,
const char *path,
@@ -90,7 +90,7 @@ int sd_bus_call_method(
return sd_bus_send_with_reply_and_block(bus, m, 0, error, reply);
}
-int sd_bus_reply_method_return(
+_public_ int sd_bus_reply_method_return(
sd_bus *bus,
sd_bus_message *call,
const char *types, ...) {
@@ -125,7 +125,7 @@ int sd_bus_reply_method_return(
return sd_bus_send(bus, m, NULL);
}
-int sd_bus_reply_method_error(
+_public_ int sd_bus_reply_method_error(
sd_bus *bus,
sd_bus_message *call,
const sd_bus_error *e) {
@@ -151,7 +151,7 @@ int sd_bus_reply_method_error(
return sd_bus_send(bus, m, NULL);
}
-int sd_bus_reply_method_errorf(
+_public_ int sd_bus_reply_method_errorf(
sd_bus *bus,
sd_bus_message *call,
const char *name,
@@ -182,7 +182,7 @@ int sd_bus_reply_method_errorf(
return sd_bus_reply_method_error(bus, call, &error);
}
-int sd_bus_reply_method_errno(
+_public_ int sd_bus_reply_method_errno(
sd_bus *bus,
sd_bus_message *call,
int error,
@@ -208,7 +208,7 @@ int sd_bus_reply_method_errno(
return sd_bus_reply_method_error(bus, call, &berror);
}
-int sd_bus_reply_method_errnof(
+_public_ int sd_bus_reply_method_errnof(
sd_bus *bus,
sd_bus_message *call,
int error,
@@ -235,7 +235,7 @@ int sd_bus_reply_method_errnof(
return sd_bus_reply_method_error(bus, call, &berror);
}
-int sd_bus_get_property(
+_public_ int sd_bus_get_property(
sd_bus *bus,
const char *destination,
const char *path,
@@ -270,7 +270,7 @@ int sd_bus_get_property(
return 0;
}
-int sd_bus_get_property_trivial(
+_public_ int sd_bus_get_property_trivial(
sd_bus *bus,
const char *destination,
const char *path,
@@ -305,7 +305,7 @@ int sd_bus_get_property_trivial(
return 0;
}
-int sd_bus_set_property(
+_public_ int sd_bus_set_property(
sd_bus *bus,
const char *destination,
const char *path,
diff --git a/src/libsystemd-bus/bus-error.c b/src/libsystemd-bus/bus-error.c
index 35e2614..1a467cf 100644
--- a/src/libsystemd-bus/bus-error.c
+++ b/src/libsystemd-bus/bus-error.c
@@ -38,7 +38,7 @@ bool bus_error_is_dirty(sd_bus_error *e) {
return e->name || e->message || e->need_free;
}
-void sd_bus_error_free(sd_bus_error *e) {
+_public_ void sd_bus_error_free(sd_bus_error *e) {
if (!e)
return;
@@ -51,7 +51,7 @@ void sd_bus_error_free(sd_bus_error *e) {
e->need_free = false;
}
-int sd_bus_error_set(sd_bus_error *e, const char *name, const char *message) {
+_public_ int sd_bus_error_set(sd_bus_error *e, const char *name, const char *message) {
char *n, *m = NULL;
if (!e)
@@ -106,7 +106,7 @@ int bus_error_setfv(sd_bus_error *e, const char *name, const char *format, va_li
return 0;
}
-int sd_bus_error_setf(sd_bus_error *e, const char *name, const char *format, ...) {
+_public_ int sd_bus_error_setf(sd_bus_error *e, const char *name, const char *format, ...) {
if (format) {
int r;
@@ -122,7 +122,7 @@ int sd_bus_error_setf(sd_bus_error *e, const char *name, const char *format, ...
return sd_bus_error_set(e, name, NULL);
}
-int sd_bus_error_copy(sd_bus_error *dest, const sd_bus_error *e) {
+_public_ int sd_bus_error_copy(sd_bus_error *dest, const sd_bus_error *e) {
char *x, *y = NULL;
if (!dest)
@@ -150,7 +150,7 @@ int sd_bus_error_copy(sd_bus_error *dest, const sd_bus_error *e) {
return 0;
}
-int sd_bus_error_set_const(sd_bus_error *e, const char *name, const char *message) {
+_public_ int sd_bus_error_set_const(sd_bus_error *e, const char *name, const char *message) {
if (!e)
return 0;
@@ -161,21 +161,21 @@ int sd_bus_error_set_const(sd_bus_error *e, const char *name, const char *messag
return 0;
}
-int sd_bus_error_is_set(const sd_bus_error *e) {
+_public_ int sd_bus_error_is_set(const sd_bus_error *e) {
if (!e)
return 0;
return !!e->name;
}
-int sd_bus_error_has_name(const sd_bus_error *e, const char *name) {
+_public_ int sd_bus_error_has_name(const sd_bus_error *e, const char *name) {
if (!e)
return 0;
return streq_ptr(e->name, name);
}
-int sd_bus_error_get_errno(const sd_bus_error* e) {
+_public_ int sd_bus_error_get_errno(const sd_bus_error* e) {
/* Better replce this with a gperf table */
@@ -380,7 +380,7 @@ static sd_bus_error map_from_errno(int error) {
return SD_BUS_ERROR_MAKE(SD_BUS_ERROR_FAILED, "Operation failed");
}
-int sd_bus_error_set_errno(sd_bus_error *e, int error) {
+_public_ int sd_bus_error_set_errno(sd_bus_error *e, int error) {
sd_bus_error x;
x = map_from_errno(error);
@@ -425,7 +425,7 @@ fallback:
return bus_error_set_strerror_or_const(e, x.name, error, x.message);
}
-int sd_bus_error_set_errnof(sd_bus_error *e, int error, const char *format, ...) {
+_public_ int sd_bus_error_set_errnof(sd_bus_error *e, int error, const char *format, ...) {
int r;
if (!e)
diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c
index 437f6df..aaa19df 100644
--- a/src/libsystemd-bus/bus-message.c
+++ b/src/libsystemd-bus/bus-message.c
@@ -440,7 +440,7 @@ static sd_bus_message *message_new(sd_bus *bus, uint8_t type) {
return m;
}
-int sd_bus_message_new_signal(
+_public_ int sd_bus_message_new_signal(
sd_bus *bus,
const char *path,
const char *interface,
@@ -480,7 +480,7 @@ fail:
return r;
}
-int sd_bus_message_new_method_call(
+_public_ int sd_bus_message_new_method_call(
sd_bus *bus,
const char *destination,
const char *path,
@@ -571,7 +571,7 @@ fail:
return r;
}
-int sd_bus_message_new_method_return(
+_public_ int sd_bus_message_new_method_return(
sd_bus *bus,
sd_bus_message *call,
sd_bus_message **m) {
@@ -579,7 +579,7 @@ int sd_bus_message_new_method_return(
return message_new_reply(bus, call, SD_BUS_MESSAGE_METHOD_RETURN, m);
}
-int sd_bus_message_new_method_error(
+_public_ int sd_bus_message_new_method_error(
sd_bus *bus,
sd_bus_message *call,
const sd_bus_error *e,
@@ -613,7 +613,7 @@ fail:
return r;
}
-int sd_bus_message_new_method_errorf(
+_public_ int sd_bus_message_new_method_errorf(
sd_bus *bus,
sd_bus_message *call,
sd_bus_message **m,
@@ -638,7 +638,7 @@ int sd_bus_message_new_method_errorf(
return sd_bus_message_new_method_error(bus, call, &error, m);
}
-int sd_bus_message_new_method_errno(
+_public_ int sd_bus_message_new_method_errno(
sd_bus *bus,
sd_bus_message *call,
int error,
@@ -655,7 +655,7 @@ int sd_bus_message_new_method_errno(
return sd_bus_message_new_method_error(bus, call, &berror, m);
}
-int sd_bus_message_new_method_errnof(
+_public_ int sd_bus_message_new_method_errnof(
sd_bus *bus,
sd_bus_message *call,
sd_bus_message **m,
@@ -724,7 +724,7 @@ fail:
return r;
}
-sd_bus_message* sd_bus_message_ref(sd_bus_message *m) {
+_public_ sd_bus_message* sd_bus_message_ref(sd_bus_message *m) {
assert_return(m, NULL);
assert(m->n_ref > 0);
@@ -733,7 +733,7 @@ sd_bus_message* sd_bus_message_ref(sd_bus_message *m) {
return m;
}
-sd_bus_message* sd_bus_message_unref(sd_bus_message *m) {
+_public_ sd_bus_message* sd_bus_message_unref(sd_bus_message *m) {
assert_return(m, NULL);
assert(m->n_ref > 0);
@@ -745,7 +745,7 @@ sd_bus_message* sd_bus_message_unref(sd_bus_message *m) {
return NULL;
}
-int sd_bus_message_get_type(sd_bus_message *m, uint8_t *type) {
+_public_ int sd_bus_message_get_type(sd_bus_message *m, uint8_t *type) {
assert_return(m, -EINVAL);
assert_return(type, -EINVAL);
@@ -753,7 +753,7 @@ int sd_bus_message_get_type(sd_bus_message *m, uint8_t *type) {
return 0;
}
-int sd_bus_message_get_serial(sd_bus_message *m, uint64_t *serial) {
+_public_ int sd_bus_message_get_serial(sd_bus_message *m, uint64_t *serial) {
assert_return(m, -EINVAL);
assert_return(serial, -EINVAL);
assert_return(m->header->serial != 0, -ENOENT);
@@ -762,7 +762,7 @@ int sd_bus_message_get_serial(sd_bus_message *m, uint64_t *serial) {
return 0;
}
-int sd_bus_message_get_reply_serial(sd_bus_message *m, uint64_t *serial) {
+_public_ int sd_bus_message_get_reply_serial(sd_bus_message *m, uint64_t *serial) {
assert_return(m, -EINVAL);
assert_return(serial, -EINVAL);
assert_return(m->reply_serial != 0, -ENOENT);
@@ -771,49 +771,50 @@ int sd_bus_message_get_reply_serial(sd_bus_message *m, uint64_t *serial) {
return 0;
}
-int sd_bus_message_get_no_reply(sd_bus_message *m) {
+_public_ int sd_bus_message_get_no_reply(sd_bus_message *m) {
assert_return(m, -EINVAL);
return m->header->type == SD_BUS_MESSAGE_METHOD_CALL ? !!(m->header->flags & SD_BUS_MESSAGE_NO_REPLY_EXPECTED) : 0;
}
-const char *sd_bus_message_get_path(sd_bus_message *m) {
+_public_ const char *sd_bus_message_get_path(sd_bus_message *m) {
assert_return(m, NULL);
return m->path;
}
-const char *sd_bus_message_get_interface(sd_bus_message *m) {
+_public_ const char *sd_bus_message_get_interface(sd_bus_message *m) {
assert_return(m, NULL);
return m->interface;
}
-const char *sd_bus_message_get_member(sd_bus_message *m) {
+_public_ const char *sd_bus_message_get_member(sd_bus_message *m) {
assert_return(m, NULL);
return m->member;
}
-const char *sd_bus_message_get_destination(sd_bus_message *m) {
+
+_public_ const char *sd_bus_message_get_destination(sd_bus_message *m) {
assert_return(m, NULL);
return m->destination;
}
-const char *sd_bus_message_get_sender(sd_bus_message *m) {
+_public_ const char *sd_bus_message_get_sender(sd_bus_message *m) {
assert_return(m, NULL);
return m->sender;
}
-const sd_bus_error *sd_bus_message_get_error(sd_bus_message *m) {
+_public_ const sd_bus_error *sd_bus_message_get_error(sd_bus_message *m) {
assert_return(m, NULL);
assert_return(sd_bus_error_is_set(&m->error), NULL);
return &m->error;
}
-int sd_bus_message_get_uid(sd_bus_message *m, uid_t *uid) {
+_public_ int sd_bus_message_get_uid(sd_bus_message *m, uid_t *uid) {
assert_return(m, -EINVAL);
assert_return(uid, -EINVAL);
assert_return(m->uid_valid, -ESRCH);
@@ -822,7 +823,7 @@ int sd_bus_message_get_uid(sd_bus_message *m, uid_t *uid) {
return 0;
}
-int sd_bus_message_get_gid(sd_bus_message *m, gid_t *gid) {
+_public_ int sd_bus_message_get_gid(sd_bus_message *m, gid_t *gid) {
assert_return(m, -EINVAL);
assert_return(gid, -EINVAL);
assert_return(m->gid_valid, -ESRCH);
@@ -831,7 +832,7 @@ int sd_bus_message_get_gid(sd_bus_message *m, gid_t *gid) {
return 0;
}
-int sd_bus_message_get_pid(sd_bus_message *m, pid_t *pid) {
+_public_ int sd_bus_message_get_pid(sd_bus_message *m, pid_t *pid) {
assert_return(m, -EINVAL);
assert_return(pid, -EINVAL);
assert_return(m->pid > 0, -ESRCH);
@@ -840,7 +841,7 @@ int sd_bus_message_get_pid(sd_bus_message *m, pid_t *pid) {
return 0;
}
-int sd_bus_message_get_tid(sd_bus_message *m, pid_t *tid) {
+_public_ int sd_bus_message_get_tid(sd_bus_message *m, pid_t *tid) {
assert_return(m, -EINVAL);
assert_return(tid, -EINVAL);
assert_return(m->tid > 0, -ESRCH);
@@ -849,7 +850,7 @@ int sd_bus_message_get_tid(sd_bus_message *m, pid_t *tid) {
return 0;
}
-int sd_bus_message_get_pid_starttime(sd_bus_message *m, uint64_t *usec) {
+_public_ int sd_bus_message_get_pid_starttime(sd_bus_message *m, uint64_t *usec) {
assert_return(m, -EINVAL);
assert_return(usec, -EINVAL);
assert_return(m->pid_starttime > 0, -ESRCH);
@@ -858,7 +859,7 @@ int sd_bus_message_get_pid_starttime(sd_bus_message *m, uint64_t *usec) {
return 0;
}
-int sd_bus_message_get_selinux_context(sd_bus_message *m, const char **ret) {
+_public_ int sd_bus_message_get_selinux_context(sd_bus_message *m, const char **ret) {
assert_return(m, -EINVAL);
assert_return(m->label, -ESRCH);
@@ -866,7 +867,7 @@ int sd_bus_message_get_selinux_context(sd_bus_message *m, const char **ret) {
return 0;
}
-int sd_bus_message_get_monotonic_timestamp(sd_bus_message *m, uint64_t *usec) {
+_public_ int sd_bus_message_get_monotonic_timestamp(sd_bus_message *m, uint64_t *usec) {
assert_return(m, -EINVAL);
assert_return(usec, -EINVAL);
assert_return(m->monotonic > 0, -ESRCH);
@@ -875,7 +876,7 @@ int sd_bus_message_get_monotonic_timestamp(sd_bus_message *m, uint64_t *usec) {
return 0;
}
-int sd_bus_message_get_realtime_timestamp(sd_bus_message *m, uint64_t *usec) {
+_public_ int sd_bus_message_get_realtime_timestamp(sd_bus_message *m, uint64_t *usec) {
assert_return(m, -EINVAL);
assert_return(usec, -EINVAL);
assert_return(m->realtime > 0, -ESRCH);
@@ -884,7 +885,7 @@ int sd_bus_message_get_realtime_timestamp(sd_bus_message *m, uint64_t *usec) {
return 0;
}
-int sd_bus_message_get_comm(sd_bus_message *m, const char **ret) {
+_public_ int sd_bus_message_get_comm(sd_bus_message *m, const char **ret) {
assert_return(m, -EINVAL);
assert_return(ret, -EINVAL);
assert_return(m->comm, -ESRCH);
@@ -893,7 +894,7 @@ int sd_bus_message_get_comm(sd_bus_message *m, const char **ret) {
return 0;
}
-int sd_bus_message_get_tid_comm(sd_bus_message *m, const char **ret) {
+_public_ int sd_bus_message_get_tid_comm(sd_bus_message *m, const char **ret) {
assert_return(m, -EINVAL);
assert_return(ret, -EINVAL);
assert_return(m->tid_comm, -ESRCH);
@@ -902,7 +903,7 @@ int sd_bus_message_get_tid_comm(sd_bus_message *m, const char **ret) {
return 0;
}
-int sd_bus_message_get_exe(sd_bus_message *m, const char **ret) {
+_public_ int sd_bus_message_get_exe(sd_bus_message *m, const char **ret) {
assert_return(m, -EINVAL);
assert_return(ret, -EINVAL);
assert_return(m->exe, -ESRCH);
@@ -911,7 +912,7 @@ int sd_bus_message_get_exe(sd_bus_message *m, const char **ret) {
return 0;
}
-int sd_bus_message_get_cgroup(sd_bus_message *m, const char **ret) {
+_public_ int sd_bus_message_get_cgroup(sd_bus_message *m, const char **ret) {
assert_return(m, -EINVAL);
assert_return(ret, -EINVAL);
assert_return(m->cgroup, -ESRCH);
@@ -920,7 +921,7 @@ int sd_bus_message_get_cgroup(sd_bus_message *m, const char **ret) {
return 0;
}
-int sd_bus_message_get_unit(sd_bus_message *m, const char **ret) {
+_public_ int sd_bus_message_get_unit(sd_bus_message *m, const char **ret) {
int r;
assert_return(m, -EINVAL);
@@ -937,7 +938,7 @@ int sd_bus_message_get_unit(sd_bus_message *m, const char **ret) {
return 0;
}
-int sd_bus_message_get_user_unit(sd_bus_message *m, const char **ret) {
+_public_ int sd_bus_message_get_user_unit(sd_bus_message *m, const char **ret) {
int r;
assert_return(m, -EINVAL);
@@ -954,7 +955,7 @@ int sd_bus_message_get_user_unit(sd_bus_message *m, const char **ret) {
return 0;
}
-int sd_bus_message_get_session(sd_bus_message *m, const char **ret) {
+_public_ int sd_bus_message_get_session(sd_bus_message *m, const char **ret) {
int r;
assert_return(m, -EINVAL);
@@ -971,7 +972,7 @@ int sd_bus_message_get_session(sd_bus_message *m, const char **ret) {
return 0;
}
-int sd_bus_message_get_owner_uid(sd_bus_message *m, uid_t *uid) {
+_public_ int sd_bus_message_get_owner_uid(sd_bus_message *m, uid_t *uid) {
assert_return(m, -EINVAL);
assert_return(uid, -EINVAL);
assert_return(m->cgroup, -ESRCH);
@@ -979,7 +980,7 @@ int sd_bus_message_get_owner_uid(sd_bus_message *m, uid_t *uid) {
return cg_path_get_owner_uid(m->cgroup, uid);
}
-int sd_bus_message_get_cmdline(sd_bus_message *m, char ***cmdline) {
+_public_ int sd_bus_message_get_cmdline(sd_bus_message *m, char ***cmdline) {
size_t n, i;
const char *p;
bool first;
@@ -1008,7 +1009,7 @@ int sd_bus_message_get_cmdline(sd_bus_message *m, char ***cmdline) {
return 0;
}
-int sd_bus_message_get_audit_sessionid(sd_bus_message *m, uint32_t *sessionid) {
+_public_ int sd_bus_message_get_audit_sessionid(sd_bus_message *m, uint32_t *sessionid) {
assert_return(m, -EINVAL);
assert_return(sessionid, -EINVAL);
assert_return(m->audit, -ESRCH);
@@ -1017,7 +1018,7 @@ int sd_bus_message_get_audit_sessionid(sd_bus_message *m, uint32_t *sessionid) {
return 0;
}
-int sd_bus_message_get_audit_loginuid(sd_bus_message *m, uid_t *uid) {
+_public_ int sd_bus_message_get_audit_loginuid(sd_bus_message *m, uid_t *uid) {
assert_return(m, -EINVAL);
assert_return(uid, -EINVAL);
assert_return(m->audit, -ESRCH);
@@ -1026,7 +1027,7 @@ int sd_bus_message_get_audit_loginuid(sd_bus_message *m, uid_t *uid) {
return 0;
}
-int sd_bus_message_has_effective_cap(sd_bus_message *m, int capability) {
+_public_ int sd_bus_message_has_effective_cap(sd_bus_message *m, int capability) {
unsigned sz;
assert_return(m, -EINVAL);
@@ -1040,7 +1041,9 @@ int sd_bus_message_has_effective_cap(sd_bus_message *m, int capability) {
return !!(m->capability[2 * sz + (capability / 8)] & (1 << (capability % 8)));
}
-int sd_bus_message_is_signal(sd_bus_message *m, const char *interface, const char *member) {
+_public_ int sd_bus_message_is_signal(sd_bus_message *m,
+ const char *interface,
+ const char *member) {
assert_return(m, -EINVAL);
if (m->header->type != SD_BUS_MESSAGE_SIGNAL)
@@ -1055,7 +1058,9 @@ int sd_bus_message_is_signal(sd_bus_message *m, const char *interface, const cha
return 1;
}
-int sd_bus_message_is_method_call(sd_bus_message *m, const char *interface, const char *member) {
+_public_ int sd_bus_message_is_method_call(sd_bus_message *m,
+ const char *interface,
+ const char *member) {
assert_return(m, -EINVAL);
if (m->header->type != SD_BUS_MESSAGE_METHOD_CALL)
@@ -1070,7 +1075,7 @@ int sd_bus_message_is_method_call(sd_bus_message *m, const char *interface, cons
return 1;
}
-int sd_bus_message_is_method_error(sd_bus_message *m, const char *name) {
+_public_ int sd_bus_message_is_method_error(sd_bus_message *m, const char *name) {
assert_return(m, -EINVAL);
if (m->header->type != SD_BUS_MESSAGE_METHOD_ERROR)
@@ -1082,7 +1087,7 @@ int sd_bus_message_is_method_error(sd_bus_message *m, const char *name) {
return 1;
}
-int sd_bus_message_set_no_reply(sd_bus_message *m, int b) {
+_public_ int sd_bus_message_set_no_reply(sd_bus_message *m, int b) {
assert_return(m, -EINVAL);
assert_return(!m->sealed, -EPERM);
assert_return(m->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EPERM);
@@ -1474,11 +1479,11 @@ fail:
return r;
}
-int sd_bus_message_append_basic(sd_bus_message *m, char type, const void *p) {
+_public_ int sd_bus_message_append_basic(sd_bus_message *m, char type, const void *p) {
return message_append_basic(m, type, p, NULL);
}
-int sd_bus_message_append_string_space(sd_bus_message *m, size_t size, char **s) {
+_public_ int sd_bus_message_append_string_space(sd_bus_message *m, size_t size, char **s) {
struct bus_container *c;
void *a;
@@ -1740,7 +1745,7 @@ static int bus_message_open_dict_entry(
return 0;
}
-int sd_bus_message_open_container(
+_public_ int sd_bus_message_open_container(
sd_bus_message *m,
char type,
const char *contents) {
@@ -1806,7 +1811,7 @@ int sd_bus_message_open_container(
return 0;
}
-int sd_bus_message_close_container(sd_bus_message *m) {
+_public_ int sd_bus_message_close_container(sd_bus_message *m) {
struct bus_container *c;
assert_return(m, -EINVAL);
@@ -2061,7 +2066,7 @@ int bus_message_append_ap(
return 0;
}
-int sd_bus_message_append(sd_bus_message *m, const char *types, ...) {
+_public_ int sd_bus_message_append(sd_bus_message *m, const char *types, ...) {
va_list ap;
int r;
@@ -2077,7 +2082,10 @@ int sd_bus_message_append(sd_bus_message *m, const char *types, ...) {
return r;
}
-int sd_bus_message_append_array_space(sd_bus_message *m, char type, size_t size, void **ptr) {
+_public_ int sd_bus_message_append_array_space(sd_bus_message *m,
+ char type,
+ size_t size,
+ void **ptr) {
ssize_t align, sz;
void *a;
int r;
@@ -2113,7 +2121,10 @@ int sd_bus_message_append_array_space(sd_bus_message *m, char type, size_t size,
return 0;
}
-int sd_bus_message_append_array(sd_bus_message *m, char type, const void *ptr, size_t size) {
+_public_ int sd_bus_message_append_array(sd_bus_message *m,
+ char type,
+ const void *ptr,
+ size_t size) {
int r;
void *p;
@@ -2133,7 +2144,9 @@ int sd_bus_message_append_array(sd_bus_message *m, char type, const void *ptr, s
return 0;
}
-int sd_bus_message_append_array_memfd(sd_bus_message *m, char type, sd_memfd *memfd) {
+_public_ int sd_bus_message_append_array_memfd(sd_bus_message *m,
+ char type,
+ sd_memfd *memfd) {
_cleanup_close_ int copy_fd = -1;
struct bus_body_part *part;
ssize_t align, sz;
@@ -2199,7 +2212,7 @@ int sd_bus_message_append_array_memfd(sd_bus_message *m, char type, sd_memfd *me
return sd_bus_message_close_container(m);
}
-int sd_bus_message_append_string_memfd(sd_bus_message *m, sd_memfd *memfd) {
+_public_ int sd_bus_message_append_string_memfd(sd_bus_message *m, sd_memfd *memfd) {
_cleanup_close_ int copy_fd = -1;
struct bus_body_part *part;
struct bus_container *c;
@@ -2275,7 +2288,7 @@ int sd_bus_message_append_string_memfd(sd_bus_message *m, sd_memfd *memfd) {
return 0;
}
-int sd_bus_message_append_strv(sd_bus_message *m, char **l) {
+_public_ int sd_bus_message_append_strv(sd_bus_message *m, char **l) {
char **i;
int r;
@@ -2555,7 +2568,7 @@ static bool validate_object_path(const char *s, size_t l) {
return true;
}
-int sd_bus_message_read_basic(sd_bus_message *m, char type, void *p) {
+_public_ int sd_bus_message_read_basic(sd_bus_message *m, char type, void *p) {
struct bus_container *c;
void *q;
int r;
@@ -2886,7 +2899,9 @@ static int bus_message_enter_dict_entry(
return 1;
}
-int sd_bus_message_enter_container(sd_bus_message *m, char type, const char *contents) {
+_public_ int sd_bus_message_enter_container(sd_bus_message *m,
+ char type,
+ const char *contents) {
struct bus_container *c, *w;
uint32_t *array_size = NULL;
char *signature;
@@ -2983,7 +2998,7 @@ int sd_bus_message_enter_container(sd_bus_message *m, char type, const char *con
return 1;
}
-int sd_bus_message_exit_container(sd_bus_message *m) {
+_public_ int sd_bus_message_exit_container(sd_bus_message *m) {
struct bus_container *c;
assert_return(m, -EINVAL);
@@ -3031,7 +3046,7 @@ static void message_quit_container(sd_bus_message *m) {
c->index = c->saved_index;
}
-int sd_bus_message_peek_type(sd_bus_message *m, char *type, const char **contents) {
+_public_ int sd_bus_message_peek_type(sd_bus_message *m, char *type, const char **contents) {
struct bus_container *c;
int r;
@@ -3151,7 +3166,7 @@ eof:
return 0;
}
-int sd_bus_message_rewind(sd_bus_message *m, int complete) {
+_public_ int sd_bus_message_rewind(sd_bus_message *m, int complete) {
struct bus_container *c;
assert_return(m, -EINVAL);
@@ -3370,7 +3385,7 @@ static int message_read_ap(
return 1;
}
-int sd_bus_message_read(sd_bus_message *m, const char *types, ...) {
+_public_ int sd_bus_message_read(sd_bus_message *m, const char *types, ...) {
va_list ap;
int r;
@@ -3385,7 +3400,7 @@ int sd_bus_message_read(sd_bus_message *m, const char *types, ...) {
return r;
}
-int sd_bus_message_skip(sd_bus_message *m, const char *types) {
+_public_ int sd_bus_message_skip(sd_bus_message *m, const char *types) {
int r;
assert_return(m, -EINVAL);
@@ -3527,7 +3542,10 @@ int sd_bus_message_skip(sd_bus_message *m, const char *types) {
}
}
-int sd_bus_message_read_array(sd_bus_message *m, char type, const void **ptr, size_t *size) {
+_public_ int sd_bus_message_read_array(sd_bus_message *m,
+ char type,
+ const void **ptr,
+ size_t *size) {
struct bus_container *c;
void *p;
size_t sz;
@@ -4065,7 +4083,7 @@ int bus_message_seal(sd_bus_message *m, uint64_t serial) {
return 0;
}
-int sd_bus_message_set_destination(sd_bus_message *m, const char *destination) {
+_public_ int sd_bus_message_set_destination(sd_bus_message *m, const char *destination) {
assert_return(m, -EINVAL);
assert_return(destination, -EINVAL);
assert_return(!m->sealed, -EPERM);
@@ -4489,7 +4507,7 @@ int bus_header_message_size(struct bus_header *h, size_t *sum) {
return 0;
}
-int sd_bus_message_get_errno(sd_bus_message *m) {
+_public_ int sd_bus_message_get_errno(sd_bus_message *m) {
assert_return(m, -EINVAL);
if (m->header->type != SD_BUS_MESSAGE_METHOD_ERROR)
@@ -4498,7 +4516,7 @@ int sd_bus_message_get_errno(sd_bus_message *m) {
return sd_bus_error_get_errno(&m->error);
}
-const char* sd_bus_message_get_signature(sd_bus_message *m, int complete) {
+_public_ const char* sd_bus_message_get_signature(sd_bus_message *m, int complete) {
struct bus_container *c;
assert_return(m, NULL);
@@ -4507,7 +4525,7 @@ const char* sd_bus_message_get_signature(sd_bus_message *m, int complete) {
return c->signature ?: "";
}
-int sd_bus_message_copy(sd_bus_message *m, sd_bus_message *source, int all) {
+_public_ int sd_bus_message_copy(sd_bus_message *m, sd_bus_message *source, int all) {
bool done_something = false;
int r;
@@ -4586,7 +4604,7 @@ int sd_bus_message_copy(sd_bus_message *m, sd_bus_message *source, int all) {
return done_something;
}
-int sd_bus_message_verify_type(sd_bus_message *m, char type, const char *contents) {
+_public_ int sd_bus_message_verify_type(sd_bus_message *m, char type, const char *contents) {
const char *c;
char t;
int r;
diff --git a/src/libsystemd-bus/bus-objects.c b/src/libsystemd-bus/bus-objects.c
index 93bd3ad..8369068 100644
--- a/src/libsystemd-bus/bus-objects.c
+++ b/src/libsystemd-bus/bus-objects.c
@@ -1389,19 +1389,35 @@ static int bus_remove_object(
return 1;
}
-int sd_bus_add_object(sd_bus *bus, const char *path, sd_bus_message_handler_t callback, void *userdata) {
+_public_ int sd_bus_add_object(sd_bus *bus,
+ const char *path,
+ sd_bus_message_handler_t callback,
+ void *userdata) {
+
return bus_add_object(bus, false, path, callback, userdata);
}
-int sd_bus_remove_object(sd_bus *bus, const char *path, sd_bus_message_handler_t callback, void *userdata) {
+_public_ int sd_bus_remove_object(sd_bus *bus,
+ const char *path,
+ sd_bus_message_handler_t callback,
+ void *userdata) {
+
return bus_remove_object(bus, false, path, callback, userdata);
}
-int sd_bus_add_fallback(sd_bus *bus, const char *prefix, sd_bus_message_handler_t callback, void *userdata) {
+_public_ int sd_bus_add_fallback(sd_bus *bus,
+ const char *prefix,
+ sd_bus_message_handler_t callback,
+ void *userdata) {
+
return bus_add_object(bus, true, prefix, callback, userdata);
}
-int sd_bus_remove_fallback(sd_bus *bus, const char *prefix, sd_bus_message_handler_t callback, void *userdata) {
+_public_ int sd_bus_remove_fallback(sd_bus *bus,
+ const char *prefix,
+ sd_bus_message_handler_t callback,
+ void *userdata) {
+
return bus_remove_object(bus, true, prefix, callback, userdata);
}
@@ -1686,7 +1702,7 @@ static int remove_object_vtable_internal(
return 1;
}
-int sd_bus_add_object_vtable(
+_public_ int sd_bus_add_object_vtable(
sd_bus *bus,
const char *path,
const char *interface,
@@ -1696,7 +1712,7 @@ int sd_bus_add_object_vtable(
return add_object_vtable_internal(bus, path, interface, vtable, false, NULL, userdata);
}
-int sd_bus_remove_object_vtable(
+_public_ int sd_bus_remove_object_vtable(
sd_bus *bus,
const char *path,
const char *interface) {
@@ -1704,7 +1720,7 @@ int sd_bus_remove_object_vtable(
return remove_object_vtable_internal(bus, path, interface, false);
}
-int sd_bus_add_fallback_vtable(
+_public_ int sd_bus_add_fallback_vtable(
sd_bus *bus,
const char *path,
const char *interface,
@@ -1715,7 +1731,7 @@ int sd_bus_add_fallback_vtable(
return add_object_vtable_internal(bus, path, interface, vtable, true, find, userdata);
}
-int sd_bus_remove_fallback_vtable(
+_public_ int sd_bus_remove_fallback_vtable(
sd_bus *bus,
const char *path,
const char *interface) {
@@ -1723,7 +1739,7 @@ int sd_bus_remove_fallback_vtable(
return remove_object_vtable_internal(bus, path, interface, true);
}
-int sd_bus_add_node_enumerator(
+_public_ int sd_bus_add_node_enumerator(
sd_bus *bus,
const char *path,
sd_bus_node_enumerator_t callback,
@@ -1764,7 +1780,7 @@ fail:
return r;
}
-int sd_bus_remove_node_enumerator(
+_public_ int sd_bus_remove_node_enumerator(
sd_bus *bus,
const char *path,
sd_bus_node_enumerator_t callback,
@@ -1939,7 +1955,7 @@ static int emit_properties_changed_on_interface(
return 1;
}
-int sd_bus_emit_properties_changed_strv(
+_public_ int sd_bus_emit_properties_changed_strv(
sd_bus *bus,
const char *path,
const char *interface,
@@ -1981,7 +1997,7 @@ int sd_bus_emit_properties_changed_strv(
return -ENOENT;
}
-int sd_bus_emit_properties_changed(
+_public_ int sd_bus_emit_properties_changed(
sd_bus *bus,
const char *path,
const char *interface,
@@ -2097,7 +2113,7 @@ static int interfaces_added_append_one(
return -ENOENT;
}
-int sd_bus_emit_interfaces_added_strv(sd_bus *bus, const char *path, char **interfaces) {
+_public_ int sd_bus_emit_interfaces_added_strv(sd_bus *bus, const char *path, char **interfaces) {
BUS_DONT_DESTROY(bus);
_cleanup_bus_message_unref_ sd_bus_message *m = NULL;
@@ -2161,7 +2177,7 @@ int sd_bus_emit_interfaces_added_strv(sd_bus *bus, const char *path, char **inte
return sd_bus_send(bus, m, NULL);
}
-int sd_bus_emit_interfaces_added(sd_bus *bus, const char *path, const char *interface, ...) {
+_public_ int sd_bus_emit_interfaces_added(sd_bus *bus, const char *path, const char *interface, ...) {
char **interfaces;
assert_return(bus, -EINVAL);
@@ -2174,7 +2190,7 @@ int sd_bus_emit_interfaces_added(sd_bus *bus, const char *path, const char *inte
return sd_bus_emit_interfaces_added_strv(bus, path, interfaces);
}
-int sd_bus_emit_interfaces_removed_strv(sd_bus *bus, const char *path, char **interfaces) {
+_public_ int sd_bus_emit_interfaces_removed_strv(sd_bus *bus, const char *path, char **interfaces) {
_cleanup_bus_message_unref_ sd_bus_message *m = NULL;
int r;
@@ -2201,7 +2217,7 @@ int sd_bus_emit_interfaces_removed_strv(sd_bus *bus, const char *path, char **in
return sd_bus_send(bus, m, NULL);
}
-int sd_bus_emit_interfaces_removed(sd_bus *bus, const char *path, const char *interface, ...) {
+_public_ int sd_bus_emit_interfaces_removed(sd_bus *bus, const char *path, const char *interface, ...) {
char **interfaces;
assert_return(bus, -EINVAL);
@@ -2214,7 +2230,7 @@ int sd_bus_emit_interfaces_removed(sd_bus *bus, const char *path, const char *in
return sd_bus_emit_interfaces_removed_strv(bus, path, interfaces);
}
-int sd_bus_add_object_manager(sd_bus *bus, const char *path) {
+_public_ int sd_bus_add_object_manager(sd_bus *bus, const char *path) {
struct node *n;
assert_return(bus, -EINVAL);
@@ -2230,7 +2246,7 @@ int sd_bus_add_object_manager(sd_bus *bus, const char *path) {
return 0;
}
-int sd_bus_remove_object_manager(sd_bus *bus, const char *path) {
+_public_ int sd_bus_remove_object_manager(sd_bus *bus, const char *path) {
struct node *n;
assert_return(bus, -EINVAL);
diff --git a/src/libsystemd-bus/libsystemd-bus.sym b/src/libsystemd-bus/libsystemd-bus.sym
new file mode 100644
index 0000000..850f370
--- /dev/null
+++ b/src/libsystemd-bus/libsystemd-bus.sym
@@ -0,0 +1,197 @@
+/***
+ This file is part of systemd.
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+***/
+
+LIBSYSTEMD_BUS_209 {
+global:
+ /* Same order as in sd-bus.h should be used */
+
+ /* Connections */
+ sd_bus_open_user;
+ sd_bus_open_system;
+ sd_bus_open_system_remote;
+ sd_bus_open_system_container;
+ sd_bus_new;
+ sd_bus_set_address;
+ sd_bus_set_fd;
+ sd_bus_set_exec;
+ sd_bus_set_bus_client;
+ sd_bus_set_server;
+ sd_bus_set_anonymous;
+ sd_bus_negotiate_fds;
+ sd_bus_negotiate_attach_comm;
+ sd_bus_negotiate_attach_exe;
+ sd_bus_negotiate_attach_cmdline;
+ sd_bus_negotiate_attach_cgroup;
+ sd_bus_negotiate_attach_caps;
+ sd_bus_negotiate_attach_selinux_context;
+ sd_bus_negotiate_attach_audit;
+ sd_bus_start;
+ sd_bus_close;
+ sd_bus_ref;
+ sd_bus_unref;
+ sd_bus_is_open;
+ sd_bus_can_send;
+ sd_bus_get_server_id;
+ sd_bus_send;
+ sd_bus_send_with_reply;
+ sd_bus_send_with_reply_cancel;
+ sd_bus_send_with_reply_and_block;
+ sd_bus_get_fd;
+ sd_bus_get_events;
+ sd_bus_get_timeout;
+ sd_bus_process;
+ sd_bus_wait;
+ sd_bus_flush;
+ sd_bus_get_current;
+ sd_bus_attach_event;
+ sd_bus_detach_event;
+ sd_bus_add_filter;
+ sd_bus_remove_filter;
+ sd_bus_add_match;
+ sd_bus_remove_match;
+ sd_bus_add_object;
+ sd_bus_remove_object;
+ sd_bus_add_fallback;
+ sd_bus_remove_fallback;
+ sd_bus_add_object_vtable;
+ sd_bus_remove_object_vtable;
+ sd_bus_add_fallback_vtable;
+ sd_bus_remove_fallback_vtable;
+ sd_bus_add_node_enumerator;
+ sd_bus_remove_node_enumerator;
+ sd_bus_add_object_manager;
+ sd_bus_remove_object_manager;
+
+ /* Message object */
+ sd_bus_message_new_signal;
+ sd_bus_message_new_method_call;
+ sd_bus_message_new_method_return;
+ sd_bus_message_new_method_error;
+ sd_bus_message_new_method_errorf;
+ sd_bus_message_new_method_errno;
+ sd_bus_message_new_method_errnof;
+ sd_bus_message_ref;
+ sd_bus_message_unref;
+ sd_bus_message_get_type;
+ sd_bus_message_get_serial;
+ sd_bus_message_get_reply_serial;
+ sd_bus_message_get_no_reply;
+ sd_bus_message_get_signature;
+ sd_bus_message_get_path;
+ sd_bus_message_get_interface;
+ sd_bus_message_get_member;
+ sd_bus_message_get_destination;
+ sd_bus_message_get_sender;
+ sd_bus_message_get_error;
+ sd_bus_message_get_errno;
+ sd_bus_message_get_monotonic_timestamp;
+ sd_bus_message_get_realtime_timestamp;
+ sd_bus_message_get_uid;
+ sd_bus_message_get_gid;
+ sd_bus_message_get_pid;
+ sd_bus_message_get_tid;
+ sd_bus_message_get_pid_starttime;
+ sd_bus_message_get_selinux_context;
+ sd_bus_message_get_comm;
+ sd_bus_message_get_tid_comm;
+ sd_bus_message_get_exe;
+ sd_bus_message_get_cgroup;
+ sd_bus_message_get_cmdline;
+ sd_bus_message_get_unit;
+ sd_bus_message_get_user_unit;
+ sd_bus_message_get_session;
+ sd_bus_message_get_owner_uid;
+ sd_bus_message_get_audit_sessionid;
+ sd_bus_message_get_audit_loginuid;
+ sd_bus_message_has_effective_cap;
+ sd_bus_message_is_signal;
+ sd_bus_message_is_method_call;
+ sd_bus_message_is_method_error;
+ sd_bus_message_set_no_reply;
+ sd_bus_message_set_destination;
+ sd_bus_message_append;
+ sd_bus_message_append_basic;
+ sd_bus_message_append_array;
+ sd_bus_message_append_array_space;
+ sd_bus_message_append_array_memfd;
+ sd_bus_message_append_string_space;
+ sd_bus_message_append_string_memfd;
+ sd_bus_message_append_strv;
+ sd_bus_message_open_container;
+ sd_bus_message_close_container;
+ sd_bus_message_copy;
+ sd_bus_message_read;
+ sd_bus_message_read_basic;
+ sd_bus_message_read_array;
+ sd_bus_message_read_strv;
+ sd_bus_message_skip;
+ sd_bus_message_enter_container;
+ sd_bus_message_exit_container;
+ sd_bus_message_peek_type;
+ sd_bus_message_verify_type;
+ sd_bus_message_at_end;
+ sd_bus_message_rewind;
+
+ /* Convenience calls */
+ sd_bus_call_method;
+ sd_bus_get_property;
+ sd_bus_get_property_trivial;
+ sd_bus_set_property;
+ sd_bus_reply_method_return;
+ sd_bus_reply_method_error;
+ sd_bus_reply_method_errorf;
+ sd_bus_reply_method_errno;
+ sd_bus_reply_method_errnof;
+ sd_bus_emit_signal;
+ sd_bus_emit_properties_changed_strv;
+ sd_bus_emit_properties_changed;
+ sd_bus_emit_interfaces_added_strv;
+ sd_bus_emit_interfaces_added;
+ sd_bus_emit_interfaces_removed_strv;
+ sd_bus_emit_interfaces_removed;
+
+ /* Bus management */
+ sd_bus_get_unique_name;
+ sd_bus_request_name;
+ sd_bus_release_name;
+ sd_bus_list_names;
+ sd_bus_get_owner;
+ sd_bus_get_owner_uid;
+ sd_bus_get_owner_pid;
+ sd_bus_get_owner_machine_id;
+
+ /* Error structures */
+ sd_bus_error_free;
+ sd_bus_error_set;
+ sd_bus_error_setf;
+ sd_bus_error_set_const;
+ sd_bus_error_set_errno;
+ sd_bus_error_set_errnof;
+ sd_bus_error_get_errno;
+ sd_bus_error_copy;
+ sd_bus_error_is_set;
+ sd_bus_error_has_name;
+
+ /* mem-fd functions */
+ sd_memfd_new;
+ sd_memfd_make;
+ sd_memfd_new_and_map;
+ sd_memfd_free;
+ sd_memfd_get_fd;
+ sd_memfd_get_file;
+ sd_memfd_dup_fd;
+ sd_memfd_map;
+ sd_memfd_set_sealed;
+ sd_memfd_get_sealed;
+ sd_memfd_get_size;
+ sd_memfd_set_size;
+
+local:
+ *;
+};
diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index e68f127..fceab50 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -159,7 +159,7 @@ static void bus_free(sd_bus *b) {
free(b);
}
-int sd_bus_new(sd_bus **ret) {
+_public_ int sd_bus_new(sd_bus **ret) {
sd_bus *r;
assert_return(ret, -EINVAL);
@@ -188,7 +188,7 @@ int sd_bus_new(sd_bus **ret) {
return 0;
}
-int sd_bus_set_address(sd_bus *bus, const char *address) {
+_public_ int sd_bus_set_address(sd_bus *bus, const char *address) {
char *a;
assert_return(bus, -EINVAL);
@@ -206,7 +206,7 @@ int sd_bus_set_address(sd_bus *bus, const char *address) {
return 0;
}
-int sd_bus_set_fd(sd_bus *bus, int input_fd, int output_fd) {
+_public_ int sd_bus_set_fd(sd_bus *bus, int input_fd, int output_fd) {
assert_return(bus, -EINVAL);
assert_return(bus->state == BUS_UNSET, -EPERM);
assert_return(input_fd >= 0, -EINVAL);
@@ -218,7 +218,7 @@ int sd_bus_set_fd(sd_bus *bus, int input_fd, int output_fd) {
return 0;
}
-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[]) {
char *p, **a;
assert_return(bus, -EINVAL);
@@ -246,7 +246,7 @@ int sd_bus_set_exec(sd_bus *bus, const char *path, char *const argv[]) {
return 0;
}
-int sd_bus_set_bus_client(sd_bus *bus, int b) {
+_public_ int sd_bus_set_bus_client(sd_bus *bus, int b) {
assert_return(bus, -EINVAL);
assert_return(bus->state == BUS_UNSET, -EPERM);
assert_return(!bus_pid_changed(bus), -ECHILD);
@@ -255,7 +255,7 @@ int sd_bus_set_bus_client(sd_bus *bus, int b) {
return 0;
}
-int sd_bus_negotiate_fds(sd_bus *bus, int b) {
+_public_ int sd_bus_negotiate_fds(sd_bus *bus, int b) {
assert_return(bus, -EINVAL);
assert_return(bus->state == BUS_UNSET, -EPERM);
assert_return(!bus_pid_changed(bus), -ECHILD);
@@ -264,7 +264,7 @@ int sd_bus_negotiate_fds(sd_bus *bus, int b) {
return 0;
}
-int sd_bus_negotiate_attach_comm(sd_bus *bus, int b) {
+_public_ int sd_bus_negotiate_attach_comm(sd_bus *bus, int b) {
assert_return(bus, -EINVAL);
assert_return(bus->state == BUS_UNSET, -EPERM);
assert_return(!bus_pid_changed(bus), -ECHILD);
@@ -273,7 +273,7 @@ int sd_bus_negotiate_attach_comm(sd_bus *bus, int b) {
return 0;
}
-int sd_bus_negotiate_attach_exe(sd_bus *bus, int b) {
+_public_ int sd_bus_negotiate_attach_exe(sd_bus *bus, int b) {
assert_return(bus, -EINVAL);
assert_return(bus->state == BUS_UNSET, -EPERM);
assert_return(!bus_pid_changed(bus), -ECHILD);
@@ -282,7 +282,7 @@ int sd_bus_negotiate_attach_exe(sd_bus *bus, int b) {
return 0;
}
-int sd_bus_negotiate_attach_cmdline(sd_bus *bus, int b) {
+_public_ int sd_bus_negotiate_attach_cmdline(sd_bus *bus, int b) {
assert_return(bus, -EINVAL);
assert_return(bus->state == BUS_UNSET, -EPERM);
assert_return(!bus_pid_changed(bus), -ECHILD);
@@ -291,7 +291,7 @@ int sd_bus_negotiate_attach_cmdline(sd_bus *bus, int b) {
return 0;
}
-int sd_bus_negotiate_attach_cgroup(sd_bus *bus, int b) {
+_public_ int sd_bus_negotiate_attach_cgroup(sd_bus *bus, int b) {
assert_return(bus, -EINVAL);
assert_return(bus->state == BUS_UNSET, -EPERM);
assert_return(!bus_pid_changed(bus), -ECHILD);
@@ -300,7 +300,7 @@ int sd_bus_negotiate_attach_cgroup(sd_bus *bus, int b) {
return 0;
}
-int sd_bus_negotiate_attach_caps(sd_bus *bus, int b) {
+_public_ int sd_bus_negotiate_attach_caps(sd_bus *bus, int b) {
assert_return(bus, -EINVAL);
assert_return(bus->state == BUS_UNSET, -EPERM);
assert_return(!bus_pid_changed(bus), -ECHILD);
@@ -309,7 +309,7 @@ int sd_bus_negotiate_attach_caps(sd_bus *bus, int b) {
return 0;
}
-int sd_bus_negotiate_attach_selinux_context(sd_bus *bus, int b) {
+_public_ int sd_bus_negotiate_attach_selinux_context(sd_bus *bus, int b) {
assert_return(bus, -EINVAL);
assert_return(bus->state == BUS_UNSET, -EPERM);
assert_return(!bus_pid_changed(bus), -ECHILD);
@@ -318,7 +318,7 @@ int sd_bus_negotiate_attach_selinux_context(sd_bus *bus, int b) {
return 0;
}
-int sd_bus_negotiate_attach_audit(sd_bus *bus, int b) {
+_public_ int sd_bus_negotiate_attach_audit(sd_bus *bus, int b) {
assert_return(bus, -EINVAL);
assert_return(bus->state == BUS_UNSET, -EPERM);
assert_return(!bus_pid_changed(bus), -ECHILD);
@@ -327,7 +327,7 @@ int sd_bus_negotiate_attach_audit(sd_bus *bus, int b) {
return 0;
}
-int sd_bus_set_server(sd_bus *bus, int b, sd_id128_t server_id) {
+_public_ int sd_bus_set_server(sd_bus *bus, int b, sd_id128_t server_id) {
assert_return(bus, -EINVAL);
assert_return(b || sd_id128_equal(server_id, SD_ID128_NULL), -EINVAL);
assert_return(bus->state == BUS_UNSET, -EPERM);
@@ -338,7 +338,7 @@ int sd_bus_set_server(sd_bus *bus, int b, sd_id128_t server_id) {
return 0;
}
-int sd_bus_set_anonymous(sd_bus *bus, int b) {
+_public_ int sd_bus_set_anonymous(sd_bus *bus, int b) {
assert_return(bus, -EINVAL);
assert_return(bus->state == BUS_UNSET, -EPERM);
assert_return(!bus_pid_changed(bus), -ECHILD);
@@ -982,7 +982,7 @@ static int bus_start_fd(sd_bus *b) {
return bus_socket_take_fd(b);
}
-int sd_bus_start(sd_bus *bus) {
+_public_ int sd_bus_start(sd_bus *bus) {
int r;
assert_return(bus, -EINVAL);
@@ -1007,7 +1007,7 @@ int sd_bus_start(sd_bus *bus) {
return bus_send_hello(bus);
}
-int sd_bus_open_system(sd_bus **ret) {
+_public_ int sd_bus_open_system(sd_bus **ret) {
const char *e;
sd_bus *b;
int r;
@@ -1043,7 +1043,7 @@ fail:
return r;
}
-int sd_bus_open_user(sd_bus **ret) {
+_public_ int sd_bus_open_user(sd_bus **ret) {
const char *e;
sd_bus *b;
size_t l;
@@ -1092,7 +1092,7 @@ fail:
return r;
}
-int sd_bus_open_system_remote(const char *host, sd_bus **ret) {
+_public_ int sd_bus_open_system_remote(const char *host, sd_bus **ret) {
_cleanup_free_ char *e = NULL;
char *p = NULL;
sd_bus *bus;
@@ -1128,7 +1128,7 @@ int sd_bus_open_system_remote(const char *host, sd_bus **ret) {
return 0;
}
-int sd_bus_open_system_container(const char *machine, sd_bus **ret) {
+_public_ int sd_bus_open_system_container(const char *machine, sd_bus **ret) {
_cleanup_free_ char *e = NULL;
sd_bus *bus;
char *p;
@@ -1164,7 +1164,7 @@ int sd_bus_open_system_container(const char *machine, sd_bus **ret) {
return 0;
}
-void sd_bus_close(sd_bus *bus) {
+_public_ void sd_bus_close(sd_bus *bus) {
if (!bus)
return;
if (bus->state == BUS_CLOSED)
@@ -1186,7 +1186,7 @@ void sd_bus_close(sd_bus *bus) {
* freed. */
}
-sd_bus *sd_bus_ref(sd_bus *bus) {
+_public_ sd_bus *sd_bus_ref(sd_bus *bus) {
assert_return(bus, NULL);
assert_se(REFCNT_INC(bus->n_ref) >= 2);
@@ -1194,7 +1194,7 @@ sd_bus *sd_bus_ref(sd_bus *bus) {
return bus;
}
-sd_bus *sd_bus_unref(sd_bus *bus) {
+_public_ sd_bus *sd_bus_unref(sd_bus *bus) {
assert_return(bus, NULL);
if (REFCNT_DEC(bus->n_ref) <= 0)
@@ -1203,7 +1203,7 @@ sd_bus *sd_bus_unref(sd_bus *bus) {
return NULL;
}
-int sd_bus_is_open(sd_bus *bus) {
+_public_ int sd_bus_is_open(sd_bus *bus) {
assert_return(bus, -EINVAL);
assert_return(!bus_pid_changed(bus), -ECHILD);
@@ -1211,7 +1211,7 @@ int sd_bus_is_open(sd_bus *bus) {
return BUS_IS_OPEN(bus->state);
}
-int sd_bus_can_send(sd_bus *bus, char type) {
+_public_ int sd_bus_can_send(sd_bus *bus, char type) {
int r;
assert_return(bus, -EINVAL);
@@ -1232,7 +1232,7 @@ int sd_bus_can_send(sd_bus *bus, char type) {
return bus_type_is_valid(type);
}
-int sd_bus_get_server_id(sd_bus *bus, sd_id128_t *server_id) {
+_public_ int sd_bus_get_server_id(sd_bus *bus, sd_id128_t *server_id) {
int r;
assert_return(bus, -EINVAL);
@@ -1339,7 +1339,7 @@ static int dispatch_rqueue(sd_bus *bus, sd_bus_message **m) {
return ret;
}
-int sd_bus_send(sd_bus *bus, sd_bus_message *m, uint64_t *serial) {
+_public_ int sd_bus_send(sd_bus *bus, sd_bus_message *m, uint64_t *serial) {
int r;
assert_return(bus, -EINVAL);
@@ -1440,7 +1440,7 @@ static int timeout_compare(const void *a, const void *b) {
return 0;
}
-int sd_bus_send_with_reply(
+_public_ int sd_bus_send_with_reply(
sd_bus *bus,
sd_bus_message *m,
sd_bus_message_handler_t callback,
@@ -1506,7 +1506,7 @@ int sd_bus_send_with_reply(
return r;
}
-int sd_bus_send_with_reply_cancel(sd_bus *bus, uint64_t serial) {
+_public_ int sd_bus_send_with_reply_cancel(sd_bus *bus, uint64_t serial) {
struct reply_callback *c;
assert_return(bus, -EINVAL);
@@ -1549,7 +1549,7 @@ int bus_ensure_running(sd_bus *bus) {
}
}
-int sd_bus_send_with_reply_and_block(
+_public_ int sd_bus_send_with_reply_and_block(
sd_bus *bus,
sd_bus_message *m,
uint64_t usec,
@@ -1671,7 +1671,7 @@ int sd_bus_send_with_reply_and_block(
}
}
-int sd_bus_get_fd(sd_bus *bus) {
+_public_ int sd_bus_get_fd(sd_bus *bus) {
assert_return(bus, -EINVAL);
assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
@@ -1681,7 +1681,7 @@ int sd_bus_get_fd(sd_bus *bus) {
return bus->input_fd;
}
-int sd_bus_get_events(sd_bus *bus) {
+_public_ int sd_bus_get_events(sd_bus *bus) {
int flags = 0;
assert_return(bus, -EINVAL);
@@ -1707,7 +1707,7 @@ int sd_bus_get_events(sd_bus *bus) {
return flags;
}
-int sd_bus_get_timeout(sd_bus *bus, uint64_t *timeout_usec) {
+_public_ int sd_bus_get_timeout(sd_bus *bus, uint64_t *timeout_usec) {
struct reply_callback *c;
assert_return(bus, -EINVAL);
@@ -2021,7 +2021,7 @@ null_message:
return r;
}
-int sd_bus_process(sd_bus *bus, sd_bus_message **ret) {
+_public_ int sd_bus_process(sd_bus *bus, sd_bus_message **ret) {
BUS_DONT_DESTROY(bus);
int r;
@@ -2126,7 +2126,7 @@ static int bus_poll(sd_bus *bus, bool need_more, uint64_t timeout_usec) {
return r > 0 ? 1 : 0;
}
-int sd_bus_wait(sd_bus *bus, uint64_t timeout_usec) {
+_public_ int sd_bus_wait(sd_bus *bus, uint64_t timeout_usec) {
assert_return(bus, -EINVAL);
assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
@@ -2138,7 +2138,7 @@ int sd_bus_wait(sd_bus *bus, uint64_t timeout_usec) {
return bus_poll(bus, false, timeout_usec);
}
-int sd_bus_flush(sd_bus *bus) {
+_public_ int sd_bus_flush(sd_bus *bus) {
int r;
assert_return(bus, -EINVAL);
@@ -2166,7 +2166,10 @@ int sd_bus_flush(sd_bus *bus) {
}
}
-int sd_bus_add_filter(sd_bus *bus, sd_bus_message_handler_t callback, void *userdata) {
+_public_ int sd_bus_add_filter(sd_bus *bus,
+ sd_bus_message_handler_t callback,
+ void *userdata) {
+
struct filter_callback *f;
assert_return(bus, -EINVAL);
@@ -2184,7 +2187,10 @@ int sd_bus_add_filter(sd_bus *bus, sd_bus_message_handler_t callback, void *user
return 0;
}
-int sd_bus_remove_filter(sd_bus *bus, sd_bus_message_handler_t callback, void *userdata) {
+_public_ int sd_bus_remove_filter(sd_bus *bus,
+ sd_bus_message_handler_t callback,
+ void *userdata) {
+
struct filter_callback *f;
assert_return(bus, -EINVAL);
@@ -2203,7 +2209,11 @@ int sd_bus_remove_filter(sd_bus *bus, sd_bus_message_handler_t callback, void *u
return 0;
}
-int sd_bus_add_match(sd_bus *bus, const char *match, sd_bus_message_handler_t callback, void *userdata) {
+_public_ int sd_bus_add_match(sd_bus *bus,
+ const char *match,
+ sd_bus_message_handler_t callback,
+ void *userdata) {
+
struct bus_match_component *components = NULL;
unsigned n_components = 0;
uint64_t cookie = 0;
@@ -2237,7 +2247,11 @@ finish:
return r;
}
-int sd_bus_remove_match(sd_bus *bus, const char *match, sd_bus_message_handler_t callback, void *userdata) {
+_public_ int sd_bus_remove_match(sd_bus *bus,
+ const char *match,
+ sd_bus_message_handler_t callback,
+ void *userdata) {
+
struct bus_match_component *components = NULL;
unsigned n_components = 0;
int r = 0, q = 0;
@@ -2352,7 +2366,7 @@ static int quit_callback(sd_event_source *event, void *userdata) {
return 1;
}
-int sd_bus_attach_event(sd_bus *bus, sd_event *event, int priority) {
+_public_ int sd_bus_attach_event(sd_bus *bus, sd_event *event, int priority) {
int r;
assert_return(bus, -EINVAL);
@@ -2406,7 +2420,7 @@ fail:
return r;
}
-int sd_bus_detach_event(sd_bus *bus) {
+_public_ int sd_bus_detach_event(sd_bus *bus) {
assert_return(bus, -EINVAL);
assert_return(bus->event, -ENXIO);
diff --git a/src/libsystemd-bus/sd-memfd.c b/src/libsystemd-bus/sd-memfd.c
index bd14da3..c229bec 100644
--- a/src/libsystemd-bus/sd-memfd.c
+++ b/src/libsystemd-bus/sd-memfd.c
@@ -34,7 +34,7 @@ struct sd_memfd {
FILE *f;
};
-int sd_memfd_new(sd_memfd **m) {
+_public_ int sd_memfd_new(sd_memfd **m) {
_cleanup_close_ int kdbus = -1;
sd_memfd *n;
int fd;
@@ -58,7 +58,7 @@ int sd_memfd_new(sd_memfd **m) {
return 0;
}
-int sd_memfd_make(int fd, sd_memfd **m) {
+_public_ int sd_memfd_make(int fd, sd_memfd **m) {
sd_memfd *n;
uint64_t sz;
@@ -81,7 +81,7 @@ int sd_memfd_make(int fd, sd_memfd **m) {
return 0;
}
-void sd_memfd_free(sd_memfd *m) {
+_public_ void sd_memfd_free(sd_memfd *m) {
if (!m)
return;
@@ -93,14 +93,14 @@ void sd_memfd_free(sd_memfd *m) {
free(m);
}
-int sd_memfd_get_fd(sd_memfd *m) {
+_public_ int sd_memfd_get_fd(sd_memfd *m) {
if (!m)
return -EINVAL;
return m->fd;
}
-int sd_memfd_get_file(sd_memfd *m, FILE **f) {
+_public_ int sd_memfd_get_file(sd_memfd *m, FILE **f) {
if (!m)
return -EINVAL;
if (!f)
@@ -116,7 +116,7 @@ int sd_memfd_get_file(sd_memfd *m, FILE **f) {
return 0;
}
-int sd_memfd_dup_fd(sd_memfd *m) {
+_public_ int sd_memfd_dup_fd(sd_memfd *m) {
int fd;
if (!m)
@@ -129,7 +129,7 @@ int sd_memfd_dup_fd(sd_memfd *m) {
return fd;
}
-int sd_memfd_map(sd_memfd *m, uint64_t offset, size_t size, void **p) {
+_public_ int sd_memfd_map(sd_memfd *m, uint64_t offset, size_t size, void **p) {
void *q;
int sealed;
@@ -152,7 +152,7 @@ int sd_memfd_map(sd_memfd *m, uint64_t offset, size_t size, void **p) {
return 0;
}
-int sd_memfd_set_sealed(sd_memfd *m, int b) {
+_public_ int sd_memfd_set_sealed(sd_memfd *m, int b) {
int r;
if (!m)
@@ -165,7 +165,7 @@ int sd_memfd_set_sealed(sd_memfd *m, int b) {
return 0;
}
-int sd_memfd_get_sealed(sd_memfd *m) {
+_public_ int sd_memfd_get_sealed(sd_memfd *m) {
int r, b;
if (!m)
@@ -178,7 +178,7 @@ int sd_memfd_get_sealed(sd_memfd *m) {
return !!b;
}
-int sd_memfd_get_size(sd_memfd *m, uint64_t *sz) {
+_public_ int sd_memfd_get_size(sd_memfd *m, uint64_t *sz) {
int r;
if (!m)
@@ -193,7 +193,7 @@ int sd_memfd_get_size(sd_memfd *m, uint64_t *sz) {
return r;
}
-int sd_memfd_set_size(sd_memfd *m, uint64_t sz) {
+_public_ int sd_memfd_set_size(sd_memfd *m, uint64_t sz) {
int r;
if (!m)
@@ -206,7 +206,7 @@ int sd_memfd_set_size(sd_memfd *m, uint64_t sz) {
return r;
}
-int sd_memfd_new_and_map(sd_memfd **m, size_t sz, void **p) {
+_public_ int sd_memfd_new_and_map(sd_memfd **m, size_t sz, void **p) {
sd_memfd *n;
int r;
commit 34a6778fb9d1065f3fbb8e2243b9f0f25d1d18f1
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Wed Oct 30 23:32:27 2013 -0400
machinectl: use initialization instead of zeroing
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index 894309c..c48abcd 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -409,11 +409,14 @@ static int openpt_in_namespace(pid_t pid, int flags) {
_cleanup_close_ int nsfd = -1, rootfd = -1;
_cleanup_free_ char *ns = NULL, *root = NULL;
_cleanup_close_pipe_ int sock[2] = { -1, -1 };
- struct msghdr mh;
union {
struct cmsghdr cmsghdr;
uint8_t buf[CMSG_SPACE(sizeof(int))];
- } control;
+ } control = {};
+ struct msghdr mh = {
+ .msg_control = &control,
+ .msg_controllen = sizeof(control),
+ };
struct cmsghdr *cmsg;
int master = -1, r;
pid_t child;
@@ -438,11 +441,6 @@ static int openpt_in_namespace(pid_t pid, int flags) {
if (socketpair(AF_UNIX, SOCK_DGRAM, 0, sock) < 0)
return -errno;
- zero(control);
- zero(mh);
- mh.msg_control = &control;
- mh.msg_controllen = sizeof(control);
-
child = fork();
if (child < 0)
return -errno;
commit 97123e532d87fab09e301c8106e878482911c6f1
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Wed Oct 30 23:03:28 2013 -0400
efi-boot-generator: simplify
diff --git a/src/efi-boot-generator/efi-boot-generator.c b/src/efi-boot-generator/efi-boot-generator.c
index e20d325..0e26662 100644
--- a/src/efi-boot-generator/efi-boot-generator.c
+++ b/src/efi-boot-generator/efi-boot-generator.c
@@ -33,8 +33,9 @@ static const char *arg_dest = "/tmp";
int main(int argc, char *argv[]) {
int r = EXIT_SUCCESS;
sd_id128_t id;
- _cleanup_free_ char *name = NULL, *what = NULL, *fsck = NULL;
- _cleanup_fclose_ FILE *f = NULL;
+ _cleanup_free_ char *what = NULL, *fsck = NULL;
+ char *name;
+ _cleanup_fclose_ FILE *f = NULL, *f2 = NULL;
if (argc > 1 && argc != 4) {
log_error("This program takes three or no arguments.");
@@ -64,12 +65,7 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE;
}
- name = strjoin(arg_dest, "/boot.mount", NULL);
- if (!name) {
- log_oom();
- return EXIT_FAILURE;
- }
-
+ name = strappenda(arg_dest, "/boot.mount");
f = fopen(name, "wxe");
if (!f) {
log_error("Failed to create mount unit file %s: %m", name);
@@ -103,16 +99,9 @@ int main(int argc, char *argv[]) {
"Options=umask=0077\n",
fsck, fsck, what);
- free(name);
- name = strjoin(arg_dest, "/boot.automount", NULL);
- if (!name) {
- log_oom();
- return EXIT_FAILURE;
- }
-
- fclose(f);
- f = fopen(name, "wxe");
- if (!f) {
+ name = strappenda(arg_dest, "/boot.automount");
+ f2 = fopen(name, "wxe");
+ if (!f2) {
log_error("Failed to create automount unit file %s: %m", name);
return EXIT_FAILURE;
}
@@ -121,15 +110,9 @@ int main(int argc, char *argv[]) {
"[Unit]\n"
"Description=EFI System Partition Automount\n\n"
"[Automount]\n"
- "Where=/boot\n", f);
-
- free(name);
- name = strjoin(arg_dest, "/local-fs.target.wants/boot.automount", NULL);
- if (!name) {
- log_oom();
- return EXIT_FAILURE;
- }
+ "Where=/boot\n", f2);
+ name = strappenda(arg_dest, "/local-fs.target.wants/boot.automount");
mkdir_parents(name, 0755);
if (symlink("../boot.automount", name) < 0) {
@@ -137,5 +120,5 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE;
}
- return 0;
+ return EXIT_SUCCESS;
}
More information about the systemd-commits
mailing list