summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libelogind/libelogind.pc.in4
-rw-r--r--src/libelogind/libelogind.sym46
-rw-r--r--src/libelogind/sd-bus/bus-bloom.c1
-rw-r--r--src/libelogind/sd-bus/bus-bloom.h1
-rw-r--r--src/libelogind/sd-bus/bus-common-errors.c1
-rw-r--r--src/libelogind/sd-bus/bus-common-errors.h1
-rw-r--r--src/libelogind/sd-bus/bus-container.c1
-rw-r--r--src/libelogind/sd-bus/bus-container.h1
-rw-r--r--src/libelogind/sd-bus/bus-control.c1
-rw-r--r--src/libelogind/sd-bus/bus-control.h1
-rw-r--r--src/libelogind/sd-bus/bus-convenience.c1
-rw-r--r--src/libelogind/sd-bus/bus-creds.c1
-rw-r--r--src/libelogind/sd-bus/bus-creds.h1
-rw-r--r--src/libelogind/sd-bus/bus-error.c1
-rw-r--r--src/libelogind/sd-bus/bus-error.h1
-rw-r--r--src/libelogind/sd-bus/bus-gvariant.c1
-rw-r--r--src/libelogind/sd-bus/bus-gvariant.h1
-rw-r--r--src/libelogind/sd-bus/bus-internal.c1
-rw-r--r--src/libelogind/sd-bus/bus-internal.h1
-rw-r--r--src/libelogind/sd-bus/bus-introspect.c43
-rw-r--r--src/libelogind/sd-bus/bus-introspect.h1
-rw-r--r--src/libelogind/sd-bus/bus-kernel.c1
-rw-r--r--src/libelogind/sd-bus/bus-kernel.h1
-rw-r--r--src/libelogind/sd-bus/bus-match.c19
-rw-r--r--src/libelogind/sd-bus/bus-match.h1
-rw-r--r--src/libelogind/sd-bus/bus-message.c89
-rw-r--r--src/libelogind/sd-bus/bus-message.h2
-rw-r--r--src/libelogind/sd-bus/bus-objects.c5
-rw-r--r--src/libelogind/sd-bus/bus-objects.h1
-rw-r--r--src/libelogind/sd-bus/bus-protocol.h1
-rw-r--r--src/libelogind/sd-bus/bus-signature.c1
-rw-r--r--src/libelogind/sd-bus/bus-signature.h1
-rw-r--r--src/libelogind/sd-bus/bus-slot.c1
-rw-r--r--src/libelogind/sd-bus/bus-slot.h1
-rw-r--r--src/libelogind/sd-bus/bus-socket.c6
-rw-r--r--src/libelogind/sd-bus/bus-socket.h1
-rw-r--r--src/libelogind/sd-bus/bus-track.c3
-rw-r--r--src/libelogind/sd-bus/bus-track.h1
-rw-r--r--src/libelogind/sd-bus/bus-type.c1
-rw-r--r--src/libelogind/sd-bus/bus-type.h1
-rw-r--r--src/libelogind/sd-bus/sd-bus.c5
-rw-r--r--src/libelogind/sd-bus/test-bus-error.c1
-rw-r--r--src/libelogind/sd-bus/test-bus-introspect.c1
-rw-r--r--src/libelogind/sd-bus/test-bus-match.c3
-rw-r--r--src/libelogind/sd-bus/test-bus-server.c1
-rw-r--r--src/libelogind/sd-bus/test-bus-signature.c1
-rw-r--r--src/libelogind/sd-daemon/sd-daemon.c1
-rw-r--r--src/libelogind/sd-event/sd-event.c1
-rw-r--r--src/libelogind/sd-event/test-event.c1
-rw-r--r--src/libelogind/sd-id128/id128-util.c1
-rw-r--r--src/libelogind/sd-id128/id128-util.h1
-rw-r--r--src/libelogind/sd-id128/sd-id128.c1
-rw-r--r--src/libelogind/sd-login/sd-login.c1
-rw-r--r--src/libelogind/sd-login/test-login.c1
54 files changed, 179 insertions, 89 deletions
diff --git a/src/libelogind/libelogind.pc.in b/src/libelogind/libelogind.pc.in
index 015cb721f..382a4157d 100644
--- a/src/libelogind/libelogind.pc.in
+++ b/src/libelogind/libelogind.pc.in
@@ -1,6 +1,8 @@
# This file is part of elogind.
+# SPDX-License-Identifier: LGPL-2.1+
#
# elogind 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.
@@ -8,7 +10,7 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@rootlibdir@
-includedir=@includedir@/elogind
+includedir=@includedir@
Name: elogind
Description: elogind Library
diff --git a/src/libelogind/libelogind.sym b/src/libelogind/libelogind.sym
index bc5a53daa..c221ec070 100644
--- a/src/libelogind/libelogind.sym
+++ b/src/libelogind/libelogind.sym
@@ -1,4 +1,6 @@
/***
+ SPDX-License-Identifier: LGPL-2.1+
+
This file is part of systemd.
systemd is free software; you can redistribute it and/or modify it
@@ -482,30 +484,30 @@ global:
sd_listen_fds_with_names;
} LIBSYSTEMD_226;
-/*
- * These methods are not needed by elogind.
- * LIBSYSTEMD_229 {
- * global:
- * sd_journal_has_runtime_files;
- * sd_journal_has_persistent_files;
- * sd_journal_enumerate_fields;
- * 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;
-*/
-
+/** if 0 /// UNNEEDED by elogind
+ * LIBSYSTEMD_229 {
+ * global:
+ * sd_journal_has_runtime_files;
+ * sd_journal_has_persistent_files;
+ * sd_journal_enumerate_fields;
+ * sd_journal_restart_fields;
+ * } LIBSYSTEMD_227;
+ *
+ * LIBSYSTEMD_230 {
+ * global:
+ * sd_journal_open_directory_fd;
+ * sd_journal_open_files_fd;
+ * } LIBSYSTEMD_229;
+ endif **/
LIBSYSTEMD_231 {
global:
sd_event_get_iteration;
+/** if 0 /// Previous blocks unused by elogind
+ * } LIBSYSTEMD_230;
+ * else **/
} LIBSYSTEMD_227;
+/** endif **/
LIBSYSTEMD_232 {
global:
@@ -528,3 +530,9 @@ LIBSYSTEMD_234 {
global:
sd_bus_message_appendv;
} LIBSYSTEMD_233;
+
+LIBSYSTEMD_236 {
+global:
+ sd_bus_message_new;
+ sd_bus_message_seal;
+} LIBSYSTEMD_234;
diff --git a/src/libelogind/sd-bus/bus-bloom.c b/src/libelogind/sd-bus/bus-bloom.c
index 112769fcb..ebda6516e 100644
--- a/src/libelogind/sd-bus/bus-bloom.c
+++ b/src/libelogind/sd-bus/bus-bloom.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-bus/bus-bloom.h b/src/libelogind/sd-bus/bus-bloom.h
index c824622b9..265076214 100644
--- a/src/libelogind/sd-bus/bus-bloom.h
+++ b/src/libelogind/sd-bus/bus-bloom.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
diff --git a/src/libelogind/sd-bus/bus-common-errors.c b/src/libelogind/sd-bus/bus-common-errors.c
index a6d38b982..da67f68a7 100644
--- a/src/libelogind/sd-bus/bus-common-errors.c
+++ b/src/libelogind/sd-bus/bus-common-errors.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-bus/bus-common-errors.h b/src/libelogind/sd-bus/bus-common-errors.h
index 2a5892b0e..496c882fb 100644
--- a/src/libelogind/sd-bus/bus-common-errors.h
+++ b/src/libelogind/sd-bus/bus-common-errors.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
diff --git a/src/libelogind/sd-bus/bus-container.c b/src/libelogind/sd-bus/bus-container.c
index 9827a4226..8f6d34838 100644
--- a/src/libelogind/sd-bus/bus-container.c
+++ b/src/libelogind/sd-bus/bus-container.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-bus/bus-container.h b/src/libelogind/sd-bus/bus-container.h
index 35952d925..6921ffd52 100644
--- a/src/libelogind/sd-bus/bus-container.h
+++ b/src/libelogind/sd-bus/bus-container.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
diff --git a/src/libelogind/sd-bus/bus-control.c b/src/libelogind/sd-bus/bus-control.c
index fcd4d27e0..12478e7cc 100644
--- a/src/libelogind/sd-bus/bus-control.c
+++ b/src/libelogind/sd-bus/bus-control.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-bus/bus-control.h b/src/libelogind/sd-bus/bus-control.h
index 01c71874d..c9d434c60 100644
--- a/src/libelogind/sd-bus/bus-control.h
+++ b/src/libelogind/sd-bus/bus-control.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
diff --git a/src/libelogind/sd-bus/bus-convenience.c b/src/libelogind/sd-bus/bus-convenience.c
index e171c53e2..9d3b59642 100644
--- a/src/libelogind/sd-bus/bus-convenience.c
+++ b/src/libelogind/sd-bus/bus-convenience.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-bus/bus-creds.c b/src/libelogind/sd-bus/bus-creds.c
index fcc3b5016..add32c6b2 100644
--- a/src/libelogind/sd-bus/bus-creds.c
+++ b/src/libelogind/sd-bus/bus-creds.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-bus/bus-creds.h b/src/libelogind/sd-bus/bus-creds.h
index df8a1f100..c4c60fa2d 100644
--- a/src/libelogind/sd-bus/bus-creds.h
+++ b/src/libelogind/sd-bus/bus-creds.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
diff --git a/src/libelogind/sd-bus/bus-error.c b/src/libelogind/sd-bus/bus-error.c
index 378f7a377..c9517499d 100644
--- a/src/libelogind/sd-bus/bus-error.c
+++ b/src/libelogind/sd-bus/bus-error.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-bus/bus-error.h b/src/libelogind/sd-bus/bus-error.h
index e2c4cf4b3..6181e37d8 100644
--- a/src/libelogind/sd-bus/bus-error.h
+++ b/src/libelogind/sd-bus/bus-error.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
diff --git a/src/libelogind/sd-bus/bus-gvariant.c b/src/libelogind/sd-bus/bus-gvariant.c
index 58782767f..6a990a02c 100644
--- a/src/libelogind/sd-bus/bus-gvariant.c
+++ b/src/libelogind/sd-bus/bus-gvariant.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-bus/bus-gvariant.h b/src/libelogind/sd-bus/bus-gvariant.h
index 6da637fb0..474e13156 100644
--- a/src/libelogind/sd-bus/bus-gvariant.h
+++ b/src/libelogind/sd-bus/bus-gvariant.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
diff --git a/src/libelogind/sd-bus/bus-internal.c b/src/libelogind/sd-bus/bus-internal.c
index aca2225ea..a53b52a98 100644
--- a/src/libelogind/sd-bus/bus-internal.c
+++ b/src/libelogind/sd-bus/bus-internal.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-bus/bus-internal.h b/src/libelogind/sd-bus/bus-internal.h
index 6f909aa42..96474e9a3 100644
--- a/src/libelogind/sd-bus/bus-internal.h
+++ b/src/libelogind/sd-bus/bus-internal.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
diff --git a/src/libelogind/sd-bus/bus-introspect.c b/src/libelogind/sd-bus/bus-introspect.c
index 9fcb59631..205bcee8f 100644
--- a/src/libelogind/sd-bus/bus-introspect.c
+++ b/src/libelogind/sd-bus/bus-introspect.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
@@ -17,6 +18,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <stdio_ext.h>
+
#include "bus-internal.h"
#include "bus-introspect.h"
#include "bus-protocol.h"
@@ -36,8 +39,10 @@ int introspect_begin(struct introspect *i, bool trusted) {
if (!i->f)
return -ENOMEM;
- fputs_unlocked(BUS_INTROSPECT_DOCTYPE
- "<node>\n", i->f);
+ (void) __fsetlocking(i->f, FSETLOCKING_BYCALLER);
+
+ fputs(BUS_INTROSPECT_DOCTYPE
+ "<node>\n", i->f);
return 0;
}
@@ -45,12 +50,12 @@ int introspect_begin(struct introspect *i, bool trusted) {
int introspect_write_default_interfaces(struct introspect *i, bool object_manager) {
assert(i);
- fputs_unlocked(BUS_INTROSPECT_INTERFACE_PEER
- BUS_INTROSPECT_INTERFACE_INTROSPECTABLE
- BUS_INTROSPECT_INTERFACE_PROPERTIES, i->f);
+ fputs(BUS_INTROSPECT_INTERFACE_PEER
+ BUS_INTROSPECT_INTERFACE_INTROSPECTABLE
+ BUS_INTROSPECT_INTERFACE_PROPERTIES, i->f);
if (object_manager)
- fputs_unlocked(BUS_INTROSPECT_INTERFACE_OBJECT_MANAGER, i->f);
+ fputs(BUS_INTROSPECT_INTERFACE_OBJECT_MANAGER, i->f);
return 0;
}
@@ -76,27 +81,27 @@ int introspect_write_child_nodes(struct introspect *i, Set *s, const char *prefi
static void introspect_write_flags(struct introspect *i, int type, int flags) {
if (flags & SD_BUS_VTABLE_DEPRECATED)
- fputs_unlocked(" <annotation name=\"org.freedesktop.DBus.Deprecated\" value=\"true\"/>\n", i->f);
+ fputs(" <annotation name=\"org.freedesktop.DBus.Deprecated\" value=\"true\"/>\n", i->f);
if (type == _SD_BUS_VTABLE_METHOD && (flags & SD_BUS_VTABLE_METHOD_NO_REPLY))
- fputs_unlocked(" <annotation name=\"org.freedesktop.DBus.Method.NoReply\" value=\"true\"/>\n", i->f);
+ fputs(" <annotation name=\"org.freedesktop.DBus.Method.NoReply\" value=\"true\"/>\n", i->f);
if (IN_SET(type, _SD_BUS_VTABLE_PROPERTY, _SD_BUS_VTABLE_WRITABLE_PROPERTY)) {
if (flags & SD_BUS_VTABLE_PROPERTY_EXPLICIT)
- fputs_unlocked(" <annotation name=\"org.freedesktop.systemd1.Explicit\" value=\"true\"/>\n", i->f);
+ fputs(" <annotation name=\"org.freedesktop.elogind1.Explicit\" value=\"true\"/>\n", i->f);
if (flags & SD_BUS_VTABLE_PROPERTY_CONST)
- fputs_unlocked(" <annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"const\"/>\n", i->f);
+ fputs(" <annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"const\"/>\n", i->f);
else if (flags & SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION)
- fputs_unlocked(" <annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"invalidates\"/>\n", i->f);
+ fputs(" <annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"invalidates\"/>\n", i->f);
else if (!(flags & SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE))
- fputs_unlocked(" <annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"false\"/>\n", i->f);
+ fputs(" <annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"false\"/>\n", i->f);
}
if (!i->trusted &&
IN_SET(type, _SD_BUS_VTABLE_METHOD, _SD_BUS_VTABLE_WRITABLE_PROPERTY) &&
!(flags & SD_BUS_VTABLE_UNPRIVILEGED))
- fputs_unlocked(" <annotation name=\"org.freedesktop.systemd1.Privileged\" value=\"true\"/>\n", i->f);
+ fputs(" <annotation name=\"org.freedesktop.elogind1.Privileged\" value=\"true\"/>\n", i->f);
}
static int introspect_write_arguments(struct introspect *i, const char *signature, const char *direction) {
@@ -117,7 +122,7 @@ static int introspect_write_arguments(struct introspect *i, const char *signatur
if (direction)
fprintf(i->f, " direction=\"%s\"/>\n", direction);
else
- fputs_unlocked("/>\n", i->f);
+ fputs("/>\n", i->f);
signature += l;
}
@@ -140,7 +145,7 @@ int introspect_write_interface(struct introspect *i, const sd_bus_vtable *v) {
case _SD_BUS_VTABLE_START:
if (v->flags & SD_BUS_VTABLE_DEPRECATED)
- fputs_unlocked(" <annotation name=\"org.freedesktop.DBus.Deprecated\" value=\"true\"/>\n", i->f);
+ fputs(" <annotation name=\"org.freedesktop.DBus.Deprecated\" value=\"true\"/>\n", i->f);
break;
case _SD_BUS_VTABLE_METHOD:
@@ -148,7 +153,7 @@ int introspect_write_interface(struct introspect *i, const sd_bus_vtable *v) {
introspect_write_arguments(i, strempty(v->x.method.signature), "in");
introspect_write_arguments(i, strempty(v->x.method.result), "out");
introspect_write_flags(i, v->type, v->flags);
- fputs_unlocked(" </method>\n", i->f);
+ fputs(" </method>\n", i->f);
break;
case _SD_BUS_VTABLE_PROPERTY:
@@ -158,14 +163,14 @@ int introspect_write_interface(struct introspect *i, const sd_bus_vtable *v) {
v->x.property.signature,
v->type == _SD_BUS_VTABLE_WRITABLE_PROPERTY ? "readwrite" : "read");
introspect_write_flags(i, v->type, v->flags);
- fputs_unlocked(" </property>\n", i->f);
+ fputs(" </property>\n", i->f);
break;
case _SD_BUS_VTABLE_SIGNAL:
fprintf(i->f, " <signal name=\"%s\">\n", v->x.signal.member);
introspect_write_arguments(i, strempty(v->x.signal.signature), NULL);
introspect_write_flags(i, v->type, v->flags);
- fputs_unlocked(" </signal>\n", i->f);
+ fputs(" </signal>\n", i->f);
break;
}
@@ -182,7 +187,7 @@ int introspect_finish(struct introspect *i, sd_bus *bus, sd_bus_message *m, sd_b
assert(m);
assert(reply);
- fputs_unlocked("</node>\n", i->f);
+ fputs("</node>\n", i->f);
r = fflush_and_check(i->f);
if (r < 0)
diff --git a/src/libelogind/sd-bus/bus-introspect.h b/src/libelogind/sd-bus/bus-introspect.h
index 8e2f3800c..5d2d5a17d 100644
--- a/src/libelogind/sd-bus/bus-introspect.h
+++ b/src/libelogind/sd-bus/bus-introspect.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
diff --git a/src/libelogind/sd-bus/bus-kernel.c b/src/libelogind/sd-bus/bus-kernel.c
index edb9b6460..8130a4705 100644
--- a/src/libelogind/sd-bus/bus-kernel.c
+++ b/src/libelogind/sd-bus/bus-kernel.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-bus/bus-kernel.h b/src/libelogind/sd-bus/bus-kernel.h
index 6b984a582..1b09c13ca 100644
--- a/src/libelogind/sd-bus/bus-kernel.h
+++ b/src/libelogind/sd-bus/bus-kernel.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
diff --git a/src/libelogind/sd-bus/bus-match.c b/src/libelogind/sd-bus/bus-match.c
index 82f0f1f0d..bd78ccb69 100644
--- a/src/libelogind/sd-bus/bus-match.c
+++ b/src/libelogind/sd-bus/bus-match.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
@@ -17,6 +18,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+//#include <stdio_ext.h>
+
#include "alloc-util.h"
#include "bus-internal.h"
#include "bus-match.h"
@@ -954,22 +957,24 @@ char *bus_match_to_string(struct bus_match_component *components, unsigned n_com
if (!f)
return NULL;
+ __fsetlocking(f, FSETLOCKING_BYCALLER);
+
for (i = 0; i < n_components; i++) {
char buf[32];
if (i != 0)
- fputc_unlocked(',', f);
+ fputc(',', f);
- fputs_unlocked(bus_match_node_type_to_string(components[i].type, buf, sizeof(buf)), f);
- fputc_unlocked('=', f);
- fputc_unlocked('\'', f);
+ fputs(bus_match_node_type_to_string(components[i].type, buf, sizeof(buf)), f);
+ fputc('=', f);
+ fputc('\'', f);
if (components[i].type == BUS_MATCH_MESSAGE_TYPE)
- fputs_unlocked(bus_message_type_to_string(components[i].value_u8), f);
+ fputs(bus_message_type_to_string(components[i].value_u8), f);
else
- fputs_unlocked(components[i].value_str, f);
+ fputs(components[i].value_str, f);
- fputc_unlocked('\'', f);
+ fputc('\'', f);
}
r = fflush_and_check(f);
diff --git a/src/libelogind/sd-bus/bus-match.h b/src/libelogind/sd-bus/bus-match.h
index 9985db133..baaaa719a 100644
--- a/src/libelogind/sd-bus/bus-match.h
+++ b/src/libelogind/sd-bus/bus-match.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
diff --git a/src/libelogind/sd-bus/bus-message.c b/src/libelogind/sd-bus/bus-message.c
index 28f5c66a1..1f79ce99a 100644
--- a/src/libelogind/sd-bus/bus-message.c
+++ b/src/libelogind/sd-bus/bus-message.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
@@ -573,28 +574,36 @@ fail:
return r;
}
-static sd_bus_message *message_new(sd_bus *bus, uint8_t type) {
- sd_bus_message *m;
+_public_ int sd_bus_message_new(
+ sd_bus *bus,
+ sd_bus_message **m,
+ uint8_t type) {
- assert(bus);
+ sd_bus_message *t;
- m = malloc0(ALIGN(sizeof(sd_bus_message)) + sizeof(struct bus_header));
- if (!m)
- return NULL;
+ assert_return(bus, -ENOTCONN);
+ assert_return(bus->state != BUS_UNSET, -ENOTCONN);
+ assert_return(m, -EINVAL);
+ assert_return(type < _SD_BUS_MESSAGE_TYPE_MAX, -EINVAL);
- m->n_ref = 1;
- m->header = (struct bus_header*) ((uint8_t*) m + ALIGN(sizeof(struct sd_bus_message)));
- m->header->endian = BUS_NATIVE_ENDIAN;
- m->header->type = type;
- m->header->version = bus->message_version;
- m->allow_fds = bus->can_fds || !IN_SET(bus->state, BUS_HELLO, BUS_RUNNING);
- m->root_container.need_offsets = BUS_MESSAGE_IS_GVARIANT(m);
- m->bus = sd_bus_ref(bus);
+ t = malloc0(ALIGN(sizeof(sd_bus_message)) + sizeof(struct bus_header));
+ if (!t)
+ return -ENOMEM;
+
+ t->n_ref = 1;
+ t->header = (struct bus_header*) ((uint8_t*) t + ALIGN(sizeof(struct sd_bus_message)));
+ t->header->endian = BUS_NATIVE_ENDIAN;
+ t->header->type = type;
+ t->header->version = bus->message_version;
+ t->allow_fds = bus->can_fds || !IN_SET(bus->state, BUS_HELLO, BUS_RUNNING);
+ t->root_container.need_offsets = BUS_MESSAGE_IS_GVARIANT(t);
+ t->bus = sd_bus_ref(bus);
if (bus->allow_interactive_authorization)
- m->header->flags |= BUS_MESSAGE_ALLOW_INTERACTIVE_AUTHORIZATION;
+ t->header->flags |= BUS_MESSAGE_ALLOW_INTERACTIVE_AUTHORIZATION;
- return m;
+ *m = t;
+ return 0;
}
_public_ int sd_bus_message_new_signal(
@@ -614,10 +623,12 @@ _public_ int sd_bus_message_new_signal(
assert_return(member_name_is_valid(member), -EINVAL);
assert_return(m, -EINVAL);
- t = message_new(bus, SD_BUS_MESSAGE_SIGNAL);
- if (!t)
+ r = sd_bus_message_new(bus, &t, SD_BUS_MESSAGE_SIGNAL);
+ if (r < 0)
return -ENOMEM;
+ assert(t);
+
t->header->flags |= BUS_MESSAGE_NO_REPLY_EXPECTED;
r = message_append_field_string(t, BUS_MESSAGE_HEADER_PATH, SD_BUS_TYPE_OBJECT_PATH, path, &t->path);
@@ -657,10 +668,12 @@ _public_ int sd_bus_message_new_method_call(
assert_return(member_name_is_valid(member), -EINVAL);
assert_return(m, -EINVAL);
- t = message_new(bus, SD_BUS_MESSAGE_METHOD_CALL);
- if (!t)
+ r = sd_bus_message_new(bus, &t, SD_BUS_MESSAGE_METHOD_CALL);
+ if (r < 0)
return -ENOMEM;
+ assert(t);
+
r = message_append_field_string(t, BUS_MESSAGE_HEADER_PATH, SD_BUS_TYPE_OBJECT_PATH, path, &t->path);
if (r < 0)
goto fail;
@@ -694,6 +707,7 @@ static int message_new_reply(
sd_bus_message **m) {
sd_bus_message *t;
+ uint64_t cookie;
int r;
assert_return(call, -EINVAL);
@@ -702,15 +716,18 @@ static int message_new_reply(
assert_return(call->bus->state != BUS_UNSET, -ENOTCONN);
assert_return(m, -EINVAL);
- t = message_new(call->bus, type);
- if (!t)
+ cookie = BUS_MESSAGE_COOKIE(call);
+ if (cookie == 0)
+ return -EOPNOTSUPP;
+
+ r = sd_bus_message_new(call->bus, &t, type);
+ if (r < 0)
return -ENOMEM;
- t->header->flags |= BUS_MESSAGE_NO_REPLY_EXPECTED;
- t->reply_cookie = BUS_MESSAGE_COOKIE(call);
- if (t->reply_cookie == 0)
- return -EOPNOTSUPP;
+ assert(t);
+ t->header->flags |= BUS_MESSAGE_NO_REPLY_EXPECTED;
+ t->reply_cookie = cookie;
r = message_append_reply_cookie(t, t->reply_cookie);
if (r < 0)
goto fail;
@@ -858,10 +875,12 @@ int bus_message_new_synthetic_error(
assert(sd_bus_error_is_set(e));
assert(m);
- t = message_new(bus, SD_BUS_MESSAGE_METHOD_ERROR);
- if (!t)
+ r = sd_bus_message_new(bus, &t, SD_BUS_MESSAGE_METHOD_ERROR);
+ if (r < 0)
return -ENOMEM;
+ assert(t);
+
t->header->flags |= BUS_MESSAGE_NO_REPLY_EXPECTED;
t->reply_cookie = cookie;
@@ -2857,13 +2876,13 @@ static int bus_message_close_header(sd_bus_message *m) {
return 0;
}
-int bus_message_seal(sd_bus_message *m, uint64_t cookie, usec_t timeout) {
+_public_ int sd_bus_message_seal(sd_bus_message *m, uint64_t cookie, uint64_t timeout_usec) {
struct bus_body_part *part;
size_t a;
unsigned i;
int r;
- assert(m);
+ assert_return(m, -EINVAL);
if (m->sealed)
return -EPERM;
@@ -2913,7 +2932,7 @@ int bus_message_seal(sd_bus_message *m, uint64_t cookie, usec_t timeout) {
else
m->header->dbus1.serial = (uint32_t) cookie;
- m->timeout = m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED ? 0 : timeout;
+ m->timeout = m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED ? 0 : timeout_usec;
/* Add padding at the end of the fields part, since we know
* the body needs to start at an 8 byte alignment. We made
@@ -5789,10 +5808,12 @@ int bus_message_remarshal(sd_bus *bus, sd_bus_message **m) {
case SD_BUS_MESSAGE_METHOD_RETURN:
case SD_BUS_MESSAGE_METHOD_ERROR:
- n = message_new(bus, (*m)->header->type);
- if (!n)
+ r = sd_bus_message_new(bus, &n, (*m)->header->type);
+ if (r < 0)
return -ENOMEM;
+ assert(n);
+
n->reply_cookie = (*m)->reply_cookie;
r = message_append_reply_cookie(n, n->reply_cookie);
@@ -5835,7 +5856,7 @@ int bus_message_remarshal(sd_bus *bus, sd_bus_message **m) {
if (timeout == 0 && !((*m)->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED))
timeout = BUS_DEFAULT_TIMEOUT;
- r = bus_message_seal(n, BUS_MESSAGE_COOKIE(*m), timeout);
+ r = sd_bus_message_seal(n, BUS_MESSAGE_COOKIE(*m), timeout);
if (r < 0)
return r;
diff --git a/src/libelogind/sd-bus/bus-message.h b/src/libelogind/sd-bus/bus-message.h
index 45f1aff65..fd75a385f 100644
--- a/src/libelogind/sd-bus/bus-message.h
+++ b/src/libelogind/sd-bus/bus-message.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
@@ -187,7 +188,6 @@ static inline bool BUS_MESSAGE_IS_GVARIANT(sd_bus_message *m) {
return m->header->version == 2;
}
-int bus_message_seal(sd_bus_message *m, uint64_t serial, usec_t timeout);
#if 0 /// UNNEEDED by elogind
int bus_message_get_blob(sd_bus_message *m, void **buffer, size_t *sz);
#endif // 0
diff --git a/src/libelogind/sd-bus/bus-objects.c b/src/libelogind/sd-bus/bus-objects.c
index df4b96910..121197bbc 100644
--- a/src/libelogind/sd-bus/bus-objects.c
+++ b/src/libelogind/sd-bus/bus-objects.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
@@ -959,7 +960,7 @@ static int process_introspect(
if (!streq_ptr(previous_interface, c->interface)) {
if (previous_interface)
- fputs_unlocked(" </interface>\n", intro.f);
+ fputs(" </interface>\n", intro.f);
fprintf(intro.f, " <interface name=\"%s\">\n", c->interface);
}
@@ -972,7 +973,7 @@ static int process_introspect(
}
if (previous_interface)
- fputs_unlocked(" </interface>\n", intro.f);
+ fputs(" </interface>\n", intro.f);
if (empty) {
/* Nothing?, let's see if we exist at all, and if not
diff --git a/src/libelogind/sd-bus/bus-objects.h b/src/libelogind/sd-bus/bus-objects.h
index e0b8c534e..6bffeda72 100644
--- a/src/libelogind/sd-bus/bus-objects.h
+++ b/src/libelogind/sd-bus/bus-objects.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
diff --git a/src/libelogind/sd-bus/bus-protocol.h b/src/libelogind/sd-bus/bus-protocol.h
index 9d180cb28..0d5dfd947 100644
--- a/src/libelogind/sd-bus/bus-protocol.h
+++ b/src/libelogind/sd-bus/bus-protocol.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
diff --git a/src/libelogind/sd-bus/bus-signature.c b/src/libelogind/sd-bus/bus-signature.c
index 7bc243494..d16461f4a 100644
--- a/src/libelogind/sd-bus/bus-signature.c
+++ b/src/libelogind/sd-bus/bus-signature.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-bus/bus-signature.h b/src/libelogind/sd-bus/bus-signature.h
index 1e0cd7f58..a6be1844e 100644
--- a/src/libelogind/sd-bus/bus-signature.h
+++ b/src/libelogind/sd-bus/bus-signature.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
diff --git a/src/libelogind/sd-bus/bus-slot.c b/src/libelogind/sd-bus/bus-slot.c
index 725265b33..756761c3e 100644
--- a/src/libelogind/sd-bus/bus-slot.c
+++ b/src/libelogind/sd-bus/bus-slot.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-bus/bus-slot.h b/src/libelogind/sd-bus/bus-slot.h
index 3b8b94dc6..beebaa167 100644
--- a/src/libelogind/sd-bus/bus-slot.h
+++ b/src/libelogind/sd-bus/bus-slot.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
diff --git a/src/libelogind/sd-bus/bus-socket.c b/src/libelogind/sd-bus/bus-socket.c
index 235fe2639..07a9c8aff 100644
--- a/src/libelogind/sd-bus/bus-socket.c
+++ b/src/libelogind/sd-bus/bus-socket.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
@@ -231,8 +232,9 @@ static int bus_socket_auth_verify_client(sd_bus *b) {
if (f)
b->can_fds =
- (f - e == strlen("\r\nAGREE_UNIX_FD")) &&
- memcmp(e + 2, "AGREE_UNIX_FD", strlen("AGREE_UNIX_FD")) == 0;
+ (f - e == STRLEN("\r\nAGREE_UNIX_FD")) &&
+ memcmp(e + 2, "AGREE_UNIX_FD",
+ STRLEN("AGREE_UNIX_FD")) == 0;
b->rbuffer_size -= (start - (char*) b->rbuffer);
memmove(b->rbuffer, start, b->rbuffer_size);
diff --git a/src/libelogind/sd-bus/bus-socket.h b/src/libelogind/sd-bus/bus-socket.h
index 684feead7..915a283f5 100644
--- a/src/libelogind/sd-bus/bus-socket.h
+++ b/src/libelogind/sd-bus/bus-socket.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
diff --git a/src/libelogind/sd-bus/bus-track.c b/src/libelogind/sd-bus/bus-track.c
index 9d9025275..ab22d6e4d 100644
--- a/src/libelogind/sd-bus/bus-track.c
+++ b/src/libelogind/sd-bus/bus-track.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
@@ -62,7 +63,7 @@ struct sd_bus_track {
({ \
char *_x; \
size_t _l = strlen(name); \
- _x = alloca(strlen(MATCH_PREFIX)+_l+strlen(MATCH_SUFFIX)+1); \
+ _x = alloca(STRLEN(MATCH_PREFIX)+_l+STRLEN(MATCH_SUFFIX)+1); \
strcpy(stpcpy(stpcpy(_x, MATCH_PREFIX), name), MATCH_SUFFIX); \
_x; \
})
diff --git a/src/libelogind/sd-bus/bus-track.h b/src/libelogind/sd-bus/bus-track.h
index 26bd05f5c..0c5636b7e 100644
--- a/src/libelogind/sd-bus/bus-track.h
+++ b/src/libelogind/sd-bus/bus-track.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
diff --git a/src/libelogind/sd-bus/bus-type.c b/src/libelogind/sd-bus/bus-type.c
index 27014eed2..817040b1a 100644
--- a/src/libelogind/sd-bus/bus-type.c
+++ b/src/libelogind/sd-bus/bus-type.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-bus/bus-type.h b/src/libelogind/sd-bus/bus-type.h
index 5c87eb5f0..ae272b1e6 100644
--- a/src/libelogind/sd-bus/bus-type.h
+++ b/src/libelogind/sd-bus/bus-type.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
diff --git a/src/libelogind/sd-bus/sd-bus.c b/src/libelogind/sd-bus/sd-bus.c
index c305e8c37..2b372e436 100644
--- a/src/libelogind/sd-bus/sd-bus.c
+++ b/src/libelogind/sd-bus/sd-bus.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
@@ -1425,7 +1426,7 @@ static int bus_seal_message(sd_bus *b, sd_bus_message *m, usec_t timeout) {
if (timeout == 0)
timeout = BUS_DEFAULT_TIMEOUT;
- return bus_message_seal(m, ++b->cookie, timeout);
+ return sd_bus_message_seal(m, ++b->cookie, timeout);
}
static int bus_remarshal_message(sd_bus *b, sd_bus_message **m) {
@@ -1465,7 +1466,7 @@ int bus_seal_synthetic_message(sd_bus *b, sd_bus_message *m) {
* pick a fixed, artificial one. We use (uint32_t) -1 rather
* than (uint64_t) -1 since dbus1 only had 32bit identifiers,
* even though kdbus can do 64bit. */
- return bus_message_seal(m, 0xFFFFFFFFULL, 0);
+ return sd_bus_message_seal(m, 0xFFFFFFFFULL, 0);
}
static int bus_write_message(sd_bus *bus, sd_bus_message *m, bool hint_sync_call, size_t *idx) {
diff --git a/src/libelogind/sd-bus/test-bus-error.c b/src/libelogind/sd-bus/test-bus-error.c
index f7c889b7c..296e123ec 100644
--- a/src/libelogind/sd-bus/test-bus-error.c
+++ b/src/libelogind/sd-bus/test-bus-error.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-bus/test-bus-introspect.c b/src/libelogind/sd-bus/test-bus-introspect.c
index 4425cfae2..8dee93676 100644
--- a/src/libelogind/sd-bus/test-bus-introspect.c
+++ b/src/libelogind/sd-bus/test-bus-introspect.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-bus/test-bus-match.c b/src/libelogind/sd-bus/test-bus-match.c
index 8fd9d03dd..47b45647c 100644
--- a/src/libelogind/sd-bus/test-bus-match.c
+++ b/src/libelogind/sd-bus/test-bus-match.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
@@ -121,7 +122,7 @@ int main(int argc, char *argv[]) {
assert_se(sd_bus_message_new_signal(bus, &m, "/foo/bar", "bar.x", "waldo") >= 0);
assert_se(sd_bus_message_append(m, "ssssas", "one", "two", "/prefix/three", "prefix.four", 3, "pi", "pa", "po") >= 0);
- assert_se(bus_message_seal(m, 1, 0) >= 0);
+ assert_se(sd_bus_message_seal(m, 1, 0) >= 0);
zero(mask);
assert_se(bus_match_run(NULL, &root, m) == 0);
diff --git a/src/libelogind/sd-bus/test-bus-server.c b/src/libelogind/sd-bus/test-bus-server.c
index b6272efc3..245f5707e 100644
--- a/src/libelogind/sd-bus/test-bus-server.c
+++ b/src/libelogind/sd-bus/test-bus-server.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-bus/test-bus-signature.c b/src/libelogind/sd-bus/test-bus-signature.c
index 4f4fd093b..aa6160d1c 100644
--- a/src/libelogind/sd-bus/test-bus-signature.c
+++ b/src/libelogind/sd-bus/test-bus-signature.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-daemon/sd-daemon.c b/src/libelogind/sd-daemon/sd-daemon.c
index f50075ef5..7aad70bc6 100644
--- a/src/libelogind/sd-daemon/sd-daemon.c
+++ b/src/libelogind/sd-daemon/sd-daemon.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-event/sd-event.c b/src/libelogind/sd-event/sd-event.c
index 2c5c2ebb4..a5f3e854b 100644
--- a/src/libelogind/sd-event/sd-event.c
+++ b/src/libelogind/sd-event/sd-event.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-event/test-event.c b/src/libelogind/sd-event/test-event.c
index dd0c74749..873e93ef8 100644
--- a/src/libelogind/sd-event/test-event.c
+++ b/src/libelogind/sd-event/test-event.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-id128/id128-util.c b/src/libelogind/sd-id128/id128-util.c
index 9fcbc7146..6f6334bbe 100644
--- a/src/libelogind/sd-id128/id128-util.c
+++ b/src/libelogind/sd-id128/id128-util.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-id128/id128-util.h b/src/libelogind/sd-id128/id128-util.h
index d435b976d..8af8abbb4 100644
--- a/src/libelogind/sd-id128/id128-util.h
+++ b/src/libelogind/sd-id128/id128-util.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
diff --git a/src/libelogind/sd-id128/sd-id128.c b/src/libelogind/sd-id128/sd-id128.c
index d44d75ece..561bcdf4f 100644
--- a/src/libelogind/sd-id128/sd-id128.c
+++ b/src/libelogind/sd-id128/sd-id128.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-login/sd-login.c b/src/libelogind/sd-login/sd-login.c
index 0b406f41c..a7de8f1c1 100644
--- a/src/libelogind/sd-login/sd-login.c
+++ b/src/libelogind/sd-login/sd-login.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
diff --git a/src/libelogind/sd-login/test-login.c b/src/libelogind/sd-login/test-login.c
index 3b5e50c34..bdd1b8909 100644
--- a/src/libelogind/sd-login/test-login.c
+++ b/src/libelogind/sd-login/test-login.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.