summaryrefslogtreecommitdiff
path: root/src/libsystemd
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd')
-rw-r--r--src/libsystemd/Makefile39
-rw-r--r--src/libsystemd/include-staging/systemd-staging/sd-netlink.h2
-rw-r--r--src/libsystemd/include/systemd/sd-utf8.h32
-rw-r--r--src/libsystemd/sd_event_get_fd.xml2
-rw-r--r--src/libsystemd/sd_notify.xml4
-rw-r--r--src/libsystemd/src/Makefile43
-rw-r--r--src/libsystemd/src/sd-bus/Makefile4
-rw-r--r--src/libsystemd/src/sd-bus/bus-signature.h1
-rw-r--r--src/libsystemd/src/sd-bus/bus-socket.h2
-rw-r--r--src/libsystemd/src/sd-bus/bus-track.h2
l---------src/libsystemd/src/sd-daemon/GNUmakefile1
-rw-r--r--src/libsystemd/src/sd-daemon/sd-daemon.c2
l---------src/libsystemd/src/sd-device/GNUmakefile1
-rw-r--r--src/libsystemd/src/sd-device/device-internal.h1
l---------src/libsystemd/src/sd-event/GNUmakefile1
-rw-r--r--src/libsystemd/src/sd-hwdb/Makefile6
l---------src/libsystemd/src/sd-id128/GNUmakefile1
-rw-r--r--src/libsystemd/src/sd-journal/Makefile15
-rw-r--r--src/libsystemd/src/sd-journal/mmap-cache.h2
l---------src/libsystemd/src/sd-login/GNUmakefile1
l---------src/libsystemd/src/sd-netlink/GNUmakefile1
-rw-r--r--src/libsystemd/src/sd-netlink/local-addresses.c275
-rw-r--r--src/libsystemd/src/sd-netlink/local-addresses.h35
-rw-r--r--src/libsystemd/src/sd-netlink/test-local-addresses.c57
l---------src/libsystemd/src/sd-network/GNUmakefile1
-rw-r--r--src/libsystemd/src/sd-network/network-util.h2
l---------src/libsystemd/src/sd-resolve/GNUmakefile1
-rw-r--r--src/libsystemd/src/sd-utf8/sd-utf8.c35
-rw-r--r--src/libsystemd/src/subdir.mk8
-rw-r--r--src/libsystemd/src/test.mk11
30 files changed, 98 insertions, 490 deletions
diff --git a/src/libsystemd/Makefile b/src/libsystemd/Makefile
index be66c9c898..b31fbb3d37 100644
--- a/src/libsystemd/Makefile
+++ b/src/libsystemd/Makefile
@@ -39,14 +39,14 @@ libsystemd_la_LDFLAGS = \
-Wl,--version-script=$(srcdir)/libsystemd.sym
libsystemd_la_LIBADD = \
- libsystemd-internal.la \
- libsystemd-basic.la \
- libsystemd-journal-internal.la
+ libsystemd-internal.la
+
+libsystemd_la_LIBADD = $(libsystemd-internal.DEPENDS)
pkgconfiglib_DATA += \
src/libsystemd/libsystemd.pc
-pkginclude_HEADERS += \
+_pkginclude_HEADERS += \
src/systemd/sd-bus.h \
src/systemd/sd-bus-protocol.h \
src/systemd/sd-bus-vtable.h \
@@ -79,31 +79,36 @@ tests += \
test-bus-track \
test-event \
test-netlink \
- test-local-addresses \
test-resolve
-pkginclude_HEADERS += \
+_pkginclude_HEADERS += \
src/systemd/sd-journal.h \
src/systemd/sd-messages.h \
src/systemd/_sd-common.h
-test-libsystemd-sym.c: \
- $(top_builddir)/src/libsystemd/libsystemd.sym \
- src/systemd/sd-journal.h \
- src/systemd/sd-daemon.h \
- src/systemd/sd-login.h \
- src/systemd/sd-bus.h \
- src/systemd/sd-utf8.h \
- src/systemd/sd-resolve.h \
- src/systemd/sd-path.h \
- src/systemd/sd-event.h
- $(generate-sym-test)
+$(outdir)/test-libsystemd-sym.c: \
+ $(srcdir)/include/systemd/sd-journal.h \
+ $(srcdir)/include/systemd/sd-daemon.h \
+ $(srcdir)/include/systemd/sd-login.h \
+ $(srcdir)/include/systemd/sd-bus.h \
+ $(srcdir)/include/systemd/sd-utf8.h \
+ $(srcdir)/include/systemd/sd-resolve.h \
+ $(srcdir)/include/systemd/sd-path.h \
+ $(srcdir)/include/systemd/sd-event.h
nodist_test_libsystemd_sym_SOURCES = \
test-libsystemd-sym.c
test_libsystemd_sym_LDADD = \
libsystemd.la
+$(DESTDIR)$(pkgincludedir)/%.h: $(srcdir)/include/systemd/%.h
+ @$(NORMAL_INSTALL)
+ @$(MKDIR_P) $(@D)
+ $(am.INSTALL_HEADERS)
+
+files.sys.all += $(addprefix $(pkgincludedir)/,$(notdir $(_pkginclude_HEADERS)))
+$(outdir)/libsystemd.la: $(srcdir)/libsystemd.sym
+
nested.subdirs += src
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/libsystemd/include-staging/systemd-staging/sd-netlink.h b/src/libsystemd/include-staging/systemd-staging/sd-netlink.h
index 8a8c85a004..7db35e1756 100644
--- a/src/libsystemd/include-staging/systemd-staging/sd-netlink.h
+++ b/src/libsystemd/include-staging/systemd-staging/sd-netlink.h
@@ -24,8 +24,8 @@
#include <netinet/ether.h>
#include <netinet/in.h>
-#include <linux/rtnetlink.h>
#include <linux/neighbour.h>
+#include <linux/rtnetlink.h>
#include <systemd/_sd-common.h>
#include <systemd/sd-event.h>
diff --git a/src/libsystemd/include/systemd/sd-utf8.h b/src/libsystemd/include/systemd/sd-utf8.h
deleted file mode 100644
index 6781983878..0000000000
--- a/src/libsystemd/include/systemd/sd-utf8.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef foosdutf8hfoo
-#define foosdutf8hfoo
-
-/***
- This file is part of systemd.
-
- Copyright 2013 Lennart Poettering
-
- 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.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include "_sd-common.h"
-
-_SD_BEGIN_DECLARATIONS;
-
-_sd_pure_ const char *sd_utf8_is_valid(const char *s);
-_sd_pure_ const char *sd_ascii_is_valid(const char *s);
-
-_SD_END_DECLARATIONS;
-
-#endif
diff --git a/src/libsystemd/sd_event_get_fd.xml b/src/libsystemd/sd_event_get_fd.xml
index f68752dd0e..982f279657 100644
--- a/src/libsystemd/sd_event_get_fd.xml
+++ b/src/libsystemd/sd_event_get_fd.xml
@@ -119,7 +119,7 @@
<example>
<title>Integration in the GLib event loop</title>
- <programlisting><xi:include href="glib-event-glue.c" parse="text" /></programlisting>
+ <programlisting><xi:include href="sd_event_get_fd-glib-example.c" parse="text" /></programlisting>
</example>
</refsect1>
diff --git a/src/libsystemd/sd_notify.xml b/src/libsystemd/sd_notify.xml
index 94542b80b8..ef66e93ab9 100644
--- a/src/libsystemd/sd_notify.xml
+++ b/src/libsystemd/sd_notify.xml
@@ -307,8 +307,8 @@
code. If <varname>$NOTIFY_SOCKET</varname> was not set and hence
no status data could be sent, 0 is returned. If the status was
sent, these functions return with a positive return value. In
- order to support both, init systems that implement this scheme and
- those which do not, it is generally recommended to ignore the
+ order to support both init systems that implement this scheme and
+ those that do not, it is generally recommended to ignore the
return value of this call.</para>
</refsect1>
diff --git a/src/libsystemd/src/Makefile b/src/libsystemd/src/Makefile
index a7c1b4789a..49480d80c4 100644
--- a/src/libsystemd/src/Makefile
+++ b/src/libsystemd/src/Makefile
@@ -23,18 +23,16 @@
include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk
include $(topsrcdir)/build-aux/Makefile.head.mk
-libsystemd_internal_la_SOURCES = \
+_libsystemd_internal_la_SOURCES = \
src/systemd/sd-bus.h \
src/systemd/sd-bus-protocol.h \
src/systemd/sd-bus-vtable.h \
- src/systemd/sd-utf8.h \
src/systemd/sd-event.h \
src/systemd/sd-netlink.h \
src/systemd/sd-resolve.h \
src/systemd/sd-login.h \
src/systemd/sd-id128.h \
src/systemd/sd-daemon.h \
- src/systemd/sd-path.h \
src/systemd/sd-network.h \
src/systemd/sd-hwdb.h \
src/systemd/sd-device.h \
@@ -81,7 +79,8 @@ libsystemd_internal_la_SOURCES = \
src/libsystemd/sd-bus/kdbus.h \
src/libsystemd/sd-bus/bus-dump.c \
src/libsystemd/sd-bus/bus-dump.h \
- src/libsystemd/sd-utf8/sd-utf8.c \
+ src/libsystemd/sd-bus/bus-util.c \
+ src/libsystemd/sd-bus/bus-util.h \
src/libsystemd/sd-event/sd-event.c \
src/libsystemd/sd-netlink/sd-netlink.c \
src/libsystemd/sd-netlink/netlink-internal.h \
@@ -92,14 +91,11 @@ libsystemd_internal_la_SOURCES = \
src/libsystemd/sd-netlink/netlink-types.c \
src/libsystemd/sd-netlink/netlink-util.h \
src/libsystemd/sd-netlink/netlink-util.c \
- src/libsystemd/sd-netlink/local-addresses.h \
- src/libsystemd/sd-netlink/local-addresses.c \
src/libsystemd/sd-id128/sd-id128.c \
src/libsystemd/sd-id128/id128-util.h \
src/libsystemd/sd-id128/id128-util.c \
src/libsystemd/sd-daemon/sd-daemon.c \
src/libsystemd/sd-login/sd-login.c \
- src/libsystemd/sd-path/sd-path.c \
src/libsystemd/sd-network/sd-network.c \
src/libsystemd/sd-network/network-util.h \
src/libsystemd/sd-network/network-util.c \
@@ -118,10 +114,10 @@ libsystemd_internal_la_SOURCES = \
libsystemd_internal_la_LIBADD = \
-lresolv
-noinst_LTLIBRARIES += \
+rootlibexec_LTLIBRARIES += \
libsystemd-internal.la
-libsystemd_journal_internal_la_SOURCES = \
+_libsystemd_journal_internal_la_SOURCES = \
src/journal/sd-journal.c \
src/systemd/sd-journal.h \
src/systemd/_sd-common.h \
@@ -142,11 +138,9 @@ libsystemd_journal_internal_la_SOURCES = \
src/journal/mmap-cache.h \
src/journal/compress.c \
src/journal/audit-type.h \
- src/journal/audit-type.c \
- src/shared/gcrypt-util.h \
- src/shared/gcrypt-util.c
+ src/journal/audit-type.c
-nodist_libsystemd_journal_internal_la_SOURCES = \
+#nodist_libsystemd_journal_internal_la_SOURCES = \
src/journal/audit_type-to-name.h
gperf_txt_sources += \
@@ -174,7 +168,7 @@ libsystemd_journal_internal_la_LIBADD += \
endif # HAVE_LZ4
ifneq ($(HAVE_GCRYPT),)
-libsystemd_journal_internal_la_SOURCES += \
+_libsystemd_journal_internal_la_SOURCES += \
src/journal/journal-authenticate.c \
src/journal/journal-authenticate.h \
src/journal/fsprg.c \
@@ -183,11 +177,30 @@ libsystemd_journal_internal_la_SOURCES += \
libsystemd_journal_internal_la_LIBADD += \
$(GCRYPT_LIBS)
+libsystemd_journal_internal_la_CFLAGS += \
+ $(GCRYPT_CFLAGS)
endif # HAVE_GCRYPT
-noinst_LTLIBRARIES += \
+#noinst_LTLIBRARIES += \
libsystemd-journal-internal.la
+# Hook into the `am` module
+libsystemd_internal_la_CFLAGS += $(libsystemd_journal_internal_la_CFLAGS)
+libsystemd_internal_la_LIBADD += $(libsystemd_journal_internal_la_LIBADD)
+
+# Don't bother trying to hook into the `am` module for the sources; the only
+# thing it adds over declaring the dependencies is adding the appropriate
+# directories to am.subdirs=>at.subdirs; but we can do that here just as easily
+# with nested.subdirs.
+sd.libsystemd_SOURCES =
+sd.libsystemd_SOURCES += $(patsubst src/libsystemd/%,%,$(filter %.c,$(_libsystemd_internal_la_SOURCES)))
+sd.libsystemd_SOURCES += $(addprefix sd-journal/,$(notdir $(filter %.c,$(_libsystemd_journal_internal_la_SOURCES))))
+$(outdir)/libsystemd-internal.la: $(addprefix $(outdir)/,$(sd.libsystemd_SOURCES:.c=.lo))
+
+libsystemd_internal_la_LIBADD += \
+ libsystemd-basic.la \
+ libsystemd-gcrypt.la
+
nested.subdirs += sd-bus
nested.subdirs += sd-daemon
nested.subdirs += sd-device
diff --git a/src/libsystemd/src/sd-bus/Makefile b/src/libsystemd/src/sd-bus/Makefile
index 60150788d8..a483e31fd1 100644
--- a/src/libsystemd/src/sd-bus/Makefile
+++ b/src/libsystemd/src/sd-bus/Makefile
@@ -20,7 +20,11 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+
include $(dir $(lastword $(MAKEFILE_LIST)))/../../../../config.mk
include $(topsrcdir)/build-aux/Makefile.head.mk
+sd.CPPFLAGS += $(libsystemd.CPPFLAGS)
+sd.CPPFLAGS += $(libsystemd-basic.CPPFLAGS)
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/libsystemd/src/sd-bus/bus-signature.h b/src/libsystemd/src/sd-bus/bus-signature.h
index 1e0cd7f587..8b7a45cef5 100644
--- a/src/libsystemd/src/sd-bus/bus-signature.h
+++ b/src/libsystemd/src/sd-bus/bus-signature.h
@@ -20,6 +20,7 @@
***/
#include <stdbool.h>
+#include <sys/types.h>
bool signature_is_single(const char *s, bool allow_dict_entry);
bool signature_is_pair(const char *s);
diff --git a/src/libsystemd/src/sd-bus/bus-socket.h b/src/libsystemd/src/sd-bus/bus-socket.h
index 6e1d32e6a7..712e37bcc0 100644
--- a/src/libsystemd/src/sd-bus/bus-socket.h
+++ b/src/libsystemd/src/sd-bus/bus-socket.h
@@ -19,6 +19,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <stdbool.h>
+
#include <systemd/sd-bus.h>
void bus_socket_setup(sd_bus *b);
diff --git a/src/libsystemd/src/sd-bus/bus-track.h b/src/libsystemd/src/sd-bus/bus-track.h
index 26bd05f5c7..68398281ae 100644
--- a/src/libsystemd/src/sd-bus/bus-track.h
+++ b/src/libsystemd/src/sd-bus/bus-track.h
@@ -19,5 +19,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <systemd/sd-bus.h>
+
void bus_track_dispatch(sd_bus_track *track);
void bus_track_close(sd_bus_track *track);
diff --git a/src/libsystemd/src/sd-daemon/GNUmakefile b/src/libsystemd/src/sd-daemon/GNUmakefile
new file mode 120000
index 0000000000..13308a50cd
--- /dev/null
+++ b/src/libsystemd/src/sd-daemon/GNUmakefile
@@ -0,0 +1 @@
+../../../../GNUmakefile \ No newline at end of file
diff --git a/src/libsystemd/src/sd-daemon/sd-daemon.c b/src/libsystemd/src/sd-daemon/sd-daemon.c
index 1424d60a78..e272d91bfc 100644
--- a/src/libsystemd/src/sd-daemon/sd-daemon.c
+++ b/src/libsystemd/src/sd-daemon/sd-daemon.c
@@ -463,7 +463,7 @@ _public_ int sd_pid_notify_with_fds(pid_t pid, int unset_environment, const char
have_pid = pid != 0 && pid != getpid();
if (n_fds > 0 || have_pid) {
- /* CMSG_SPACE(0) may return value different than zero, which results in miscalculated controllen. */
+ /* CMSG_SPACE(0) returns a value greater than zero, hence the ternary on n_fds. */
msghdr.msg_controllen =
(n_fds > 0 ? CMSG_SPACE(sizeof(int) * n_fds) : 0) +
(have_pid ? CMSG_SPACE(sizeof(struct ucred)) : 0);
diff --git a/src/libsystemd/src/sd-device/GNUmakefile b/src/libsystemd/src/sd-device/GNUmakefile
new file mode 120000
index 0000000000..13308a50cd
--- /dev/null
+++ b/src/libsystemd/src/sd-device/GNUmakefile
@@ -0,0 +1 @@
+../../../../GNUmakefile \ No newline at end of file
diff --git a/src/libsystemd/src/sd-device/device-internal.h b/src/libsystemd/src/sd-device/device-internal.h
index c2539feb89..c23e329ed4 100644
--- a/src/libsystemd/src/sd-device/device-internal.h
+++ b/src/libsystemd/src/sd-device/device-internal.h
@@ -22,6 +22,7 @@
#include "systemd-basic/hashmap.h"
#include "systemd-basic/set.h"
+#include "systemd-staging/sd-device.h"
struct sd_device {
uint64_t n_ref;
diff --git a/src/libsystemd/src/sd-event/GNUmakefile b/src/libsystemd/src/sd-event/GNUmakefile
new file mode 120000
index 0000000000..13308a50cd
--- /dev/null
+++ b/src/libsystemd/src/sd-event/GNUmakefile
@@ -0,0 +1 @@
+../../../../GNUmakefile \ No newline at end of file
diff --git a/src/libsystemd/src/sd-hwdb/Makefile b/src/libsystemd/src/sd-hwdb/Makefile
index 60150788d8..a2696e2976 100644
--- a/src/libsystemd/src/sd-hwdb/Makefile
+++ b/src/libsystemd/src/sd-hwdb/Makefile
@@ -20,7 +20,13 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+
include $(dir $(lastword $(MAKEFILE_LIST)))/../../../../config.mk
include $(topsrcdir)/build-aux/Makefile.head.mk
+sd.CPPFLAGS += $(libsystemd.CPPFLAGS)
+sd.CPPFLAGS += $(libsystemd-staging.CPPFLAGS)
+sd.CPPFLAGS += $(libsystemd-basic.CPPFLAGS)
+sd.CPPFLAGS += -DUDEVLIBEXECDIR=\"$(udevlibexecdir)\"
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/libsystemd/src/sd-id128/GNUmakefile b/src/libsystemd/src/sd-id128/GNUmakefile
new file mode 120000
index 0000000000..13308a50cd
--- /dev/null
+++ b/src/libsystemd/src/sd-id128/GNUmakefile
@@ -0,0 +1 @@
+../../../../GNUmakefile \ No newline at end of file
diff --git a/src/libsystemd/src/sd-journal/Makefile b/src/libsystemd/src/sd-journal/Makefile
index d0415fb0d3..10cd8c45bb 100644
--- a/src/libsystemd/src/sd-journal/Makefile
+++ b/src/libsystemd/src/sd-journal/Makefile
@@ -23,20 +23,25 @@
include $(dir $(lastword $(MAKEFILE_LIST)))/../../../../config.mk
include $(topsrcdir)/build-aux/Makefile.head.mk
-audit_list_includes = -include linux/audit.h -include missing.h
+audit_list_includes = -include linux/audit.h -include systemd-basic/missing.h
ifneq ($(HAVE_AUDIT),)
audit_list_includes += -include libaudit.h
endif # HAVE_AUDIT
-$(outdir)/audit_type-list.txt:
+$(outdir)/audit_type-list.txt: | $(outdir)/$(DEPDIR)
$(AM_V_GEN)$(CPP) $(sd.ALL_CPPFLAGS) -dM $(audit_list_includes) - </dev/null | grep -vE 'AUDIT_.*(FIRST|LAST)_' | $(SED) -r -n 's/^#define\s+AUDIT_(\w+)\s+([0-9]{4})\s*$$/\1\t\2/p' | sort -k2 >$@
$(outdir)/audit_type-to-name.h: $(outdir)/audit_type-list.txt
$(AM_V_GEN)$(AWK) 'BEGIN{ print "const char *audit_type_to_string(int type) {\n\tswitch(type) {" } {printf " case AUDIT_%s: return \"%s\";\n", $$1, $$1 } END{ print " default: return NULL;\n\t}\n}\n" }' <$< >$@
# fsprg.c is a drop-in file using void pointer arithmetic
-libsystemd_journal_internal_la_CFLAGS += \
- $(GCRYPT_CFLAGS) \
- -Wno-pointer-arith
+$(outdir)/fsprg.lo: sd.ALL_CFLAGS += -Wno-pointer-arith
+
+$(outdir)/audit-type.lo: $(outdir)/audit_type-to-name.h
+
+sd.CPPFLAGS += $(libsystemd.CPPFLAGS)
+sd.CPPFLAGS += $(libsystemd-basic.CPPFLAGS)
+sd.CPPFLAGS += $(libsystemd-gcrypt.CPPFLAGS)
+sd.CPPFLAGS += -DCATALOG_DATABASE=\"$(catalogstatedir)/database\"
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/libsystemd/src/sd-journal/mmap-cache.h b/src/libsystemd/src/sd-journal/mmap-cache.h
index 199d944647..d7eca3c237 100644
--- a/src/libsystemd/src/sd-journal/mmap-cache.h
+++ b/src/libsystemd/src/sd-journal/mmap-cache.h
@@ -20,7 +20,9 @@
***/
#include <stdbool.h>
+#include <stdint.h>
#include <sys/stat.h>
+#include <sys/types.h>
/* One context per object type, plus one of the header, plus one "additional" one */
#define MMAP_CACHE_MAX_CONTEXTS 9
diff --git a/src/libsystemd/src/sd-login/GNUmakefile b/src/libsystemd/src/sd-login/GNUmakefile
new file mode 120000
index 0000000000..13308a50cd
--- /dev/null
+++ b/src/libsystemd/src/sd-login/GNUmakefile
@@ -0,0 +1 @@
+../../../../GNUmakefile \ No newline at end of file
diff --git a/src/libsystemd/src/sd-netlink/GNUmakefile b/src/libsystemd/src/sd-netlink/GNUmakefile
new file mode 120000
index 0000000000..13308a50cd
--- /dev/null
+++ b/src/libsystemd/src/sd-netlink/GNUmakefile
@@ -0,0 +1 @@
+../../../../GNUmakefile \ No newline at end of file
diff --git a/src/libsystemd/src/sd-netlink/local-addresses.c b/src/libsystemd/src/sd-netlink/local-addresses.c
deleted file mode 100644
index 74e1b2c2bf..0000000000
--- a/src/libsystemd/src/sd-netlink/local-addresses.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/***
- This file is part of systemd.
-
- Copyright 2008-2011 Lennart Poettering
- Copyright 2014 Tom Gundersen
-
- 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.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include "systemd-basic/alloc-util.h"
-#include "systemd-basic/macro.h"
-#include "systemd-staging/sd-netlink.h"
-
-#include "local-addresses.h"
-#include "netlink-util.h"
-
-static int address_compare(const void *_a, const void *_b) {
- const struct local_address *a = _a, *b = _b;
-
- /* Order lowest scope first, IPv4 before IPv6, lowest interface index first */
-
- if (a->family == AF_INET && b->family == AF_INET6)
- return -1;
- if (a->family == AF_INET6 && b->family == AF_INET)
- return 1;
-
- if (a->scope < b->scope)
- return -1;
- if (a->scope > b->scope)
- return 1;
-
- if (a->metric < b->metric)
- return -1;
- if (a->metric > b->metric)
- return 1;
-
- if (a->ifindex < b->ifindex)
- return -1;
- if (a->ifindex > b->ifindex)
- return 1;
-
- return memcmp(&a->address, &b->address, FAMILY_ADDRESS_SIZE(a->family));
-}
-
-int local_addresses(sd_netlink *context, int ifindex, int af, struct local_address **ret) {
- _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL, *reply = NULL;
- _cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
- _cleanup_free_ struct local_address *list = NULL;
- size_t n_list = 0, n_allocated = 0;
- sd_netlink_message *m;
- int r;
-
- assert(ret);
-
- if (context)
- rtnl = sd_netlink_ref(context);
- else {
- r = sd_netlink_open(&rtnl);
- if (r < 0)
- return r;
- }
-
- r = sd_rtnl_message_new_addr(rtnl, &req, RTM_GETADDR, 0, af);
- if (r < 0)
- return r;
-
- r = sd_netlink_call(rtnl, req, 0, &reply);
- if (r < 0)
- return r;
-
- for (m = reply; m; m = sd_netlink_message_next(m)) {
- struct local_address *a;
- unsigned char flags;
- uint16_t type;
- int ifi, family;
-
- r = sd_netlink_message_get_errno(m);
- if (r < 0)
- return r;
-
- r = sd_netlink_message_get_type(m, &type);
- if (r < 0)
- return r;
- if (type != RTM_NEWADDR)
- continue;
-
- r = sd_rtnl_message_addr_get_ifindex(m, &ifi);
- if (r < 0)
- return r;
- if (ifindex > 0 && ifi != ifindex)
- continue;
-
- r = sd_rtnl_message_addr_get_family(m, &family);
- if (r < 0)
- return r;
- if (af != AF_UNSPEC && af != family)
- continue;
-
- r = sd_rtnl_message_addr_get_flags(m, &flags);
- if (r < 0)
- return r;
- if (flags & IFA_F_DEPRECATED)
- continue;
-
- if (!GREEDY_REALLOC0(list, n_allocated, n_list+1))
- return -ENOMEM;
-
- a = list + n_list;
-
- r = sd_rtnl_message_addr_get_scope(m, &a->scope);
- if (r < 0)
- return r;
-
- if (ifindex == 0 && (a->scope == RT_SCOPE_HOST || a->scope == RT_SCOPE_NOWHERE))
- continue;
-
- switch (family) {
-
- case AF_INET:
- r = sd_netlink_message_read_in_addr(m, IFA_LOCAL, &a->address.in);
- if (r < 0) {
- r = sd_netlink_message_read_in_addr(m, IFA_ADDRESS, &a->address.in);
- if (r < 0)
- continue;
- }
- break;
-
- case AF_INET6:
- r = sd_netlink_message_read_in6_addr(m, IFA_LOCAL, &a->address.in6);
- if (r < 0) {
- r = sd_netlink_message_read_in6_addr(m, IFA_ADDRESS, &a->address.in6);
- if (r < 0)
- continue;
- }
- break;
-
- default:
- continue;
- }
-
- a->ifindex = ifi;
- a->family = family;
-
- n_list++;
- };
-
- qsort_safe(list, n_list, sizeof(struct local_address), address_compare);
-
- *ret = list;
- list = NULL;
-
- return (int) n_list;
-}
-
-int local_gateways(sd_netlink *context, int ifindex, int af, struct local_address **ret) {
- _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL, *reply = NULL;
- _cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
- _cleanup_free_ struct local_address *list = NULL;
- sd_netlink_message *m = NULL;
- size_t n_list = 0, n_allocated = 0;
- int r;
-
- assert(ret);
-
- if (context)
- rtnl = sd_netlink_ref(context);
- else {
- r = sd_netlink_open(&rtnl);
- if (r < 0)
- return r;
- }
-
- r = sd_rtnl_message_new_route(rtnl, &req, RTM_GETROUTE, af, RTPROT_UNSPEC);
- if (r < 0)
- return r;
-
- r = sd_netlink_message_request_dump(req, true);
- if (r < 0)
- return r;
-
- r = sd_netlink_call(rtnl, req, 0, &reply);
- if (r < 0)
- return r;
-
- for (m = reply; m; m = sd_netlink_message_next(m)) {
- struct local_address *a;
- uint16_t type;
- unsigned char dst_len, src_len;
- uint32_t ifi;
- int family;
-
- r = sd_netlink_message_get_errno(m);
- if (r < 0)
- return r;
-
- r = sd_netlink_message_get_type(m, &type);
- if (r < 0)
- return r;
- if (type != RTM_NEWROUTE)
- continue;
-
- /* We only care for default routes */
- r = sd_rtnl_message_route_get_dst_prefixlen(m, &dst_len);
- if (r < 0)
- return r;
- if (dst_len != 0)
- continue;
-
- r = sd_rtnl_message_route_get_src_prefixlen(m, &src_len);
- if (r < 0)
- return r;
- if (src_len != 0)
- continue;
-
- r = sd_netlink_message_read_u32(m, RTA_OIF, &ifi);
- if (r < 0)
- return r;
- if (ifindex > 0 && (int) ifi != ifindex)
- continue;
-
- r = sd_rtnl_message_route_get_family(m, &family);
- if (r < 0)
- return r;
- if (af != AF_UNSPEC && af != family)
- continue;
-
- if (!GREEDY_REALLOC0(list, n_allocated, n_list + 1))
- return -ENOMEM;
-
- a = list + n_list;
-
- switch (family) {
- case AF_INET:
- r = sd_netlink_message_read_in_addr(m, RTA_GATEWAY, &a->address.in);
- if (r < 0)
- continue;
-
- break;
- case AF_INET6:
- r = sd_netlink_message_read_in6_addr(m, RTA_GATEWAY, &a->address.in6);
- if (r < 0)
- continue;
-
- break;
- default:
- continue;
- }
-
- sd_netlink_message_read_u32(m, RTA_PRIORITY, &a->metric);
-
- a->ifindex = ifi;
- a->family = family;
-
- n_list++;
- }
-
- if (n_list > 0)
- qsort(list, n_list, sizeof(struct local_address), address_compare);
-
- *ret = list;
- list = NULL;
-
- return (int) n_list;
-}
diff --git a/src/libsystemd/src/sd-netlink/local-addresses.h b/src/libsystemd/src/sd-netlink/local-addresses.h
deleted file mode 100644
index f1e91ccfd2..0000000000
--- a/src/libsystemd/src/sd-netlink/local-addresses.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#pragma once
-
-/***
- This file is part of systemd.
-
- Copyright 2008-2011 Lennart Poettering
-
- 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.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-
-#include "systemd-basic/in-addr-util.h"
-#include "systemd-staging/sd-netlink.h"
-
-struct local_address {
- int family, ifindex;
- unsigned char scope;
- uint32_t metric;
- union in_addr_union address;
-};
-
-int local_addresses(sd_netlink *rtnl, int ifindex, int af, struct local_address **ret);
-
-int local_gateways(sd_netlink *rtnl, int ifindex, int af, struct local_address **ret);
diff --git a/src/libsystemd/src/sd-netlink/test-local-addresses.c b/src/libsystemd/src/sd-netlink/test-local-addresses.c
deleted file mode 100644
index b08cac9907..0000000000
--- a/src/libsystemd/src/sd-netlink/test-local-addresses.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/***
- This file is part of systemd.
-
- Copyright 2014 Lennart Poettering
-
- 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.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include "systemd-basic/af-list.h"
-#include "systemd-basic/alloc-util.h"
-#include "systemd-basic/in-addr-util.h"
-
-#include "local-addresses.h"
-
-static void print_local_addresses(struct local_address *a, unsigned n) {
- unsigned i;
-
- for (i = 0; i < n; i++) {
- _cleanup_free_ char *b = NULL;
-
- assert_se(in_addr_to_string(a[i].family, &a[i].address, &b) >= 0);
- printf("%s if%i scope=%i metric=%u address=%s\n", af_to_name(a[i].family), a[i].ifindex, a[i].scope, a[i].metric, b);
- }
-}
-
-int main(int argc, char *argv[]) {
- struct local_address *a;
- int n;
-
- a = NULL;
- n = local_addresses(NULL, 0, AF_UNSPEC, &a);
- assert_se(n >= 0);
-
- printf("Local Addresses:\n");
- print_local_addresses(a, (unsigned) n);
- a = mfree(a);
-
- n = local_gateways(NULL, 0, AF_UNSPEC, &a);
- assert_se(n >= 0);
-
- printf("Local Gateways:\n");
- print_local_addresses(a, (unsigned) n);
- free(a);
-
- return 0;
-}
diff --git a/src/libsystemd/src/sd-network/GNUmakefile b/src/libsystemd/src/sd-network/GNUmakefile
new file mode 120000
index 0000000000..13308a50cd
--- /dev/null
+++ b/src/libsystemd/src/sd-network/GNUmakefile
@@ -0,0 +1 @@
+../../../../GNUmakefile \ No newline at end of file
diff --git a/src/libsystemd/src/sd-network/network-util.h b/src/libsystemd/src/sd-network/network-util.h
index 4527ed7c0f..253a6b9934 100644
--- a/src/libsystemd/src/sd-network/network-util.h
+++ b/src/libsystemd/src/sd-network/network-util.h
@@ -19,6 +19,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <stdbool.h>
+
#include "systemd-staging/sd-network.h"
bool network_is_online(void);
diff --git a/src/libsystemd/src/sd-resolve/GNUmakefile b/src/libsystemd/src/sd-resolve/GNUmakefile
new file mode 120000
index 0000000000..13308a50cd
--- /dev/null
+++ b/src/libsystemd/src/sd-resolve/GNUmakefile
@@ -0,0 +1 @@
+../../../../GNUmakefile \ No newline at end of file
diff --git a/src/libsystemd/src/sd-utf8/sd-utf8.c b/src/libsystemd/src/sd-utf8/sd-utf8.c
deleted file mode 100644
index e00ec94390..0000000000
--- a/src/libsystemd/src/sd-utf8/sd-utf8.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/***
- This file is part of systemd.
-
- Copyright 2013 Lennart Poettering
-
- 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.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <systemd/sd-utf8.h>
-
-#include "systemd-basic/utf8.h"
-#include "systemd-basic/util.h"
-
-_public_ const char *sd_utf8_is_valid(const char *s) {
- assert_return(s, NULL);
-
- return utf8_is_valid(s);
-}
-
-_public_ const char *sd_ascii_is_valid(const char *s) {
- assert_return(s, NULL);
-
- return ascii_is_valid(s);
-}
diff --git a/src/libsystemd/src/subdir.mk b/src/libsystemd/src/subdir.mk
index 605b592401..73c05740ce 100644
--- a/src/libsystemd/src/subdir.mk
+++ b/src/libsystemd/src/subdir.mk
@@ -20,10 +20,12 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
-include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk
+
+include $(dir $(lastword $(MAKEFILE_LIST)))/../../../../config.mk
include $(topsrcdir)/build-aux/Makefile.head.mk
-sd.CPPFLAGS += -DLIBDIR=\"$(libdir)\"
-sd.CPPFLAGS += -DUDEVLIBEXECDIR=\"$(udevlibexecdir)\"
+sd.CPPFLAGS += $(libsystemd.CPPFLAGS)
+sd.CPPFLAGS += $(libsystemd-staging.CPPFLAGS)
+sd.CPPFLAGS += $(libsystemd-basic.CPPFLAGS)
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/libsystemd/src/test.mk b/src/libsystemd/src/test.mk
index c823a360f2..ffaff5c889 100644
--- a/src/libsystemd/src/test.mk
+++ b/src/libsystemd/src/test.mk
@@ -20,8 +20,6 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
-include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk
-include $(topsrcdir)/build-aux/Makefile.head.mk
test_bus_marshal_SOURCES = \
src/libsystemd/sd-bus/test-bus-marshal.c
@@ -148,17 +146,8 @@ test_netlink_SOURCES = \
test_netlink_LDADD = \
libsystemd-shared.la
-test_local_addresses_SOURCES = \
- src/libsystemd/sd-netlink/test-local-addresses.c
-
-test_local_addresses_LDADD = \
- libsystemd-shared.la
-
test_resolve_SOURCES = \
src/libsystemd/sd-resolve/test-resolve.c
test_resolve_LDADD = \
libsystemd-shared.la
-
-
-include $(topsrcdir)/build-aux/Makefile.tail.mk