diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/grp-journal/Makefile | 1 | ||||
-rw-r--r-- | src/grp-journal/grp-remote/libsystemd-microhttpd/Makefile | 2 | ||||
-rw-r--r-- | src/grp-journal/grp-remote/libsystemd-microhttpd/src/Makefile | 2 | ||||
-rw-r--r-- | src/grp-machine/libmachine-core/Makefile | 1 | ||||
-rw-r--r-- | src/grp-machine/libmachine-core/src/Makefile | 9 | ||||
-rw-r--r-- | src/grp-machine/libmachine-core/test/Makefile | 35 | ||||
-rw-r--r-- | src/grp-resolve/libbasic-dns/src/Makefile | 3 | ||||
-rw-r--r-- | src/grp-resolve/libbasic-dns/test/Makefile | 7 | ||||
-rw-r--r-- | src/grp-system/libcore/src/manager.c | 24 | ||||
-rw-r--r-- | src/grp-system/systemctl/systemctl.c | 9 | ||||
-rw-r--r-- | src/grp-system/systemd/main.c | 6 | ||||
-rw-r--r-- | src/libsystemd-basic/src/Makefile | 8 | ||||
-rw-r--r-- | src/libsystemd-shared/src/Makefile | 11 | ||||
-rw-r--r-- | src/systemd-nspawn/nspawn.c | 3 |
14 files changed, 87 insertions, 34 deletions
diff --git a/src/grp-journal/Makefile b/src/grp-journal/Makefile index acd4b7a0a1..59ae3ee8b3 100644 --- a/src/grp-journal/Makefile +++ b/src/grp-journal/Makefile @@ -192,7 +192,6 @@ dist_systempreset_DATA = \ nested.subdirs += grp-remote nested.subdirs += journalctl -nested.subdirs += libjournal-core nested.subdirs += systemd-cat nested.subdirs += systemd-journald diff --git a/src/grp-journal/grp-remote/libsystemd-microhttpd/Makefile b/src/grp-journal/grp-remote/libsystemd-microhttpd/Makefile index 4a9896ee1c..ef8de68e3a 100644 --- a/src/grp-journal/grp-remote/libsystemd-microhttpd/Makefile +++ b/src/grp-journal/grp-remote/libsystemd-microhttpd/Makefile @@ -8,7 +8,7 @@ # Copyright 2013 David Strauss # Copyright 2016 Luke Shumaker # -# systemd is free software; you can redistribute it anor modify it +# 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. diff --git a/src/grp-journal/grp-remote/libsystemd-microhttpd/src/Makefile b/src/grp-journal/grp-remote/libsystemd-microhttpd/src/Makefile index 7df638b778..b0eae79db5 100644 --- a/src/grp-journal/grp-remote/libsystemd-microhttpd/src/Makefile +++ b/src/grp-journal/grp-remote/libsystemd-microhttpd/src/Makefile @@ -8,7 +8,7 @@ # Copyright 2013 David Strauss # Copyright 2016 Luke Shumaker # -# systemd is free software; you can redistribute it anor modify it +# 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. diff --git a/src/grp-machine/libmachine-core/Makefile b/src/grp-machine/libmachine-core/Makefile index 76e6e9ddee..7c64e6af5f 100644 --- a/src/grp-machine/libmachine-core/Makefile +++ b/src/grp-machine/libmachine-core/Makefile @@ -24,5 +24,6 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk nested.subdirs += src +nested.subdirs += test include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-machine/libmachine-core/src/Makefile b/src/grp-machine/libmachine-core/src/Makefile index 75c196f199..a1e10f3cb4 100644 --- a/src/grp-machine/libmachine-core/src/Makefile +++ b/src/grp-machine/libmachine-core/src/Makefile @@ -41,13 +41,4 @@ libmachine_core_la_LIBADD = \ noinst_LTLIBRARIES += \ libmachine-core.la -test_machine_tables_SOURCES = \ - src/machine/test-machine-tables.c - -test_machine_tables_LDADD = \ - libmachine-core.la - -tests += \ - test-machine-tables - include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-machine/libmachine-core/test/Makefile b/src/grp-machine/libmachine-core/test/Makefile new file mode 100644 index 0000000000..a75e11f3ac --- /dev/null +++ b/src/grp-machine/libmachine-core/test/Makefile @@ -0,0 +1,35 @@ +# -*- Mode: makefile; indent-tabs-mode: t -*- +# +# This file is part of systemd. +# +# Copyright 2010-2012 Lennart Poettering +# Copyright 2010-2012 Kay Sievers +# Copyright 2013 Zbigniew Jędrzejewski-Szmek +# Copyright 2013 David Strauss +# Copyright 2016 Luke Shumaker +# +# 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 $(dir $(lastword $(MAKEFILE_LIST)))/../../../../config.mk +include $(topsrcdir)/build-aux/Makefile.head.mk + +test_machine_tables_SOURCES = \ + src/machine/test-machine-tables.c + +test_machine_tables_LDADD = \ + libmachine-core.la + +tests += \ + test-machine-tables + +include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-resolve/libbasic-dns/src/Makefile b/src/grp-resolve/libbasic-dns/src/Makefile index 75041cbc3d..93d4c59345 100644 --- a/src/grp-resolve/libbasic-dns/src/Makefile +++ b/src/grp-resolve/libbasic-dns/src/Makefile @@ -32,6 +32,9 @@ $(outdir)/dns_type-to-name.h: $(outdir)/dns_type-list.txt $(outdir)/dns_type-from-name.gperf: $(outdir)/dns_type-list.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct dns_type_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { s=$$1; sub(/_/, "-", s); printf "%s, ", $$s; printf "DNS_TYPE_%s\n", $$1 }' <$< >$@ +gperf_txt_sources += \ + src/resolve/dns_type-list.txt + libbasic_dns_la_SOURCES = \ src/resolve/resolved-dns-dnssec.c \ src/resolve/resolved-dns-dnssec.h \ diff --git a/src/grp-resolve/libbasic-dns/test/Makefile b/src/grp-resolve/libbasic-dns/test/Makefile index a5028500df..4f4cbd42a3 100644 --- a/src/grp-resolve/libbasic-dns/test/Makefile +++ b/src/grp-resolve/libbasic-dns/test/Makefile @@ -42,7 +42,7 @@ test_resolve_tables_CFLAGS = \ $(GCRYPT_CFLAGS) test_resolve_tables_LDADD = \ - libbasic-dns.la \ + libbasic-dns.la \ libsystemd-shared.la \ $(GCRYPT_LIBS) \ -lm @@ -58,7 +58,8 @@ test_dns_packet_CFLAGS = \ $(GCRYPT_CFLAGS) test_dns_packet_LDADD = \ - libbasic-dns.la \ + libbasic-dns.la \ + libsystemd-shared.la \ $(GCRYPT_LIBS) \ -lm @@ -83,7 +84,7 @@ test_dnssec_CFLAGS = \ $(GCRYPT_CFLAGS) test_dnssec_LDADD = \ - libbasic-dns.la \ + libbasic-dns.la \ libsystemd-shared.la \ $(GCRYPT_LIBS) \ -lm diff --git a/src/grp-system/libcore/src/manager.c b/src/grp-system/libcore/src/manager.c index efc002cf87..b769c33b20 100644 --- a/src/grp-system/libcore/src/manager.c +++ b/src/grp-system/libcore/src/manager.c @@ -1586,13 +1586,12 @@ static int manager_dispatch_cgroups_agent_fd(sd_event_source *source, int fd, ui return 0; } -static void manager_invoke_notify_message(Manager *m, Unit *u, pid_t pid, const char *buf, size_t n, FDSet *fds) { +static void manager_invoke_notify_message(Manager *m, Unit *u, pid_t pid, const char *buf, FDSet *fds) { _cleanup_strv_free_ char **tags = NULL; assert(m); assert(u); assert(buf); - assert(n > 0); tags = strv_split(buf, "\n\r"); if (!tags) { @@ -1645,10 +1644,14 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t n = recvmsg(m->notify_fd, &msghdr, MSG_DONTWAIT|MSG_CMSG_CLOEXEC); if (n < 0) { - if (errno == EAGAIN || errno == EINTR) - return 0; + if (!IN_SET(errno, EAGAIN, EINTR)) + log_error("Failed to receive notification message: %m"); - return -errno; + /* It's not an option to return an error here since it + * would disable the notification handler entirely. Services + * wouldn't be able to send the WATCHDOG message for + * example... */ + return 0; } CMSG_FOREACH(cmsg, &msghdr) { @@ -1671,7 +1674,8 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t r = fdset_new_array(&fds, fd_array, n_fds); if (r < 0) { close_many(fd_array, n_fds); - return log_oom(); + log_oom(); + return 0; } } @@ -1685,25 +1689,27 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t return 0; } + /* The message should be a string. Here we make sure it's NUL-terminated, + * but only the part until first NUL will be used anyway. */ buf[n] = 0; /* Notify every unit that might be interested, but try * to avoid notifying the same one multiple times. */ u1 = manager_get_unit_by_pid_cgroup(m, ucred->pid); if (u1) { - manager_invoke_notify_message(m, u1, ucred->pid, buf, n, fds); + manager_invoke_notify_message(m, u1, ucred->pid, buf, fds); found = true; } u2 = hashmap_get(m->watch_pids1, PID_TO_PTR(ucred->pid)); if (u2 && u2 != u1) { - manager_invoke_notify_message(m, u2, ucred->pid, buf, n, fds); + manager_invoke_notify_message(m, u2, ucred->pid, buf, fds); found = true; } u3 = hashmap_get(m->watch_pids2, PID_TO_PTR(ucred->pid)); if (u3 && u3 != u2 && u3 != u1) { - manager_invoke_notify_message(m, u3, ucred->pid, buf, n, fds); + manager_invoke_notify_message(m, u3, ucred->pid, buf, fds); found = true; } diff --git a/src/grp-system/systemctl/systemctl.c b/src/grp-system/systemctl/systemctl.c index 0c7349fc07..ab9fc4a427 100644 --- a/src/grp-system/systemctl/systemctl.c +++ b/src/grp-system/systemctl/systemctl.c @@ -4686,12 +4686,14 @@ static int show_one( return log_error_errno(r, "Failed to map properties: %s", bus_error_message(&error, r)); if (streq_ptr(info.load_state, "not-found") && streq_ptr(info.active_state, "inactive")) { - log_error("Unit %s could not be found.", unit); + log_full(streq(verb, "status") ? LOG_ERR : LOG_DEBUG, + "Unit %s could not be found.", unit); if (streq(verb, "status")) return EXIT_PROGRAM_OR_SERVICES_STATUS_UNKNOWN; - return -ENOENT; + if (!streq(verb, "show")) + return -ENOENT; } r = sd_bus_message_rewind(reply, true); @@ -4756,10 +4758,11 @@ static int show_one( r = 0; if (show_properties) { char **pp; + int not_found_level = streq(verb, "show") ? LOG_DEBUG : LOG_WARNING; STRV_FOREACH(pp, arg_properties) if (!set_contains(found_properties, *pp)) { - log_warning("Property %s does not exist.", *pp); + log_full(not_found_level, "Property %s does not exist.", *pp); r = -ENXIO; } diff --git a/src/grp-system/systemd/main.c b/src/grp-system/systemd/main.c index 43cf9a045c..1c53f9aad3 100644 --- a/src/grp-system/systemd/main.c +++ b/src/grp-system/systemd/main.c @@ -2016,9 +2016,6 @@ finish: log_error_errno(r, "Failed to switch root, trying to continue: %m"); } - /* Reopen the console */ - (void) make_console_stdio(); - args_size = MAX(6, argc+1); args = newa(const char*, args_size); @@ -2066,6 +2063,9 @@ finish: arg_serialization = safe_fclose(arg_serialization); fds = fdset_free(fds); + /* Reopen the console */ + (void) make_console_stdio(); + for (j = 1, i = 1; j < (unsigned) argc; j++) args[i++] = argv[j]; args[i++] = NULL; diff --git a/src/libsystemd-basic/src/Makefile b/src/libsystemd-basic/src/Makefile index 56fa57e5a9..3c9f3246af 100644 --- a/src/libsystemd-basic/src/Makefile +++ b/src/libsystemd-basic/src/Makefile @@ -244,13 +244,13 @@ $(outdir)/errno-list.txt: | $(outdir)/.deps $(outdir)/errno-to-name.h: $(outdir)/errno-list.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const errno_names[] = { "} !/EDEADLOCK/ && !/EWOULDBLOCK/ && !/ENOTSUP/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@ -$(outdir)/af-list.txt: +$(outdir)/af-list.txt: | $(outdir)/.deps $(AM_V_GEN)$(CPP) $(sd.ALL_CPPFLAGS) -dM -include sys/socket.h - </dev/null | grep -v AF_UNSPEC | grep -v AF_MAX | $(AWK) '/^#define[ \t]+AF_[^ \t]+[ \t]+PF_[^ \t]/ { print $$2; }' >$@ $(outdir)/af-to-name.h: $(outdir)/af-list.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const af_names[] = { "} !/AF_FILE/ && !/AF_ROUTE/ && !/AF_LOCAL/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@ -$(outdir)/arphrd-list.txt: +$(outdir)/arphrd-list.txt: | $(outdir)/.deps $(AM_V_GEN)$(CPP) $(sd.ALL_CPPFLAGS) -dM -include net/if_arp.h - </dev/null | $(AWK) '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $$2; }' | sed -e 's/ARPHRD_//' >$@ $(outdir)/arphrd-to-name.h: $(outdir)/arphrd-list.txt @@ -259,8 +259,8 @@ $(outdir)/arphrd-to-name.h: $(outdir)/arphrd-list.txt $(outdir)/arphrd-from-name.gperf: $(outdir)/arphrd-list.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct arphrd_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, ARPHRD_%s\n", $$1, $$1 }' <$< >$@ -$(outdir)/cap-list.txt: $(call at.path,$(srcdir)/../include/systemd-basic/missing.h) - $(AM_V_GEN)$(CPP) $(sd.ALL_CPPFLAGS) -dM -include linux/capability.h -include $< - </dev/null | $(AWK) '/^#define[ \t]+CAP_[A-Z_]+[ \t]+/ { print $$2; }' | grep -v CAP_LAST_CAP >$@ +$(outdir)/cap-list.txt: | $(outdir)/.deps + $(AM_V_GEN)$(CPP) $(sd.ALL_CPPFLAGS) -dM -include linux/capability.h -include systemd-basic/missing.h - </dev/null | $(AWK) '/^#define[ \t]+CAP_[A-Z_]+[ \t]+/ { print $$2; }' | grep -v CAP_LAST_CAP >$@ $(outdir)/cap-to-name.h: $(outdir)/cap-list.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const capability_names[] = { "} { printf "[%s] = \"%s\",\n", $$1, tolower($$1) } END{print "};"}' <$< >$@ diff --git a/src/libsystemd-shared/src/Makefile b/src/libsystemd-shared/src/Makefile index 62fe215e3f..a8f08e8934 100644 --- a/src/libsystemd-shared/src/Makefile +++ b/src/libsystemd-shared/src/Makefile @@ -135,6 +135,8 @@ libsystemd_shared_la_CFLAGS = \ libsystemd_shared_la_LIBADD = \ libsystemd-internal.la \ + libsystemd-basic.la \ + libsystemd-journal-internal.la \ libudev-internal.la \ $(ACL_LIBS) \ $(LIBIDN_LIBS) \ @@ -146,6 +148,15 @@ libsystemd_shared_la_CFLAGS = \ $(SECCOMP_CFLAGS) \ -fvisibility=default +libsystemd_shared_la_LIBADD = \ + $(libsystemd_basic_la_LIBADD) \ + $(libsystemd_internal_la_LIBADD) \ + $(libsystemd_journal_internal_la_LIBADD) \ + $(libudev_internal_la_LIBADD) \ + $(ACL_LIBS) \ + $(LIBIDN_LIBS) \ + $(SECCOMP_LIBS) + libsystemd_shared_la_LDFLAGS = \ -release $(PACKAGE_VERSION) diff --git a/src/systemd-nspawn/nspawn.c b/src/systemd-nspawn/nspawn.c index 868f72eb87..f2cbae2ddb 100644 --- a/src/systemd-nspawn/nspawn.c +++ b/src/systemd-nspawn/nspawn.c @@ -75,9 +75,12 @@ #include "systemd-basic/socket-util.h" #include "systemd-basic/stat-util.h" #include "systemd-basic/stdio-util.h" +#include "systemd-basic/string-util.h" +#include "systemd-basic/strv.h" #include "systemd-basic/terminal-util.h" #include "systemd-basic/umask-util.h" #include "systemd-basic/user-util.h" +#include "systemd-basic/util.h" #include "systemd-blkid/blkid-util.h" #include "systemd-shared/base-filesystem.h" #include "systemd-shared/dev-setup.h" |