chiark / gitweb /
Prep v230: Apply missing upstream fixes and updates (5/8) src/libelogind.
authorSven Eden <yamakuzure@gmx.net>
Wed, 31 May 2017 05:39:59 +0000 (07:39 +0200)
committerSven Eden <yamakuzure@gmx.net>
Fri, 16 Jun 2017 08:12:58 +0000 (10:12 +0200)
13 files changed:
src/libelogind/libelogind.sym
src/libelogind/sd-bus/bus-common-errors.h
src/libelogind/sd-bus/bus-introspect.c
src/libelogind/sd-bus/bus-kernel.c
src/libelogind/sd-bus/bus-match.c
src/libelogind/sd-bus/bus-message.c
src/libelogind/sd-bus/bus-track.c
src/libelogind/sd-bus/sd-bus.c
src/libelogind/sd-daemon/sd-daemon.c
src/libelogind/sd-event/sd-event.c
src/libelogind/sd-id128/sd-id128.c
src/libelogind/sd-login/sd-login.c
src/libelogind/sd-login/test-login.c

index 5e80140..abdcafc 100644 (file)
@@ -498,3 +498,12 @@ global:
  *         sd_journal_restart_fields;
  * } LIBSYSTEMD_227;
 */
+
+/*
+ * These methods are not needed by elogind.
+ * LIBSYSTEMD_230 {
+ * global:
+ *         sd_journal_open_directory_fd;
+ *         sd_journal_open_files_fd;
+ * } LIBSYSTEMD_229;
+*/
index 4648349..c8f369c 100644 (file)
@@ -34,6 +34,8 @@
 #define BUS_ERROR_TRANSACTION_ORDER_IS_CYCLIC "org.freedesktop.systemd1.TransactionOrderIsCyclic"
 #define BUS_ERROR_TRANSACTION_IS_DESTRUCTIVE "org.freedesktop.systemd1.TransactionIsDestructive"
 #define BUS_ERROR_UNIT_MASKED "org.freedesktop.systemd1.UnitMasked"
+#define BUS_ERROR_UNIT_GENERATED "org.freedesktop.systemd1.UnitGenerated"
+#define BUS_ERROR_UNIT_LINKED "org.freedesktop.systemd1.UnitLinked"
 #define BUS_ERROR_JOB_TYPE_NOT_APPLICABLE "org.freedesktop.systemd1.JobTypeNotApplicable"
 #define BUS_ERROR_NO_ISOLATION "org.freedesktop.systemd1.NoIsolation"
 #define BUS_ERROR_SHUTTING_DOWN "org.freedesktop.systemd1.ShuttingDown"
index 8f93edb..f711300 100644 (file)
@@ -83,7 +83,7 @@ static void introspect_write_flags(struct introspect *i, int type, int flags) {
 
         if (type == _SD_BUS_VTABLE_PROPERTY || type == _SD_BUS_VTABLE_WRITABLE_PROPERTY) {
                 if (flags & SD_BUS_VTABLE_PROPERTY_EXPLICIT)
-                        fputs("   <annotation name=\"org.freedesktop.systemd1.Explicit\" value=\"true\"/>\n", i->f);
+                        fputs("   <annotation name=\"org.freedesktop.elogind.Explicit\" value=\"true\"/>\n", i->f);
 
                 if (flags & SD_BUS_VTABLE_PROPERTY_CONST)
                         fputs("   <annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"const\"/>\n", i->f);
@@ -96,7 +96,7 @@ static void introspect_write_flags(struct introspect *i, int type, int flags) {
         if (!i->trusted &&
             (type == _SD_BUS_VTABLE_METHOD || type == _SD_BUS_VTABLE_WRITABLE_PROPERTY) &&
             !(flags & SD_BUS_VTABLE_UNPRIVILEGED))
-                fputs("   <annotation name=\"org.freedesktop.systemd1.Privileged\" value=\"true\"/>\n", i->f);
+                fputs("   <annotation name=\"org.freedesktop.elogind.Privileged\" value=\"true\"/>\n", i->f);
 }
 
 static int introspect_write_arguments(struct introspect *i, const char *signature, const char *direction) {
index 7886e3a..5db011b 100644 (file)
@@ -1695,52 +1695,6 @@ int bus_kernel_open_bus_fd(const char *bus, char **path) {
         return fd;
 }
 
-#if 0 /// UNNEEDED by elogind
-int bus_kernel_create_endpoint(const char *bus_name, const char *ep_name, char **ep_path) {
-        _cleanup_free_ char *path = NULL;
-        struct kdbus_cmd *make;
-        struct kdbus_item *n;
-        const char *name;
-        int fd;
-
-        fd = bus_kernel_open_bus_fd(bus_name, &path);
-        if (fd < 0)
-                return fd;
-
-        make = alloca0_align(ALIGN8(offsetof(struct kdbus_cmd, items)) +
-                             ALIGN8(offsetof(struct kdbus_item, str) + DECIMAL_STR_MAX(uid_t) + 1 + strlen(ep_name) + 1),
-                             8);
-        make->size = ALIGN8(offsetof(struct kdbus_cmd, items));
-        make->flags = KDBUS_MAKE_ACCESS_WORLD;
-
-        n = make->items;
-        sprintf(n->str, UID_FMT "-%s", getuid(), ep_name);
-        n->size = offsetof(struct kdbus_item, str) + strlen(n->str) + 1;
-        n->type = KDBUS_ITEM_MAKE_NAME;
-        make->size += ALIGN8(n->size);
-        name = n->str;
-
-        if (ioctl(fd, KDBUS_CMD_ENDPOINT_MAKE, make) < 0) {
-                safe_close(fd);
-                return -errno;
-        }
-
-        if (ep_path) {
-                char *p;
-
-                p = strjoin(dirname(path), "/", name, NULL);
-                if (!p) {
-                        safe_close(fd);
-                        return -ENOMEM;
-                }
-
-                *ep_path = p;
-        }
-
-        return fd;
-}
-#endif // 0
-
 int bus_kernel_try_close(sd_bus *bus) {
         struct kdbus_cmd byebye = { .size = sizeof(byebye) };
 
index feb4ce8..dda0b5c 100644 (file)
@@ -940,7 +940,7 @@ char *bus_match_to_string(struct bus_match_component *components, unsigned n_com
         char *buffer = NULL;
         size_t size = 0;
         unsigned i;
-               int r;
+        int r;
 
         if (n_components <= 0)
                 return strdup("");
index fb3311c..d4f5911 100644 (file)
@@ -5676,8 +5676,8 @@ int bus_message_get_arg(sd_bus_message *m, unsigned i, const char **str) {
         assert(str);
 
         r = bus_message_get_arg_skip(m, i, &type, NULL);
-                if (r < 0)
-                        return r;
+        if (r < 0)
+                return r;
 
         if (!IN_SET(type, SD_BUS_TYPE_STRING, SD_BUS_TYPE_OBJECT_PATH, SD_BUS_TYPE_SIGNATURE))
                 return -ENXIO;
@@ -5694,8 +5694,8 @@ int bus_message_get_arg_strv(sd_bus_message *m, unsigned i, char ***strv) {
         assert(strv);
 
         r = bus_message_get_arg_skip(m, i, &type, &contents);
-                if (r < 0)
-                        return r;
+        if (r < 0)
+                return r;
 
         if (type != SD_BUS_TYPE_ARRAY)
                 return -ENXIO;
index 0d01f9d..b2e5623 100644 (file)
@@ -24,7 +24,6 @@
 #include "bus-track.h"
 #include "bus-util.h"
 
-
 struct sd_bus_track {
         unsigned n_ref;
         sd_bus *bus;
index 8a5cd38..c35bd5a 100644 (file)
@@ -1172,7 +1172,7 @@ _public_ int sd_bus_open(sd_bus **ret) {
                         return sd_bus_open_user(ret);
                 else
 #endif // 0
-                return sd_bus_open_system(ret);
+                        return sd_bus_open_system(ret);
         }
 
         r = sd_bus_new(&b);
@@ -2074,8 +2074,8 @@ _public_ int sd_bus_call(
 
                                 } else if (incoming->header->type == SD_BUS_MESSAGE_METHOD_ERROR) {
                                         r = sd_bus_error_copy(error, &incoming->error);
-                                sd_bus_message_unref(incoming);
-                                return r;
+                                        sd_bus_message_unref(incoming);
+                                        return r;
                                 } else {
                                         r = -EIO;
                                         goto fail;
@@ -3435,7 +3435,7 @@ _public_ int sd_bus_default(sd_bus **ret) {
                 return sd_bus_default_user(ret);
         else
 #endif // 0
-        return sd_bus_default_system(ret);
+                return sd_bus_default_system(ret);
 }
 
 #if 0 /// UNNEEDED by elogind
index 4481640..85edfea 100644 (file)
@@ -103,7 +103,7 @@ _public_ int sd_listen_fds(int unset_environment) {
 finish:
         unsetenv_all(unset_environment);
         return r;
-        }
+}
 
 _public_ int sd_listen_fds_with_names(int unset_environment, char ***names) {
         _cleanup_strv_free_ char **l = NULL;
@@ -137,8 +137,8 @@ _public_ int sd_listen_fds_with_names(int unset_environment, char ***names) {
         } else {
                 r = strv_extend_n(&l, "unknown", n_fds);
                 if (r < 0)
-        return r;
-}
+                        return r;
+        }
 
         *names = l;
         l = NULL;
index d76f01b..192dc0e 100644 (file)
@@ -649,7 +649,7 @@ static int event_make_signal_data(
                 if (sigismember(&d->sigset, sig) > 0) {
                         if (ret)
                                 *ret = d;
-                return 0;
+                        return 0;
                 }
         } else {
                 r = hashmap_ensure_allocated(&e->signal_data, &uint64_hash_ops);
@@ -696,7 +696,7 @@ static int event_make_signal_data(
         ev.data.ptr = d;
 
         r = epoll_ctl(e->epoll_fd, EPOLL_CTL_ADD, d->fd, &ev);
-        if (r < 0) {
+        if (r < 0)  {
                 r = -errno;
                 goto fail;
         }
@@ -953,7 +953,7 @@ static sd_event_source *source_new(sd_event *e, bool floating, EventSourceType t
                 sd_event_ref(e);
 
         LIST_PREPEND(sources, e->sources, s);
-        e->n_sources ++;
+        e->n_sources++;
 
         return s;
 }
@@ -1184,10 +1184,10 @@ _public_ int sd_event_add_signal(
         e->signal_sources[sig] = s;
 
         r = event_make_signal_data(e, sig, &d);
-                if (r < 0) {
-                        source_free(s);
-                        return r;
-                }
+        if (r < 0) {
+                source_free(s);
+                return r;
+        }
 
         /* Use the signal name as description for the event source by default */
         (void) sd_event_source_set_description(s, signal_to_string(sig));
@@ -1241,14 +1241,14 @@ _public_ int sd_event_add_child(
                 return r;
         }
 
-        e->n_enabled_child_sources ++;
+        e->n_enabled_child_sources++;
 
         r = event_make_signal_data(e, SIGCHLD, NULL);
-                if (r < 0) {
+        if (r < 0) {
                 e->n_enabled_child_sources--;
-                        source_free(s);
-                        return r;
-                }
+                source_free(s);
+                return r;
+        }
 
         e->need_process_child = true;
 
@@ -1585,7 +1585,7 @@ _public_ int sd_event_source_set_priority(sd_event_source *s, int64_t priority)
 
                 event_unmask_signal_data(s->event, old, s->signal.sig);
         } else
-        s->priority = priority;
+                s->priority = priority;
 
         if (s->pending)
                 prioq_reshuffle(s->event->pending, s, &s->pending_index);
@@ -1713,11 +1713,11 @@ _public_ int sd_event_source_set_enabled(sd_event_source *s, int m) {
                         s->enabled = m;
 
                         r = event_make_signal_data(s->event, s->signal.sig, NULL);
-                                if (r < 0) {
-                                        s->enabled = SD_EVENT_OFF;
+                        if (r < 0) {
+                                s->enabled = SD_EVENT_OFF;
                                 event_gc_signal_data(s->event, &s->priority, s->signal.sig);
-                                        return r;
-                                }
+                                return r;
+                        }
 
                         break;
 
@@ -1729,12 +1729,12 @@ _public_ int sd_event_source_set_enabled(sd_event_source *s, int m) {
                         s->enabled = m;
 
                         r = event_make_signal_data(s->event, SIGCHLD, NULL);
-                                        if (r < 0) {
-                                                s->enabled = SD_EVENT_OFF;
+                        if (r < 0) {
+                                s->enabled = SD_EVENT_OFF;
                                 s->event->n_enabled_child_sources--;
                                 event_gc_signal_data(s->event, &s->priority, SIGCHLD);
-                                                return r;
-                                        }
+                                return r;
+                        }
 
                         break;
 
@@ -2564,7 +2564,7 @@ _public_ int sd_event_wait(sd_event *e, uint64_t timeout) {
                         switch (*t) {
 
                         case WAKEUP_EVENT_SOURCE:
-                        r = process_io(e, ev_queue[i].data.ptr, ev_queue[i].events);
+                                r = process_io(e, ev_queue[i].data.ptr, ev_queue[i].events);
                                 break;
 
                         case WAKEUP_CLOCK_DATA: {
index 81bd842..d9c0116 100644 (file)
@@ -27,7 +27,7 @@
 #include "hexdecoct.h"
 #include "io-util.h"
 #include "macro.h"
- #include "random-util.h"
+#include "random-util.h"
 #include "util.h"
 
 _public_ char *sd_id128_to_string(sd_id128_t id, char s[SD_ID128_STRING_MAX]) {
index a0bd299..e7f6143 100644 (file)
@@ -378,7 +378,7 @@ static int file_of_seat(const char *seat, char **_p) {
                 if (!filename_is_valid(seat))
                         return -EINVAL;
 
-        p = strappend("/run/systemd/seats/", seat);
+                p = strappend("/run/systemd/seats/", seat);
         } else {
                 _cleanup_free_ char *buf = NULL;
 
@@ -442,10 +442,10 @@ static int uid_get_array(uid_t uid, const char *variable, char ***array) {
 
         r = parse_env_file(p, NEWLINE, variable, &s, NULL);
         if (r == -ENOENT || (r >= 0 && isempty(s))) {
-                        if (array)
-                                *array = NULL;
-                        return 0;
-                }
+                if (array)
+                        *array = NULL;
+                return 0;
+        }
         if (r < 0)
                 return r;
 
index 9e24ab9..c1fd7dd 100644 (file)
@@ -25,7 +25,6 @@
 #include "alloc-util.h"
 #include "fd-util.h"
 #include "formats-util.h"
-#include "musl_missing.h"
 #include "string-util.h"
 #include "strv.h"
 #include "util.h"
@@ -256,7 +255,6 @@ static void test_login(void) {
 }
 
 int main(int argc, char* argv[]) {
-        elogind_set_program_name(argv[0]);
         log_parse_environment();
         log_open();