chiark / gitweb /
Prep v221: Update and clean up build system to sync with upstream
authorSven Eden <yamakuzure@gmx.net>
Fri, 16 Dec 2016 11:09:41 +0000 (12:09 +0100)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:18:01 +0000 (10:18 +0100)
This commit replays the moving around of source files that have been
done between systemd-219 and systemd-221.

Further the Makefile.am is synchronized with the upstream version and
then "re-cleaned".

A lot of functions, that are not used anywhere in elogind have been
coated into #if 0/#endif directives to further shorten the list of
dependencies.

All unneeded files have been removed.

252 files changed:
.gitignore
CODING_STYLE
Makefile-man.am
Makefile.am
NEWS
README
TODO
autogen.sh
configure.ac
docs/gtk-doc.make [new symlink]
factory/etc/pam.d/system-auth
m4/gtk-doc.m4 [new file with mode: 0644]
man/custom-html.xsl
man/elogind.conf.xml [moved from man/logind.conf.xml with 88% similarity]
man/loginctl.xml
man/pam_elogind.xml
man/sd_is_fifo.xml [new file with mode: 0644]
shell-completion/zsh/_elogind-inhibit [new file with mode: 0644]
src/basic/.gitignore [new file with mode: 0644]
src/basic/Makefile [moved from src/shared/linux/Makefile with 100% similarity]
src/basic/audit.c [moved from src/shared/audit.c with 100% similarity]
src/basic/audit.h [moved from src/shared/audit.h with 100% similarity]
src/basic/btrfs-util.h [new file with mode: 0644]
src/basic/build.h [new file with mode: 0644]
src/basic/bus-label.c [moved from src/shared/bus-label.c with 100% similarity]
src/basic/bus-label.h [moved from src/shared/bus-label.h with 100% similarity]
src/basic/calendarspec.h [moved from src/shared/calendarspec.h with 100% similarity]
src/basic/capability.c [moved from src/shared/capability.c with 99% similarity]
src/basic/capability.h [moved from src/shared/capability.h with 90% similarity]
src/basic/cgroup-util.c [moved from src/shared/cgroup-util.c with 75% similarity]
src/basic/cgroup-util.h [moved from src/shared/cgroup-util.h with 85% similarity]
src/basic/conf-files.c [moved from src/shared/conf-files.c with 100% similarity]
src/basic/conf-files.h [moved from src/shared/conf-files.h with 100% similarity]
src/basic/def.h [moved from src/shared/def.h with 98% similarity]
src/basic/device-nodes.h [moved from src/shared/device-nodes.h with 100% similarity]
src/basic/env-util.h [moved from src/shared/env-util.h with 100% similarity]
src/basic/errno-list.c [moved from src/shared/errno-list.c with 97% similarity]
src/basic/errno-list.h [moved from src/shared/errno-list.h with 96% similarity]
src/basic/exit-status.h [moved from src/shared/exit-status.h with 100% similarity]
src/basic/fdset.h [moved from src/shared/fdset.h with 88% similarity]
src/basic/fileio-label.c [moved from src/shared/fileio-label.c with 97% similarity]
src/basic/fileio-label.h [moved from src/shared/fileio-label.h with 82% similarity]
src/basic/fileio.c [moved from src/shared/fileio.c with 99% similarity]
src/basic/fileio.h [moved from src/shared/fileio.h with 90% similarity]
src/basic/gunicode.c [moved from src/shared/gunicode.c with 100% similarity]
src/basic/gunicode.h [moved from src/shared/gunicode.h with 100% similarity]
src/basic/hashmap.c [moved from src/shared/hashmap.c with 99% similarity]
src/basic/hashmap.h [moved from src/shared/hashmap.h with 99% similarity]
src/basic/hostname-util.c [moved from src/shared/hostname-util.c with 100% similarity]
src/basic/hostname-util.h [moved from src/shared/hostname-util.h with 100% similarity]
src/basic/ioprio.h [moved from src/shared/ioprio.h with 100% similarity]
src/basic/label.c [moved from src/shared/label.c with 100% similarity]
src/basic/label.h [moved from src/shared/label.h with 100% similarity]
src/basic/list.h [moved from src/shared/list.h with 100% similarity]
src/basic/log.c [moved from src/shared/log.c with 100% similarity]
src/basic/log.h [moved from src/shared/log.h with 100% similarity]
src/basic/login-util.c [moved from src/shared/login-shared.c with 97% similarity]
src/basic/login-util.h [moved from src/shared/ima-util.h with 90% similarity]
src/basic/macro.h [moved from src/shared/macro.h with 100% similarity]
src/basic/memfd-util.c [moved from src/shared/memfd-util.c with 98% similarity]
src/basic/memfd-util.h [moved from src/shared/memfd-util.h with 93% similarity]
src/basic/mempool.c [moved from src/shared/mempool.c with 98% similarity]
src/basic/mempool.h [moved from src/shared/mempool.h with 96% similarity]
src/basic/missing.h [moved from src/shared/missing.h with 95% similarity]
src/basic/mkdir-label.c [moved from src/shared/mkdir-label.c with 100% similarity]
src/basic/mkdir.c [moved from src/shared/mkdir.c with 100% similarity]
src/basic/mkdir.h [moved from src/shared/mkdir.h with 100% similarity]
src/basic/path-util.c [moved from src/shared/path-util.c with 99% similarity]
src/basic/path-util.h [moved from src/shared/path-util.h with 96% similarity]
src/basic/prioq.c [moved from src/shared/prioq.c with 100% similarity]
src/basic/prioq.h [moved from src/shared/prioq.h with 100% similarity]
src/basic/process-util.c [moved from src/shared/process-util.c with 99% similarity]
src/basic/process-util.h [moved from src/shared/process-util.h with 89% similarity]
src/basic/random-util.c [moved from src/shared/random-util.c with 99% similarity]
src/basic/random-util.h [moved from src/shared/random-util.h with 100% similarity]
src/basic/ratelimit.h [moved from src/shared/ratelimit.h with 100% similarity]
src/basic/refcnt.h [moved from src/shared/refcnt.h with 100% similarity]
src/basic/ring.h [moved from src/shared/ring.h with 94% similarity]
src/basic/rm-rf.c [moved from src/shared/rm-rf.c with 97% similarity]
src/basic/rm-rf.h [moved from src/shared/rm-rf.h with 100% similarity]
src/basic/selinux-util.c [moved from src/shared/selinux-util.c with 99% similarity]
src/basic/selinux-util.h [moved from src/shared/selinux-util.h with 95% similarity]
src/basic/set.h [moved from src/shared/set.h with 98% similarity]
src/basic/signal-util.c [moved from src/shared/signal-util.c with 99% similarity]
src/basic/signal-util.h [moved from src/shared/signal-util.h with 100% similarity]
src/basic/siphash24.c [moved from src/shared/siphash24.c with 100% similarity]
src/basic/siphash24.h [moved from src/shared/siphash24.h with 100% similarity]
src/basic/smack-util.c [moved from src/shared/smack-util.c with 100% similarity]
src/basic/smack-util.h [moved from src/shared/smack-util.h with 100% similarity]
src/basic/socket-util.h [moved from src/shared/socket-util.h with 93% similarity]
src/basic/sparse-endian.h [moved from src/shared/sparse-endian.h with 100% similarity]
src/basic/special.h [moved from src/shared/special.h with 97% similarity]
src/basic/strv.c [moved from src/shared/strv.c with 98% similarity]
src/basic/strv.h [moved from src/shared/strv.h with 94% similarity]
src/basic/terminal-util.c [moved from src/shared/terminal-util.c with 99% similarity]
src/basic/terminal-util.h [moved from src/shared/terminal-util.h with 95% similarity]
src/basic/time-util.c [moved from src/shared/time-util.c with 99% similarity]
src/basic/time-util.h [moved from src/shared/time-util.h with 93% similarity]
src/basic/unit-name.c [moved from src/shared/unit-name.c with 100% similarity]
src/basic/unit-name.h [moved from src/shared/unit-name.h with 100% similarity]
src/basic/utf8.c [moved from src/shared/utf8.c with 100% similarity]
src/basic/utf8.h [moved from src/shared/utf8.h with 100% similarity]
src/basic/util.c [moved from src/shared/util.c with 99% similarity]
src/basic/util.h [moved from src/shared/util.h with 76% similarity]
src/basic/verbs.c [moved from src/shared/verbs.c with 100% similarity]
src/basic/verbs.h [moved from src/shared/verbs.h with 100% similarity]
src/basic/virt.c [moved from src/shared/virt.c with 100% similarity]
src/basic/virt.h [moved from src/shared/virt.h with 100% similarity]
src/core/org.freedesktop.systemd1.conf [new file with mode: 0644]
src/core/org.freedesktop.systemd1.policy.in.in [new file with mode: 0644]
src/core/org.freedesktop.systemd1.service [new file with mode: 0644]
src/core/system.conf [new file with mode: 0644]
src/core/user.conf [new file with mode: 0644]
src/libelogind/sd-bus/bus-container.c [deleted file]
src/libelogind/sd-bus/bus-control.c
src/libelogind/sd-bus/bus-convenience.c
src/libelogind/sd-bus/bus-creds.c
src/libelogind/sd-bus/bus-internal.c
src/libelogind/sd-bus/bus-internal.h
src/libelogind/sd-bus/bus-match.c
src/libelogind/sd-bus/bus-match.h
src/libelogind/sd-bus/bus-message.c
src/libelogind/sd-bus/bus-message.h
src/libelogind/sd-bus/bus-objects.c
src/libelogind/sd-bus/bus-slot.c
src/libelogind/sd-bus/bus-track.c
src/libelogind/sd-bus/bus-type.c
src/libelogind/sd-bus/bus-type.h
src/libelogind/sd-bus/sd-bus.c
src/libelogind/sd-daemon/sd-daemon.c
src/libelogind/sd-device/device-internal.h [deleted file]
src/libelogind/sd-device/device-private.c [deleted file]
src/libelogind/sd-device/device-private.h [deleted file]
src/libelogind/sd-device/device-util.h [deleted file]
src/libelogind/sd-event/sd-event.c
src/libelogind/sd-hwdb/Makefile [deleted symlink]
src/libelogind/sd-hwdb/hwdb-internal.h [deleted file]
src/libelogind/sd-hwdb/sd-hwdb.c [deleted file]
src/libelogind/sd-netlink/Makefile [moved from src/libsystemd/sd-netlink/Makefile with 100% similarity]
src/libelogind/sd-netlink/netlink-types.h [moved from src/libsystemd/sd-netlink/netlink-types.h with 100% similarity]
src/libelogind/sd-network/network-util.c [deleted file]
src/libelogind/sd-network/network-util.h [deleted file]
src/libelogind/sd-network/sd-network.c [deleted file]
src/libelogind/sd-resolve/Makefile [deleted symlink]
src/libelogind/sd-rtnl/Makefile [deleted symlink]
src/libelogind/sd-rtnl/local-addresses.h [deleted file]
src/libelogind/sd-rtnl/rtnl-internal.h [deleted file]
src/libelogind/sd-rtnl/rtnl-types.c [deleted file]
src/libelogind/sd-rtnl/rtnl-types.h [deleted file]
src/libelogind/sd-rtnl/rtnl-util.h [deleted file]
src/libelogind/sd-utf8/Makefile [deleted symlink]
src/libelogind/sd-utf8/sd-utf8.c [deleted file]
src/libsystemd/sd-netlink/local-addresses.c [deleted file]
src/libsystemd/sd-netlink/local-addresses.h [deleted file]
src/libsystemd/sd-netlink/netlink-util.c [deleted file]
src/libsystemd/sd-netlink/netlink-util.h [deleted file]
src/libsystemd/sd-netlink/sd-netlink.c [deleted file]
src/libsystemd/sd-netlink/test-local-addresses.c [deleted file]
src/libsystemd/sd-netlink/test-netlink.c [deleted file]
src/login/elogind.conf [moved from src/login/logind.conf with 96% similarity]
src/login/logind-button.h
src/login/logind.c
src/shared/Makefile [deleted symlink]
src/shared/MurmurHash2.c [deleted file]
src/shared/MurmurHash2.h [deleted file]
src/shared/acl-util.c
src/shared/acl-util.h
src/shared/acpi-fpdt.c [deleted file]
src/shared/acpi-fpdt.h [deleted file]
src/shared/af-list.c [deleted file]
src/shared/architecture.c [deleted file]
src/shared/arphrd-list.c [deleted file]
src/shared/arphrd-list.h [deleted file]
src/shared/async.c [deleted file]
src/shared/async.h [deleted file]
src/shared/barrier.c [deleted file]
src/shared/barrier.h [deleted file]
src/shared/base-filesystem.c [deleted file]
src/shared/base-filesystem.h [deleted file]
src/shared/build.h [deleted file]
src/shared/bus-util.c [moved from src/libelogind/sd-bus/bus-util.c with 98% similarity]
src/shared/bus-util.h [moved from src/libelogind/sd-bus/bus-util.h with 97% similarity]
src/shared/calendarspec.c [deleted file]
src/shared/cap-list.c [deleted file]
src/shared/cap-list.h [deleted file]
src/shared/cgroup-show.c
src/shared/cgroup-show.h
src/shared/clock-util.c [deleted file]
src/shared/clock-util.h [deleted file]
src/shared/condition.h
src/shared/conf-parser.c
src/shared/conf-parser.h
src/shared/device-nodes.c [deleted file]
src/shared/env-util.c [deleted file]
src/shared/exit-status.c [deleted file]
src/shared/fdset.c [deleted file]
src/shared/firewall-util.c [deleted file]
src/shared/firewall-util.h [deleted file]
src/shared/fstab-util.c [deleted file]
src/shared/fstab-util.h [deleted file]
src/shared/ima-util.c [deleted file]
src/shared/import-util.c [deleted file]
src/shared/import-util.h [deleted file]
src/shared/in-addr-util.c [deleted file]
src/shared/in-addr-util.h [deleted file]
src/shared/json.c [deleted file]
src/shared/json.h [deleted file]
src/shared/locale-util.c [deleted file]
src/shared/locale-util.h [deleted file]
src/shared/pager.c
src/shared/pager.h
src/shared/pty.c [deleted file]
src/shared/pty.h [deleted file]
src/shared/ptyfwd.c [deleted file]
src/shared/ptyfwd.h [deleted file]
src/shared/ratelimit.c [deleted file]
src/shared/replace-var.c [deleted file]
src/shared/replace-var.h [deleted file]
src/shared/ring.c [deleted file]
src/shared/seccomp-util.c [new file with mode: 0644]
src/shared/seccomp-util.h [moved from src/shared/af-list.h with 80% similarity]
src/shared/sigbus.c [deleted file]
src/shared/sigbus.h [deleted file]
src/shared/strbuf.c [deleted file]
src/shared/strbuf.h [deleted file]
src/shared/strxcpyx.c [deleted file]
src/shared/strxcpyx.h [deleted file]
src/shared/sysctl-util.h [deleted file]
src/shared/uid-range.c [deleted file]
src/shared/uid-range.h [deleted file]
src/shared/watchdog.c [deleted file]
src/shared/watchdog.h [deleted file]
src/shared/xml.c [deleted file]
src/shared/xml.h [deleted file]
src/systemctl/systemd-sysv-install.SKELETON [deleted file]
src/systemd/sd-bus.h
src/systemd/sd-daemon.h
src/systemd/sd-device.h [deleted file]
src/systemd/sd-dhcp-client.h [deleted file]
src/systemd/sd-dhcp-lease.h [deleted file]
src/systemd/sd-dhcp-server.h [deleted file]
src/systemd/sd-dhcp6-client.h [deleted file]
src/systemd/sd-event.h
src/systemd/sd-hwdb.h [deleted file]
src/systemd/sd-icmp6-nd.h [deleted file]
src/systemd/sd-ipv4ll.h [deleted file]
src/systemd/sd-lldp.h [deleted file]
src/systemd/sd-network.h [deleted file]
src/systemd/sd-resolve.h [deleted file]
src/systemd/sd-utf8.h [deleted file]
src/test/test-firewall-util.c [deleted file]
src/test/test-netlink-manual.c [deleted file]

index cccb49d..342d34f 100644 (file)
@@ -291,3 +291,4 @@ stamp-*
 /elogind-cgroups-agent
 /rebuild_all.sh
 /src/libelogind/libelogind.pc
+/elogind-inhibit
index 91f09e8..dbadfbd 100644 (file)
   c) recvmsg() must get MSG_CMSG_CLOEXEC set
   d) F_DUPFD_CLOEXEC should be used instead of F_DUPFD, and so on
 
-- We never use the XDG version of basename(). glibc defines it in
-  libgen.h. The only reason to include that file is because dirname()
+- We never use the POSIX version of basename() (which glibc defines it in
+  libgen.h), only the GNU version (which glibc defines in string.h).
+  The only reason to include libgen.h is because dirname()
   is needed. Everytime you need that please immediately undefine
   basename(), and add a comment about it, so that no code ever ends up
-  using the XDG version!
+  using the POSIX version!
 
 - Use the bool type for booleans, not integers. One exception: in public
   headers (i.e those in src/systemd/sd-*.h) use integers after all, as "bool"
 
 - When returning a return code from main(), please preferably use
   EXIT_FAILURE and EXIT_SUCCESS as defined by libc.
+
+- The order in which header files are included doesn't matter too
+  much. However, please try to include the headers of external
+  libraries first (these are all headers enclosed in <>), followed by
+  the headers of our own public headers (these are all headers
+  starting with "sd-"), internal utility libraries from src/shared/,
+  followed by the headers of the specific component. Or in other
+  words:
+
+          #include <stdio.h>
+          #include "sd-daemon.h"
+          #include "util.h"
+          #include "frobnicator.h"
+
+  Where stdio.h is a public glibc API, sd-daemon.h is a public API of
+  our own, util.h is a utility library header from src/shared, and
+  frobnicator.h is an placeholder name for any systemd component. The
+  benefit of following this ordering is that more local definitions
+  are always defined after more global ones. Thus, our local
+  definitions will never "leak" into the global header files, possibly
+  altering their effect due to #ifdeffery.
index f931ac4..65a6a89 100644 (file)
@@ -1,11 +1,10 @@
 MANPAGES += \
        man/loginctl.1 \
-       man/logind.conf.5 \
-       man/logind.8
+       man/elogind.conf.5
 MANPAGES_ALIAS += \
-       man/logind.conf.d.5
-man/logind.conf.d.5: man/logind.conf.5
-man/logind.conf.d.html: man/logind.conf.html
+       man/elogind.conf.d.5
+man/elogind.conf.d.5: man/elogind.conf.5
+man/elogind.conf.d.html: man/elogind.conf.html
        $(html-alias)
 
 if HAVE_PAM
@@ -228,8 +227,7 @@ endif
 
 EXTRA_DIST += \
        man/loginctl.xml \
-       man/logind.xml \
-       man/logind.conf.xml \
+       man/elogind.conf.xml \
        man/pam_elogind.xml \
        man/sd_get_seats.xml \
        man/sd_login_monitor_new.xml \
index e104c41..1cb1c20 100644 (file)
@@ -38,39 +38,36 @@ SUBDIRS = . po
 # Keep the test-suite.log
 .PRECIOUS: $(TEST_SUITE_LOG) Makefile
 
-LIBELOGIND_CURRENT=7
+LIBELOGIND_CURRENT=8
 LIBELOGIND_REVISION=0
-LIBELOGIND_AGE=7
+LIBELOGIND_AGE=8
 
 # Dirs of external packages
 dbuspolicydir=@dbuspolicydir@
-dbussessionservicedir=@dbussessionservicedir@
 dbussystemservicedir=@dbussystemservicedir@
 pamlibdir=@pamlibdir@
 pamconfdir=@pamconfdir@
+pkgconfigdatadir=$(datadir)/pkgconfig
 pkgconfiglibdir=$(libdir)/pkgconfig
 polkitpolicydir=$(datadir)/polkit-1/actions
 bashcompletiondir=@bashcompletiondir@
 zshcompletiondir=@zshcompletiondir@
-varlogdir=$(localstatedir)/log
-elogindstatedir=$(localstatedir)/lib/elogind
-systemsleepdir=$(pkglibexecdir)/sleep.d
-systemshutdowndir=$(pkglibexecdir)/shutdown.d
-
-udevrulesdir=@udevrulesdir@
-udevbindir=@udevbindir@
-
-PKTTYAGENT=$(bindir)/pkttyagent
 
 # Our own, non-special dirs
 pkgsysconfdir=$(sysconfdir)/elogind
 pkgincludedir=$(includedir)/elogind
+udevrulesdir=@udevrulesdir@
+udevbindir=@udevbindir@
 udevlibexecdir=$(udevbindir)
 udevhomedir=$(udevlibexecdir)
 udevhwdbdir=$(udevlibexecdir)/hwdb.d
-factory_etcdir = $(datadir)/factory/etc
 factory_pamdir = $(datadir)/factory/etc/pam.d
 
+# And these are the special ones for /
+rootprefix=@rootprefix@
+rootbindir=$(rootprefix)/bin
+rootlibexecdir=$(rootprefix)/lib/elogind
+
 EXTRA_DIST =
 BUILT_SOURCES =
 INSTALL_EXEC_HOOKS =
@@ -82,23 +79,19 @@ CLEAN_LOCAL_HOOKS =
 pkginclude_HEADERS =
 noinst_LTLIBRARIES =
 lib_LTLIBRARIES =
-include_HEADERS =
 noinst_DATA =
 pkgconfiglib_DATA =
-polkitpolicy_in_in_files =
 polkitpolicy_in_files =
 polkitpolicy_files =
+dist_udevrules_DATA =
+nodist_udevrules_DATA =
 dist_pkgsysconf_DATA =
-nodist_pkgsysconf_DATA =
-dist_pkgdata_DATA =
 dist_dbuspolicy_DATA =
 dist_dbussystemservice_DATA =
 check_PROGRAMS =
 check_DATA =
 tests=
 manual_tests =
-TEST_EXTENSIONS = .py
-PY_LOG_COMPILER = $(PYTHON)
 if ENABLE_TESTS
 noinst_PROGRAMS = $(manual_tests) $(tests)
 TESTS = $(tests)
@@ -123,114 +116,51 @@ CLEANFILES = $(BUILT_SOURCES) \
 AM_CPPFLAGS = \
        -include $(top_builddir)/config.h \
        -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\" \
-       -DPOLKIT_AGENT_BINARY_PATH=\"$(PKTTYAGENT)\" \
-       -DSYSTEM_CONFIG_UNIT_PATH=\"$(pkgsysconfdir)/system\" \
-       -DSYSTEM_DATA_UNIT_PATH=\"$(systemunitdir)\" \
-       -DSYSTEMD_CGROUP_AGENT_PATH=\"$(pkglibexecdir)/logind-cgroups-agent\" \
-       -DUSER_CONFIG_UNIT_PATH=\"$(pkgsysconfdir)/user\" \
-       -DUSER_DATA_UNIT_PATH=\"$(userunitdir)\" \
+       -DCERTIFICATE_ROOT=\"$(CERTIFICATEROOT)\" \
+       -DELOGIND_CGROUP_AGENT_PATH=\"$(rootlibexecdir)/elogind-cgroups-agent\" \
        -DROOTPREFIX=\"$(rootprefix)\" \
-       -DSYSTEM_SLEEP_PATH=\"$(systemsleepdir)\" \
-       -DSYSTEM_SHUTDOWN_PATH=\"$(systemshutdowndir)\" \
-       -DHALT=\"$(HALT)\" \
-       -DREBOOT=\"$(REBOOT)\" \
        -DUDEVLIBEXECDIR=\"$(udevlibexecdir)\" \
+       -DPOLKIT_AGENT_BINARY_PATH=\"$(bindir)/pkttyagent\" \
        -DKEXEC=\"$(KEXEC)\" \
        -DLIBDIR=\"$(libdir)\" \
        -DROOTLIBDIR=\"$(rootlibdir)\" \
+       -DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \
        -DTEST_DIR=\"$(abs_top_srcdir)/test\" \
        -I $(top_srcdir)/src \
-       -I $(top_builddir)/src/shared \
+       -I $(top_builddir)/src/basic \
+       -I $(top_srcdir)/src/basic \
        -I $(top_srcdir)/src/shared \
+       -I $(top_builddir)/src/shared \
        -I $(top_srcdir)/src/login \
        -I $(top_srcdir)/src/systemd \
+       -I $(top_builddir)/src/core \
+       -I $(top_srcdir)/src/core \
        -I $(top_srcdir)/src/libelogind/sd-bus \
        -I $(top_srcdir)/src/libelogind/sd-event \
-       -I $(top_srcdir)/src/libelogind/sd-device \
-       $(UDEV_CFLAGS) \
+       -I $(top_srcdir)/src/libelogind/sd-login \
+       -I $(top_srcdir)/src/libelogind/sd-netlink \
        $(OUR_CPPFLAGS)
 
 AM_CFLAGS = $(OUR_CFLAGS)
 AM_LDFLAGS = $(OUR_LDFLAGS)
 
 # ------------------------------------------------------------------------------
-SHUTDOWN_TARGET_WANTS =
-LOCAL_FS_TARGET_WANTS =
-MULTI_USER_TARGET_WANTS =
-GRAPHICAL_TARGET_WANTS =
-RESCUE_TARGET_WANTS =
-SYSINIT_TARGET_WANTS =
-SOCKETS_TARGET_WANTS =
-BUSNAMES_TARGET_WANTS =
-TIMERS_TARGET_WANTS =
-USER_SOCKETS_TARGET_WANTS =
-USER_DEFAULT_TARGET_WANTS =
-USER_BUSNAMES_TARGET_WANTS =
-
-SYSTEM_UNIT_ALIASES =
-USER_UNIT_ALIASES =
-GENERAL_ALIASES =
-
-install-target-wants-hook:
-       what="$(SHUTDOWN_TARGET_WANTS)" && wants=shutdown.target && dir=$(systemunitdir) && $(add-wants)
-       what="$(LOCAL_FS_TARGET_WANTS)" && wants=local-fs.target && dir=$(systemunitdir) && $(add-wants)
-       what="$(MULTI_USER_TARGET_WANTS)" && wants=multi-user.target && dir=$(systemunitdir) && $(add-wants)
-       what="$(GRAPHICAL_TARGET_WANTS)" && wants=graphical.target && dir=$(systemunitdir) && $(add-wants)
-       what="$(RESCUE_TARGET_WANTS)" && wants=rescue.target && dir=$(systemunitdir) && $(add-wants)
-       what="$(SYSINIT_TARGET_WANTS)" && wants=sysinit.target && dir=$(systemunitdir) && $(add-wants)
-       what="$(SOCKETS_TARGET_WANTS)" && wants=sockets.target && dir=$(systemunitdir) && $(add-wants)
-       what="$(TIMERS_TARGET_WANTS)" && wants=timers.target && dir=$(systemunitdir) && $(add-wants)
-       what="$(SLICES_TARGET_WANTS)" && wants=slices.target && dir=$(systemunitdir) && $(add-wants)
-       what="$(USER_SOCKETS_TARGET_WANTS)" && wants=sockets.target && dir=$(userunitdir) && $(add-wants)
-       what="$(USER_DEFAULT_TARGET_WANTS)" && wants=default.target && dir=$(userunitdir) && $(add-wants)
-
-install-busnames-target-wants-hook:
-       what="$(BUSNAMES_TARGET_WANTS)" && wants=busnames.target && dir=$(systemunitdir) && $(add-wants)
-       what="$(USER_BUSNAMES_TARGET_WANTS)" && wants=busnames.target && dir=$(userunitdir) && $(add-wants)
-
-define add-wants
-       [ -z "$$what" ] || ( \
-         dir=$(DESTDIR)$$dir/$$wants.wants && \
-         $(MKDIR_P) -m 0755 $$dir && \
-         cd $$dir && \
-         rm -f $$what && \
-         for i in $$what; do $(LN_S) ../$$i . || exit $$? ; done )
-endef
-
-install-aliases-hook:
-       set -- $(GENERAL_ALIASES) && \
-               dir= && $(install-relative-aliases)
-
-define install-aliases
-       while [ -n "$$1" ]; do \
-               $(MKDIR_P) `dirname $(DESTDIR)$$dir/$$2` && \
-               rm -f $(DESTDIR)$$dir/$$2 && \
-               $(LN_S) $$1 $(DESTDIR)$$dir/$$2 && \
-               shift 2 || exit $$?; \
-       done
-endef
-
-define install-relative-aliases
-       while [ -n "$$1" ]; do \
-               $(MKDIR_P) `dirname $(DESTDIR)$$dir/$$2` && \
-               rm -f $(DESTDIR)$$dir/$$2 && \
-               $(LN_S) --relative $(DESTDIR)$$1 $(DESTDIR)$$dir/$$2 && \
-               shift 2 || exit $$?; \
-       done
+define move-to-rootlibdir
+       if test "$(libdir)" != "$(rootlibdir)"; then \
+               $(MKDIR_P) $(DESTDIR)$(rootlibdir) && \
+               so_img_name=$$(readlink $(DESTDIR)$(libdir)/$$libname) && \
+               rm -f $(DESTDIR)$(libdir)/$$libname && \
+               $(LN_S) --relative -f $(DESTDIR)$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/$$libname && \
+               mv $(DESTDIR)$(libdir)/$$libname.* $(DESTDIR)$(rootlibdir); \
+       fi
 endef
 
 install-touch-usr-hook:
        touch -c $(DESTDIR)/$(prefix)
 
 INSTALL_EXEC_HOOKS += \
-       install-target-wants-hook \
-       install-aliases-hook \
        install-touch-usr-hook
 
-if ENABLE_KDBUS
-INSTALL_EXEC_HOOKS += \
-       install-busnames-target-wants-hook
-endif
 
 # ------------------------------------------------------------------------------
 AM_V_M4 = $(AM_V_M4_$(V))
@@ -254,8 +184,10 @@ AM_V_RM_ = $(AM_V_RM_$(AM_DEFAULT_VERBOSITY))
 AM_V_RM_0 = @echo "  RM      " $@;
 
 # ------------------------------------------------------------------------------
+rootbin_PROGRAMS =
 bin_PROGRAMS =
-pkglibexec_PROGRAMS =
+rootlibexec_PROGRAMS =
+
 dist_bashcompletion_DATA =
 dist_zshcompletion_DATA =
 
@@ -264,10 +196,7 @@ dist_doc_DATA = \
        NEWS \
        LICENSE.LGPL2.1 \
        LICENSE.GPL2 \
-       LICENSE.MIT \
-       src/libelogind/sd-bus/PORTING-DBUS1 \
-       src/libelogind/sd-bus/DIFFERENCES \
-       src/libelogind/sd-bus/GVARIANT-SERIALIZATION
+       DISTRO_PORTING
 
 @INTLTOOL_POLICY_RULE@
 
@@ -315,235 +244,162 @@ CLEANFILES += \
 endif
 
 EXTRA_DIST += \
-       $(XML_FILES) \
+       $(filter-out man/systemd.directives.xml,$(XML_FILES)) \
        $(HTML_FILES) \
        $(HTML_ALIAS) \
        $(man_MANS) \
-       tools/make-man-index.py \
-       tools/make-directive-index.py \
-       tools/xml_helper.py
+       $(NULL)
 
 # ------------------------------------------------------------------------------
 noinst_LTLIBRARIES += \
-       libelogind-shared.la
-
-libelogind_shared_la_SOURCES = \
-       src/shared/capability.c \
-       src/shared/capability.h \
-       src/shared/linux/auto_dev-ioctl.h \
-       src/shared/ioprio.h \
-       src/shared/missing.h \
-       src/shared/initreq.h \
-       src/shared/securebits.h \
-       src/shared/special.h \
-       src/shared/list.h \
-       src/shared/unaligned.h \
-       src/shared/macro.h \
-       src/shared/def.h \
-       src/shared/sparse-endian.h \
-       src/shared/refcnt.h \
-       src/shared/udev-util.h \
-       src/shared/device-nodes.c \
-       src/shared/device-nodes.h \
-       src/shared/util.c \
-       src/shared/util.h \
-       src/shared/virt.c \
-       src/shared/virt.h \
-       src/shared/architecture.c \
-       src/shared/architecture.h \
-       src/shared/fstab-util.c \
-       src/shared/fstab-util.h \
-       src/shared/path-util.c \
-       src/shared/path-util.h \
-       src/shared/time-util.c \
-       src/shared/time-util.h \
-       src/shared/locale-util.c \
-       src/shared/locale-util.h \
-       src/shared/mempool.c \
-       src/shared/mempool.h \
-       src/shared/hashmap.c \
-       src/shared/hashmap.h \
-       src/shared/siphash24.c \
-       src/shared/siphash24.h \
-       src/shared/set.h \
-       src/shared/fdset.c \
-       src/shared/fdset.h \
-       src/shared/prioq.c \
-       src/shared/prioq.h \
+       libbasic.la
+
+libbasic_la_SOURCES = \
+       src/basic/missing.h \
+       src/basic/capability.c \
+       src/basic/capability.h \
+       src/basic/conf-files.c \
+       src/basic/conf-files.h \
+       src/basic/hostname-util.h \
+       src/basic/hostname-util.c \
+       src/basic/unit-name.c \
+       src/basic/unit-name.h \
+       src/basic/util.c \
+       src/basic/util.h \
+       src/basic/path-util.c \
+       src/basic/path-util.h \
+       src/basic/time-util.c \
+       src/basic/time-util.h \
+       src/basic/signal-util.c \
+       src/basic/signal-util.h \
+       src/basic/mempool.c \
+       src/basic/mempool.h \
+       src/basic/hashmap.c \
+       src/basic/hashmap.h \
+       src/basic/siphash24.c \
+       src/basic/siphash24.h \
+       src/basic/prioq.c \
+       src/basic/prioq.h \
+       src/basic/strv.c \
+       src/basic/strv.h \
+       src/basic/log.c \
+       src/basic/log.h \
+       src/basic/bus-label.c \
+       src/basic/bus-label.h \
+       src/basic/virt.c \
+       src/basic/virt.h \
+       src/basic/smack-util.c \
+       src/basic/smack-util.h \
+       src/basic/utf8.c \
+       src/basic/utf8.h \
+       src/basic/gunicode.c \
+       src/basic/gunicode.h \
+       src/basic/fileio.c \
+       src/basic/fileio.h \
+       src/basic/mkdir.c \
+       src/basic/mkdir.h \
+       src/basic/cgroup-util.c \
+       src/basic/cgroup-util.h \
+       src/basic/errno-list.c \
+       src/basic/errno-list.h \
+       src/basic/terminal-util.c \
+       src/basic/terminal-util.h \
+       src/basic/login-util.h \
+       src/basic/login-util.c \
+       src/basic/audit.c \
+       src/basic/audit.h \
+       src/basic/memfd-util.c \
+       src/basic/memfd-util.h \
+       src/basic/process-util.c \
+       src/basic/process-util.h \
+       src/basic/random-util.c \
+       src/basic/random-util.h \
+       src/basic/verbs.c \
+       src/basic/verbs.h \
+       src/basic/label.c \
+       src/basic/label.h \
+       src/basic/selinux-util.c \
+       src/basic/selinux-util.h \
+       src/basic/mkdir-label.c \
+       src/basic/fileio-label.c \
+       src/basic/fileio-label.h \
+       src/basic/rm-rf.c \
+       src/basic/rm-rf.h
+
+nodist_libbasic_la_SOURCES = \
+       src/basic/errno-from-name.h \
+       src/basic/errno-to-name.h \
+       src/basic/cap-from-name.h \
+       src/basic/cap-to-name.h
+
+libbasic_la_CFLAGS = \
+       $(AM_CFLAGS) \
+       $(SELINUX_CFLAGS) \
+       $(CAP_CFLAGS) \
+       -pthread
+
+libbasic_la_LIBADD = \
+       $(SELINUX_LIBS) \
+       $(CAP_LIBS) \
+       -ldl \
+       -lrt \
+       -lm
+
+# -----------------------------------------------------------------------------
+noinst_LTLIBRARIES += \
+       libshared.la
+
+libshared_la_SOURCES = \
        src/shared/sleep-config.c \
        src/shared/sleep-config.h \
-       src/shared/strv.c \
-       src/shared/strv.h \
-       src/shared/env-util.c \
-       src/shared/env-util.h \
-       src/shared/strbuf.c \
-       src/shared/strbuf.h \
-       src/shared/strxcpyx.c \
-       src/shared/strxcpyx.h \
        src/shared/conf-parser.c \
        src/shared/conf-parser.h \
-       src/shared/log.c \
-       src/shared/log.h \
-       src/shared/ratelimit.h \
-       src/shared/ratelimit.c \
-       src/shared/exit-status.c \
-       src/shared/exit-status.h \
-       src/shared/utf8.c \
-       src/shared/utf8.h \
-       src/shared/gunicode.c \
-       src/shared/gunicode.h \
        src/shared/pager.c \
        src/shared/pager.h \
-       src/shared/socket-util.c \
-       src/shared/socket-util.h \
-       src/shared/in-addr-util.c \
-       src/shared/in-addr-util.h \
-       src/shared/ether-addr-util.h \
-       src/shared/conf-files.c \
-       src/shared/conf-files.h \
-       src/shared/cgroup-util.c \
-       src/shared/cgroup-util.h \
-       src/shared/cgroup-show.c \
-       src/shared/cgroup-show.h \
-       src/shared/logs-show.h \
-       src/shared/unit-name.c \
-       src/shared/unit-name.h \
-       src/shared/watchdog.c \
-       src/shared/watchdog.h \
-       src/shared/replace-var.c \
-       src/shared/replace-var.h \
        src/shared/spawn-polkit-agent.c \
        src/shared/spawn-polkit-agent.h \
-       src/shared/clock-util.c \
-       src/shared/clock-util.h \
-       src/shared/calendarspec.c \
-       src/shared/calendarspec.h \
-       src/shared/fileio.c \
-       src/shared/fileio.h \
-       src/shared/output-mode.h \
-       src/shared/MurmurHash2.c \
-       src/shared/MurmurHash2.h \
-       src/shared/acpi-fpdt.h \
-       src/shared/acpi-fpdt.c \
-       src/shared/mkdir.c \
-       src/shared/mkdir.h \
-       src/shared/smack-util.c \
-       src/shared/smack-util.h \
        src/shared/apparmor-util.c \
        src/shared/apparmor-util.h \
-       src/shared/ima-util.c \
-       src/shared/ima-util.h \
-       src/shared/ptyfwd.c \
-       src/shared/ptyfwd.h \
-       src/shared/errno-list.c \
-       src/shared/errno-list.h \
-       src/shared/af-list.c \
-       src/shared/af-list.h \
-       src/shared/arphrd-list.c \
-       src/shared/arphrd-list.h \
-       src/shared/cap-list.c \
-       src/shared/cap-list.h \
-       src/shared/audit.c \
-       src/shared/audit.h \
-       src/shared/xml.c \
-       src/shared/xml.h \
-       src/shared/json.c \
-       src/shared/json.h \
-       src/shared/selinux-util.c \
-       src/shared/selinux-util.h \
-       src/shared/label.c \
-       src/shared/label.h \
-       src/shared/socket-label.c \
-       src/shared/mkdir-label.c \
-       src/shared/fileio-label.h \
-       src/shared/fileio-label.c \
-       src/shared/bus-label.c \
-       src/shared/bus-label.h \
-       src/shared/gpt.h \
-       src/shared/clean-ipc.h \
        src/shared/clean-ipc.c \
-       src/shared/login-shared.c \
-       src/shared/login-shared.h \
-       src/shared/ring.c \
-       src/shared/ring.h \
-       src/shared/barrier.c \
-       src/shared/barrier.h \
-       src/shared/pty.c \
-       src/shared/pty.h \
-       src/shared/async.c \
-       src/shared/async.h \
-       src/shared/base-filesystem.c \
-       src/shared/base-filesystem.h \
-       src/shared/memfd-util.c \
-       src/shared/memfd-util.h \
-       src/shared/process-util.c \
-       src/shared/process-util.h \
-       src/shared/random-util.c \
-       src/shared/random-util.h \
-       src/shared/terminal-util.c \
-       src/shared/terminal-util.h \
-       src/shared/uid-range.c \
-       src/shared/uid-range.h \
-       src/shared/nss-util.h \
-       src/shared/verbs.c \
-       src/shared/verbs.h \
-       src/shared/sigbus.c \
-       src/shared/sigbus.h \
-       src/shared/build.h \
-       src/shared/import-util.c \
-       src/shared/import-util.h \
-       src/shared/sysctl-util.c \
-       src/shared/sysctl-util.h \
-       src/shared/hostname-util.h \
-       src/shared/hostname-util.c
-
-nodist_libelogind_shared_la_SOURCES = \
-       src/shared/errno-from-name.h \
-       src/shared/errno-to-name.h \
-       src/shared/af-from-name.h \
-       src/shared/af-to-name.h \
-       src/shared/arphrd-from-name.h \
-       src/shared/arphrd-to-name.h \
-       src/shared/cap-from-name.h \
-       src/shared/cap-to-name.h
-
-libelogind_shared_la_CFLAGS = \
-       $(AM_CFLAGS) \
-       $(CAP_CFLAGS) \
-       $(SECCOMP_CFLAGS) \
-       -pthread
-
-libelogind_shared_la_LIBADD = \
-       $(CAP_LIBS) \
-       -lm
+       src/shared/clean-ipc.h \
+       src/shared/cgroup-show.c \
+       src/shared/cgroup-show.h \
+       src/shared/bus-util.c \
+       src/shared/bus-util.h
 
-libelogind_shared_la_LDFLAGS = \
-       $(CAP_LDFLAGS)
+if HAVE_SECCOMP
+libshared_la_SOURCES += \
+       src/shared/seccomp-util.h \
+       src/shared/seccomp-util.c
+endif
 
-# ------------------------------------------------------------------------------
 if HAVE_ACL
-noinst_LTLIBRARIES += \
-       libelogind-acl.la
-
-libelogind_acl_la_SOURCES = \
+libshared_la_SOURCES += \
        src/shared/acl-util.c \
        src/shared/acl-util.h
+endif
 
-libelogind_acl_la_CFLAGS = \
+libshared_la_CFLAGS = \
        $(AM_CFLAGS) \
-       $(ACL_CFLAGS)
+       $(ACL_CFLAGS) \
+       $(LIBIDN_CFLAGS) \
+       $(SECCOMP_CFLAGS)
 
-libelogind_acl_la_LIBADD = \
-       $(ACL_LIBS)
-endif
+libshared_la_LIBADD = \
+       libelogind-internal.la \
+       $(UDEV_LIBS) \
+       $(ACL_LIBS) \
+       $(LIBIDN_LIBS) \
+       $(SECCOMP_LIBS)
 
 gperf_txt_sources = \
-       src/shared/errno-list.txt \
-       src/shared/af-list.txt \
-       src/shared/arphrd-list.txt \
-       src/shared/cap-list.txt
+       src/basic/errno-list.txt \
+       src/basic/af-list.txt \
+       src/basic/arphrd-list.txt \
+       src/basic/cap-list.txt
 
 BUILT_SOURCES += \
+       $(gperf_gperf_m4_sources:-gperf.gperf.m4=-gperf.c) \
        $(gperf_gperf_sources:-gperf.gperf=-gperf.c) \
        $(gperf_txt_sources:-list.txt=-from-name.h) \
        $(gperf_txt_sources:-list.txt=-to-name.h)
@@ -555,61 +411,68 @@ DISTCLEANFILES = \
 
 EXTRA_DIST += \
        $(gperf_gperf_m4_sources) \
-       $(gperf_gperf_sources) \
-       $(gperf_txt_sources:-list.txt=-from-name.gperf)
+       $(gperf_gperf_sources)
 
 CLEANFILES += \
        $(gperf_txt_sources)
 
 %-from-name.gperf: %-list.txt
+       $(AM_V_at)$(MKDIR_P) $(dir $@)
        $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct $(notdir $*)_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, %s\n", $$1, $$1 }' <$< >$@
 
 %-from-name.h: %-from-name.gperf
+       $(AM_V_at)$(MKDIR_P) $(dir $@)
        $(AM_V_GPERF)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_$(notdir $*) -H hash_$(notdir $*)_name -p -C <$< >$@
 
 
-src/shared/errno-list.txt:
+src/basic/errno-list.txt:
        $(AM_V_at)$(MKDIR_P) $(dir $@)
        $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include errno.h - </dev/null | $(AWK) '/^#define[ \t]+E[^ _]+[ \t]+/ { print $$2; }' >$@
 
-src/shared/errno-to-name.h: src/shared/errno-list.txt
+src/basic/errno-to-name.h: src/basic/errno-list.txt
+       $(AM_V_at)$(MKDIR_P) $(dir $@)
        $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const errno_names[] = { "} !/EDEADLOCK/ && !/EWOULDBLOCK/ && !/ENOTSUP/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@
 
 
-src/shared/af-list.txt:
+src/basic/af-list.txt:
        $(AM_V_at)$(MKDIR_P) $(dir $@)
        $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(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; }' >$@
 
-src/shared/af-to-name.h: src/shared/af-list.txt
+src/basic/af-to-name.h: src/basic/af-list.txt
+       $(AM_V_at)$(MKDIR_P) $(dir $@)
        $(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 "};"}' <$< >$@
 
 
-src/shared/arphrd-list.txt:
+src/basic/arphrd-list.txt:
        $(AM_V_at)$(MKDIR_P) $(dir $@)
        $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include net/if_arp.h - </dev/null | $(AWK) '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $$2; }' | sed -e 's/ARPHRD_//' >$@
 
-src/shared/arphrd-to-name.h: src/shared/arphrd-list.txt
+src/basic/arphrd-to-name.h: src/basic/arphrd-list.txt
+       $(AM_V_at)$(MKDIR_P) $(dir $@)
        $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const arphrd_names[] = { "} !/CISCO/ { printf "[ARPHRD_%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@
 
-src/shared/arphrd-from-name.gperf: src/shared/arphrd-list.txt
+src/basic/arphrd-from-name.gperf: src/basic/arphrd-list.txt
+       $(AM_V_at)$(MKDIR_P) $(dir $@)
        $(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 }' <$< >$@
 
 
-src/shared/cap-list.txt:
+src/basic/cap-list.txt:
        $(AM_V_at)$(MKDIR_P) $(dir $@)
        $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include linux/capability.h -include missing.h - </dev/null | $(AWK) '/^#define[ \t]+CAP_[A-Z_]+[ \t]+/ { print $$2; }' | grep -v CAP_LAST_CAP >$@
 
-src/shared/cap-to-name.h: src/shared/cap-list.txt
+src/basic/cap-to-name.h: src/basic/cap-list.txt
+       $(AM_V_at)$(MKDIR_P) $(dir $@)
        $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const capability_names[] = { "} { printf "[%s] = \"%s\",\n", $$1, tolower($$1) } END{print "};"}' <$< >$@
 
-src/shared/cap-from-name.gperf: src/shared/cap-list.txt
+src/basic/cap-from-name.gperf: src/basic/cap-list.txt
+       $(AM_V_at)$(MKDIR_P) $(dir $@)
        $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct capability_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, %s\n", $$1, $$1 }' <$< >$@
 
-src/shared/cap-from-name.h: src/shared/cap-from-name.gperf
+src/basic/cap-from-name.h: src/basic/cap-from-name.gperf
+       $(AM_V_at)$(MKDIR_P) $(dir $@)
        $(AM_V_GPERF)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_capability -H hash_capability_name -p -C <$< >$@
 
 # ------------------------------------------------------------------------------
-dist_factory_etc_DATA =
 
 if HAVE_PAM
 dist_factory_pam_DATA = \
@@ -618,24 +481,26 @@ dist_factory_pam_DATA = \
 endif
 
 # ------------------------------------------------------------------------------
-noinst_LTLIBRARIES += \
-       libelogind-internal.la
+rootlibexec_PROGRAMS += \
+       elogind-cgroups-agent
+
+elogind_cgroups_agent_SOURCES = \
+       src/cgroups-agent/cgroups-agent.c
+
+elogind_cgroups_agent_LDADD = \
+       libshared.la
 
+# ------------------------------------------------------------------------------
 libelogind_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-rtnl.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 \
+       src/libelogind/libelogind.sym \
        src/libelogind/sd-bus/sd-bus.c \
        src/libelogind/sd-bus/bus-control.c \
        src/libelogind/sd-bus/bus-control.h \
@@ -649,8 +514,6 @@ libelogind_internal_la_SOURCES = \
        src/libelogind/sd-bus/bus-socket.h \
        src/libelogind/sd-bus/bus-kernel.c \
        src/libelogind/sd-bus/bus-kernel.h \
-       src/libelogind/sd-bus/bus-container.c \
-       src/libelogind/sd-bus/bus-container.h \
        src/libelogind/sd-bus/bus-message.c \
        src/libelogind/sd-bus/bus-message.h \
        src/libelogind/sd-bus/bus-creds.c \
@@ -672,88 +535,68 @@ libelogind_internal_la_SOURCES = \
        src/libelogind/sd-bus/bus-convenience.c \
        src/libelogind/sd-bus/bus-track.c \
        src/libelogind/sd-bus/bus-track.h \
-       src/libelogind/sd-bus/bus-util.c \
-       src/libelogind/sd-bus/bus-util.h \
        src/libelogind/sd-bus/bus-slot.c \
        src/libelogind/sd-bus/bus-slot.h \
        src/libelogind/sd-bus/bus-protocol.h \
-       src/libelogind/sd-bus/kdbus.h \
-       src/libelogind/sd-utf8/sd-utf8.c \
        src/libelogind/sd-event/sd-event.c \
        src/libelogind/sd-event/event-util.h \
-       src/libelogind/sd-rtnl/sd-rtnl.c \
-       src/libelogind/sd-rtnl/rtnl-internal.h \
-       src/libelogind/sd-rtnl/rtnl-message.c \
-       src/libelogind/sd-rtnl/rtnl-types.h \
-       src/libelogind/sd-rtnl/rtnl-types.c \
-       src/libelogind/sd-rtnl/rtnl-util.h \
-       src/libelogind/sd-rtnl/rtnl-util.c \
-       src/libelogind/sd-rtnl/local-addresses.h \
-       src/libelogind/sd-rtnl/local-addresses.c \
        src/libelogind/sd-id128/sd-id128.c \
        src/libelogind/sd-daemon/sd-daemon.c \
        src/libelogind/sd-login/sd-login.c \
-       src/libelogind/sd-path/sd-path.c \
-       src/libelogind/sd-network/sd-network.c \
-       src/libelogind/sd-network/network-util.h \
-       src/libelogind/sd-network/network-util.c \
-       src/libelogind/sd-hwdb/sd-hwdb.c \
-       src/libelogind/sd-hwdb/hwdb-util.h \
-       src/libelogind/sd-hwdb/hwdb-internal.h \
-       src/libelogind/sd-device/device-internal.h \
-       src/libelogind/sd-device/device-util.h \
-       src/libelogind/sd-device/device-enumerator.c \
-       src/libelogind/sd-device/device-enumerator-private.h \
-       src/libelogind/sd-device/sd-device.c \
-       src/libelogind/sd-device/device-private.c \
-       src/libelogind/sd-device/device-private.h
-
-nodist_libelogind_internal_la_SOURCES = \
-       src/libelogind/libelogind.sym
-
-libelogind_internal_la_CFLAGS = \
-       $(AM_CFLAGS) \
-       -pthread
+       src/libelogind/sd-path/sd-path.c
 
 libelogind_internal_la_LIBADD = \
-       libelogind-shared.la
+       libbasic.la \
+       -lresolv
 
-libelogind_internal_la_LDFLAGS = \
-       $(AM_LDFLAGS)
+noinst_LTLIBRARIES += \
+       libelogind-internal.la
 
-lib_LTLIBRARIES += \
-       libelogind.la
+EXTRA_DIST += \
+       src/libelogind/libelogind.pc.in \
+       src/libelogind/sd-bus/DIFFERENCES \
+       src/libelogind/sd-bus/GVARIANT-SERIALIZATION
+
+libelogind_la_SOURCES = \
+       $(libelogind_internal_la_SOURCES)
 
-libelogind_la_SOURCES =
+nodist_libelogind_la_SOURCES = \
+       $(nodist_libelogind_internal_la_SOURCES)
 
 libelogind_la_CFLAGS = \
-       $(AM_CFLAGS)
+       $(libelogind_internal_la_CFLAGS)
 
 libelogind_la_LDFLAGS = \
        $(AM_LDFLAGS) \
        -version-info $(LIBELOGIND_CURRENT):$(LIBELOGIND_REVISION):$(LIBELOGIND_AGE) \
-       -Wl,--version-script=src/libelogind/libelogind.sym
+       -Wl,--version-script=$(top_srcdir)/src/libelogind/libelogind.sym
 
 libelogind_la_LIBADD = \
-       libelogind-internal.la
+       $(libelogind_internal_la_LIBADD)
+
+libelogind-install-hook:
+       libname=libelogind.so && $(move-to-rootlibdir)
+
+libelogind-uninstall-hook:
+       rm -f $(DESTDIR)$(rootlibdir)/libelogind.so*
+
+INSTALL_EXEC_HOOKS += libelogind-install-hook
+UNINSTALL_EXEC_HOOKS += libelogind-uninstall-hook
 
 pkgconfiglib_DATA += \
        src/libelogind/libelogind.pc
 
 pkginclude_HEADERS += \
+       src/systemd/sd-bus.h \
+       src/systemd/sd-bus-protocol.h \
+       src/systemd/sd-bus-vtable.h \
+       src/systemd/sd-event.h \
        src/systemd/sd-login.h \
-       src/systemd/sd-messages.h \
-       src/systemd/sd-journal.h \
-       src/systemd/_sd-common.h
-
-EXTRA_DIST += \
-       src/libelogind/libelogind.sym.m4 \
-       src/libelogind/libelogind.pc.in \
-       src/libelogind/sd-bus/DIFFERENCES \
-       src/libelogind/sd-bus/GVARIANT-SERIALIZATION
+       src/systemd/sd-id128.h \
+       src/systemd/sd-daemon.h
 
-BUILT_SOURCES += \
-       src/libelogind/libelogind.sym
+lib_LTLIBRARIES += \
+       libelogind.la
 
 # ------------------------------------------------------------------------------
 elogind_SOURCES = \
@@ -788,24 +631,22 @@ libelogind_core_la_SOURCES = \
        src/login/logind-session-dbus.c \
        src/login/logind-seat-dbus.c \
        src/login/logind-user-dbus.c \
+       src/login/logind-utmp.c \
        src/login/logind-acl.h
 
 libelogind_core_la_LIBADD = \
-       $(UDEV_LIBS) \
-       libelogind-internal.la
+       libshared.la
 
 if HAVE_ACL
 libelogind_core_la_SOURCES += \
        src/login/logind-acl.c
-
-libelogind_core_la_LIBADD += \
-       libelogind-acl.la
 endif
 
 noinst_LTLIBRARIES += \
        libelogind-core.la
 
-pkglibexec_PROGRAMS += elogind
+rootlibexec_PROGRAMS += \
+       elogind
 
 loginctl_SOURCES = \
        src/login/loginctl.c \
@@ -813,63 +654,47 @@ loginctl_SOURCES = \
        src/login/sysfs-show.c
 
 loginctl_LDADD = \
-       $(UDEV_LIBS) \
-       libelogind-internal.la \
-       libelogind-shared.la
+       libshared.la
 
-bin_PROGRAMS += \
+rootbin_PROGRAMS += \
        loginctl
 
-logind_cgroups_agent_SOURCES = \
-       src/cgroups-agent/cgroups-agent.c
-
-logind_cgroups_agent_LDADD = \
-       libelogind-internal.la \
-       libelogind-shared.la
-
-pkglibexec_PROGRAMS += \
-       logind-cgroups-agent
-
 dist_bashcompletion_DATA += \
        shell-completion/bash/loginctl
 
 dist_zshcompletion_DATA += \
-       shell-completion/zsh/_loginctl
+       shell-completion/zsh/_loginctl \
+       shell-completion/zsh/_elogind-inhibit
 
-systemd_inhibit_SOURCES = \
+elogind_inhibit_SOURCES = \
        src/login/inhibit.c
 
-systemd_inhibit_LDADD = \
-       libelogind-internal.la \
-       libelogind-shared.la
+elogind_inhibit_LDADD = \
+       libshared.la
 
-bin_PROGRAMS += \
-       systemd-inhibit
+rootbin_PROGRAMS += \
+       elogind-inhibit
 
 test_login_SOURCES = \
        src/libelogind/sd-login/test-login.c
 
 test_login_LDADD = \
-       libelogind-internal.la \
-       libelogind-shared.la
+       libshared.la
 
 test_login_shared_SOURCES = \
        src/login/test-login-shared.c
 
 test_login_shared_LDADD = \
-       libelogind-internal.la \
-       libelogind-shared.la
+       libshared.la
 
 test_inhibit_SOURCES = \
        src/login/test-inhibit.c
 
 test_inhibit_LDADD = \
-       libelogind-internal.la \
-       libelogind-shared.la
+       libshared.la
 
 test_login_tables_SOURCES = \
-       src/login/test-login-tables.c \
-       src/shared/test-tables.h
+       src/login/test-login-tables.c
 
 test_login_tables_LDADD = \
        libelogind-core.la
@@ -889,8 +714,7 @@ pam_elogind_la_SOURCES = \
 
 pam_elogind_la_CFLAGS = \
        $(AM_CFLAGS) \
-       $(PAM_CFLAGS) \
-       -fvisibility=hidden
+       $(PAM_CFLAGS)
 
 pam_elogind_la_LDFLAGS = \
        $(AM_LDFLAGS) \
@@ -901,7 +725,7 @@ pam_elogind_la_LDFLAGS = \
        -Wl,--version-script=$(top_srcdir)/src/login/pam_elogind.sym
 
 pam_elogind_la_LIBADD = \
-       libelogind-internal.la \
+       libshared.la \
        $(PAM_LIBS)
 
 pamlib_LTLIBRARIES = \
@@ -919,19 +743,16 @@ dist_dbuspolicy_DATA += \
        src/login/org.freedesktop.login1.conf
 
 dist_pkgsysconf_DATA += \
-       src/login/logind.conf
+       src/login/elogind.conf
 
 polkitpolicy_files += \
        src/login/org.freedesktop.login1.policy
 
-SYSTEM_UNIT_ALIASES += \
-       elogind.service dbus-org.freedesktop.login1.service
-
-dist_udevrules_DATA = \
+dist_udevrules_DATA += \
        src/login/70-uaccess.rules \
        src/login/70-power-switch.rules
 
-nodist_udevrules_DATA = \
+nodist_udevrules_DATA += \
        src/login/71-seat.rules \
        src/login/73-seat-late.rules
 
@@ -947,10 +768,14 @@ EXTRA_DIST += \
 
 # ------------------------------------------------------------------------------
 substitutions = \
+       '|rootlibexecdir=$(rootlibexecdir)|' \
+       '|rootbindir=$(rootbindir)|' \
        '|bindir=$(bindir)|' \
-       '|udevbindir=$(udevbindir)|' \
        '|pkgsysconfdir=$(pkgsysconfdir)|' \
        '|pkgdatadir=$(pkgdatadir)|' \
+       '|udevhwdbdir=$(udevhwdbdir)|' \
+       '|udevrulesdir=$(udevrulesdir)|' \
+       '|CERTIFICATEROOT=$(CERTIFICATEROOT)|' \
        '|PACKAGE_VERSION=$(PACKAGE_VERSION)|' \
        '|PACKAGE_NAME=$(PACKAGE_NAME)|' \
        '|PACKAGE_URL=$(PACKAGE_URL)|' \
@@ -960,18 +785,29 @@ substitutions = \
        '|includedir=$(includedir)|' \
        '|VERSION=$(VERSION)|' \
        '|rootprefix=$(rootprefix)|' \
+       '|udevlibexecdir=$(udevlibexecdir)|' \
+       '|SUSHELL=$(SUSHELL)|' \
+       '|SULOGIN=$(SULOGIN)|' \
+       '|DEBUGTTY=$(DEBUGTTY)|' \
+       '|KILL=$(KILL)|' \
+       '|KMOD=$(KMOD)|' \
        '|MKDIR_P=$(MKDIR_P)|' \
+       '|QUOTAON=$(QUOTAON)|' \
+       '|RC_LOCAL_SCRIPT_PATH_START=$(RC_LOCAL_SCRIPT_PATH_START)|' \
+       '|RC_LOCAL_SCRIPT_PATH_STOP=$(RC_LOCAL_SCRIPT_PATH_STOP)|' \
+       '|PYTHON=$(PYTHON)|' \
+       '|PYTHON_BINARY=$(PYTHON_BINARY)|' \
+       '|NTP_SERVERS=$(NTP_SERVERS)|' \
+       '|DNS_SERVERS=$(DNS_SERVERS)|' \
        '|systemuidmax=$(SYSTEM_UID_MAX)|' \
-       '|systemgidmax=$(SYSTEM_GID_MAX)|'
+       '|systemgidmax=$(SYSTEM_GID_MAX)|' \
+       '|TTY_GID=$(TTY_GID)|'
 
 SED_PROCESS = \
        $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
        $(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(substitutions)))) \
                < $< > $@
 
-units/%: units/%.in
-       $(SED_PROCESS)
-
 man/%: man/%.in
        $(SED_PROCESS)
 
@@ -984,9 +820,6 @@ sysctl.d/%: sysctl.d/%.in
 %.conf: %.conf.in
        $(SED_PROCESS)
 
-src/%.policy.in: src/%.policy.in.in
-       $(SED_PROCESS)
-
 shell-completion/%: shell-completion/%.in
        $(SED_PROCESS)
 
@@ -1027,13 +860,11 @@ units/user/%: units/user/%.m4
 
 if ENABLE_POLKIT
 nodist_polkitpolicy_DATA = \
-       $(polkitpolicy_files) \
-       $(polkitpolicy_in_in_files:.policy.in.in=.policy)
+       $(polkitpolicy_files)
 endif
 
 EXTRA_DIST += \
-       $(polkitpolicy_in_files) \
-       $(polkitpolicy_in_in_files)
+       $(polkitpolicy_in_files)
 
 # ------------------------------------------------------------------------------
 if ENABLE_MANPAGES
@@ -1043,7 +874,7 @@ man/custom-entities.ent: configure.ac
         printf '$(subst '|,<!ENTITY ,$(subst =, ",$(subst |',">\n,$(substitutions))))') \
         > $@ # '
 
-DISTCLEANFILES += \
+CLEANFILES += \
        man/custom-entities.ent
 
 XSLTPROC_FLAGS = \
@@ -1100,19 +931,159 @@ distclean-local: $(DISTCLEAN_LOCAL_HOOKS)
 
 clean-local: $(CLEAN_LOCAL_HOOKS)
        rm -rf $(abs_srcdir)/install-tree
+       rm -f $(abs_srcdir)/hwdb/usb.ids $(abs_srcdir)/hwdb/pci.ids $(abs_srcdir)/hwdb/oui.txt \
+             $(abs_srcdir)/hwdb/iab.txt
 
 DISTCHECK_CONFIGURE_FLAGS = \
        --with-dbuspolicydir=$$dc_install_base/$(dbuspolicydir) \
-       --with-dbussessionservicedir=$$dc_install_base/$(dbussessionservicedir) \
        --with-dbussystemservicedir=$$dc_install_base/$(dbussystemservicedir) \
        --with-bashcompletiondir=$$dc_install_base/$(bashcompletiondir) \
        --with-zshcompletiondir=$$dc_install_base/$(zshcompletiondir) \
        --with-pamlibdir=$$dc_install_base/$(pamlibdir) \
        --with-pamconfdir=$$dc_install_base/$(pamconfdir) \
-       --enable-kdbus \
-       --with-udevrulesdir=$$dc_install_base/$(udevrulesdir)
+       --with-rootprefix=$$dc_install_base \
+       --enable-compat-libs
+
+DISTCHECK_CONFIGURE_FLAGS += \
+       --with-sysvinit-path= \
+       --with-sysvrcnd-path=
 
-if ENABLE_GTK_DOC
+if ENABLE_SPLIT_USR
+DISTCHECK_CONFIGURE_FLAGS += \
+       --enable-split-usr
+else
 DISTCHECK_CONFIGURE_FLAGS += \
-       --enable-gtk-doc
+       --disable-split-usr
 endif
+
+#
+# Require python when making dist
+#
+.PHONY: dist-check-python dist-check-compat-libs dist-check-help
+dist-check-python:
+
+dist-check-compat-libs:
+
+dist-check-help: $(rootbin_PROGRAMS) $(bin_PROGRAMS)
+       for i in $(abspath $^); do                                             \
+            if $$i  --help | grep -v 'default:' | grep -E -q '.{80}.' ; then   \
+               echo "$(basename $$i) --help output is too wide:";             \
+               $$i  --help | awk 'length > 80' | grep -E --color=yes '.{80}'; \
+               exit 1;                                                        \
+            fi; done
+
+dist: dist-check-python dist-check-compat-libs
+
+.PHONY: git-tag
+git-tag:
+       git tag -s "v$(VERSION)" -m "elogind $(VERSION)"
+
+.PHONY: install-tree
+install-tree: all
+       rm -rf $(abs_srcdir)/install-tree
+       $(MAKE) install DESTDIR=$(abs_srcdir)/install-tree
+       tree $(abs_srcdir)/install-tree
+
+# Let's run all tests of the test suite, but under valgrind. Let's
+# exclude the one perl script we have in there
+.PHONY: valgrind-tests
+valgrind-tests: $(TESTS)
+       $(AM_V_GEN)for f in $(filter-out %.pl, $^); do \
+               if file $$f | grep -q shell; then \
+               echo -e "$${x}Skipping non-binary $$f"; else \
+               echo -e "$${x}Running $$f"; \
+               libtool --mode=execute valgrind -q --leak-check=full --max-stackframe=5242880 --error-exitcode=55 $(builddir)/$$f ; fi; \
+               x="\n\n"; \
+       done
+
+exported-%: %
+       $(AM_V_GEN)$(NM) -g --defined-only $(builddir)/.libs/$(<:.la=.so) 2>&1 /dev/null | grep " T " | cut -d" " -f3 > $@
+
+exported: $(addprefix exported-, $(lib_LTLIBRARIES))
+       $(AM_V_GEN)cat $^ > $@
+
+.PHONY: check-api-docs
+check-api-docs: exported man
+       $(AM_V_GEN)for symbol in `cat exported` ; do \
+               if test -f $(builddir)/man/$$symbol.html ; then \
+                       echo "  Symbol $$symbol() is documented." ; \
+               else \
+                       echo "‣ Symbol $$symbol() lacks documentation." ; \
+               fi ; \
+       done
+
+OBJECT_VARIABLES:=$(filter %_OBJECTS,$(.VARIABLES))
+ALL_OBJECTS:=$(foreach v,$(OBJECT_VARIABLES),$($(v)))
+
+undefined defined: $(ALL_OBJECTS)
+       $(AM_V_GEN)for f in $(ALL_OBJECTS) ; do \
+               $(NM) -g --$@-only `echo $(builddir)/"$$f" | sed -e 's,\([^/]*\).lo$$,.libs/\1.o,'` ; \
+       done | cut -c 20- | cut -d @ -f 1 | sort -u > $@
+
+CLEANFILES += \
+       defined \
+       undefined
+
+.PHONY: check-api-unused
+check-api-unused: defined undefined exported
+       ( cat exported undefined ) | sort -u  | diff -u - defined | grep ^+ | grep -v ^+++ | cut -c2-
+
+.PHONY: check-includes
+check-includes: $(top_srcdir)/tools/check-includes.pl
+       $(AM_V_GEN) find * -name '*.[hcS]' -type f -print | sort -u \
+               | xargs $(top_srcdir)/tools/check-includes.pl
+
+EXTRA_DIST += \
+       $(top_srcdir)/tools/check-includes.pl
+
+# Stupid test that everything purported to be exported really is
+define generate-sym-test
+       $(AM_V_at)$(MKDIR_P) $(dir $@)
+       $(AM_V_at)printf '#include <stdio.h>\n' > $@
+       $(AM_V_at)printf '#include "%s"\n' $(notdir $(filter %.h, $^)) >> $@
+       $(AM_V_at)printf 'void* functions[] = {\n' >> $@
+       $(AM_V_GEN)sed -r -n 's/^ +([a-zA-Z0-9_]+);/\1,/p' $< >> $@
+       $(AM_V_at)printf '};\nint main(void) {\n' >> $@
+       $(AM_V_at)printf 'unsigned i; for (i=0;i<sizeof(functions)/sizeof(void*);i++) printf("%%p\\n", functions[i]);\n' >> $@
+       $(AM_V_at)printf 'return 0; }\n' >> $@
+endef
+
+test-libelogind-sym.c: \
+               $(top_builddir)/src/libelogind/libelogind.sym \
+               src/systemd/sd-daemon.h \
+               src/systemd/sd-login.h \
+               src/systemd/sd-bus.h \
+               src/systemd/sd-path.h \
+               src/systemd/sd-event.h
+       $(generate-sym-test)
+
+test_libelogind_sym_SOURCES = \
+       test-libelogind-sym.c
+test_libelogind_sym_LDADD = \
+       libelogind.la
+
+BUILT_SOURCES += \
+       $(test_libelogind_sym_SOURCES)
+
+tests += \
+       test-libelogind-sym
+
+.PHONY: cppcheck
+cppcheck:
+       cppcheck --enable=all -q $(top_srcdir)
+
+# Used to extract compile flags for YCM.
+print-%:
+       @echo $($*)
+
+git-contrib:
+       @git shortlog -s `git describe --abbrev=0`.. | cut -c8- | awk '{ print $$0 "," }' | sort -u
+
+EXTRA_DIST += \
+        tools/gdb-sd_dump_hashmaps.py
+
+list-keys:
+       gpg --verbose --no-options --no-default-keyring --no-auto-key-locate --batch --trust-model=always --keyring=$(srcdir)/src/import/import-pubring.gpg --list-keys
+
+add-key:
+       gpg --verbose --no-options --no-default-keyring --no-auto-key-locate --batch --trust-model=always --keyring=$(srcdir)/src/import/import-pubring.gpg --import -
diff --git a/NEWS b/NEWS
index 7a4621c..bda8a8e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,83 @@
 systemd System and Service Manager
 
+CHANGES WITH 221:
+
+        * The sd-bus.h and sd-event.h APIs have now been declared
+          stable and have been added to the official interface of
+          libsystemd.so. sd-bus implements an alternative D-Bus client
+          library, that is relatively easy to use, very efficient and
+          supports both classic D-Bus as well as kdbus as transport
+          backend. sd-event is a generic event loop abstraction that
+          is built around Linux epoll, but adds features such as event
+          prioritization or efficient timer handling. Both APIs are good
+          choices for C programs looking for a bus and/or event loop
+          implementation that is minimal and does not have to be
+          portable to other kernels.
+
+        * kdbus support is no longer compile-time optional. It is now
+          always built-in. However, it can still be disabled at
+          runtime using the kdbus=0 kernel command line setting, and
+          that setting may be changed to default to off, by specifying
+          --disable-kdbus at build-time. Note though that the kernel
+          command line setting has no effect if the kdbus.ko kernel
+          module is not installed, in which case kdbus is (obviously)
+          also disabled. We encourage all downstream distributions to
+          begin testing kdbus by adding it to the kernel images in the
+          development distributions, and leaving kdbus support in
+          systemd enabled.
+
+        * The minimal required util-linux version has been bumped to
+          2.26.
+
+        * Support for chkconfig (--enable-chkconfig) was removed in
+          favor of calling an abstraction tool
+          /lib/systemd/systemd-sysv-install. This needs to be
+          implemented for your distribution. See "SYSV INIT.D SCRIPTS"
+          in README for details.
+
+        * If there's a systemd unit and a SysV init script for the
+          same service name, and the user executes "systemctl enable"
+          for it (or a related call), then this will now enable both
+          (or execute the related operation on both), not just the
+          unit.
+
+        * The libudev API documentation has been converted from gtkdoc
+          into man pages.
+
+        * gudev has been removed from the systemd tree, it is now an
+          external project.
+
+        * The systemd-cgtop tool learnt a new --raw switch to generate
+          "raw" (machine parsable) output.
+
+        * networkd's IPForwarding= .network file setting learnt the
+          new setting "kernel", which ensures that networkd does not
+          change the IP forwarding sysctl from the default kernel
+          state.
+
+        * The systemd-logind bus API now exposes a new boolean
+          property "Docked" that reports whether logind considers the
+          system "docked", i.e. connected to a docking station or not.
+
+        Contributions from: Alex Crawford, Andreas Pokorny, Andrei
+        Borzenkov, Charles Duffy, Colin Guthrie, Cristian Rodríguez,
+        Daniele Medri, Daniel Hahler, Daniel Mack, David Herrmann,
+        David Mohr, Dimitri John Ledkov, Djalal Harouni, dslul, Ed
+        Swierk, Eric Cook, Filipe Brandenburger, Gianpaolo Macario,
+        Harald Hoyer, Iago López Galeiras, Igor Vuk, Jan Synacek,
+        Jason Pleau, Jason S. McMullan, Jean Delvare, Jeff Huang,
+        Jonathan Boulle, Karel Zak, Kay Sievers, kloun, Lennart
+        Poettering, Marc-Antoine Perennou, Marcel Holtmann, Mario
+        Limonciello, Martin Pitt, Michael Biebl, Michael Olbrich,
+        Michal Schmidt, Mike Gilbert, Nick Owens, Pablo Lezaeta Reyes,
+        Patrick Donnelly, Pavel Odvody, Peter Hutterer, Philip
+        Withnall, Ronny Chevalier, Simon McVittie, Susant Sahani,
+        Thomas Hindoe Paaboel Andersen, Tom Gundersen, Torstein
+        Husebø, Umut Tezduyar Lindskog, Viktar Vauchkevich, Werner
+        Fink, Zbigniew Jędrzejewski-Szmek
+
+        -- Berlin, 2015-06-19
+
 CHANGES WITH 220:
 
         * The gudev library has been extracted into a separate repository
@@ -227,7 +305,7 @@ CHANGES WITH 220:
         Gundersen, Torstein Husebø, Umut Tezduyar Lindskog, Will
         Woods, Zachary Cook, Zbigniew Jędrzejewski-Szmek
 
-        -- Berlin, 2015-05-??
+        -- Berlin, 2015-05-22
 
 CHANGES WITH 219:
 
@@ -3997,7 +4075,7 @@ CHANGES WITH 191:
         * HandleSleepKey= in logind.conf has been split up into
           HandleSuspendKey= and HandleHibernateKey=. The old setting
           is not available anymore. X11 and the kernel are
-          distuingishing between these keys and we should too. This
+          distinguishing between these keys and we should too. This
           also means the inhibition lock for these keys has been split
           into two.
 
@@ -4743,7 +4821,7 @@ CHANGES WITH 43:
 
         * Various functionality updates to libsystemd-login.so
 
-        * Track class of PAM logins to distuingish greeters from
+        * Track class of PAM logins to distinguish greeters from
           normal user logins.
 
         Contributions from: Kay Sievers, Lennart Poettering, Michael
diff --git a/README b/README
index e08b1dd..651aa98 100644 (file)
--- a/README
+++ b/README
-Elogind User, Seat and Session Manager
-
-Introduction
-------------
-
-Elogind is the systemd project's "logind", extracted out to be a
-standalone daemon.  It integrates with PAM to know the set of users
-that are logged in to a system and whether they are logged in
-graphically, on the console, or remotely.  Elogind exposes this
-information via the standard org.freedesktop.login1 D-Bus interface,
-as well as through the file system using systemd's standard
-/run/systemd layout.  Elogind also provides "libelogind", which is a
-subset of the facilities offered by "libsystemd".  There is a
-"libelogind.pc" pkg-config file as well.
-
-All of the credit for elogind should go to the systemd developers.
-For more on systemd, see
-http://www.freedesktop.org/wiki/Software/systemd.  All of the blame
-should go to Andy Wingo, who extracted elogind from systemd.
-
-Contributing
-------------
-
-Elogind was branched from systemd version 219, and preserves the git
-history of the systemd project.  The version of elogind is the
-upstream systemd version, followed by the patchlevel of elogind.  For
-example version 219.12 is the twelfth elogind release, which aims to
-provide a subset of the interfaces of systemd 219.
-
-To contribute to elogind, fork the current source code from github:
-
-  https://github.com/elogind/elogind
-
-Send a pull request for the changes you like.
-
-To chat about elogind:
-
-  #guix on irc.freenode.org
-
-Finally, bug reports:
-
-  https://github.com/elogind/elogind/issues
-
-Why bother?
------------
-
-Elogind has been developed for use in GuixSD, the OS distribution of
-GNU Guix.  See http://gnu.org/s/guix for more on Guix.  GuixSD uses a
-specific init manager (DMD), for reasons that are not relevant here,
-but still aims to eventually be a full-featured distribution that can
-run GNOME and other desktop environments.  However, to run GNOME these
-days means that you need to have support for the login1 D-Bus
-interface, which is currently only provided by systemd.  That is the
-origin of this project: to take the excellent logind functionality
-from systemd and provide it as a standalone package.
-
-We like systemd.  We realize that there are people out there that hate
-it.  You're welcome to use elogind for whatever purpose you like --
-as-is, or as a jumping-off point for other things -- but please don't
-use it as part of some anti-systemd vendetta.  Systemd hackers are
-smart folks that are trying to solve interesting problems on the free
-desktop, and their large adoption is largely because they solve
-problems that users and developers of user-focused applications care
-about.  We are appreciative of their logind effort and think that
-everyone deserves to run it if they like, even if they use a different
-PID 1.
-
-Differences relative to systemd
--------------------------------
-
-The pkg-config file is called libelogind, not libsystemd or
-libsystemd-logind.
-
-The headers are in <elogind/...>, so like <elogind/sd-login.h> instead
-of <systemd/sd-login.h>.
-
-Libelogind just implements login-related functionality.  It also
-provides the sd-bus API.
-
-Unlike systemd, whose logind arranges to manage resources for user
-sessions via RPC calls to systemd, in elogind there is no systemd so
-there is no global cgroup-based resource management.  This has a few
-implications:
-
-  * Elogind does not create "slices" for users.  Elogind will not
-    record that users are associated with slices.
-
-  * The /run/systemd/slices directory will always be empty.
-
-  * Elogind does not have the concept of a "scope", internally, as
-    it's the same as a session.  Any API that refers to scopes will
-    always return an error code.
-
-On the other hand, elogind does use a similar strategy to systemd in
-that it places processes in a private cgroup for organizational
-purposes, without installing any controllers (see
-http://0pointer.de/blog/projects/cgroups-vs-cgroups.html).  This
-allows elogind to map arbitrary processes to sessions, even if the
-process does the usual double-fork to be reparented to PID 1.
-
-Elogind does not manage virtual terminals.
-
-Elogind does monitor power button and the lid switch, like systemd,
-but instead of doing RPC to systemd to suspend, poweroff, or restart
-the machine, elogind just does this directly.  For suspend, hybernate,
-and hybrid-sleep, elogind uses the same code as systemd-sleep.
-Instead of using a separate sleep.conf file to configure the sleep
-behavior, this is included in the [Sleep] section of
-/etc/elogind/login.conf.  See the example login.conf for more.  For
-shutdown, reboot, and kexec, elogind shells out to "halt", "reboot",
-and "kexec" binaries.
-
-The loginctl command has the poweroff, reboot, sleep, hibernate, and
-hybrid-sleep commands from systemd, as well as the --ignore-inhibitors
-flag.
-
-The PAM module is called pam_elogind.so, not pam_systemd.so.
-
-License
--------
-
-LGPLv2.1+ for all code
-
-  - except src/shared/MurmurHash2.c which is Public Domain
-  - except src/shared/siphash24.c which is CC0 Public Domain
-  - except src/journal/lookup3.c which is Public Domain
-
-Dependencies
-------------
-
-  glibc >= 2.14
-  libcap
-  libmount >= 2.20 (from util-linux)
-  libseccomp >= 1.0.0 (optional)
-  libblkid >= 2.24 (from util-linux) (optional)
-  PAM >= 1.1.2 (optional)
-  libacl (optional)
-  libselinux (optional)
-  make, gcc, and similar tools
-
-During runtime, you need the following additional dependencies:
-
-  dbus >= 1.4.0 (strictly speaking optional, but recommended)
-  PolicyKit (optional)
-
-When building from git, you need the following additional
-dependencies:
-
-  pkg-config
-  docbook-xsl
-  xsltproc
-  automake
-  autoconf
-  libtool
-  intltool
-  gperf
-  gtkdocize (optional)
+systemd System and Service Manager
+
+DETAILS:
+        http://0pointer.de/blog/projects/systemd.html
+
+WEB SITE:
+        http://www.freedesktop.org/wiki/Software/systemd
+
+GIT:
+        git@github.com:systemd/systemd.git
+        https://github.com/systemd/systemd.git
+
+GITWEB:
+        https://github.com/systemd/systemd
+
+MAILING LIST:
+        http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+        http://lists.freedesktop.org/mailman/listinfo/systemd-commits
+
+IRC:
+        #systemd on irc.freenode.org
+
+BUG REPORTS:
+        https://github.com/systemd/systemd/issues
+
+AUTHOR:
+        Lennart Poettering
+        Kay Sievers
+        ...and many others
+
+LICENSE:
+        LGPLv2.1+ for all code
+        - except src/basic/MurmurHash2.c which is Public Domain
+        - except src/basic/siphash24.c which is CC0 Public Domain
+        - except src/journal/lookup3.c which is Public Domain
+        - except src/udev/* which is (currently still) GPLv2, GPLv2+
+
+REQUIREMENTS:
+        Linux kernel >= 3.7
+        Linux kernel >= 3.8 for Smack support
+
+        Kernel Config Options:
+          CONFIG_DEVTMPFS
+          CONFIG_CGROUPS (it is OK to disable all controllers)
+          CONFIG_INOTIFY_USER
+          CONFIG_SIGNALFD
+          CONFIG_TIMERFD
+          CONFIG_EPOLL
+          CONFIG_NET
+          CONFIG_SYSFS
+          CONFIG_PROC_FS
+          CONFIG_FHANDLE (libudev, mount and bind mount handling)
+
+        udev will fail to work with the legacy sysfs layout:
+          CONFIG_SYSFS_DEPRECATED=n
+
+        Legacy hotplug slows down the system and confuses udev:
+          CONFIG_UEVENT_HELPER_PATH=""
+
+        Userspace firmware loading is not supported and should
+        be disabled in the kernel:
+          CONFIG_FW_LOADER_USER_HELPER=n
+
+        Some udev rules and virtualization detection relies on it:
+          CONFIG_DMIID
+
+        Support for some SCSI devices serial number retrieval, to
+        create additional symlinks in /dev/disk/ and /dev/tape:
+          CONFIG_BLK_DEV_BSG
+
+        Required for PrivateNetwork and PrivateDevices in service units:
+          CONFIG_NET_NS
+          CONFIG_DEVPTS_MULTIPLE_INSTANCES
+        Note that systemd-localed.service and other systemd units use
+        PrivateNetwork and PrivateDevices so this is effectively required.
+
+        Optional but strongly recommended:
+          CONFIG_IPV6
+          CONFIG_AUTOFS4_FS
+          CONFIG_TMPFS_XATTR
+          CONFIG_{TMPFS,EXT4,XFS,BTRFS_FS,...}_POSIX_ACL
+          CONFIG_SECCOMP
+          CONFIG_CHECKPOINT_RESTORE (for the kcmp() syscall)
+
+        Required for CPUShares in resource control unit settings
+          CONFIG_CGROUP_SCHED
+          CONFIG_FAIR_GROUP_SCHED
+
+        Required for CPUQuota in resource control unit settings
+          CONFIG_CFS_BANDWIDTH
+
+        For systemd-bootchart, several proc debug interfaces are required:
+          CONFIG_SCHEDSTATS
+          CONFIG_SCHED_DEBUG
+
+        For UEFI systems:
+          CONFIG_EFIVAR_FS
+          CONFIG_EFI_PARTITION
+
+        Note that kernel auditing is broken when used with systemd's
+        container code. When using systemd in conjunction with
+        containers, please make sure to either turn off auditing at
+        runtime using the kernel command line option "audit=0", or
+        turn it off at kernel compile time using:
+          CONFIG_AUDIT=n
+        If systemd is compiled with libseccomp support on
+        architectures which do not use socketcall() and where seccomp
+        is supported (this effectively means x86-64 and ARM, but
+        excludes 32-bit x86!), then nspawn will now install a
+        work-around seccomp filter that makes containers boot even
+        with audit being enabled. This works correctly only on kernels
+        3.14 and newer though. TL;DR: turn audit off, still.
+
+        glibc >= 2.16
+        libcap
+        libmount >= 2.20 (from util-linux)
+        libseccomp >= 1.0.0 (optional)
+        libblkid >= 2.24 (from util-linux) (optional)
+        libkmod >= 15 (optional)
+        PAM >= 1.1.2 (optional)
+        libcryptsetup (optional)
+        libaudit (optional)
+        libacl (optional)
+        libselinux (optional)
+        liblzma (optional)
+        liblz4 >= 119 (optional)
+        libgcrypt (optional)
+        libqrencode (optional)
+        libmicrohttpd (optional)
+        libpython (optional)
+        libidn (optional)
+        elfutils >= 158 (optional)
+        make, gcc, and similar tools
+
+        During runtime, you need the following additional
+        dependencies:
+
+        util-linux >= v2.26 required
+        dbus >= 1.4.0 (strictly speaking optional, but recommended)
+        dracut (optional)
+        PolicyKit (optional)
+
+        When building from git, you need the following additional
+        dependencies:
+
+        pkg-config
+        docbook-xsl
+        xsltproc
+        automake
+        autoconf
+        libtool
+        intltool
+        gperf
+        python (optional)
+        python-lxml (optional, but required to build the indices)
+        sphinx (optional)
+
+        When systemd-hostnamed is used, it is strongly recommended to
+        install nss-myhostname to ensure that, in a world of
+        dynamically changing hostnames, the hostname stays resolvable
+        under all circumstances. In fact, systemd-hostnamed will warn
+        if nss-myhostname is not installed.
+
+        To build HTML documentation for python-systemd using sphinx,
+        please first install systemd (using 'make install'), and then
+        invoke sphinx-build with 'make sphinx-<target>', with <target>
+        being 'html' or 'latexpdf'. If using DESTDIR for installation,
+        pass the same DESTDIR to 'make sphinx-html' invocation.
+
+USERS AND GROUPS:
+        Default udev rules use the following standard system group
+        names, which need to be resolvable by getgrnam() at any time,
+        even in the very early boot stages, where no other databases
+        and network are available:
+
+        audio, cdrom, dialout, disk, input, kmem, lp, tape, tty, video
+
+        During runtime, the journal daemon requires the
+        "systemd-journal" system group to exist. New journal files will
+        be readable by this group (but not writable), which may be used
+        to grant specific users read access. In addition, system
+        groups "wheel" and "adm" will be given read-only access to
+        journal files using systemd-tmpfiles.service.
+
+        The journal gateway daemon requires the
+        "systemd-journal-gateway" system user and group to
+        exist. During execution this network facing service will drop
+        privileges and assume this uid/gid for security reasons.
+
+        Similarly, the NTP daemon requires the "systemd-timesync" system
+        user and group to exist.
+
+        Similarly, the network management daemon requires the
+        "systemd-network" system user and group to exist.
+
+        Similarly, the name resolution daemon requires the
+        "systemd-resolve" system user and group to exist.
+
+        Similarly, the kdbus dbus1 proxy daemon requires the
+        "systemd-bus-proxy" system user and group to exist.
+
+NSS:
+        systemd ships with three NSS modules:
+
+        nss-myhostname resolves the local hostname to locally
+        configured IP addresses, as well as "localhost" to
+        127.0.0.1/::1.
+
+        nss-resolve enables DNS resolution via the systemd-resolved
+        DNS/LLMNR caching stub resolver "systemd-resolved".
+
+        nss-mymachines enables resolution of all local containers
+        registered with machined to their respective IP addresses.
+
+        To make use of these NSS modules, please add them to the
+        "hosts: " line in /etc/nsswitch.conf. The "resolve" module
+        should replace the glibc "dns" module in this file.
+
+        The three modules should be used in the following order:
+
+                hosts: files mymachines resolve myhostname
+
+SYSV INIT.D SCRIPTS:
+        When calling "systemctl enable/disable/is-enabled" on a unit which is a
+        SysV init.d script, it calls /usr/lib/systemd/systemd-sysv-install;
+        this needs to translate the action into the distribution specific
+        mechanism such as chkconfig or update-rc.d. Packagers need to provide
+        this script if you need this functionality (you don't if you disabled
+        SysV init support).
+
+        Please see src/systemctl/systemd-sysv-install.SKELETON for how this
+        needs to look like, and provide an implementation at the marked places.
+
+WARNINGS:
+        systemd will warn you during boot if /etc/mtab is not a
+        symlink to /proc/mounts. Please ensure that /etc/mtab is a
+        proper symlink.
+
+        systemd will warn you during boot if /usr is on a different
+        file system than /. While in systemd itself very little will
+        break if /usr is on a separate partition, many of its
+        dependencies very likely will break sooner or later in one
+        form or another. For example, udev rules tend to refer to
+        binaries in /usr, binaries that link to libraries in /usr or
+        binaries that refer to data files in /usr. Since these
+        breakages are not always directly visible, systemd will warn
+        about this, since this kind of file system setup is not really
+        supported anymore by the basic set of Linux OS components.
+
+        systemd requires that the /run mount point exists. systemd also
+        requires that /var/run is a symlink to /run.
+
+        For more information on this issue consult
+        http://freedesktop.org/wiki/Software/systemd/separate-usr-is-broken
+
+        To run systemd under valgrind, compile with VALGRIND defined
+        (e.g. ./configure CPPFLAGS='... -DVALGRIND=1'). Otherwise,
+        false positives will be triggered by code which violates
+        some rules but is actually safe.
+
+ENGINEERING AND CONSULTING SERVICES:
+        ENDOCODE <https://endocode.com/> offers professional
+        engineering and consulting services for systemd. Please
+        contact Chris Kühl <chris@endocode.com> for more information.
diff --git a/TODO b/TODO
index 43b6968..386599b 100644 (file)
--- a/TODO
+++ b/TODO
@@ -26,6 +26,31 @@ External:
 
 Features:
 
+* "systemctl edit" should know a mode to create a new unit file
+
+* there's probably something wrong with having user mounts below /sys,
+  as we have for debugfs. for exmaple, src/core/mount.c handles mounts
+  prefixed with /sys generally special.
+  http://lists.freedesktop.org/archives/systemd-devel/2015-June/032962.html
+
+* Add PassEnvironment= setting to service units, to import select env vars from PID 1 into the service env block
+
+* nspawn: fix logic always print a final newline on output.
+  https://github.com/systemd/systemd/pull/272#issuecomment-113153176
+
+* make nspawn's --network-veth switch more powerful:
+  http://lists.freedesktop.org/archives/systemd-devel/2015-June/033121.html
+
+* man: document that unless you use StandardError=null the shell >/dev/stderr won't work in shell scripts in services
+
+* man: clarify that "machinectl show" shows different information than "machinectl status" (no cgroup tree, no IP addresses, ...)
+
+* "systemctl daemon-reload" should result in /etc/systemd/system.conf being reloaded by systemd
+
+* install: include generator dirs in unit file search paths
+
+* networkd: add support for configuring ipv6 privacy extensions
+
 * introduce an NSS module that uses machined info to give container UIDs pretty names when user namespacing is used.
 
 * stop using off_t, it's a crazy type. Use uint64_t instead.
@@ -537,8 +562,6 @@ Features:
 
 * maybe do not install getty@tty1.service symlink in /etc but in /usr?
 
-* re-enable "make check" for gtk-doc (broken for unknown reason)
-
 * fstab: add new mount option x-systemd-after=/foobar/waldo to allow manual dependencies to other mount points
   https://bugzilla.redhat.com/show_bug.cgi?id=812826
 
index 3997db3..9d2c652 100755 (executable)
@@ -21,21 +21,13 @@ oldpwd=$(pwd)
 topdir=$(dirname $0)
 cd $topdir
 
-if [ -f .git/hooks/pre-commit.sample ] && [ ! -f .git/hooks/pre-commit ]; then
-        # This part is allowed to fail
-        cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit && \
-        chmod +x .git/hooks/pre-commit && \
-        echo "Activated pre-commit hook." || :
-fi
-
-if which gtkdocize >/dev/null 2>/dev/null; then
-        gtkdocize --docdir docs/ --flavour no-tmpl
-        gtkdocargs=--enable-gtk-doc
-else
-        echo "You don't have gtk-doc installed, and thus won't be able to generate the documentation."
-        rm -f docs/gtk-doc.make
-        echo 'EXTRA_DIST =' > docs/gtk-doc.make
-fi
+# We do not need this, we are not systemd upstream!
+#if [ -f .git/hooks/pre-commit.sample ] && [ ! -f .git/hooks/pre-commit ]; then
+#        # This part is allowed to fail
+#        cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit && \
+#        chmod +x .git/hooks/pre-commit && \
+#        echo "Activated pre-commit hook." || :
+#fi
 
 intltoolize --force --automake
 autoreconf --force --install --symlink
index 9b6365a..c8a4aff 100644 (file)
@@ -20,7 +20,7 @@
 AC_PREREQ([2.64])
 
 AC_INIT([elogind],
-        [220],
+        [221],
         [https://github.com/elogind/elogind/issues],
         [elogind],
         [https://github.com/elogind/elogind])
@@ -47,6 +47,7 @@ AS_IF([test "x$enable_largefile" = "xno"], [AC_MSG_ERROR([--disable-largefile is
 SET_ARCH(X86_64, x86_64*)
 SET_ARCH(IA32, i*86*)
 SET_ARCH(MIPS, mips*)
+SET_ARCH(AARCH64, aarch64*)
 
 # i18n stuff for the PolicyKit policy files, heck whether intltool can be found, disable NLS otherwise
 AC_CHECK_PROG(intltool_found, [intltool-merge], [yes], [no])
@@ -144,11 +145,9 @@ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
         -pipe \
         -Wall \
         -Wextra \
-        -Wno-inline \
         -Wundef \
         "-Wformat=2 -Wformat-security -Wformat-nonliteral" \
         -Wlogical-op \
-        -Wsign-compare \
         -Wmissing-include-dirs \
         -Wold-style-definition \
         -Wpointer-arith \
@@ -156,17 +155,18 @@ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
         -Wdeclaration-after-statement \
         -Wfloat-equal \
         -Wsuggest-attribute=noreturn \
-        -Wmissing-prototypes \
+        -Werror=missing-prototypes \
+        -Werror=implicit-function-declaration \
+        -Werror=missing-declarations \
+        -Werror=return-type \
+        -Werror=shadow \
         -Wstrict-prototypes \
         -Wredundant-decls \
-        -Wmissing-declarations \
         -Wmissing-noreturn \
         -Wshadow \
         -Wendif-labels \
         -Wstrict-aliasing=2 \
         -Wwrite-strings \
-        -Wno-long-long \
-        -Wno-overlength-strings \
         -Wno-unused-parameter \
         -Wno-missing-field-initializers \
         -Wno-unused-result \
@@ -179,8 +179,6 @@ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
         -fdiagnostics-show-option \
         -fno-strict-aliasing \
         -fvisibility=hidden \
-        -ffunction-sections \
-        -fdata-sections \
         -fstack-protector \
         -fstack-protector-strong \
         -fPIE \
@@ -204,10 +202,21 @@ AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
         [AC_MSG_RESULT([skipping -D_FORTIFY_SOURCE, optimization not enabled])])
 AC_SUBST([OUR_CPPFLAGS], "$with_cppflags $sanitizer_cppflags")
 
+AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
+        [CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
+               -Wl,--gc-sections])],
+        [AC_MSG_RESULT([skipping --gc-sections, optimization not enabled])])
+AC_SUBST([OUR_CFLAGS], "$with_ldflags $sanitizer_cflags")
+
+AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
+        [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
+               -ffunction-sections -fdata-sections])],
+        [AC_MSG_RESULT([skipping -ffunction/data-section, optimization not enabled])])
+AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")
+
 CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
         -Wl,--as-needed \
         -Wl,--no-undefined \
-        -Wl,--gc-sections \
         -Wl,-z,relro \
         -Wl,-z,now \
         -pie \
@@ -269,6 +278,7 @@ AC_CHECK_DECLS([IFLA_INET6_ADDR_GEN_MODE,
                 IFLA_PHYS_PORT_ID,
                 IFLA_BOND_AD_INFO,
                 IFLA_VLAN_PROTOCOL,
+                IFLA_VXLAN_REMCSUM_NOPARTIAL,
                 IFLA_VXLAN_LOCAL6,
                 IFLA_IPTUN_6RD_RELAY_PREFIXLEN,
                 IFLA_BRIDGE_VLAN_INFO,
@@ -285,6 +295,7 @@ AC_CHECK_DECLS([IFLA_INET6_ADDR_GEN_MODE,
 #include <linux/if_tunnel.h>
 #include <linux/if_link.h>
 #include <linux/if_bridge.h>
+#include <linux/if_addr.h>
 #include <linux/neighbour.h>
 ]])
 
@@ -310,7 +321,12 @@ AC_ARG_WITH([udevrulesdir],
             [],
             [with_udevrulesdir=$($PKG_CONFIG --variable=udevdir udev)/rules.d])
 AC_SUBST([udevrulesdir], [$with_udevrulesdir])
-AC_SUBST([udevbindir], [$($PKG_CONFIG --variable=udevdir udev)/../bin])
+
+AC_ARG_WITH([udevbindir],
+            AS_HELP_STRING([--with-udevbindir=DIR], [Directory for udev binary files]),
+            [],
+            [with_udevbindir=$($PKG_CONFIG --variable=udevdir udev)])
+AC_SUBST([udevbindir], [$with_udevbindir])
 
 # ------------------------------------------------------------------------------
 have_coverage=no
@@ -526,9 +542,9 @@ AM_CONDITIONAL(ENABLE_POLKIT, [test "x$have_polkit" = "xyes"])
 
 # ------------------------------------------------------------------------------
 have_kdbus=no
-AC_ARG_ENABLE(kdbus, AS_HELP_STRING([--enable-kdbus], [do connect to kdbus by default]))
-if test "x$enable_kdbus" = "xyes"; then
-        AC_DEFINE(ENABLE_KDBUS, 1, [Define if kdbus support is to be enabled])
+AC_ARG_ENABLE(kdbus, AS_HELP_STRING([--disable-kdbus], [do not connect to kdbus by default]))
+if test "x$enable_kdbus" != "xno"; then
+        AC_DEFINE(ENABLE_KDBUS, 1, [Define if kdbus is to be connected to by default])
         have_kdbus=yes
         M4_DEFINES="$M4_DEFINES -DENABLE_KDBUS"
 fi
@@ -555,16 +571,13 @@ AC_ARG_WITH([dbuspolicydir],
         AS_HELP_STRING([--with-dbuspolicydir=DIR], [D-Bus policy directory]),
         [],
         [with_dbuspolicydir=${sysconfdir}/dbus-1/system.d])
-
-AC_ARG_WITH([dbussessionservicedir],
-        AS_HELP_STRING([--with-dbussessionservicedir=DIR], [D-Bus session service directory]),
-        [],
-        [with_dbussessionservicedir=${datadir}/dbus-1/services])
+AX_NORMALIZE_PATH([with_dbuspolicydir])
 
 AC_ARG_WITH([dbussystemservicedir],
         AS_HELP_STRING([--with-dbussystemservicedir=DIR], [D-Bus system service directory]),
         [],
         [with_dbussystemservicedir=${datadir}/dbus-1/system-services])
+AX_NORMALIZE_PATH([with_dbussystemservicedir])
 
 AC_ARG_WITH([bashcompletiondir],
         AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
@@ -574,25 +587,42 @@ AC_ARG_WITH([bashcompletiondir],
         ] , [
                 with_bashcompletiondir=${datadir}/bash-completion/completions
         ])])
+AX_NORMALIZE_PATH([with_bashcompletiondir])
 
 AC_ARG_WITH([zshcompletiondir],
         AS_HELP_STRING([--with-zshcompletiondir=DIR], [Zsh completions directory]),
         [], [with_zshcompletiondir=${datadir}/zsh/site-functions])
+AX_NORMALIZE_PATH([with_zshcompletiondir])
+
+AC_ARG_WITH([rootprefix],
+        AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]),
+        [], [with_rootprefix=${ac_default_prefix}])
+# --with-rootprefix= (empty) should default to "/" but AX_NORMALIZE_PATH
+# defaults those to ".", solve that here for now until we can find a suitable
+# fix for AX_NORMALIZE_PATH upstream at autoconf-archive.
+# See: https://github.com/systemd/systemd/issues/54
+if test "x${with_rootprefix}" = "x"; then
+        with_rootprefix="/"
+fi
+AX_NORMALIZE_PATH([with_rootprefix])
 
 AC_ARG_WITH([rootlibdir],
         AS_HELP_STRING([--with-rootlibdir=DIR], [Root directory for libraries necessary for boot]),
         [],
         [with_rootlibdir=${libdir}])
+AX_NORMALIZE_PATH([with_rootlibdir])
 
 AC_ARG_WITH([pamlibdir],
         AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]),
         [],
         [with_pamlibdir=${with_rootlibdir}/security])
+AX_NORMALIZE_PATH([with_pamlibdir])
 
 AC_ARG_WITH([pamconfdir],
         AS_HELP_STRING([--with-pamconfdir=DIR], [Directory for PAM configuration]),
         [],
         [with_pamconfdir=${sysconfdir}/pam.d])
+AX_NORMALIZE_PATH([with_pamconfdir])
 
 AC_ARG_ENABLE([split-usr],
         AS_HELP_STRING([--enable-split-usr], [Assume that /bin, /sbin aren\'t symlinks into /usr]),
@@ -606,10 +636,9 @@ AC_ARG_ENABLE([split-usr],
 AS_IF([test "x${enable_split_usr}" = "xyes"], [
         AC_DEFINE(HAVE_SPLIT_USR, 1, [Define if /bin, /sbin aren't symlinks into /usr])
 ])
+AM_CONDITIONAL(ENABLE_SPLIT_USR, [test "x${enable_split_usr}" = "xyes"])
 
-# Work around intltoolize and gtk-doc problems in VPATH builds
-AM_CONDITIONAL([ENABLE_GTK_DOC_TESTS], [test "x$0" = "x./configure"],
-                                       [Define to do gtk-doc tests])
+# work around intltool-update issues during 'make distcheck'
 AS_IF([test "x$0" != "x./configure"], [
         AC_SUBST([INTLTOOL_UPDATE], [/usr/bin/env true])
 ])
@@ -650,16 +679,17 @@ AS_IF([test x$enable_debug_mmap_cache = xyes], [
 test -z "$enable_debug" && enable_debug="none"
 
 AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
-AC_SUBST([dbussessionservicedir], [$with_dbussessionservicedir])
 AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir])
 AC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
 AC_SUBST([zshcompletiondir], [$with_zshcompletiondir])
 AC_SUBST([pamlibdir], [$with_pamlibdir])
 AC_SUBST([pamconfdir], [$with_pamconfdir])
+AC_SUBST([rootprefix], [$with_rootprefix])
 AC_SUBST([rootlibdir], [$with_rootlibdir])
 
 AC_CONFIG_FILES([
-        Makefile po/Makefile.in
+        Makefile
+        po/Makefile.in
 ])
 
 AC_OUTPUT
@@ -677,12 +707,12 @@ AC_MSG_RESULT([
         dbus:                    ${have_dbus}
         kdbus:                   ${have_kdbus}
         man pages:               ${have_manpages}
-        gtk-doc:                 ${enable_gtk_doc}
         test coverage:           ${have_coverage}
         Split /usr:              ${enable_split_usr}
         extra debugging:         ${enable_debug}
 
         prefix:                  ${prefix}
+        rootprefix:              ${with_rootprefix}
         sysconf dir:             ${sysconfdir}
         datarootdir:             ${datarootdir}
         includedir:              ${includedir}
@@ -691,7 +721,6 @@ AC_MSG_RESULT([
         PAM modules dir:         ${with_pamlibdir}
         PAM configuration dir:   ${with_pamconfdir}
         D-Bus policy dir:        ${with_dbuspolicydir}
-        D-Bus session dir:       ${with_dbussessionservicedir}
         D-Bus system dir:        ${with_dbussystemservicedir}
         Bash completions dir:    ${with_bashcompletiondir}
         Zsh completions dir:     ${with_zshcompletiondir}
diff --git a/docs/gtk-doc.make b/docs/gtk-doc.make
new file mode 120000 (symlink)
index 0000000..3ee6bad
--- /dev/null
@@ -0,0 +1 @@
+/usr/share/gtk-doc/data/gtk-doc.notmpl.make
\ No newline at end of file
index dec7a8f..6f5f4ad 100644 (file)
@@ -8,5 +8,5 @@ account  sufficient pam_unix.so
 password sufficient pam_unix.so nullok sha512 shadow try_first_pass try_authtok
 
 -session optional   pam_loginuid.so
--session optional   pam_systemd.so
+-session optional   pam_elogind.so
 session  sufficient pam_unix.so
diff --git a/m4/gtk-doc.m4 b/m4/gtk-doc.m4
new file mode 100644 (file)
index 0000000..3675543
--- /dev/null
@@ -0,0 +1,88 @@
+dnl -*- mode: autoconf -*-
+
+# serial 2
+
+dnl Usage:
+dnl   GTK_DOC_CHECK([minimum-gtk-doc-version])
+AC_DEFUN([GTK_DOC_CHECK],
+[
+  AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+  AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
+  AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
+
+  ifelse([$1],[],[gtk_doc_requires="gtk-doc"],[gtk_doc_requires="gtk-doc >= $1"])
+  AC_MSG_CHECKING([for gtk-doc])
+  PKG_CHECK_EXISTS([$gtk_doc_requires],[have_gtk_doc=yes],[have_gtk_doc=no])
+  AC_MSG_RESULT($have_gtk_doc)
+
+  if test "$have_gtk_doc" = "no"; then
+      AC_MSG_WARN([
+  You will not be able to create source packages with 'make dist'
+  because $gtk_doc_requires is not found.])
+  fi
+
+  dnl check for tools we added during development
+  dnl Use AC_CHECK_PROG to avoid the check target using an absolute path that
+  dnl may not be writable by the user. Currently, automake requires that the
+  dnl test name must end in '.test'.
+  dnl https://bugzilla.gnome.org/show_bug.cgi?id=701638
+  AC_CHECK_PROG([GTKDOC_CHECK],[gtkdoc-check],[gtkdoc-check.test])
+  AC_PATH_PROG([GTKDOC_CHECK_PATH],[gtkdoc-check])
+  AC_PATH_PROGS([GTKDOC_REBASE],[gtkdoc-rebase],[true])
+  AC_PATH_PROG([GTKDOC_MKPDF],[gtkdoc-mkpdf])
+
+  dnl for overriding the documentation installation directory
+  AC_ARG_WITH([html-dir],
+    AS_HELP_STRING([--with-html-dir=PATH], [path to installed docs]),,
+    [with_html_dir='${datadir}/gtk-doc/html'])
+  HTML_DIR="$with_html_dir"
+  AC_SUBST([HTML_DIR])
+
+  dnl enable/disable documentation building
+  AC_ARG_ENABLE([gtk-doc],
+    AS_HELP_STRING([--enable-gtk-doc],
+                   [use gtk-doc to build documentation [[default=no]]]),,
+    [enable_gtk_doc=no])
+
+  AC_MSG_CHECKING([whether to build gtk-doc documentation])
+  AC_MSG_RESULT($enable_gtk_doc)
+
+  if test "x$enable_gtk_doc" = "xyes" && test "$have_gtk_doc" = "no"; then
+    AC_MSG_ERROR([
+  You must have $gtk_doc_requires installed to build documentation for
+  $PACKAGE_NAME. Please install gtk-doc or disable building the
+  documentation by adding '--disable-gtk-doc' to '[$]0'.])
+  fi
+
+  dnl don't check for glib if we build glib
+  if test "x$PACKAGE_NAME" != "xglib"; then
+    dnl don't fail if someone does not have glib
+    PKG_CHECK_MODULES(GTKDOC_DEPS, glib-2.0 >= 2.10.0 gobject-2.0  >= 2.10.0,,[:])
+  fi
+
+  dnl enable/disable output formats
+  AC_ARG_ENABLE([gtk-doc-html],
+    AS_HELP_STRING([--enable-gtk-doc-html],
+                   [build documentation in html format [[default=yes]]]),,
+    [enable_gtk_doc_html=yes])
+    AC_ARG_ENABLE([gtk-doc-pdf],
+      AS_HELP_STRING([--enable-gtk-doc-pdf],
+                     [build documentation in pdf format [[default=no]]]),,
+      [enable_gtk_doc_pdf=no])
+
+  if test -z "$GTKDOC_MKPDF"; then
+    enable_gtk_doc_pdf=no
+  fi
+
+  if test -z "$AM_DEFAULT_VERBOSITY"; then
+    AM_DEFAULT_VERBOSITY=1
+  fi
+  AC_SUBST([AM_DEFAULT_VERBOSITY])
+
+  AM_CONDITIONAL([HAVE_GTK_DOC], [test x$have_gtk_doc = xyes])
+  AM_CONDITIONAL([ENABLE_GTK_DOC], [test x$enable_gtk_doc = xyes])
+  AM_CONDITIONAL([GTK_DOC_BUILD_HTML], [test x$enable_gtk_doc_html = xyes])
+  AM_CONDITIONAL([GTK_DOC_BUILD_PDF], [test x$enable_gtk_doc_pdf = xyes])
+  AM_CONDITIONAL([GTK_DOC_USE_LIBTOOL], [test -n "$LIBTOOL"])
+  AM_CONDITIONAL([GTK_DOC_USE_REBASE], [test -n "$GTKDOC_REBASE"])
+])
index 5ee5d22..99acc43 100644 (file)
       <xsl:text>index.html</xsl:text>
     </xsl:attribute>
     <xsl:text>Index </xsl:text>
+  </a>
 
   <span style="float:right">
-    <xsl:text>elogind </xsl:text>
+    <xsl:text>elogind</xsl:text>
     <xsl:value-of select="$elogind.version"/>
   </span>
   <hr/>
similarity index 88%
rename from man/logind.conf.xml
rename to man/elogind.conf.xml
index 9332e80..b6392a6 100644 (file)
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 -->
 
-<refentry id="logind.conf" xmlns:xi="http://www.w3.org/2001/XInclude">
+<refentry id="elogind.conf" xmlns:xi="http://www.w3.org/2001/XInclude">
   <refentryinfo>
-    <title>logind.conf</title>
-    <productname>systemd</productname>
+    <title>elogind.conf</title>
+    <productname>elogind</productname>
 
     <authorgroup>
       <author>
   </refentryinfo>
 
   <refmeta>
-    <refentrytitle>logind.conf</refentrytitle>
+    <refentrytitle>elogind.conf</refentrytitle>
     <manvolnum>5</manvolnum>
   </refmeta>
 
   <refnamediv>
-    <refname>logind.conf</refname>
-    <refname>logind.conf.d</refname>
+    <refname>elogind.conf</refname>
+    <refname>elogind.conf.d</refname>
     <refpurpose>Login manager configuration files</refpurpose>
   </refnamediv>
 
   <refsynopsisdiv>
-    <para><filename>/etc/systemd/logind.conf</filename></para>
-    <para><filename>/etc/systemd/logind.conf.d/*.conf</filename></para>
-    <para><filename>/run/systemd/logind.conf.d/*.conf</filename></para>
-    <para><filename>/usr/lib/systemd/logind.conf.d/*.conf</filename></para>
+    <para><filename>/etc/elogind/elogind.conf</filename></para>
   </refsynopsisdiv>
 
   <refsect1>
     <title>Description</title>
 
-    <para>These files configure various parameters of the systemd
+    <para>These files configure various parameters of the elogind
     login manager,
-    <citerefentry><refentrytitle>logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
     </para>
   </refsect1>
 
         <term><varname>HoldoffTimeoutSec=</varname></term>
 
         <listitem><para>Specifies the timeout after system startup or
-        system resume in which systemd will hold off on reacting to
+        system resume in which elogind will hold off on reacting to
         LID events. This is required for the system to properly
-        detect any hotplugged devices so systemd can ignore LID events
+        detect any hotplugged devices so elogind can ignore LID events
         if external monitors, or docks, are connected. If set to 0,
-        systemd will always react immediately, possibly before the
+        elogind will always react immediately, possibly before the
         kernel fully probed all hotplugged devices. This is safe, as
-        long as you do not care for systemd to account for devices
+        long as you do not care for elogind to account for devices
         that have been plugged or unplugged while the system was off.
         Defaults to 30s.</para></listitem>
       </varlistentry>
   <refsect1>
       <title>See Also</title>
       <para>
-        <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
-        <citerefentry><refentrytitle>logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
         <citerefentry><refentrytitle>loginctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
-        <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
       </para>
   </refsect1>
 
index 4e09e7a..1c2d913 100644 (file)
@@ -25,7 +25,7 @@
 
   <refentryinfo>
     <title>loginctl</title>
-    <productname>systemd</productname>
+    <productname>elogind</productname>
 
     <authorgroup>
       <author>
@@ -44,7 +44,7 @@
 
   <refnamediv>
     <refname>loginctl</refname>
-    <refpurpose>Control the systemd login manager</refpurpose>
+    <refpurpose>Control the elogind login manager</refpurpose>
   </refnamediv>
 
   <refsynopsisdiv>
     <title>Description</title>
 
     <para><command>loginctl</command> may be used to introspect and
-    control the state of the
-    <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
-    login manager
-    <citerefentry><refentrytitle>logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
+        control the state of the elogind login manager</para>
   </refsect1>
 
   <refsect1>
   <refsect1>
     <title>See Also</title>
     <para>
-      <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
-      <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
-      <citerefentry><refentrytitle>logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-      <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+      <citerefentry><refentrytitle>elogind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
     </para>
   </refsect1>
 
index 7c3690a..927ad1f 100644 (file)
@@ -88,7 +88,7 @@
 
     <orderedlist>
       <listitem><para>If enabled in
-      <citerefentry><refentrytitle>logind.conf</refentrytitle>
+      <citerefentry><refentrytitle>elogind.conf</refentrytitle>
       <manvolnum>5</manvolnum></citerefentry>, all processes of the
       session are terminated. If the last concurrent session of a user
       ends, the user's elogind instance will be terminated too, and so
@@ -279,8 +279,8 @@ session    required     pam_elogind.so</programlisting>
   <refsect1>
     <title>See Also</title>
     <para>
-      <citerefentry><refentrytitle>logind</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
-      <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+      <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+      <citerefentry><refentrytitle>elogind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
       <citerefentry><refentrytitle>loginctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
       <citerefentry project='man-pages'><refentrytitle>pam.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
       <citerefentry project='man-pages'><refentrytitle>pam.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
diff --git a/man/sd_is_fifo.xml b/man/sd_is_fifo.xml
new file mode 100644 (file)
index 0000000..627cb87
--- /dev/null
@@ -0,0 +1,200 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<!--
+  This file is part of systemd.
+
+  Copyright 2010 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/>.
+-->
+
+<refentry id="sd_is_fifo"
+  xmlns:xi="http://www.w3.org/2001/XInclude">
+
+  <refentryinfo>
+    <title>sd_is_fifo</title>
+    <productname>systemd</productname>
+
+    <authorgroup>
+      <author>
+        <contrib>Developer</contrib>
+        <firstname>Lennart</firstname>
+        <surname>Poettering</surname>
+        <email>lennart@poettering.net</email>
+      </author>
+    </authorgroup>
+  </refentryinfo>
+
+  <refmeta>
+    <refentrytitle>sd_is_fifo</refentrytitle>
+    <manvolnum>3</manvolnum>
+  </refmeta>
+
+  <refnamediv>
+    <refname>sd_is_fifo</refname>
+    <refname>sd_is_socket</refname>
+    <refname>sd_is_socket_inet</refname>
+    <refname>sd_is_socket_unix</refname>
+    <refname>sd_is_mq</refname>
+    <refname>sd_is_special</refname>
+    <refpurpose>Check the type of a file descriptor</refpurpose>
+  </refnamediv>
+
+  <refsynopsisdiv>
+    <funcsynopsis>
+      <funcsynopsisinfo>#include &lt;systemd/sd-daemon.h&gt;</funcsynopsisinfo>
+
+      <funcprototype>
+        <funcdef>int <function>sd_is_fifo</function></funcdef>
+        <paramdef>int <parameter>fd</parameter></paramdef>
+        <paramdef>const char *<parameter>path</parameter></paramdef>
+      </funcprototype>
+
+      <funcprototype>
+        <funcdef>int <function>sd_is_socket</function></funcdef>
+        <paramdef>int <parameter>fd</parameter></paramdef>
+        <paramdef>int <parameter>family</parameter></paramdef>
+        <paramdef>int <parameter>type</parameter></paramdef>
+        <paramdef>int <parameter>listening</parameter></paramdef>
+      </funcprototype>
+
+      <funcprototype>
+        <funcdef>int <function>sd_is_socket_inet</function></funcdef>
+        <paramdef>int <parameter>fd</parameter></paramdef>
+        <paramdef>int <parameter>family</parameter></paramdef>
+        <paramdef>int <parameter>type</parameter></paramdef>
+        <paramdef>int <parameter>listening</parameter></paramdef>
+        <paramdef>uint16_t <parameter>port</parameter></paramdef>
+      </funcprototype>
+
+      <funcprototype>
+        <funcdef>int <function>sd_is_socket_unix</function></funcdef>
+        <paramdef>int <parameter>fd</parameter></paramdef>
+        <paramdef>int <parameter>type</parameter></paramdef>
+        <paramdef>int <parameter>listening</parameter></paramdef>
+        <paramdef>const char *<parameter>path</parameter></paramdef>
+        <paramdef>size_t <parameter>length</parameter></paramdef>
+      </funcprototype>
+
+      <funcprototype>
+        <funcdef>int <function>sd_is_mq</function></funcdef>
+        <paramdef>int <parameter>fd</parameter></paramdef>
+        <paramdef>const char *<parameter>path</parameter></paramdef>
+      </funcprototype>
+
+      <funcprototype>
+        <funcdef>int <function>sd_is_special</function></funcdef>
+        <paramdef>int <parameter>fd</parameter></paramdef>
+        <paramdef>const char *<parameter>path</parameter></paramdef>
+      </funcprototype>
+
+    </funcsynopsis>
+  </refsynopsisdiv>
+
+  <refsect1>
+    <title>Description</title>
+
+    <para><function>sd_is_fifo()</function> may be called to check
+    whether the specified file descriptor refers to a FIFO or pipe. If
+    the <parameter>path</parameter> parameter is not
+    <constant>NULL</constant>, it is checked whether the FIFO is bound
+    to the specified file system path.</para>
+
+    <para><function>sd_is_socket()</function> may be called to check
+    whether the specified file descriptor refers to a socket. If the
+    <parameter>family</parameter> parameter is not
+    <constant>AF_UNSPEC</constant>, it is checked whether the socket
+    is of the specified family (AF_UNIX, <constant>AF_INET</constant>,
+    ...). If the <parameter>type</parameter> parameter is not 0, it is
+    checked whether the socket is of the specified type
+    (<constant>SOCK_STREAM</constant>,
+    <constant>SOCK_DGRAM</constant>, ...). If the
+    <parameter>listening</parameter> parameter is positive, it is
+    checked whether the socket is in accepting mode, i.e.
+    <function>listen()</function> has been called for it. If
+    <parameter>listening</parameter> is 0, it is checked whether the
+    socket is not in this mode. If the parameter is negative, no such
+    check is made. The <parameter>listening</parameter> parameter
+    should only be used for stream sockets and should be set to a
+    negative value otherwise.</para>
+
+    <para><function>sd_is_socket_inet()</function> is similar to
+    <function>sd_is_socket()</function>, but optionally checks the
+    IPv4 or IPv6 port number the socket is bound to, unless
+    <parameter>port</parameter> is zero. For this call
+    <parameter>family</parameter> must be passed as either
+    <constant>AF_UNSPEC</constant>, <constant>AF_INET</constant>, or
+    <constant>AF_INET6</constant>.</para>
+
+    <para><function>sd_is_socket_unix()</function> is similar to
+    <function>sd_is_socket()</function> but optionally checks the
+    <constant>AF_UNIX</constant> path the socket is bound to, unless
+    the <parameter>path</parameter> parameter is
+    <constant>NULL</constant>. For normal file system
+    <constant>AF_UNIX</constant> sockets, set the
+    <parameter>length</parameter> parameter to 0. For Linux abstract
+    namespace sockets, set the <parameter>length</parameter> to the
+    size of the address, including the initial 0 byte, and set the
+    <parameter>path</parameter> to the initial 0 byte of the socket
+    address.</para>
+
+    <para><function>sd_is_mq()</function> may be called to check
+    whether the specified file descriptor refers to a POSIX message
+    queue. If the <parameter>path</parameter> parameter is not
+    <constant>NULL</constant>, it is checked whether the message queue
+    is bound to the specified name.</para>
+
+    <para><function>sd_is_special()</function> may be called to check
+    whether the specified file descriptor refers to a special file. If
+    the <parameter>path</parameter> parameter is not
+    <constant>NULL</constant>, it is checked whether the file
+    descriptor is bound to the specified file name. Special files in
+    this context are character device nodes and files in
+    <filename>/proc</filename> or <filename>/sys</filename>.</para>
+  </refsect1>
+
+  <refsect1>
+    <title>Return Value</title>
+
+    <para>On failure, these calls return a negative errno-style error
+    code. If the file descriptor is of the specified type and bound to
+    the specified address, a positive return value is returned,
+    otherwise zero.</para>
+  </refsect1>
+
+  <refsect1>
+    <title>Notes</title>
+
+    <xi:include href="libsystemd-pkgconfig.xml" xpointer="pkgconfig-text"/>
+
+    <para>Internally, these function use a combination of
+    <filename>fstat()</filename> and
+    <filename>getsockname()</filename> to check the file descriptor
+    type and where it is bound to.</para>
+  </refsect1>
+
+  <refsect1>
+    <title>See Also</title>
+    <para>
+      <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+      <citerefentry><refentrytitle>sd-daemon</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+      <citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+      <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+      <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+    </para>
+  </refsect1>
+
+</refentry>
diff --git a/shell-completion/zsh/_elogind-inhibit b/shell-completion/zsh/_elogind-inhibit
new file mode 100644 (file)
index 0000000..1ecb6dc
--- /dev/null
@@ -0,0 +1,33 @@
+#compdef systemd-inhibit
+
+_systemd_inhibit_command(){
+    if (( CURRENT == 1 )); then
+        compset -q
+        _normal
+    else
+        local n=${words[(b:2:i)[^-]*]}
+        if (( n <= CURRENT )); then
+            compset -n $n
+            _alternative \
+                'files:file:_files' \
+                'commands:command:_normal' && return 0
+        fi
+        _default
+    fi
+}
+
+_inhibit_what() {
+    local _inhibit
+    _inhibit=(shutdown sleep idle handle-power-key handle-suspend-key handle-hibernate-key handle-lid-switch)
+    _values -s : "${_inhibit[@]}"
+}
+
+_arguments \
+    {-h,--help}'[Show this help]' \
+    '--version[Show package version]' \
+    '--what=[Operations to inhibit]:options:_inhibit_what' \
+    '--who=[A descriptive string who is inhibiting]' \
+    '--why=[A descriptive string why is being inhibited]' \
+    '--mode=[One of block or delay]' \
+    '--list[List active inhibitors]' \
+    '*:commands:_systemd_inhibit_command'
diff --git a/src/basic/.gitignore b/src/basic/.gitignore
new file mode 100644 (file)
index 0000000..e22411e
--- /dev/null
@@ -0,0 +1,16 @@
+/cap-from-name.gperf
+/cap-from-name.h
+/cap-list.txt
+/cap-to-name.h
+/errno-from-name.gperf
+/errno-from-name.h
+/errno-list.txt
+/errno-to-name.h
+/af-from-name.gperf
+/af-from-name.h
+/af-list.txt
+/af-to-name.h
+/arphrd-from-name.gperf
+/arphrd-from-name.h
+/arphrd-list.txt
+/arphrd-to-name.h
similarity index 100%
rename from src/shared/linux/Makefile
rename to src/basic/Makefile
similarity index 100%
rename from src/shared/audit.c
rename to src/basic/audit.c
similarity index 100%
rename from src/shared/audit.h
rename to src/basic/audit.h
diff --git a/src/basic/btrfs-util.h b/src/basic/btrfs-util.h
new file mode 100644 (file)
index 0000000..94ab1b5
--- /dev/null
@@ -0,0 +1,88 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+  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/>.
+***/
+
+#pragma once
+
+#include <stdbool.h>
+#include <sys/types.h>
+
+#include "time-util.h"
+
+typedef struct BtrfsSubvolInfo {
+        uint64_t subvol_id;
+        usec_t otime;
+
+        sd_id128_t uuid;
+        sd_id128_t parent_uuid;
+
+        bool read_only;
+} BtrfsSubvolInfo;
+
+typedef struct BtrfsQuotaInfo {
+        uint64_t referenced;
+        uint64_t exclusive;
+        uint64_t referenced_max;
+        uint64_t exclusive_max;
+} BtrfsQuotaInfo;
+
+typedef enum BtrfsSnapshotFlags {
+        BTRFS_SNAPSHOT_FALLBACK_COPY = 1,
+        BTRFS_SNAPSHOT_READ_ONLY = 2,
+        BTRFS_SNAPSHOT_RECURSIVE = 4,
+} BtrfsSnapshotFlags;
+
+int btrfs_is_filesystem(int fd);
+int btrfs_is_subvol(int fd);
+
+int btrfs_subvol_make(const char *path);
+int btrfs_subvol_make_label(const char *path);
+
+int btrfs_subvol_snapshot_fd(int old_fd, const char *new_path, BtrfsSnapshotFlags flags);
+int btrfs_subvol_snapshot(const char *old_path, const char *new_path, BtrfsSnapshotFlags flags);
+
+int btrfs_subvol_set_read_only_fd(int fd, bool b);
+int btrfs_subvol_set_read_only(const char *path, bool b);
+// UNNEEDED int btrfs_subvol_get_read_only_fd(int fd);
+int btrfs_subvol_get_id(int fd, const char *subvolume, uint64_t *ret);
+int btrfs_subvol_get_id_fd(int fd, uint64_t *ret);
+int btrfs_subvol_get_info_fd(int fd, BtrfsSubvolInfo *info);
+int btrfs_subvol_get_quota_fd(int fd, BtrfsQuotaInfo *quota);
+
+int btrfs_reflink(int infd, int outfd);
+// UNNEEDED int btrfs_clone_range(int infd, uint64_t in_offset, int ofd, uint64_t out_offset, uint64_t sz);
+
+int btrfs_get_block_device_fd(int fd, dev_t *dev);
+int btrfs_get_block_device(const char *path, dev_t *dev);
+
+int btrfs_defrag_fd(int fd);
+int btrfs_defrag(const char *p);
+
+int btrfs_quota_enable_fd(int fd, bool b);
+int btrfs_quota_enable(const char *path, bool b);
+
+int btrfs_quota_limit_fd(int fd, uint64_t referenced_max);
+int btrfs_quota_limit(const char *path, uint64_t referenced_max);
+
+int btrfs_resize_loopback_fd(int fd, uint64_t size, bool grow_only);
+int btrfs_resize_loopback(const char *path, uint64_t size, bool grow_only);
+
+int btrfs_subvol_remove(const char *path, bool recursive);
+int btrfs_subvol_remove_fd(int fd, const char *subvolume, bool recursive);
diff --git a/src/basic/build.h b/src/basic/build.h
new file mode 100644 (file)
index 0000000..24873ab
--- /dev/null
@@ -0,0 +1,157 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+#pragma once
+
+/***
+  This file is part of systemd.
+
+  Copyright 2010 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/>.
+***/
+
+#ifdef HAVE_PAM
+#define _PAM_FEATURE_ "+PAM"
+#else
+#define _PAM_FEATURE_ "-PAM"
+#endif
+
+#ifdef HAVE_AUDIT
+#define _AUDIT_FEATURE_ "+AUDIT"
+#else
+#define _AUDIT_FEATURE_ "-AUDIT"
+#endif
+
+#ifdef HAVE_SELINUX
+#define _SELINUX_FEATURE_ "+SELINUX"
+#else
+#define _SELINUX_FEATURE_ "-SELINUX"
+#endif
+
+#ifdef HAVE_APPARMOR
+#define _APPARMOR_FEATURE_ "+APPARMOR"
+#else
+#define _APPARMOR_FEATURE_ "-APPARMOR"
+#endif
+
+#ifdef HAVE_IMA
+#define _IMA_FEATURE_ "+IMA"
+#else
+#define _IMA_FEATURE_ "-IMA"
+#endif
+
+#ifdef HAVE_SMACK
+#define _SMACK_FEATURE_ "+SMACK"
+#else
+#define _SMACK_FEATURE_ "-SMACK"
+#endif
+
+#ifdef HAVE_SYSV_COMPAT
+#define _SYSVINIT_FEATURE_ "+SYSVINIT"
+#else
+#define _SYSVINIT_FEATURE_ "-SYSVINIT"
+#endif
+
+#ifdef HAVE_UTMP
+#define _UTMP_FEATURE_ "+UTMP"
+#else
+#define _UTMP_FEATURE_ "-UTMP"
+#endif
+
+#ifdef HAVE_LIBCRYPTSETUP
+#define _LIBCRYPTSETUP_FEATURE_ "+LIBCRYPTSETUP"
+#else
+#define _LIBCRYPTSETUP_FEATURE_ "-LIBCRYPTSETUP"
+#endif
+
+#ifdef HAVE_GCRYPT
+#define _GCRYPT_FEATURE_ "+GCRYPT"
+#else
+#define _GCRYPT_FEATURE_ "-GCRYPT"
+#endif
+
+#ifdef HAVE_GNUTLS
+#define _GNUTLS_FEATURE_ "+GNUTLS"
+#else
+#define _GNUTLS_FEATURE_ "-GNUTLS"
+#endif
+
+#ifdef HAVE_ACL
+#define _ACL_FEATURE_ "+ACL"
+#else
+#define _ACL_FEATURE_ "-ACL"
+#endif
+
+#ifdef HAVE_XZ
+#define _XZ_FEATURE_ "+XZ"
+#else
+#define _XZ_FEATURE_ "-XZ"
+#endif
+
+#ifdef HAVE_LZ4
+#define _LZ4_FEATURE_ "+LZ4"
+#else
+#define _LZ4_FEATURE_ "-LZ4"
+#endif
+
+#ifdef HAVE_SECCOMP
+#define _SECCOMP_FEATURE_ "+SECCOMP"
+#else
+#define _SECCOMP_FEATURE_ "-SECCOMP"
+#endif
+
+#ifdef HAVE_BLKID
+#define _BLKID_FEATURE_ "+BLKID"
+#else
+#define _BLKID_FEATURE_ "-BLKID"
+#endif
+
+#ifdef HAVE_ELFUTILS
+#define _ELFUTILS_FEATURE_ "+ELFUTILS"
+#else
+#define _ELFUTILS_FEATURE_ "-ELFUTILS"
+#endif
+
+#ifdef HAVE_KMOD
+#define _KMOD_FEATURE_ "+KMOD"
+#else
+#define _KMOD_FEATURE_ "-KMOD"
+#endif
+
+#ifdef HAVE_LIBIDN
+#define _IDN_FEATURE_ "+IDN"
+#else
+#define _IDN_FEATURE_ "-IDN"
+#endif
+
+#define SYSTEMD_FEATURES                                                \
+        _PAM_FEATURE_ " "                                               \
+        _AUDIT_FEATURE_ " "                                             \
+        _SELINUX_FEATURE_ " "                                           \
+        _IMA_FEATURE_ " "                                               \
+        _APPARMOR_FEATURE_ " "                                          \
+        _SMACK_FEATURE_ " "                                             \
+        _SYSVINIT_FEATURE_ " "                                          \
+        _UTMP_FEATURE_ " "                                              \
+        _LIBCRYPTSETUP_FEATURE_ " "                                     \
+        _GCRYPT_FEATURE_ " "                                            \
+        _GNUTLS_FEATURE_ " "                                            \
+        _ACL_FEATURE_ " "                                               \
+        _XZ_FEATURE_ " "                                                \
+        _LZ4_FEATURE_ " "                                               \
+        _SECCOMP_FEATURE_ " "                                           \
+        _BLKID_FEATURE_ " "                                             \
+        _ELFUTILS_FEATURE_ " "                                          \
+        _KMOD_FEATURE_ " "                                              \
+        _IDN_FEATURE_
similarity index 100%
rename from src/shared/bus-label.c
rename to src/basic/bus-label.c
similarity index 100%
rename from src/shared/bus-label.h
rename to src/basic/bus-label.h
similarity index 99%
rename from src/shared/capability.c
rename to src/basic/capability.c
index 8dbe4da..3963753 100644 (file)
@@ -224,6 +224,8 @@ int capability_bounding_set_drop_usermode(uint64_t drop) {
         return r;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int drop_privileges(uid_t uid, gid_t gid, uint64_t keep_capabilities) {
         _cleanup_cap_free_ cap_t d = NULL;
         unsigned i, j = 0;
@@ -305,3 +307,4 @@ int drop_capability(cap_value_t cv) {
 
         return 0;
 }
+#endif // 0
similarity index 90%
rename from src/shared/capability.h
rename to src/basic/capability.h
index 4eb5c2a..01a2858 100644 (file)
@@ -31,9 +31,9 @@ int have_effective_cap(int value);
 int capability_bounding_set_drop(uint64_t drop, bool right_now);
 int capability_bounding_set_drop_usermode(uint64_t drop);
 
-int drop_privileges(uid_t uid, gid_t gid, uint64_t keep_capabilities);
+// UNNEEDED int drop_privileges(uid_t uid, gid_t gid, uint64_t keep_capabilities);
 
-int drop_capability(cap_value_t cv);
+// UNNEEDED int drop_capability(cap_value_t cv);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(cap_t, cap_free);
 #define _cleanup_cap_free_ _cleanup_(cap_freep)
similarity index 75%
rename from src/shared/cgroup-util.c
rename to src/basic/cgroup-util.c
index 99d0654..ba9eeb9 100644 (file)
 #include "set.h"
 #include "macro.h"
 #include "util.h"
+#include "formats-util.h"
+#include "process-util.h"
 #include "path-util.h"
+#include "unit-name.h"
 #include "fileio.h"
 #include "special.h"
 #include "mkdir.h"
+#include "login-util.h"
 
 int cg_enumerate_processes(const char *controller, const char *path, FILE **_f) {
         _cleanup_free_ char *fs = NULL;
@@ -437,9 +441,7 @@ static const char *normalize_controller(const char *controller) {
 
         assert(controller);
 
-        if (streq(controller, SYSTEMD_CGROUP_CONTROLLER))
-                return "elogind";
-        else if (startswith(controller, "name="))
+        if (startswith(controller, "name="))
                 return controller + 5;
         else
                 return controller;
@@ -479,15 +481,17 @@ int cg_get_path(const char *controller, const char *path, const char *suffix, ch
 
         assert(fs);
 
-        if (controller && !cg_controller_is_valid(controller, true))
+        if (controller && !cg_controller_is_valid(controller))
                 return -EINVAL;
 
         if (_unlikely_(!good)) {
                 int r;
 
-                r = path_is_mount_point("/sys/fs/cgroup", false);
-                if (r <= 0)
-                        return r < 0 ? r : -ENOENT;
+                r = path_is_mount_point("/sys/fs/cgroup", 0);
+                if (r < 0)
+                        return r;
+                if (r == 0)
+                        return -ENOENT;
 
                 /* Cache this to save a few stat()s */
                 good = true;
@@ -520,7 +524,7 @@ int cg_get_path_and_check(const char *controller, const char *path, const char *
 
         assert(fs);
 
-        if (!cg_controller_is_valid(controller, true))
+        if (!cg_controller_is_valid(controller))
                 return -EINVAL;
 
         /* Normalize the controller syntax */
@@ -571,6 +575,8 @@ int cg_trim(const char *controller, const char *path, bool delete_root) {
         return r;
 }
 
+/// UNNEDED by elogind
+#if 0
 int cg_delete(const char *controller, const char *path) {
         _cleanup_free_ char *parent = NULL;
         int r;
@@ -584,6 +590,7 @@ int cg_delete(const char *controller, const char *path) {
         r = cg_migrate_recursive(controller, path, controller, parent, false, true);
         return r == -ENOENT ? 0 : r;
 }
+#endif // 0
 
 int cg_create(const char *controller, const char *path) {
         _cleanup_free_ char *fs = NULL;
@@ -736,7 +743,7 @@ int cg_pid_get_path(const char *controller, pid_t pid, char **path) {
         assert(pid >= 0);
 
         if (controller) {
-                if (!cg_controller_is_valid(controller, true))
+                if (!cg_controller_is_valid(controller))
                         return -EINVAL;
 
                 controller = normalize_controller(controller);
@@ -965,7 +972,7 @@ int cg_split_spec(const char *spec, char **controller, char **path) {
 
         e = strchr(spec, ':');
         if (!e) {
-                if (!cg_controller_is_valid(spec, true))
+                if (!cg_controller_is_valid(spec))
                         return -EINVAL;
 
                 if (controller) {
@@ -988,7 +995,7 @@ int cg_split_spec(const char *spec, char **controller, char **path) {
         t = strdup(normalize_controller(v));
         if (!t)
                 return -ENOMEM;
-        if (!cg_controller_is_valid(t, true)) {
+        if (!cg_controller_is_valid(t)) {
                 free(t);
                 return -EINVAL;
         }
@@ -1057,9 +1064,21 @@ int cg_mangle_path(const char *path, char **result) {
 }
 
 int cg_get_root_path(char **path) {
+        char *p, *e;
+        int r;
+
         assert(path);
 
-        return cg_pid_get_path(SYSTEMD_CGROUP_CONTROLLER, 1, path);
+        r = cg_pid_get_path(SYSTEMD_CGROUP_CONTROLLER, 1, &p);
+        if (r < 0)
+                return r;
+
+        e = endswith(p, "/" SPECIAL_SYSTEM_SLICE);
+        if (e)
+                *e = 0;
+
+        *path = p;
+        return 0;
 }
 
 int cg_shift_path(const char *cgroup, const char *root, const char **shifted) {
@@ -1122,34 +1141,293 @@ int cg_pid_get_path_shifted(pid_t pid, const char *root, char **cgroup) {
         return 0;
 }
 
-int cg_path_get_session(const char *path, char **session) {
-        const char *e, *n, *s;
+int cg_path_decode_unit(const char *cgroup, char **unit){
+        char *c, *s;
+        size_t n;
+
+        assert(cgroup);
+        assert(unit);
+
+        n = strcspn(cgroup, "/");
+        if (n < 3)
+                return -ENXIO;
+
+        c = strndupa(cgroup, n);
+        c = cg_unescape(c);
+
+        if (!unit_name_is_valid(c, UNIT_NAME_PLAIN|UNIT_NAME_INSTANCE))
+                return -ENXIO;
+
+        s = strdup(c);
+        if (!s)
+                return -ENOMEM;
+
+        *unit = s;
+        return 0;
+}
+
+static bool valid_slice_name(const char *p, size_t n) {
+
+        if (!p)
+                return false;
+
+        if (n < strlen("x.slice"))
+                return false;
+
+        if (memcmp(p + n - 6, ".slice", 6) == 0) {
+                char buf[n+1], *c;
+
+                memcpy(buf, p, n);
+                buf[n] = 0;
 
-        /* Elogind uses a flat hierarchy, just "/SESSION".  The only
-           wrinkle is that SESSION might be escaped.  */
+                c = cg_unescape(buf);
+
+                return unit_name_is_valid(c, UNIT_NAME_PLAIN);
+        }
+
+        return false;
+}
+
+static const char *skip_slices(const char *p) {
+        assert(p);
+
+        /* Skips over all slice assignments */
+
+        for (;;) {
+                size_t n;
+
+                p += strspn(p, "/");
+
+                n = strcspn(p, "/");
+                if (!valid_slice_name(p, n))
+                        return p;
+
+                p += n;
+        }
+}
+
+int cg_path_get_unit(const char *path, char **ret) {
+        const char *e;
+        char *unit;
+        int r;
 
         assert(path);
-        assert(path[0] == '/');
+        assert(ret);
+
+        e = skip_slices(path);
+
+        r = cg_path_decode_unit(e, &unit);
+        if (r < 0)
+                return r;
 
-        e = path + 1;
-        n = strchrnul(e, '/');
-        if (e == n)
-                return -ENOENT;
+        /* We skipped over the slices, don't accept any now */
+        if (endswith(unit, ".slice")) {
+                free(unit);
+                return -ENXIO;
+        }
 
-        s = strndupa(e, n - e);
-        s = cg_unescape(s);
+        *ret = unit;
+        return 0;
+}
 
-        if (!s[0])
-                return -ENOENT;
+int cg_pid_get_unit(pid_t pid, char **unit) {
+        _cleanup_free_ char *cgroup = NULL;
+        int r;
+
+        assert(unit);
+
+        r = cg_pid_get_path_shifted(pid, NULL, &cgroup);
+        if (r < 0)
+                return r;
+
+        return cg_path_get_unit(cgroup, unit);
+}
+
+/**
+ * Skip session-*.scope, but require it to be there.
+ */
+static const char *skip_session(const char *p) {
+        size_t n;
+
+        if (isempty(p))
+                return NULL;
+
+        p += strspn(p, "/");
+
+        n = strcspn(p, "/");
+        if (n < strlen("session-x.scope"))
+                return NULL;
+
+        if (memcmp(p, "session-", 8) == 0 && memcmp(p + n - 6, ".scope", 6) == 0) {
+                char buf[n - 8 - 6 + 1];
+
+                memcpy(buf, p + 8, n - 8 - 6);
+                buf[n - 8 - 6] = 0;
+
+                /* Note that session scopes never need unescaping,
+                 * since they cannot conflict with the kernel's own
+                 * names, hence we don't need to call cg_unescape()
+                 * here. */
+
+                if (!session_id_valid(buf))
+                        return false;
+
+                p += n;
+                p += strspn(p, "/");
+                return p;
+        }
+
+        return NULL;
+}
+
+/**
+ * Skip user@*.service, but require it to be there.
+ */
+static const char *skip_user_manager(const char *p) {
+        size_t n;
+
+        if (isempty(p))
+                return NULL;
+
+        p += strspn(p, "/");
+
+        n = strcspn(p, "/");
+        if (n < strlen("user@x.service"))
+                return NULL;
+
+        if (memcmp(p, "user@", 5) == 0 && memcmp(p + n - 8, ".service", 8) == 0) {
+                char buf[n - 5 - 8 + 1];
+
+                memcpy(buf, p + 5, n - 5 - 8);
+                buf[n - 5 - 8] = 0;
+
+                /* Note that user manager services never need unescaping,
+                 * since they cannot conflict with the kernel's own
+                 * names, hence we don't need to call cg_unescape()
+                 * here. */
+
+                if (parse_uid(buf, NULL) < 0)
+                        return NULL;
+
+                p += n;
+                p += strspn(p, "/");
+
+                return p;
+        }
+
+        return NULL;
+}
+
+static const char *skip_user_prefix(const char *path) {
+        const char *e, *t;
+
+        assert(path);
+
+        /* Skip slices, if there are any */
+        e = skip_slices(path);
+
+        /* Skip the user manager, if it's in the path now... */
+        t = skip_user_manager(e);
+        if (t)
+                return t;
+
+        /* Alternatively skip the user session if it is in the path... */
+        return skip_session(e);
+}
+
+int cg_path_get_user_unit(const char *path, char **ret) {
+        const char *t;
+
+        assert(path);
+        assert(ret);
+
+        t = skip_user_prefix(path);
+        if (!t)
+                return -ENXIO;
+
+        /* And from here on it looks pretty much the same as for a
+         * system unit, hence let's use the same parser from here
+         * on. */
+        return cg_path_get_unit(t, ret);
+}
+
+/// UNNEDED by elogind
+#if 0
+int cg_pid_get_user_unit(pid_t pid, char **unit) {
+        _cleanup_free_ char *cgroup = NULL;
+        int r;
+
+        assert(unit);
+
+        r = cg_pid_get_path_shifted(pid, NULL, &cgroup);
+        if (r < 0)
+                return r;
+
+        return cg_path_get_user_unit(cgroup, unit);
+}
+#endif // 0
+
+int cg_path_get_machine_name(const char *path, char **machine) {
+        _cleanup_free_ char *u = NULL, *sl = NULL;
+        int r;
+
+        r = cg_path_get_unit(path, &u);
+        if (r < 0)
+                return r;
+
+        sl = strjoin("/run/systemd/machines/unit:", u, NULL);
+        if (!sl)
+                return -ENOMEM;
+
+        return readlink_malloc(sl, machine);
+}
+
+/// UNNEDED by elogind
+#if 0
+int cg_pid_get_machine_name(pid_t pid, char **machine) {
+        _cleanup_free_ char *cgroup = NULL;
+        int r;
+
+        assert(machine);
+
+        r = cg_pid_get_path_shifted(pid, NULL, &cgroup);
+        if (r < 0)
+                return r;
+
+        return cg_path_get_machine_name(cgroup, machine);
+}
+#endif // 0
+
+int cg_path_get_session(const char *path, char **session) {
+        _cleanup_free_ char *unit = NULL;
+        char *start, *end;
+        int r;
+
+        assert(path);
+
+        r = cg_path_get_unit(path, &unit);
+        if (r < 0)
+                return r;
+
+        start = startswith(unit, "session-");
+        if (!start)
+                return -ENXIO;
+        end = endswith(start, ".scope");
+        if (!end)
+                return -ENXIO;
+
+        *end = 0;
+        if (!session_id_valid(start))
+                return -ENXIO;
 
         if (session) {
-                char *r;
+                char *rr;
 
-                r = strdup(s);
-                if (!r)
+                rr = strdup(start);
+                if (!rr)
                         return -ENOMEM;
 
-                *session = r;
+                *session = rr;
         }
 
         return 0;
@@ -1166,6 +1444,121 @@ int cg_pid_get_session(pid_t pid, char **session) {
         return cg_path_get_session(cgroup, session);
 }
 
+int cg_path_get_owner_uid(const char *path, uid_t *uid) {
+        _cleanup_free_ char *slice = NULL;
+        char *start, *end;
+        int r;
+
+        assert(path);
+
+        r = cg_path_get_slice(path, &slice);
+        if (r < 0)
+                return r;
+
+        start = startswith(slice, "user-");
+        if (!start)
+                return -ENXIO;
+        end = endswith(start, ".slice");
+        if (!end)
+                return -ENXIO;
+
+        *end = 0;
+        if (parse_uid(start, uid) < 0)
+                return -ENXIO;
+
+        return 0;
+}
+
+/// UNNEDED by elogind
+#if 0
+int cg_pid_get_owner_uid(pid_t pid, uid_t *uid) {
+        _cleanup_free_ char *cgroup = NULL;
+        int r;
+
+        r = cg_pid_get_path_shifted(pid, NULL, &cgroup);
+        if (r < 0)
+                return r;
+
+        return cg_path_get_owner_uid(cgroup, uid);
+}
+#endif // 0
+
+int cg_path_get_slice(const char *p, char **slice) {
+        const char *e = NULL;
+
+        assert(p);
+        assert(slice);
+
+        /* Finds the right-most slice unit from the beginning, but
+         * stops before we come to the first non-slice unit. */
+
+        for (;;) {
+                size_t n;
+
+                p += strspn(p, "/");
+
+                n = strcspn(p, "/");
+                if (!valid_slice_name(p, n)) {
+
+                        if (!e) {
+                                char *s;
+
+                                s = strdup("-.slice");
+                                if (!s)
+                                        return -ENOMEM;
+
+                                *slice = s;
+                                return 0;
+                        }
+
+                        return cg_path_decode_unit(e, slice);
+                }
+
+                e = p;
+                p += n;
+        }
+}
+
+int cg_pid_get_slice(pid_t pid, char **slice) {
+        _cleanup_free_ char *cgroup = NULL;
+        int r;
+
+        assert(slice);
+
+        r = cg_pid_get_path_shifted(pid, NULL, &cgroup);
+        if (r < 0)
+                return r;
+
+        return cg_path_get_slice(cgroup, slice);
+}
+
+int cg_path_get_user_slice(const char *p, char **slice) {
+        const char *t;
+        assert(p);
+        assert(slice);
+
+        t = skip_user_prefix(p);
+        if (!t)
+                return -ENXIO;
+
+        /* And now it looks pretty much the same as for a system
+         * slice, so let's just use the same parser from here on. */
+        return cg_path_get_slice(t, slice);
+}
+
+int cg_pid_get_user_slice(pid_t pid, char **slice) {
+        _cleanup_free_ char *cgroup = NULL;
+        int r;
+
+        assert(slice);
+
+        r = cg_pid_get_path_shifted(pid, NULL, &cgroup);
+        if (r < 0)
+                return r;
+
+        return cg_path_get_user_slice(cgroup, slice);
+}
+
 char *cg_escape(const char *p) {
         bool need_prefix = false;
 
@@ -1227,17 +1620,15 @@ char *cg_unescape(const char *p) {
         DIGITS LETTERS                          \
         "_"
 
-bool cg_controller_is_valid(const char *p, bool allow_named) {
+bool cg_controller_is_valid(const char *p) {
         const char *t, *s;
 
         if (!p)
                 return false;
 
-        if (allow_named) {
-                s = startswith(p, "name=");
-                if (s)
-                        p = s;
-        }
+        s = startswith(p, "name=");
+        if (s)
+                p = s;
 
         if (*p == 0 || *p == '_')
                 return false;
@@ -1252,6 +1643,78 @@ bool cg_controller_is_valid(const char *p, bool allow_named) {
         return true;
 }
 
+/// UNNEEDED by elogind
+#if 0
+int cg_slice_to_path(const char *unit, char **ret) {
+        _cleanup_free_ char *p = NULL, *s = NULL, *e = NULL;
+        const char *dash;
+        int r;
+
+        assert(unit);
+        assert(ret);
+
+        if (streq(unit, "-.slice")) {
+                char *x;
+
+                x = strdup("");
+                if (!x)
+                        return -ENOMEM;
+                *ret = x;
+                return 0;
+        }
+
+        if (!unit_name_is_valid(unit, UNIT_NAME_PLAIN))
+                return -EINVAL;
+
+        if (!endswith(unit, ".slice"))
+                return -EINVAL;
+
+        r = unit_name_to_prefix(unit, &p);
+        if (r < 0)
+                return r;
+
+        dash = strchr(p, '-');
+
+        /* Don't allow initial dashes */
+        if (dash == p)
+                return -EINVAL;
+
+        while (dash) {
+                _cleanup_free_ char *escaped = NULL;
+                char n[dash - p + sizeof(".slice")];
+
+                /* Don't allow trailing or double dashes */
+                if (dash[1] == 0 || dash[1] == '-')
+                        return -EINVAL;
+
+                strcpy(stpncpy(n, p, dash - p), ".slice");
+                if (!unit_name_is_valid(n, UNIT_NAME_PLAIN))
+                        return -EINVAL;
+
+                escaped = cg_escape(n);
+                if (!escaped)
+                        return -ENOMEM;
+
+                if (!strextend(&s, escaped, "/", NULL))
+                        return -ENOMEM;
+
+                dash = strchr(dash+1, '-');
+        }
+
+        e = cg_escape(unit);
+        if (!e)
+                return -ENOMEM;
+
+        if (!strextend(&s, e, NULL))
+                return -ENOMEM;
+
+        *ret = s;
+        s = NULL;
+
+        return 0;
+}
+#endif // 0
+
 int cg_set_attribute(const char *controller, const char *path, const char *attribute, const char *value) {
         _cleanup_free_ char *p = NULL;
         int r;
@@ -1328,7 +1791,7 @@ int cg_attach_everywhere(CGroupControllerMask supported, const char *path, pid_t
                         if (!p)
                                 p = path;
 
-                        cg_attach_fallback(n, path, pid);
+                        cg_attach_fallback(n, p, pid);
                 }
 
                 bit <<= 1;
similarity index 85%
rename from src/shared/cgroup-util.h
rename to src/basic/cgroup-util.h
index 496fe05..8a432aa 100644 (file)
@@ -77,7 +77,7 @@ int cg_pid_get_path(const char *controller, pid_t pid, char **path);
 int cg_trim(const char *controller, const char *path, bool delete_root);
 
 int cg_rmdir(const char *controller, const char *path);
-int cg_delete(const char *controller, const char *path);
+// UNNEEDED int cg_delete(const char *controller, const char *path);
 
 int cg_create(const char *controller, const char *path);
 int cg_attach(const char *controller, const char *path, pid_t pid);
@@ -99,16 +99,33 @@ int cg_is_empty_recursive(const char *controller, const char *path, bool ignore_
 int cg_get_root_path(char **path);
 
 int cg_path_get_session(const char *path, char **session);
+int cg_path_get_owner_uid(const char *path, uid_t *uid);
+int cg_path_get_unit(const char *path, char **unit);
+int cg_path_get_user_unit(const char *path, char **unit);
+int cg_path_get_machine_name(const char *path, char **machine);
+int cg_path_get_slice(const char *path, char **slice);
+int cg_path_get_user_slice(const char *path, char **slice);
 
 int cg_shift_path(const char *cgroup, const char *cached_root, const char **shifted);
 int cg_pid_get_path_shifted(pid_t pid, const char *cached_root, char **cgroup);
 
 int cg_pid_get_session(pid_t pid, char **session);
+// UNNEEDED int cg_pid_get_owner_uid(pid_t pid, uid_t *uid);
+int cg_pid_get_unit(pid_t pid, char **unit);
+// UNNEEDED int cg_pid_get_user_unit(pid_t pid, char **unit);
+// UNNEEDED int cg_pid_get_machine_name(pid_t pid, char **machine);
+int cg_pid_get_slice(pid_t pid, char **slice);
+int cg_pid_get_user_slice(pid_t pid, char **slice);
+
+int cg_path_decode_unit(const char *cgroup, char **unit);
+
 char *cg_escape(const char *p);
 char *cg_unescape(const char *p) _pure_;
 
 bool cg_controller_is_valid(const char *p);
 
+// UNNEEDED int cg_slice_to_path(const char *unit, char **ret);
+
 typedef const char* (*cg_migrate_callback_t)(CGroupControllerMask mask, void *userdata);
 
 int cg_create_everywhere(CGroupControllerMask supported, CGroupControllerMask mask, const char *path);
similarity index 98%
rename from src/shared/def.h
rename to src/basic/def.h
index ea54e25..5aaba1f 100644 (file)
@@ -35,7 +35,7 @@
  * the watchdog pings will keep the loop busy. */
 #define DEFAULT_EXIT_USEC (30*USEC_PER_SEC)
 
-#define SYSTEMD_CGROUP_CONTROLLER "name=elogind"
+#define SYSTEMD_CGROUP_CONTROLLER "systemd"
 
 #define SIGNALS_CRASH_HANDLER SIGSEGV,SIGILL,SIGFPE,SIGBUS,SIGQUIT,SIGABRT
 #define SIGNALS_IGNORE SIGPIPE
similarity index 100%
rename from src/shared/env-util.h
rename to src/basic/env-util.h
similarity index 97%
rename from src/shared/errno-list.c
rename to src/basic/errno-list.c
index 34d1331..fff37eb 100644 (file)
@@ -53,6 +53,9 @@ int errno_from_name(const char *name) {
         return sc->id;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int errno_max(void) {
         return ELEMENTSOF(errno_names);
 }
+#endif // 0
similarity index 96%
rename from src/shared/errno-list.h
rename to src/basic/errno-list.h
index ba53329..0b819fc 100644 (file)
@@ -24,4 +24,4 @@
 const char *errno_to_name(int id);
 int errno_from_name(const char *name);
 
-int errno_max(void);
+// UNNEEDED int errno_max(void);
similarity index 88%
rename from src/shared/fdset.h
rename to src/basic/fdset.h
index 340438d..88fb838 100644 (file)
@@ -30,21 +30,21 @@ FDSet* fdset_free(FDSet *s);
 
 int fdset_put(FDSet *s, int fd);
 int fdset_put_dup(FDSet *s, int fd);
-int fdset_consume(FDSet *s, int fd);
+// UNNEEDED int fdset_consume(FDSet *s, int fd);
 
 bool fdset_contains(FDSet *s, int fd);
 int fdset_remove(FDSet *s, int fd);
 
 int fdset_new_array(FDSet **ret, int *fds, unsigned n_fds);
 int fdset_new_fill(FDSet **ret);
-int fdset_new_listen_fds(FDSet **ret, bool unset);
+// UNNEEDED int fdset_new_listen_fds(FDSet **ret, bool unset);
 
 int fdset_cloexec(FDSet *fds, bool b);
 
-int fdset_close_others(FDSet *fds);
+// UNNEEDED int fdset_close_others(FDSet *fds);
 
 unsigned fdset_size(FDSet *fds);
-bool fdset_isempty(FDSet *fds);
+// UNNEEDED bool fdset_isempty(FDSet *fds);
 
 int fdset_iterate(FDSet *s, Iterator *i);
 
similarity index 97%
rename from src/shared/fileio-label.c
rename to src/basic/fileio-label.c
index f596f1d..1443cef 100644 (file)
@@ -38,6 +38,8 @@ int write_string_file_atomic_label(const char *fn, const char *line) {
         return r;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int write_env_file_label(const char *fname, char **l) {
         int r;
 
@@ -66,3 +68,4 @@ int fopen_temporary_label(const char *target,
 
         return r;
 }
+#endif // 0
similarity index 82%
rename from src/shared/fileio-label.h
rename to src/basic/fileio-label.h
index 25fa351..af31cf6 100644 (file)
@@ -26,6 +26,6 @@
 #include "fileio.h"
 
 int write_string_file_atomic_label(const char *fn, const char *line);
-int write_env_file_label(const char *fname, char **l);
-int fopen_temporary_label(const char *target,
-                          const char *path, FILE **f, char **temp_path);
+// UNNEEDED int write_env_file_label(const char *fname, char **l);
+// UNNEEDED int fopen_temporary_label(const char *target,
+//                          const char *path, FILE **f, char **temp_path);
similarity index 99%
rename from src/shared/fileio.c
rename to src/basic/fileio.c
index d592bf5..718ed36 100644 (file)
@@ -631,6 +631,8 @@ int load_env_file(FILE *f, const char *fname, const char *newline, char ***rl) {
         return 0;
 }
 
+/// UNNEDED by elogind
+#if 0
 static int load_env_file_push_pairs(
                 const char *filename, unsigned line,
                 const char *key, char *value,
@@ -689,6 +691,7 @@ int load_env_file_pairs(FILE *f, const char *fname, const char *newline, char **
         *rl = m;
         return 0;
 }
+#endif // 0
 
 static void write_env_var(FILE *f, const char *v) {
         const char *p;
@@ -750,6 +753,8 @@ int write_env_file(const char *fname, char **l) {
         return r;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int executable_is_script(const char *path, char **interpreter) {
         int r;
         _cleanup_free_ char *line = NULL;
@@ -778,6 +783,7 @@ int executable_is_script(const char *path, char **interpreter) {
         *interpreter = ans;
         return 1;
 }
+#endif // 0
 
 /**
  * Retrieve one field from a file like /proc/self/status.  pattern
similarity index 90%
rename from src/shared/fileio.h
rename to src/basic/fileio.h
index 2e8148f..1fdad92 100644 (file)
@@ -42,10 +42,10 @@ int verify_one_line_file(const char *fn, const char *line);
 
 int parse_env_file(const char *fname, const char *separator, ...) _sentinel_;
 int load_env_file(FILE *f, const char *fname, const char *separator, char ***l);
-int load_env_file_pairs(FILE *f, const char *fname, const char *separator, char ***l);
+// UNNEEDED int load_env_file_pairs(FILE *f, const char *fname, const char *separator, char ***l);
 
 int write_env_file(const char *fname, char **l);
 
-int executable_is_script(const char *path, char **interpreter);
+// UNNEEDED int executable_is_script(const char *path, char **interpreter);
 
 int get_status_field(const char *filename, const char *pattern, char **field);
similarity index 100%
rename from src/shared/gunicode.c
rename to src/basic/gunicode.c
similarity index 100%
rename from src/shared/gunicode.h
rename to src/basic/gunicode.h
similarity index 99%
rename from src/shared/hashmap.c
rename to src/basic/hashmap.c
index e5f05f3..55e1989 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <stdlib.h>
 #include <errno.h>
+#include <pthread.h>
 
 #include "util.h"
 #include "hashmap.h"
@@ -157,6 +158,7 @@ struct hashmap_debug_info {
 
 /* Tracks all existing hashmaps. Get at it from gdb. See sd_dump_hashmaps.py */
 static LIST_HEAD(struct hashmap_debug_info, hashmap_debug_list);
+static pthread_mutex_t hashmap_debug_list_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 #define HASHMAP_DEBUG_FIELDS struct hashmap_debug_info debug;
 
@@ -806,10 +808,12 @@ static struct HashmapBase *hashmap_base_new(const struct hash_ops *hash_ops, enu
         }
 
 #ifdef ENABLE_DEBUG_HASHMAP
-        LIST_PREPEND(debug_list, hashmap_debug_list, &h->debug);
         h->debug.func = func;
         h->debug.file = file;
         h->debug.line = line;
+        assert_se(pthread_mutex_lock(&hashmap_debug_list_mutex) == 0);
+        LIST_PREPEND(debug_list, hashmap_debug_list, &h->debug);
+        assert_se(pthread_mutex_unlock(&hashmap_debug_list_mutex) == 0);
 #endif
 
         return h;
@@ -861,7 +865,9 @@ static void hashmap_free_no_clear(HashmapBase *h) {
         assert(!h->n_direct_entries);
 
 #ifdef ENABLE_DEBUG_HASHMAP
+        assert_se(pthread_mutex_lock(&hashmap_debug_list_mutex) == 0);
         LIST_REMOVE(debug_list, hashmap_debug_list, &h->debug);
+        assert_se(pthread_mutex_unlock(&hashmap_debug_list_mutex) == 0);
 #endif
 
         if (h->from_pool)
@@ -1794,6 +1800,8 @@ char **internal_hashmap_get_strv(HashmapBase *h) {
         return sv;
 }
 
+/// UNNEEDED by elogind
+#if 0
 void *ordered_hashmap_next(OrderedHashmap *h, const void *key) {
         struct ordered_hashmap_entry *e;
         unsigned hash, idx;
@@ -1811,7 +1819,7 @@ void *ordered_hashmap_next(OrderedHashmap *h, const void *key) {
                 return NULL;
         return ordered_bucket_at(h, e->iterate_next)->p.value;
 }
-
+#endif // 0
 int set_consume(Set *s, void *value) {
         int r;
 
@@ -1840,6 +1848,8 @@ int set_put_strdup(Set *s, const char *p) {
         return r;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int set_put_strdupv(Set *s, char **l) {
         int n = 0, r;
         char **i;
@@ -1854,3 +1864,4 @@ int set_put_strdupv(Set *s, char **l) {
 
         return n;
 }
+#endif // 0
similarity index 99%
rename from src/shared/hashmap.h
rename to src/basic/hashmap.h
index 5723f09..03c8ae1 100644 (file)
@@ -65,7 +65,6 @@ typedef struct {
 } Iterator;
 
 #define _IDX_ITERATOR_FIRST (UINT_MAX - 1)
-#define _IDX_ITERATOR_NIL (UINT_MAX)
 #define ITERATOR_FIRST ((Iterator) { .idx = _IDX_ITERATOR_FIRST, .next_key = NULL })
 
 typedef unsigned long (*hash_func_t)(const void *p, const uint8_t hash_key[HASH_KEY_SIZE]);
@@ -370,7 +369,7 @@ static inline void *ordered_hashmap_first(OrderedHashmap *h) {
 }
 
 /* no hashmap_next */
-void *ordered_hashmap_next(OrderedHashmap *h, const void *key);
+// UNNEEDED void *ordered_hashmap_next(OrderedHashmap *h, const void *key);
 
 char **internal_hashmap_get_strv(HashmapBase *h);
 static inline char **hashmap_get_strv(Hashmap *h) {
similarity index 100%
rename from src/shared/ioprio.h
rename to src/basic/ioprio.h
similarity index 100%
rename from src/shared/label.c
rename to src/basic/label.c
similarity index 100%
rename from src/shared/label.h
rename to src/basic/label.h
similarity index 100%
rename from src/shared/list.h
rename to src/basic/list.h
similarity index 100%
rename from src/shared/log.c
rename to src/basic/log.c
similarity index 100%
rename from src/shared/log.h
rename to src/basic/log.h
similarity index 97%
rename from src/shared/login-shared.c
rename to src/basic/login-util.c
index 64650a9..e25437f 100644 (file)
@@ -19,7 +19,7 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "login-shared.h"
+#include "login-util.h"
 #include "def.h"
 
 bool session_id_valid(const char *id) {
similarity index 90%
rename from src/shared/ima-util.h
rename to src/basic/login-util.h
index d382161..a79f20c 100644 (file)
@@ -1,11 +1,9 @@
 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
 
-#pragma once
-
 /***
   This file is part of systemd.
 
-  Copyright 2013 Lennart Poettering
+  Copyright 2013 Zbigniew Jędrzejewski-Szmek
 
   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
@@ -21,6 +19,8 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
+#pragma once
+
 #include <stdbool.h>
 
-bool use_ima(void);
+bool session_id_valid(const char *id);
similarity index 100%
rename from src/shared/macro.h
rename to src/basic/macro.h
similarity index 98%
rename from src/shared/memfd-util.c
rename to src/basic/memfd-util.c
index e99a738..b6dc190 100644 (file)
@@ -145,6 +145,8 @@ int memfd_set_size(int fd, uint64_t sz) {
         return 0;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int memfd_new_and_map(const char *name, size_t sz, void **p) {
         _cleanup_close_ int fd = -1;
         int r;
@@ -169,3 +171,4 @@ int memfd_new_and_map(const char *name, size_t sz, void **p) {
 
         return r;
 }
+#endif // 0
similarity index 93%
rename from src/shared/memfd-util.h
rename to src/basic/memfd-util.h
index 3ed551f..9aa87b7 100644 (file)
@@ -24,7 +24,7 @@
 
 
 int memfd_new(const char *name);
-int memfd_new_and_map(const char *name, size_t sz, void **p);
+// UNNEEDED int memfd_new_and_map(const char *name, size_t sz, void **p);
 
 int memfd_map(int fd, uint64_t offset, size_t size, void **p);
 
similarity index 98%
rename from src/shared/mempool.c
rename to src/basic/mempool.c
index d5d98d8..19c0edf 100644 (file)
@@ -90,7 +90,7 @@ void mempool_free_tile(struct mempool *mp, void *p) {
 
 #ifdef VALGRIND
 
-void mempool_drop(struct mempool *mp) {
+// UNNEEDED void mempool_drop(struct mempool *mp) {
         struct pool *p = mp->first_pool;
         while (p) {
                 struct pool *n;
similarity index 96%
rename from src/shared/mempool.h
rename to src/basic/mempool.h
index 42f473b..a0d081a 100644 (file)
@@ -45,5 +45,5 @@ struct mempool pool_name = { \
 
 
 #ifdef VALGRIND
-void mempool_drop(struct mempool *mp);
+// UNNEEDED void mempool_drop(struct mempool *mp);
 #endif
similarity index 95%
rename from src/shared/missing.h
rename to src/basic/missing.h
index 2b979ae..93da55c 100644 (file)
@@ -265,6 +265,11 @@ struct btrfs_qgroup_inherit {
         __u64 qgroups[0];
 };
 
+struct btrfs_ioctl_qgroup_limit_args {
+        __u64 qgroupid;
+        struct btrfs_qgroup_limit lim;
+};
+
 struct btrfs_ioctl_vol_args_v2 {
         __s64 fd;
         __u64 transid;
@@ -356,6 +361,14 @@ struct btrfs_ioctl_clone_range_args {
         __u64 src_offset, src_length;
         __u64 dest_offset;
 };
+
+#define BTRFS_QUOTA_CTL_ENABLE  1
+#define BTRFS_QUOTA_CTL_DISABLE 2
+#define BTRFS_QUOTA_CTL_RESCAN__NOTUSED 3
+struct btrfs_ioctl_quota_ctl_args {
+        __u64 cmd;
+        __u64 status;
+};
 #endif
 
 #ifndef BTRFS_IOC_DEFRAG
@@ -363,6 +376,11 @@ struct btrfs_ioctl_clone_range_args {
                                  struct btrfs_ioctl_vol_args)
 #endif
 
+#ifndef BTRFS_IOC_RESIZE
+#define BTRFS_IOC_RESIZE _IOW(BTRFS_IOCTL_MAGIC, 3, \
+                                 struct btrfs_ioctl_vol_args)
+#endif
+
 #ifndef BTRFS_IOC_CLONE
 #define BTRFS_IOC_CLONE _IOW(BTRFS_IOCTL_MAGIC, 9, int)
 #endif
@@ -420,6 +438,16 @@ struct btrfs_ioctl_clone_range_args {
                                  struct btrfs_ioctl_vol_args)
 #endif
 
+#ifndef BTRFS_IOC_QUOTA_CTL
+#define BTRFS_IOC_QUOTA_CTL _IOWR(BTRFS_IOCTL_MAGIC, 40, \
+                               struct btrfs_ioctl_quota_ctl_args)
+#endif
+
+#ifndef BTRFS_IOC_QGROUP_LIMIT
+#define BTRFS_IOC_QGROUP_LIMIT _IOR(BTRFS_IOCTL_MAGIC, 43, \
+                               struct btrfs_ioctl_qgroup_limit_args)
+#endif
+
 #ifndef BTRFS_FIRST_FREE_OBJECTID
 #define BTRFS_FIRST_FREE_OBJECTID 256
 #endif
@@ -701,7 +729,7 @@ static inline int setns(int fd, int nstype) {
 #define IFLA_VLAN_MAX   (__IFLA_VLAN_MAX - 1)
 #endif
 
-#if !HAVE_DECL_IFLA_VXLAN_LOCAL6
+#if !HAVE_DECL_IFLA_VXLAN_REMCSUM_NOPARTIAL
 #define IFLA_VXLAN_UNSPEC 0
 #define IFLA_VXLAN_ID 1
 #define IFLA_VXLAN_GROUP 2
@@ -720,7 +748,14 @@ static inline int setns(int fd, int nstype) {
 #define IFLA_VXLAN_PORT 15
 #define IFLA_VXLAN_GROUP6 16
 #define IFLA_VXLAN_LOCAL6 17
-#define __IFLA_VXLAN_MAX 18
+#define IFLA_VXLAN_UDP_CSUM 18
+#define IFLA_VXLAN_UDP_ZERO_CSUM6_TX 19
+#define IFLA_VXLAN_UDP_ZERO_CSUM6_RX 20
+#define IFLA_VXLAN_REMCSUM_TX 21
+#define IFLA_VXLAN_REMCSUM_RX 22
+#define IFLA_VXLAN_GBP 23
+#define IFLA_VXLAN_REMCSUM_NOPARTIAL 24
+#define __IFLA_VXLAN_MAX 25
 
 #define IFLA_VXLAN_MAX  (__IFLA_VXLAN_MAX - 1)
 #endif
similarity index 100%
rename from src/shared/mkdir.c
rename to src/basic/mkdir.c
similarity index 100%
rename from src/shared/mkdir.h
rename to src/basic/mkdir.h
similarity index 99%
rename from src/shared/path-util.c
rename to src/basic/path-util.c
index 8f49d65..cc985b0 100644 (file)
@@ -130,6 +130,8 @@ char *path_make_absolute_cwd(const char *p) {
         return strjoin(cwd, "/", p, NULL);
 }
 
+/// UNNEEDED by elogind
+#if 0
 int path_make_relative(const char *from_dir, const char *to_path, char **_r) {
         char *r, *p;
         unsigned n_parents;
@@ -214,6 +216,7 @@ int path_make_relative(const char *from_dir, const char *to_path, char **_r) {
         *_r = r;
         return 0;
 }
+#endif // 0
 
 char **path_strv_make_absolute_cwd(char **l) {
         char **s;
@@ -759,6 +762,8 @@ int find_binary(const char *name, bool local, char **filename) {
         }
 }
 
+/// UNNEEDED by elogind
+#if 0
 bool paths_check_timestamp(const char* const* paths, usec_t *timestamp, bool update) {
         bool changed = false;
         const char* const* i;
@@ -793,6 +798,7 @@ bool paths_check_timestamp(const char* const* paths, usec_t *timestamp, bool upd
 
         return changed;
 }
+#endif // 0
 
 int fsck_exists(const char *fstype) {
         _cleanup_free_ char *p = NULL, *d = NULL;
similarity index 96%
rename from src/shared/path-util.h
rename to src/basic/path-util.h
index 1eac89c..5e6e3db 100644 (file)
@@ -41,7 +41,7 @@ int path_get_parent(const char *path, char **parent);
 bool path_is_absolute(const char *p) _pure_;
 char* path_make_absolute(const char *p, const char *prefix);
 char* path_make_absolute_cwd(const char *p);
-int path_make_relative(const char *from_dir, const char *to_path, char **_r);
+// UNNEEDED int path_make_relative(const char *from_dir, const char *to_path, char **_r);
 char* path_kill_slashes(char *path);
 char* path_startswith(const char *path, const char *prefix) _pure_;
 int path_compare(const char *a, const char *b) _pure_;
@@ -60,7 +60,7 @@ int path_is_os_tree(const char *path);
 
 int find_binary(const char *name, bool local, char **filename);
 
-bool paths_check_timestamp(const char* const* paths, usec_t *paths_ts_usec, bool update);
+// UNNEEDED bool paths_check_timestamp(const char* const* paths, usec_t *paths_ts_usec, bool update);
 
 int fsck_exists(const char *fstype);
 
similarity index 100%
rename from src/shared/prioq.c
rename to src/basic/prioq.c
similarity index 100%
rename from src/shared/prioq.h
rename to src/basic/prioq.h
similarity index 99%
rename from src/shared/process-util.c
rename to src/basic/process-util.c
index cfc8765..9e7ddca 100644 (file)
@@ -197,6 +197,8 @@ int is_kernel_thread(pid_t pid) {
         return 0;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int get_process_capeff(pid_t pid, char **capeff) {
         const char *p;
 
@@ -207,6 +209,7 @@ int get_process_capeff(pid_t pid, char **capeff) {
 
         return get_status_field(p, "\nCapEff:", capeff);
 }
+#endif // 0
 
 static int get_process_link_contents(const char *proc_file, char **name) {
         int r;
@@ -278,6 +281,8 @@ int get_process_uid(pid_t pid, uid_t *uid) {
         return get_process_id(pid, "Uid:", uid);
 }
 
+/// UNNEEDED by elogind
+#if 0
 int get_process_gid(pid_t pid, gid_t *gid) {
         assert_cc(sizeof(uid_t) == sizeof(gid_t));
         return get_process_id(pid, "Gid:", gid);
@@ -335,6 +340,7 @@ int get_process_environ(pid_t pid, char **env) {
 
         return 0;
 }
+#endif // 0
 
 int get_parent_of_pid(pid_t pid, pid_t *_ppid) {
         int r;
similarity index 89%
rename from src/shared/process-util.h
rename to src/basic/process-util.h
index 07431d0..0f0475a 100644 (file)
@@ -46,11 +46,11 @@ int get_process_comm(pid_t pid, char **name);
 int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char **line);
 int get_process_exe(pid_t pid, char **name);
 int get_process_uid(pid_t pid, uid_t *uid);
-int get_process_gid(pid_t pid, gid_t *gid);
-int get_process_capeff(pid_t pid, char **capeff);
-int get_process_cwd(pid_t pid, char **cwd);
-int get_process_root(pid_t pid, char **root);
-int get_process_environ(pid_t pid, char **environ);
+// UNNEEDED int get_process_gid(pid_t pid, gid_t *gid);
+// UNNEEDED int get_process_capeff(pid_t pid, char **capeff);
+// UNNEEDED int get_process_cwd(pid_t pid, char **cwd);
+// UNNEEDED int get_process_root(pid_t pid, char **root);
+// UNNEEDED int get_process_environ(pid_t pid, char **environ);
 
 int wait_for_terminate(pid_t pid, siginfo_t *status);
 int wait_for_terminate_and_warn(const char *name, pid_t pid, bool check_exit_code);
similarity index 99%
rename from src/shared/random-util.c
rename to src/basic/random-util.c
index 88f5182..b230044 100644 (file)
@@ -23,7 +23,9 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <time.h>
+#ifdef HAVE_SYS_AUXV_H
 #include <sys/auxv.h>
+#endif
 #include <linux/random.h>
 
 #include "random-util.h"
similarity index 100%
rename from src/shared/ratelimit.h
rename to src/basic/ratelimit.h
similarity index 100%
rename from src/shared/refcnt.h
rename to src/basic/refcnt.h
similarity index 94%
rename from src/shared/ring.h
rename to src/basic/ring.h
index a7c44d1..fc857e7 100644 (file)
@@ -32,7 +32,7 @@ struct Ring {
 };
 
 /* flush buffer so it is empty again */
-void ring_flush(Ring *r);
+// UNNEEDED void ring_flush(Ring *r);
 
 /* flush buffer, free allocated data and reset to initial state */
 void ring_clear(Ring *r);
@@ -41,7 +41,7 @@ void ring_clear(Ring *r);
 size_t ring_peek(Ring *r, struct iovec *vec);
 
 /* copy data into external linear buffer */
-size_t ring_copy(Ring *r, void *buf, size_t size);
+// UNNEEDED size_t ring_copy(Ring *r, void *buf, size_t size);
 
 /* push data to the end of the buffer */
 int ring_push(Ring *r, const void *u8, size_t size);
similarity index 97%
rename from src/shared/rm-rf.c
rename to src/basic/rm-rf.c
index d70e959..d35d172 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "util.h"
 #include "path-util.h"
+// #include "btrfs-util.h"
 #include "rm-rf.h"
 
 int rm_rf_children(int fd, RemoveFlags flags, struct stat *root_dev) {
@@ -114,14 +115,14 @@ int rm_rf_children(int fd, RemoveFlags flags, struct stat *root_dev) {
                                 safe_close(subdir_fd);
                                 continue;
                         }
+
 #if 0
                         if ((flags & REMOVE_SUBVOLUME) && st.st_ino == 256) {
 
                                 /* This could be a subvolume, try to remove it */
-
                                 r = btrfs_subvol_remove_fd(fd, de->d_name, true);
                                 if (r < 0) {
-                                        if (r != -ENOTTY && r != -EINVAL) {
+                                       if (r != -ENOTTY && r != -EINVAL) {
                                                 if (ret == 0)
                                                         ret = r;
 
@@ -137,8 +138,9 @@ int rm_rf_children(int fd, RemoveFlags flags, struct stat *root_dev) {
                                         safe_close(subdir_fd);
                                         continue;
                                 }
-                        }
-#endif //
+                       }
+#endif // 0
+
                         /* We pass REMOVE_PHYSICAL here, to avoid
                          * doing the fstatfs() to check the file
                          * system type again for each directory */
@@ -174,19 +176,20 @@ int rm_rf(const char *path, RemoveFlags flags) {
                 log_error("Attempted to remove entire root file system, and we can't allow that.");
                 return -EPERM;
         }
-#if 0
+
         if ((flags & (REMOVE_SUBVOLUME|REMOVE_ROOT|REMOVE_PHYSICAL)) == (REMOVE_SUBVOLUME|REMOVE_ROOT|REMOVE_PHYSICAL)) {
                 /* Try to remove as subvolume first */
-                r = btrfs_subvol_remove(path, true);
+#if 0
+               r = btrfs_subvol_remove(path, true);
                 if (r >= 0)
                         return r;
 
-                if (r != -ENOTTY && r != -EINVAL)
+                if (r != -ENOTTY && r != -EINVAL && r != -ENOTDIR)
                         return r;
-
+#endif // 0
                 /* Not btrfs or not a subvolume */
         }
-#endif // 0
+
         fd = open(path, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW|O_NOATIME);
         if (fd < 0) {
 
similarity index 100%
rename from src/shared/rm-rf.h
rename to src/basic/rm-rf.h
similarity index 99%
rename from src/shared/selinux-util.c
rename to src/basic/selinux-util.c
index 7c58985..69885d9 100644 (file)
@@ -168,6 +168,8 @@ int mac_selinux_fix(const char *path, bool ignore_enoent, bool ignore_erofs) {
         return 0;
 }
 
+/// UNNEDED by elogind
+#if 0
 int mac_selinux_apply(const char *path, const char *label) {
 
 #ifdef HAVE_SELINUX
@@ -185,6 +187,7 @@ int mac_selinux_apply(const char *path, const char *label) {
 #endif
         return 0;
 }
+#endif // 0
 
 int mac_selinux_get_create_label_from_exe(const char *exe, char **label) {
         int r = -EOPNOTSUPP;
similarity index 95%
rename from src/shared/selinux-util.h
rename to src/basic/selinux-util.h
index 8467185..6f6b08d 100644 (file)
@@ -31,7 +31,7 @@ int mac_selinux_init(const char *prefix);
 void mac_selinux_finish(void);
 
 int mac_selinux_fix(const char *path, bool ignore_enoent, bool ignore_erofs);
-int mac_selinux_apply(const char *path, const char *label);
+// UNNEEDED int mac_selinux_apply(const char *path, const char *label);
 
 int mac_selinux_get_create_label_from_exe(const char *exe, char **label);
 int mac_selinux_get_our_label(char **label);
similarity index 98%
rename from src/shared/set.h
rename to src/basic/set.h
index 51e40d3..1d16999 100644 (file)
@@ -122,7 +122,7 @@ static inline char **set_get_strv(Set *s) {
 
 int set_consume(Set *s, void *value);
 int set_put_strdup(Set *s, const char *p);
-int set_put_strdupv(Set *s, char **l);
+// UNNEEDED int set_put_strdupv(Set *s, char **l);
 
 #define SET_FOREACH(e, s, i) \
         for ((i) = ITERATOR_FIRST; set_iterate((s), &(i), (void**)&(e)); )
similarity index 99%
rename from src/shared/signal-util.c
rename to src/basic/signal-util.c
index d24730d..90abe8a 100644 (file)
@@ -167,7 +167,7 @@ int sigprocmask_many(int how, sigset_t *old, ...) {
         if (sigemptyset(&ss) < 0)
                 return -errno;
 
-        va_start(ap, how);
+        va_start(ap, old);
         r = sigset_add_many_ap(&ss, ap);
         va_end(ap);
 
similarity index 100%
rename from src/shared/siphash24.c
rename to src/basic/siphash24.c
similarity index 100%
rename from src/shared/siphash24.h
rename to src/basic/siphash24.h
similarity index 93%
rename from src/shared/socket-util.h
rename to src/basic/socket-util.h
index 6b0ce78..cccc6a6 100644 (file)
@@ -86,7 +86,7 @@ int socket_address_listen(
                 mode_t directory_mode,
                 mode_t socket_mode,
                 const char *label);
-int make_socket_fd(int log_level, const char* address, int flags);
+// UNNEEDED int make_socket_fd(int log_level, const char* address, int flags);
 
 bool socket_address_is(const SocketAddress *a, const char *s, int type);
 bool socket_address_is_netlink(const SocketAddress *a, const char *s);
@@ -103,10 +103,10 @@ int sockaddr_port(const struct sockaddr *_sa) _pure_;
 
 int sockaddr_pretty(const struct sockaddr *_sa, socklen_t salen, bool translate_ipv6, bool include_port, char **ret);
 int getpeername_pretty(int fd, char **ret);
-int getsockname_pretty(int fd, char **ret);
+// UNNEEDED int getsockname_pretty(int fd, char **ret);
 
 int socknameinfo_pretty(union sockaddr_union *sa, socklen_t salen, char **_ret);
-int getnameinfo_pretty(int fd, char **ret);
+// UNNEEDED int getnameinfo_pretty(int fd, char **ret);
 
 const char* socket_address_bind_ipv6_only_to_string(SocketAddressBindIPv6Only b) _const_;
 SocketAddressBindIPv6Only socket_address_bind_ipv6_only_from_string(const char *s) _pure_;
@@ -114,7 +114,7 @@ SocketAddressBindIPv6Only socket_address_bind_ipv6_only_from_string(const char *
 int netlink_family_to_string_alloc(int b, char **s);
 int netlink_family_from_string(const char *s) _pure_;
 
-bool sockaddr_equal(const union sockaddr_union *a, const union sockaddr_union *b);
+// UNNEEDED bool sockaddr_equal(const union sockaddr_union *a, const union sockaddr_union *b);
 
 #define ETHER_ADDR_TO_STRING_MAX (3*6)
 
similarity index 97%
rename from src/shared/special.h
rename to src/basic/special.h
index 1bf5c0e..e51310e 100644 (file)
@@ -95,6 +95,8 @@
 
 /* Magic early boot services */
 #define SPECIAL_FSCK_SERVICE "systemd-fsck@.service"
+#define SPECIAL_QUOTACHECK_SERVICE "systemd-quotacheck.service"
+#define SPECIAL_QUOTAON_SERVICE "quotaon.service"
 #define SPECIAL_REMOUNT_FS_SERVICE "systemd-remount-fs.service"
 
 /* Services systemd relies on */
similarity index 98%
rename from src/shared/strv.c
rename to src/basic/strv.c
index d44a72f..31d83f3 100644 (file)
@@ -253,6 +253,8 @@ char **strv_split(const char *s, const char *separator) {
         return r;
 }
 
+/// UNNEEDED by elogind
+#if 0
 char **strv_split_newlines(const char *s) {
         char **l;
         unsigned n;
@@ -277,6 +279,7 @@ char **strv_split_newlines(const char *s) {
 
         return l;
 }
+#endif // 0
 
 int strv_split_quoted(char ***t, const char *s, UnquoteFlags flags) {
         size_t n = 0, allocated = 0;
@@ -477,6 +480,8 @@ int strv_consume(char ***l, char *value) {
         return r;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int strv_consume_pair(char ***l, char *a, char *b) {
         int r;
 
@@ -488,6 +493,7 @@ int strv_consume_pair(char ***l, char *a, char *b) {
 
         return r;
 }
+#endif // 0
 
 int strv_consume_prepend(char ***l, char *value) {
         int r;
@@ -524,6 +530,8 @@ char **strv_uniq(char **l) {
         return l;
 }
 
+/// UNNEEDED by elogind
+#if 0
 bool strv_is_uniq(char **l) {
         char **i;
 
@@ -533,6 +541,7 @@ bool strv_is_uniq(char **l) {
 
         return true;
 }
+#endif // 0
 
 char **strv_remove(char **l, const char *s) {
         char **f, **t;
@@ -642,6 +651,8 @@ char **strv_sort(char **l) {
         return l;
 }
 
+/// UNNEEDED by elogind
+#if 0
 bool strv_equal(char **a, char **b) {
         if (!a || !b)
                 return a == b;
@@ -652,6 +663,7 @@ bool strv_equal(char **a, char **b) {
 
         return true;
 }
+#endif // 0
 
 void strv_print(char **l) {
         char **s;
@@ -660,6 +672,8 @@ void strv_print(char **l) {
                 puts(*s);
 }
 
+/// UNNEEDED by elogind
+#if 0
 int strv_extendf(char ***l, const char *format, ...) {
         va_list ap;
         char *x;
@@ -692,6 +706,7 @@ char **strv_reverse(char **l) {
 
         return l;
 }
+#endif // 0
 
 bool strv_fnmatch(char* const* patterns, const char *s, int flags) {
         char* const* p;
similarity index 94%
rename from src/shared/strv.h
rename to src/basic/strv.h
index 22f8f98..2a2003c 100644 (file)
@@ -43,19 +43,19 @@ unsigned strv_length(char * const *l) _pure_;
 int strv_extend_strv(char ***a, char **b);
 int strv_extend_strv_concat(char ***a, char **b, const char *suffix);
 int strv_extend(char ***l, const char *value);
-int strv_extendf(char ***l, const char *format, ...) _printf_(2,0);
+// UNNEEDED int strv_extendf(char ***l, const char *format, ...) _printf_(2,0);
 int strv_push(char ***l, char *value);
 int strv_push_pair(char ***l, char *a, char *b);
 int strv_push_prepend(char ***l, char *value);
 int strv_consume(char ***l, char *value);
-int strv_consume_pair(char ***l, char *a, char *b);
+// UNNEEDED int strv_consume_pair(char ***l, char *a, char *b);
 int strv_consume_prepend(char ***l, char *value);
 
 char **strv_remove(char **l, const char *s);
 char **strv_uniq(char **l);
-bool strv_is_uniq(char **l);
+// UNNEEDED bool strv_is_uniq(char **l);
 
-bool strv_equal(char **a, char **b);
+// UNNEEDED bool strv_equal(char **a, char **b);
 
 #define strv_contains(l, s) (!!strv_find((l), (s)))
 
@@ -71,7 +71,7 @@ static inline bool strv_isempty(char * const *l) {
 }
 
 char **strv_split(const char *s, const char *separator);
-char **strv_split_newlines(const char *s);
+// UNNEEDED char **strv_split_newlines(const char *s);
 
 int strv_split_quoted(char ***t, const char *s, UnquoteFlags flags);
 
@@ -144,7 +144,7 @@ void strv_print(char **l);
                 _l[0];                                       \
         }))
 
-char **strv_reverse(char **l);
+// UNNEEDED char **strv_reverse(char **l);
 
 bool strv_fnmatch(char* const* patterns, const char *s, int flags);
 
similarity index 99%
rename from src/shared/terminal-util.c
rename to src/basic/terminal-util.c
index 042b88f..1036436 100644 (file)
@@ -174,6 +174,8 @@ int ask_char(char *ret, const char *replies, const char *text, ...) {
         }
 }
 
+/// UNNEEDED by elogind
+#if 0
 int ask_string(char **ret, const char *text, ...) {
         assert(ret);
         assert(text);
@@ -216,6 +218,7 @@ int ask_string(char **ret, const char *text, ...) {
                 }
         }
 }
+#endif // 0
 
 int reset_terminal_fd(int fd, bool switch_to_text) {
         struct termios termios;
@@ -882,10 +885,13 @@ unsigned lines(void) {
 }
 
 /* intended to be used as a SIGWINCH sighandler */
+/// UNNEEDED by elogind
+#if 0
 void columns_lines_cache_reset(int signum) {
         cached_columns = 0;
         cached_lines = 0;
 }
+#endif // 0
 
 bool on_tty(void) {
         static int cached_on_tty = -1;
similarity index 95%
rename from src/shared/terminal-util.h
rename to src/basic/terminal-util.h
index 188714f..f6eace4 100644 (file)
@@ -50,7 +50,7 @@ int chvt(int vt);
 
 int read_one_char(FILE *f, char *ret, usec_t timeout, bool *need_nl);
 int ask_char(char *ret, const char *replies, const char *text, ...) _printf_(3, 4);
-int ask_string(char **ret, const char *text, ...) _printf_(2, 3);
+// UNNEEDED int ask_string(char **ret, const char *text, ...) _printf_(2, 3);
 
 int vt_disallocate(const char *name);
 
@@ -74,7 +74,7 @@ int fd_columns(int fd);
 unsigned columns(void);
 int fd_lines(int fd);
 unsigned lines(void);
-void columns_lines_cache_reset(int _unused_ signum);
+// UNNEEDED void columns_lines_cache_reset(int _unused_ signum);
 
 bool on_tty(void);
 
similarity index 99%
rename from src/shared/time-util.c
rename to src/basic/time-util.c
index 12f1b19..ecca227 100644 (file)
@@ -173,9 +173,12 @@ char *format_timestamp(char *buf, size_t l, usec_t t) {
         return format_timestamp_internal(buf, l, t, false);
 }
 
+/// UNNEEDED by elogind
+#if 0
 char *format_timestamp_utc(char *buf, size_t l, usec_t t) {
         return format_timestamp_internal(buf, l, t, true);
 }
+#endif // 0
 
 static char *format_timestamp_internal_us(char *buf, size_t l, usec_t t, bool utc) {
         struct tm tm;
@@ -415,6 +418,8 @@ int dual_timestamp_deserialize(const char *value, dual_timestamp *t) {
         return 0;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int parse_timestamp(const char *t, usec_t *usec) {
         static const struct {
                 const char *name;
@@ -615,6 +620,7 @@ finish:
 
         return 0;
 }
+#endif // 0
 
 int parse_sec(const char *t, usec_t *usec) {
         static const struct {
@@ -864,6 +870,8 @@ int parse_nsec(const char *t, nsec_t *nsec) {
         return 0;
 }
 
+/// UNNEEDED by elogind
+#if 0
 bool ntp_synced(void) {
         struct timex txc = {};
 
@@ -977,6 +985,7 @@ bool timezone_is_valid(const char *name) {
 
         return true;
 }
+#endif // 0
 
 clockid_t clock_boottime_or_monotonic(void) {
         static clockid_t clock = -1;
similarity index 93%
rename from src/shared/time-util.h
rename to src/basic/time-util.h
index 7a64d45..48ca453 100644 (file)
@@ -87,7 +87,7 @@ usec_t timeval_load(const struct timeval *tv) _pure_;
 struct timeval *timeval_store(struct timeval *tv, usec_t u);
 
 char *format_timestamp(char *buf, size_t l, usec_t t);
-char *format_timestamp_utc(char *buf, size_t l, usec_t t);
+// UNNEEDED char *format_timestamp_utc(char *buf, size_t l, usec_t t);
 char *format_timestamp_us(char *buf, size_t l, usec_t t);
 char *format_timestamp_us_utc(char *buf, size_t l, usec_t t);
 char *format_timestamp_relative(char *buf, size_t l, usec_t t);
@@ -96,15 +96,15 @@ char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy);
 void dual_timestamp_serialize(FILE *f, const char *name, dual_timestamp *t);
 int dual_timestamp_deserialize(const char *value, dual_timestamp *t);
 
-int parse_timestamp(const char *t, usec_t *usec);
+// UNNEEDED int parse_timestamp(const char *t, usec_t *usec);
 
 int parse_sec(const char *t, usec_t *usec);
 int parse_nsec(const char *t, nsec_t *nsec);
 
-bool ntp_synced(void);
+// UNNEEDED bool ntp_synced(void);
 
-int get_timezones(char ***l);
-bool timezone_is_valid(const char *name);
+// UNNEEDED int get_timezones(char ***l);
+// UNNEEDED bool timezone_is_valid(const char *name);
 
 clockid_t clock_boottime_or_monotonic(void);
 
similarity index 100%
rename from src/shared/unit-name.c
rename to src/basic/unit-name.c
similarity index 100%
rename from src/shared/unit-name.h
rename to src/basic/unit-name.h
similarity index 100%
rename from src/shared/utf8.c
rename to src/basic/utf8.c
similarity index 100%
rename from src/shared/utf8.h
rename to src/basic/utf8.h
similarity index 99%
rename from src/shared/util.c
rename to src/basic/util.c
index 950519e..3945abd 100644 (file)
@@ -789,6 +789,8 @@ char *strstrip(char *s) {
         return s;
 }
 
+/// UNNEEDED by elogind
+#if 0
 char *delete_chars(char *s, const char *bad) {
         char *f, *t;
 
@@ -805,6 +807,7 @@ char *delete_chars(char *s, const char *bad) {
 
         return s;
 }
+#endif // 0
 
 char *file_in_same_dir(const char *path, const char *filename) {
         char *e, *ret;
@@ -1923,6 +1926,8 @@ int chmod_and_chown(const char *path, mode_t mode, uid_t uid, gid_t gid) {
         return 0;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int fchmod_and_fchown(int fd, mode_t mode, uid_t uid, gid_t gid) {
         assert(fd >= 0);
 
@@ -1940,6 +1945,7 @@ int fchmod_and_fchown(int fd, mode_t mode, uid_t uid, gid_t gid) {
 
         return 0;
 }
+#endif // 0
 
 cpu_set_t* cpu_set_malloc(unsigned *ncpus) {
         cpu_set_t *r;
@@ -2144,6 +2150,8 @@ int touch(const char *path) {
         return touch_file(path, false, USEC_INFINITY, UID_INVALID, GID_INVALID, 0);
 }
 
+/// UNNEEDED by elogind
+#if 0
 static char *unquote(const char *s, const char* quotes) {
         size_t l;
         assert(s);
@@ -2163,6 +2171,7 @@ static char *unquote(const char *s, const char* quotes) {
 
         return strdup(s);
 }
+#endif // 0
 
 noreturn void freeze(void) {
 
@@ -2198,6 +2207,8 @@ int null_or_empty_path(const char *fn) {
         return null_or_empty(&st);
 }
 
+/// UNNEEDED by elogind
+#if 0
 int null_or_empty_fd(int fd) {
         struct stat st;
 
@@ -2208,6 +2219,7 @@ int null_or_empty_fd(int fd) {
 
         return null_or_empty(&st);
 }
+#endif // 0
 
 DIR *xopendirat(int fd, const char *name, int flags) {
         int nfd;
@@ -2228,6 +2240,8 @@ DIR *xopendirat(int fd, const char *name, int flags) {
         return d;
 }
 
+/// UNNEEDED by elogind
+#if 0
 static char *tag_to_udev_node(const char *tagvalue, const char *by) {
         _cleanup_free_ char *t = NULL, *u = NULL;
         size_t enc_len;
@@ -2264,6 +2278,7 @@ char *fstab_node_to_udev_node(const char *p) {
 
         return strdup(p);
 }
+#endif // 0
 
 bool dirent_is_file(const struct dirent *de) {
         assert(de);
@@ -2293,6 +2308,8 @@ bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix) {
         return endswith(de->d_name, suffix);
 }
 
+/// UNNEEDED by elogind
+#if 0
 static int do_execute(char **directories, usec_t timeout, char *argv[]) {
         _cleanup_hashmap_free_free_ Hashmap *pids = NULL;
         _cleanup_set_free_free_ Set *seen = NULL;
@@ -2432,6 +2449,7 @@ void execute_directories(const char* const* directories, usec_t timeout, char *a
 
         wait_for_terminate_and_warn(name, executor_pid, true);
 }
+#endif // 0
 
 bool nulstr_contains(const char*nulstr, const char *needle) {
         const char *i;
@@ -2446,9 +2464,12 @@ bool nulstr_contains(const char*nulstr, const char *needle) {
         return false;
 }
 
+/// UNNEEDED by elogind
+#if 0
 bool plymouth_running(void) {
         return access("/run/plymouth/pid", F_OK) >= 0;
 }
+#endif // 0
 
 char* strshorten(char *s, size_t l) {
         assert(s);
@@ -2566,6 +2587,8 @@ int symlink_atomic(const char *from, const char *to) {
         return 0;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int symlink_idempotent(const char *from, const char *to) {
         _cleanup_free_ char *p = NULL;
         int r;
@@ -2629,6 +2652,7 @@ int mkfifo_atomic(const char *path, mode_t mode) {
 
         return 0;
 }
+#endif // 0
 
 bool display_is_local(const char *display) {
         assert(display);
@@ -2829,6 +2853,8 @@ int in_gid(gid_t gid) {
         return 0;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int in_group(const char *name) {
         int r;
         gid_t gid;
@@ -2839,6 +2865,7 @@ int in_group(const char *name) {
 
         return in_gid(gid);
 }
+#endif // 0
 
 int glob_exists(const char *path) {
         _cleanup_globfree_ glob_t g = {};
@@ -2859,6 +2886,8 @@ int glob_exists(const char *path) {
                 return errno ? -errno : -EIO;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int glob_extend(char ***strv, const char *path) {
         _cleanup_globfree_ glob_t g = {};
         int k;
@@ -2882,6 +2911,7 @@ int glob_extend(char ***strv, const char *path) {
 
         return k;
 }
+#endif // 0
 
 int dirent_ensure_type(DIR *d, struct dirent *de) {
         struct stat st;
@@ -3196,6 +3226,8 @@ bool kexec_loaded(void) {
        return loaded;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int prot_from_flags(int flags) {
 
         switch (flags & O_ACCMODE) {
@@ -3213,7 +3245,7 @@ int prot_from_flags(int flags) {
                 return -EINVAL;
         }
 }
-
+#endif // 0
 char *format_bytes(char *buf, size_t l, off_t t) {
         unsigned i;
 
@@ -3427,6 +3459,8 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
         return 0;
 }
 
+/// UNNEEDED by elogind
+#if 0
 bool http_etag_is_valid(const char *etag) {
         if (isempty(etag))
                 return false;
@@ -3439,6 +3473,7 @@ bool http_etag_is_valid(const char *etag) {
 
         return true;
 }
+#endif // 0
 
 bool http_url_is_valid(const char *url) {
         const char *p;
@@ -3678,6 +3713,8 @@ bool path_is_safe(const char *p) {
         return true;
 }
 
+/// UNNEEDED by elogind
+#if 0
 /* hey glibc, APIs with callbacks without a user pointer are so useless */
 void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size,
                  int (*compar) (const void *, const void *, void *), void *arg) {
@@ -3705,6 +3742,7 @@ void init_gettext(void) {
         setlocale(LC_ALL, "");
         textdomain(GETTEXT_PACKAGE);
 }
+#endif // 0
 
 bool is_locale_utf8(void) {
         const char *set;
@@ -4047,6 +4085,8 @@ int search_and_fopen(const char *path, const char *mode, const char *root, const
         return search_and_fopen_internal(path, mode, root, copy, _f);
 }
 
+/// UNNEEDED by elogind
+#if 0
 int search_and_fopen_nulstr(const char *path, const char *mode, const char *root, const char *search, FILE **_f) {
         _cleanup_strv_free_ char **s = NULL;
 
@@ -4068,6 +4108,7 @@ int search_and_fopen_nulstr(const char *path, const char *mode, const char *root
 
         return search_and_fopen_internal(path, mode, root, s, _f);
 }
+#endif // 0
 
 char *strextend(char **x, ...) {
         va_list ap;
@@ -4226,6 +4267,8 @@ bool id128_is_valid(const char *s) {
         return true;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int split_pair(const char *s, const char *sep, char **l, char **r) {
         char *x, *a, *b;
 
@@ -4269,6 +4312,7 @@ int shall_restore_state(void) {
 
         return parse_boolean(value) != 0;
 }
+#endif // 0
 
 int proc_cmdline(char **ret) {
         assert(ret);
@@ -4318,6 +4362,8 @@ int parse_proc_cmdline(int (*parse_item)(const char *key, const char *value)) {
         return 0;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int get_proc_cmdline_key(const char *key, char **value) {
         _cleanup_free_ char *line = NULL, *ret = NULL;
         bool found = false;
@@ -4370,6 +4416,7 @@ int get_proc_cmdline_key(const char *key, char **value) {
         return found;
 
 }
+#endif // 0
 
 int container_get_leader(const char *machine, pid_t *pid) {
         _cleanup_free_ char *s = NULL, *class = NULL;
@@ -4611,6 +4658,8 @@ int fd_warn_permissions(const char *path, int fd) {
         return 0;
 }
 
+/// UNNEEDED by elogind
+#if 0
 unsigned long personality_from_string(const char *p) {
 
         /* Parse a personality specifier. We introduce our own
@@ -4636,6 +4685,7 @@ unsigned long personality_from_string(const char *p) {
 
         return PERSONALITY_INVALID;
 }
+#endif // 0
 
 const char* personality_to_string(unsigned long p) {
 
@@ -4668,6 +4718,8 @@ uint64_t physical_memory(void) {
         return (uint64_t) mem * (uint64_t) page_size();
 }
 
+/// UNNEEDED by elogind
+#if 0
 void hexdump(FILE *f, const void *p, size_t s) {
         const uint8_t *b = p;
         unsigned n = 0;
@@ -4710,6 +4762,7 @@ void hexdump(FILE *f, const void *p, size_t s) {
                 s -= 16;
         }
 }
+#endif // 0
 
 int update_reboot_param_file(const char *param) {
         int r = 0;
@@ -5043,6 +5096,8 @@ int tempfn_random(const char *p, const char *extra, char **ret) {
         return 0;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int tempfn_random_child(const char *p, const char *extra, char **ret) {
         char *t, *x;
         uint64_t u;
@@ -5117,6 +5172,7 @@ int take_password_lock(const char *root) {
 
         return fd;
 }
+#endif // 0
 
 int is_symlink(const char *path) {
         struct stat info;
@@ -5141,6 +5197,8 @@ int is_dir(const char* path, bool follow) {
         return !!S_ISDIR(st.st_mode);
 }
 
+/// UNNEEDED by elogind
+#if 0
 int is_device_node(const char *path) {
         struct stat info;
 
@@ -5149,6 +5207,7 @@ int is_device_node(const char *path) {
 
         return !!(S_ISBLK(info.st_mode) || S_ISCHR(info.st_mode));
 }
+#endif // 0
 
 int unquote_first_word(const char **p, char **ret, UnquoteFlags flags) {
         _cleanup_free_ char *s = NULL;
@@ -5350,6 +5409,8 @@ int unquote_first_word_and_warn(
         return r;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int unquote_many_words(const char **p, UnquoteFlags flags, ...) {
         va_list ap;
         char **l;
@@ -5405,6 +5466,7 @@ int unquote_many_words(const char **p, UnquoteFlags flags, ...) {
 
         return c;
 }
+#endif // 0
 
 int free_and_strdup(char **p, const char *s) {
         char *t;
@@ -5457,6 +5519,8 @@ int ptsname_malloc(int fd, char **ret) {
         }
 }
 
+/// UNNEEDED by elogind
+#if 0
 int openpt_in_namespace(pid_t pid, int flags) {
         _cleanup_close_ int pidnsfd = -1, mntnsfd = -1, rootfd = -1;
         _cleanup_close_pair_ int pair[2] = { -1, -1 };
@@ -5542,6 +5606,7 @@ int openpt_in_namespace(pid_t pid, int flags) {
 
         return -EIO;
 }
+#endif // 0
 
 ssize_t fgetxattrat_fake(int dirfd, const char *filename, const char *attribute, void *value, size_t size, int flags) {
         _cleanup_close_ int fd = -1;
@@ -5605,6 +5670,8 @@ int fd_getcrtime_at(int dirfd, const char *name, usec_t *usec, int flags) {
         return parse_crtime(le, usec);
 }
 
+/// UNNEEDED by elogind
+#if 0
 int path_getcrtime(const char *p, usec_t *usec) {
         le64_t le;
         ssize_t n;
@@ -5620,6 +5687,7 @@ int path_getcrtime(const char *p, usec_t *usec) {
 
         return parse_crtime(le, usec);
 }
+#endif // 0
 
 int fd_setcrtime(int fd, usec_t usec) {
         le64_t le;
@@ -5780,6 +5848,8 @@ int read_attr_path(const char *p, unsigned *ret) {
         return read_attr_fd(fd, ret);
 }
 
+/// UNNEEDED by elogind
+#if 0
 static size_t nul_length(const uint8_t *p, size_t sz) {
         size_t n = 0;
 
@@ -5841,6 +5911,7 @@ ssize_t sparse_write(int fd, const void *p, size_t sz, size_t run_length) {
 
         return q - (const uint8_t*) p;
 }
+#endif // 0
 
 void sigkill_wait(pid_t *pid) {
         if (!pid)
@@ -5852,6 +5923,8 @@ void sigkill_wait(pid_t *pid) {
                 (void) wait_for_terminate(*pid, NULL);
 }
 
+/// UNNEEDED by elogind
+#if 0
 int syslog_parse_priority(const char **p, int *priority, bool with_facility) {
         int a = 0, b = 0, c = 0;
         int k;
@@ -5893,6 +5966,7 @@ int syslog_parse_priority(const char **p, int *priority, bool with_facility) {
         *p += k;
         return 1;
 }
+#endif // 0
 
 ssize_t string_table_lookup(const char * const *table, size_t len, const char *key) {
         size_t i;
similarity index 76%
rename from src/shared/util.h
rename to src/basic/util.h
index 11ab9f6..4e30fe1 100644 (file)
 #include <locale.h>
 #include <mntent.h>
 #include <sys/inotify.h>
-
-#if SIZEOF_PID_T == 4
-#  define PID_PRI PRIi32
-#elif SIZEOF_PID_T == 2
-#  define PID_PRI PRIi16
-#else
-#  error Unknown pid_t size
-#endif
-#define PID_FMT "%" PID_PRI
-
-#if SIZEOF_UID_T == 4
-#  define UID_FMT "%" PRIu32
-#elif SIZEOF_UID_T == 2
-#  define UID_FMT "%" PRIu16
-#else
-#  error Unknown uid_t size
-#endif
-
-#if SIZEOF_GID_T == 4
-#  define GID_FMT "%" PRIu32
-#elif SIZEOF_GID_T == 2
-#  define GID_FMT "%" PRIu16
-#else
-#  error Unknown gid_t size
-#endif
-
-#if SIZEOF_TIME_T == 8
-#  define PRI_TIME PRIi64
-#elif SIZEOF_TIME_T == 4
-#  define PRI_TIME PRIu32
-#else
-#  error Unknown time_t size
-#endif
-
-#if SIZEOF_RLIM_T == 8
-#  define RLIM_FMT "%" PRIu64
-#elif SIZEOF_RLIM_T == 4
-#  define RLIM_FMT "%" PRIu32
-#else
-#  error Unknown rlim_t size
-#endif
+#include <sys/statfs.h>
 
 #include "macro.h"
 #include "missing.h"
 #include "time-util.h"
+#include "formats-util.h"
 
 /* What is interpreted as whitespace? */
 #define WHITESPACE " \t\n\r"
 
 #define FORMAT_BYTES_MAX 8
 
-#define ANSI_HIGHLIGHT_ON "\x1B[1;39m"
-#define ANSI_RED_ON "\x1B[31m"
-#define ANSI_HIGHLIGHT_RED_ON "\x1B[1;31m"
-#define ANSI_GREEN_ON "\x1B[32m"
-#define ANSI_HIGHLIGHT_GREEN_ON "\x1B[1;32m"
-#define ANSI_HIGHLIGHT_YELLOW_ON "\x1B[1;33m"
-#define ANSI_HIGHLIGHT_BLUE_ON "\x1B[1;34m"
-#define ANSI_HIGHLIGHT_OFF "\x1B[0m"
-#define ANSI_ERASE_TO_END_OF_LINE "\x1B[K"
-
 size_t page_size(void) _pure_;
 #define PAGE_ALIGN(l) ALIGN_TO((l), page_size())
 
@@ -182,6 +133,7 @@ static inline char *startswith_no_case(const char *s, const char *prefix) {
 }
 
 char *endswith(const char *s, const char *postfix) _pure_;
+char *endswith_no_case(const char *s, const char *postfix) _pure_;
 
 char *first_word(const char *s, const char *word) _pure_;
 
@@ -265,14 +217,9 @@ const char* split(const char **state, size_t *l, const char *separator, bool quo
 #define _FOREACH_WORD(word, length, s, separator, quoted, state)        \
         for ((state) = (s), (word) = split(&(state), &(length), (separator), (quoted)); (word); (word) = split(&(state), &(length), (separator), (quoted)))
 
-pid_t get_parent_of_pid(pid_t pid, pid_t *ppid);
-
 char *strappend(const char *s, const char *suffix);
 char *strnappend(const char *s, const char *suffix, size_t length);
 
-char *replace_env(const char *format, char **env);
-char **replace_env_argv(char **argv, char **env);
-
 int readlinkat_malloc(int fd, const char *p, char **ret);
 int readlink_malloc(const char *p, char **r);
 int readlink_value(const char *p, char **ret);
@@ -280,24 +227,13 @@ int readlink_and_make_absolute(const char *p, char **r);
 int readlink_and_canonicalize(const char *p, char **r);
 
 char *strstrip(char *s);
-char *delete_chars(char *s, const char *bad);
+// UNNEEDED char *delete_chars(char *s, const char *bad);
 char *truncate_nl(char *s);
 
 char *file_in_same_dir(const char *path, const char *filename);
 
 int rmdir_parents(const char *path, const char *stop);
 
-int get_process_state(pid_t pid);
-int get_process_comm(pid_t pid, char **name);
-int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char **line);
-int get_process_exe(pid_t pid, char **name);
-int get_process_uid(pid_t pid, uid_t *uid);
-int get_process_gid(pid_t pid, gid_t *gid);
-int get_process_capeff(pid_t pid, char **capeff);
-int get_process_cwd(pid_t pid, char **cwd);
-int get_process_root(pid_t pid, char **root);
-int get_process_environ(pid_t pid, char **environ);
-
 char hexchar(int x) _const_;
 int unhexchar(char c) _const_;
 char octchar(int x) _const_;
@@ -306,9 +242,15 @@ char decchar(int x) _const_;
 int undecchar(char c) _const_;
 
 char *cescape(const char *s);
-char *cunescape(const char *s);
-char *cunescape_length(const char *s, size_t length);
-char *cunescape_length_with_prefix(const char *s, size_t length, const char *prefix);
+size_t cescape_char(char c, char *buf);
+
+typedef enum UnescapeFlags {
+        UNESCAPE_RELAX = 1,
+} UnescapeFlags;
+
+int cunescape(const char *s, UnescapeFlags flags, char **ret);
+int cunescape_length(const char *s, size_t length, UnescapeFlags flags, char **ret);
+int cunescape_length_with_prefix(const char *s, size_t length, const char *prefix, UnescapeFlags flags, char **ret);
 
 char *xescape(const char *s, const char *bad);
 
@@ -321,26 +263,6 @@ bool hidden_file(const char *filename) _pure_;
 
 bool chars_intersect(const char *a, const char *b) _pure_;
 
-int make_stdio(int fd);
-int make_null_stdio(void);
-int make_console_stdio(void);
-
-int dev_urandom(void *p, size_t n);
-void random_bytes(void *p, size_t n);
-void initialize_srand(void);
-
-static inline uint64_t random_u64(void) {
-        uint64_t u;
-        random_bytes(&u, sizeof(u));
-        return u;
-}
-
-static inline uint32_t random_u32(void) {
-        uint32_t u;
-        random_bytes(&u, sizeof(u));
-        return u;
-}
-
 /* For basic lookup tables with strictly enumerated entries */
 #define _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,scope)          \
         scope const char *name##_to_string(type i) {                    \
@@ -406,19 +328,6 @@ int close_all_fds(const int except[], unsigned n_except);
 
 bool fstype_is_network(const char *fstype);
 
-int chvt(int vt);
-
-int read_one_char(FILE *f, char *ret, usec_t timeout, bool *need_nl);
-int ask_char(char *ret, const char *replies, const char *text, ...) _printf_(3, 4);
-int ask_string(char **ret, const char *text, ...) _printf_(2, 3);
-
-int reset_terminal_fd(int fd, bool switch_to_text);
-int reset_terminal(const char *name);
-
-int open_terminal(const char *name, int mode);
-int acquire_terminal(const char *name, bool fail, bool force, bool ignore_tiocstty_eperm, usec_t timeout);
-int release_terminal(void);
-
 int flush_fd(int fd);
 
 int fopen_temporary(const char *path, FILE **_f, char **_temp_path);
@@ -432,72 +341,22 @@ bool is_device_path(const char *path);
 int dir_is_empty(const char *path);
 char* dirname_malloc(const char *path);
 
-void rename_process(const char name[8]);
-
-bool hostname_is_set(void);
-
 char* lookup_uid(uid_t uid);
-char* gethostname_malloc(void);
 char* getlogname_malloc(void);
 char* getusername_malloc(void);
 
-int getttyname_malloc(int fd, char **r);
-int getttyname_harder(int fd, char **r);
-
-int get_ctty_devnr(pid_t pid, dev_t *d);
-int get_ctty(pid_t, dev_t *_devnr, char **r);
-
 int chmod_and_chown(const char *path, mode_t mode, uid_t uid, gid_t gid);
-int fchmod_and_fchown(int fd, mode_t mode, uid_t uid, gid_t gid);
-
-int is_fd_on_temporary_fs(int fd);
+// UNNEEDED int fchmod_and_fchown(int fd, mode_t mode, uid_t uid, gid_t gid);
 
-int rm_rf_children(int fd, bool only_dirs, bool honour_sticky, struct stat *root_dev);
-int rm_rf_children_dangerous(int fd, bool only_dirs, bool honour_sticky, struct stat *root_dev);
-int rm_rf(const char *path, bool only_dirs, bool delete_root, bool honour_sticky);
-int rm_rf_dangerous(const char *path, bool only_dirs, bool delete_root, bool honour_sticky);
+bool is_temporary_fs(const struct statfs *s) _pure_;
+int fd_is_temporary_fs(int fd);
 
 int pipe_eof(int fd);
 
 cpu_set_t* cpu_set_malloc(unsigned *ncpus);
 
-int status_vprintf(const char *status, bool ellipse, bool ephemeral, const char *format, va_list ap) _printf_(4,0);
-int status_printf(const char *status, bool ellipse, bool ephemeral, const char *format, ...) _printf_(4,5);
-
 #define xsprintf(buf, fmt, ...) assert_se((size_t) snprintf(buf, ELEMENTSOF(buf), fmt, __VA_ARGS__) < ELEMENTSOF(buf))
 
-int fd_columns(int fd);
-unsigned columns(void);
-int fd_lines(int fd);
-unsigned lines(void);
-void columns_lines_cache_reset(int _unused_ signum);
-
-bool on_tty(void);
-
-static inline const char *ansi_highlight(void) {
-        return on_tty() ? ANSI_HIGHLIGHT_ON : "";
-}
-
-static inline const char *ansi_highlight_red(void) {
-        return on_tty() ? ANSI_HIGHLIGHT_RED_ON : "";
-}
-
-static inline const char *ansi_highlight_green(void) {
-        return on_tty() ? ANSI_HIGHLIGHT_GREEN_ON : "";
-}
-
-static inline const char *ansi_highlight_yellow(void) {
-        return on_tty() ? ANSI_HIGHLIGHT_YELLOW_ON : "";
-}
-
-static inline const char *ansi_highlight_blue(void) {
-        return on_tty() ? ANSI_HIGHLIGHT_BLUE_ON : "";
-}
-
-static inline const char *ansi_highlight_off(void) {
-        return on_tty() ? ANSI_HIGHLIGHT_OFF : "";
-}
-
 int files_same(const char *filea, const char *fileb);
 
 int running_in_chroot(void);
@@ -509,52 +368,31 @@ char *ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigne
 int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode);
 int touch(const char *path);
 
-char *unquote(const char *s, const char *quotes);
-char *normalize_env_assignment(const char *s);
-
-int wait_for_terminate(pid_t pid, siginfo_t *status);
-int wait_for_terminate_and_warn(const char *name, pid_t pid, bool check_exit_code);
-
 noreturn void freeze(void);
 
 bool null_or_empty(struct stat *st) _pure_;
 int null_or_empty_path(const char *fn);
-int null_or_empty_fd(int fd);
+// UNNEEDED int null_or_empty_fd(int fd);
 
 DIR *xopendirat(int dirfd, const char *name, int flags);
 
-char *fstab_node_to_udev_node(const char *p);
-
-char *resolve_dev_console(char **active);
-bool tty_is_vc(const char *tty);
-bool tty_is_vc_resolve(const char *tty);
-bool tty_is_console(const char *tty) _pure_;
-int vtnr_from_tty(const char *tty);
-const char *default_term_for_tty(const char *tty);
-
-void execute_directories(const char* const* directories, usec_t timeout, char *argv[]);
+// UNNEEDED char *fstab_node_to_udev_node(const char *p);
 
-int kill_and_sigcont(pid_t pid, int sig);
+// UNNEEDED void execute_directories(const char* const* directories, usec_t timeout, char *argv[]);
 
 bool nulstr_contains(const char*nulstr, const char *needle);
 
-bool plymouth_running(void);
-
-bool hostname_is_valid(const char *s) _pure_;
-char* hostname_cleanup(char *s, bool lowercase);
+// UNNEEDED bool plymouth_running(void);
 
 bool machine_name_is_valid(const char *s) _pure_;
 
 char* strshorten(char *s, size_t l);
 
-int terminal_vhangup_fd(int fd);
-int terminal_vhangup(const char *name);
-
-int vt_disallocate(const char *name);
+// UNNEEDED int symlink_idempotent(const char *from, const char *to);
 
 int symlink_atomic(const char *from, const char *to);
-int mknod_atomic(const char *path, mode_t mode, dev_t dev);
-int mkfifo_atomic(const char *path, mode_t mode);
+// UNNEEDED int mknod_atomic(const char *path, mode_t mode, dev_t dev);
+// UNNEEDED int mkfifo_atomic(const char *path, mode_t mode);
 
 int fchmod_umask(int fd, mode_t mode);
 
@@ -565,13 +403,13 @@ int get_user_creds(const char **username, uid_t *uid, gid_t *gid, const char **h
 int get_group_creds(const char **groupname, gid_t *gid);
 
 int in_gid(gid_t gid);
-int in_group(const char *name);
+// UNNEEDED int in_group(const char *name);
 
 char* uid_to_name(uid_t uid);
 char* gid_to_name(gid_t gid);
 
 int glob_exists(const char *path);
-int glob_extend(char ***strv, const char *path);
+// UNNEEDED int glob_extend(char ***strv, const char *path);
 
 int dirent_ensure_type(DIR *d, struct dirent *de);
 
@@ -621,7 +459,7 @@ extern char **saved_argv;
 
 bool kexec_loaded(void);
 
-int prot_from_flags(int flags) _const_;
+// UNNEEDED int prot_from_flags(int flags) _const_;
 
 char *format_bytes(char *buf, size_t l, off_t t);
 
@@ -629,8 +467,6 @@ int fd_wait_for_event(int fd, int event, usec_t timeout);
 
 void* memdup(const void *p, size_t l) _alloc_(2);
 
-int is_kernel_thread(pid_t pid);
-
 int fd_inc_sndbuf(int fd, size_t n);
 int fd_inc_rcvbuf(int fd, size_t n);
 
@@ -638,17 +474,13 @@ int fork_agent(pid_t *pid, const int except[], unsigned n_except, const char *pa
 
 int setrlimit_closest(int resource, const struct rlimit *rlim);
 
-int getenv_for_pid(pid_t pid, const char *field, char **_value);
-
 bool http_url_is_valid(const char *url) _pure_;
 bool documentation_url_is_valid(const char *url) _pure_;
 
-bool http_etag_is_valid(const char *etag);
+// UNNEEDED bool http_etag_is_valid(const char *etag);
 
 bool in_initrd(void);
 
-void warn_melody(void);
-
 int get_home_dir(char **ret);
 int get_shell(char **_ret);
 
@@ -716,12 +548,12 @@ _pure_ static inline bool string_is_glob(const char *p) {
         return !!strpbrk(p, GLOB_CHARS);
 }
 
-void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size,
-                 int (*compar) (const void *, const void *, void *),
-                 void *arg);
+// UNNEEDED void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size,
+// UNNEEDED                 int (*compar) (const void *, const void *, void *),
+// UNNEEDED                 void *arg);
 
 #define _(String) gettext (String)
-void init_gettext(void);
+// UNNEEDED void init_gettext(void);
 bool is_locale_utf8(void);
 
 typedef enum DrawSpecialChar {
@@ -745,7 +577,7 @@ char *strip_tab_ansi(char **p, size_t *l);
 int on_ac_power(void);
 
 int search_and_fopen(const char *path, const char *mode, const char *root, const char **search, FILE **_f);
-int search_and_fopen_nulstr(const char *path, const char *mode, const char *root, const char *search, FILE **_f);
+// UNNEEDED int search_and_fopen_nulstr(const char *path, const char *mode, const char *root, const char *search, FILE **_f);
 
 #define FOREACH_LINE(line, f, on_error)                         \
         for (;;)                                                \
@@ -916,35 +748,37 @@ int unlink_noerrno(const char *path);
                 _d_;                                                    \
         })
 
-#define procfs_file_alloca(pid, field)                                  \
-        ({                                                              \
-                pid_t _pid_ = (pid);                                    \
-                const char *_r_;                                        \
-                if (_pid_ == 0) {                                       \
-                        _r_ = ("/proc/self/" field);                    \
-                } else {                                                \
-                        _r_ = alloca(strlen("/proc/") + DECIMAL_STR_MAX(pid_t) + 1 + sizeof(field)); \
-                        sprintf((char*) _r_, "/proc/"PID_FMT"/" field, _pid_);                       \
-                }                                                       \
-                _r_;                                                    \
-        })
-
 bool id128_is_valid(const char *s) _pure_;
 
-int split_pair(const char *s, const char *sep, char **l, char **r);
+// UNNEEDED int split_pair(const char *s, const char *sep, char **l, char **r);
 
-int shall_restore_state(void);
+// UNNEEDED int shall_restore_state(void);
 
 /**
  * Normal qsort requires base to be nonnull. Here were require
  * that only if nmemb > 0.
  */
-static inline void qsort_safe(void *base, size_t nmemb, size_t size,
-                              int (*compar)(const void *, const void *)) {
-        if (nmemb) {
-                assert(base);
-                qsort(base, nmemb, size, compar);
-        }
+static inline void qsort_safe(void *base, size_t nmemb, size_t size, comparison_fn_t compar) {
+        if (nmemb <= 1)
+                return;
+
+        assert(base);
+        qsort(base, nmemb, size, compar);
+}
+
+/* Normal memmem() requires haystack to be nonnull, which is annoying for zero-length buffers */
+static inline void *memmem_safe(const void *haystack, size_t haystacklen, const void *needle, size_t needlelen) {
+
+        if (needlelen <= 0)
+                return (void*) haystack;
+
+        if (haystacklen < needlelen)
+                return NULL;
+
+        assert(haystack);
+        assert(needle);
+
+        return memmem(haystack, haystacklen, needle, needlelen);
 }
 
 int proc_cmdline(char **ret);
@@ -956,9 +790,6 @@ int container_get_leader(const char *machine, pid_t *pid);
 int namespace_open(pid_t pid, int *pidns_fd, int *mntns_fd, int *netns_fd, int *root_fd);
 int namespace_enter(int pidns_fd, int mntns_fd, int netns_fd, int root_fd);
 
-bool pid_is_alive(pid_t pid);
-bool pid_is_unwaited(pid_t pid);
-
 int getpeercred(int fd, struct ucred *ucred);
 int getpeersec(int fd, char **ret);
 
@@ -969,12 +800,19 @@ int open_tmpfile(const char *path, int flags);
 
 int fd_warn_permissions(const char *path, int fd);
 
-unsigned long personality_from_string(const char *p);
+#ifndef PERSONALITY_INVALID
+/* personality(7) documents that 0xffffffffUL is used for querying the
+ * current personality, hence let's use that here as error
+ * indicator. */
+#define PERSONALITY_INVALID 0xffffffffLU
+#endif
+
+// UNNEEDED unsigned long personality_from_string(const char *p);
 const char *personality_to_string(unsigned long);
 
 uint64_t physical_memory(void);
 
-void hexdump(FILE *f, const void *p, size_t s);
+// UNNEEDED void hexdump(FILE *f, const void *p, size_t s);
 
 union file_handle_union {
         struct file_handle handle;
@@ -992,16 +830,15 @@ int fflush_and_check(FILE *f);
 
 int tempfn_xxxxxx(const char *p, const char *extra, char **ret);
 int tempfn_random(const char *p, const char *extra, char **ret);
-int tempfn_random_child(const char *p, const char *extra, char **ret);
+// UNNEEDED int tempfn_random_child(const char *p, const char *extra, char **ret);
 
-bool is_localhost(const char *hostname);
-
-int take_password_lock(const char *root);
+// UNNEEDED int take_password_lock(const char *root);
 
 int is_symlink(const char *path);
 int is_dir(const char *path, bool follow);
+// UNNEEDED int is_device_node(const char *path);
 
-typedef enum UnquoteFlags{
+typedef enum UnquoteFlags {
         UNQUOTE_RELAX           = 1,
         UNQUOTE_CUNESCAPE       = 2,
         UNQUOTE_CUNESCAPE_RELAX = 4,
@@ -1009,12 +846,10 @@ typedef enum UnquoteFlags{
 
 int unquote_first_word(const char **p, char **ret, UnquoteFlags flags);
 int unquote_first_word_and_warn(const char **p, char **ret, UnquoteFlags flags, const char *unit, const char *filename, unsigned line, const char *rvalue);
-int unquote_many_words(const char **p, UnquoteFlags flags, ...) _sentinel_;
+// UNNEEDED int unquote_many_words(const char **p, UnquoteFlags flags, ...) _sentinel_;
 
 int free_and_strdup(char **p, const char *s);
 
-int sethostname_idempotent(const char *s);
-
 #define INOTIFY_EVENT_MAX (sizeof(struct inotify_event) + NAME_MAX + 1)
 
 #define FOREACH_INOTIFY_EVENT(e, buffer, sz) \
@@ -1031,45 +866,40 @@ union inotify_event_buffer {
 
 int ptsname_malloc(int fd, char **ret);
 
-int openpt_in_namespace(pid_t pid, int flags);
+// UNNEEDED int openpt_in_namespace(pid_t pid, int flags);
 
 ssize_t fgetxattrat_fake(int dirfd, const char *filename, const char *attribute, void *value, size_t size, int flags);
 
 int fd_setcrtime(int fd, usec_t usec);
 int fd_getcrtime(int fd, usec_t *usec);
-int path_getcrtime(const char *p, usec_t *usec);
+// UNNEEDED int path_getcrtime(const char *p, usec_t *usec);
 int fd_getcrtime_at(int dirfd, const char *name, usec_t *usec, int flags);
 
-int chattr_fd(int fd, bool b, unsigned mask);
-int chattr_path(const char *p, bool b, unsigned mask);
-int change_attr_fd(int fd, unsigned value, unsigned mask);
+int same_fd(int a, int b);
+
+int chattr_fd(int fd, unsigned value, unsigned mask);
+int chattr_path(const char *p, unsigned value, unsigned mask);
 
 int read_attr_fd(int fd, unsigned *ret);
 int read_attr_path(const char *p, unsigned *ret);
 
-typedef struct LockFile {
-        char *path;
-        int fd;
-        int operation;
-} LockFile;
-
-int make_lock_file(const char *p, int operation, LockFile *ret);
-int make_lock_file_for(const char *p, int operation, LockFile *ret);
-void release_lock_file(LockFile *f);
-
-#define _cleanup_release_lock_file_ _cleanup_(release_lock_file)
-
-#define LOCK_FILE_INIT { .fd = -1, .path = NULL }
-
 #define RLIMIT_MAKE_CONST(lim) ((struct rlimit) { lim, lim })
 
-ssize_t sparse_write(int fd, const void *p, size_t sz, size_t run_length);
+// UNNEEDED ssize_t sparse_write(int fd, const void *p, size_t sz, size_t run_length);
 
 void sigkill_wait(pid_t *pid);
 #define _cleanup_sigkill_wait_ _cleanup_(sigkill_wait)
 
-int syslog_parse_priority(const char **p, int *priority, bool with_facility);
+// UNNEEDED int syslog_parse_priority(const char **p, int *priority, bool with_facility);
 
 void cmsg_close_all(struct msghdr *mh);
 
 int rename_noreplace(int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
+
+char *shell_maybe_quote(const char *s);
+
+int parse_mode(const char *s, mode_t *ret);
+
+int mount_move_root(const char *path);
+
+int reset_uid_gid(void);
similarity index 100%
rename from src/shared/verbs.c
rename to src/basic/verbs.c
similarity index 100%
rename from src/shared/verbs.h
rename to src/basic/verbs.h
similarity index 100%
rename from src/shared/virt.c
rename to src/basic/virt.c
similarity index 100%
rename from src/shared/virt.h
rename to src/basic/virt.h
diff --git a/src/core/org.freedesktop.systemd1.conf b/src/core/org.freedesktop.systemd1.conf
new file mode 100644 (file)
index 0000000..6a7a37e
--- /dev/null
@@ -0,0 +1,212 @@
+<?xml version="1.0"?> <!--*-nxml-*-->
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+        "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+
+<!--
+  This file is part of systemd.
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+-->
+
+<busconfig>
+
+        <policy user="root">
+                <allow own="org.freedesktop.systemd1"/>
+
+                <!-- Root clients can do everything -->
+                <allow send_destination="org.freedesktop.systemd1"/>
+                <allow receive_sender="org.freedesktop.systemd1"/>
+
+                <!-- systemd may receive activator requests -->
+                <allow receive_interface="org.freedesktop.systemd1.Activator"
+                       receive_member="ActivationRequest"/>
+        </policy>
+
+        <policy context="default">
+                <deny send_destination="org.freedesktop.systemd1"/>
+
+                <!-- Completely open to anyone -->
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.DBus.Introspectable"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.DBus.Peer"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.DBus.Properties"
+                       send_member="Get"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.DBus.Properties"
+                       send_member="GetAll"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="GetUnit"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="GetUnitByPID"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="LoadUnit"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="GetJob"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="ListUnits"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="ListUnitsFiltered"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="ListUnitFiles"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="GetUnitFileState"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="ListJobs"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="Subscribe"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="Unsubscribe"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="Dump"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="GetDefaultTarget"/>
+
+                <!-- Managed via polkit or other criteria -->
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="StartUnit"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="StartUnitReplace"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="StopUnit"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="ReloadUnit"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="RestartUnit"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="TryRestartUnit"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="ReloadOrRestartUnit"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="ReloadOrTryRestartUnit"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="KillUnit"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="ResetFailedUnit"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="SetUnitProperties"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="StartTransientUnit"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="CancelJob"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="Reload"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="Reexecute"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="EnableUnitFiles"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="DisableUnitFiles"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="ReenableUnitFiles"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="LinkUnitFiles"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="PresetUnitFiles"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="PresetUnitFilesWithMode"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="MaskUnitFiles"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="UnmaskUnitFiles"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="SetDefaultTarget"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="PresetAllUnitFiles"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Manager"
+                       send_member="AddDependencyUnitFiles"/>
+
+                <allow send_destination="org.freedesktop.systemd1"
+                       send_interface="org.freedesktop.systemd1.Job"
+                       send_member="Cancel"/>
+
+                <allow receive_sender="org.freedesktop.systemd1"/>
+        </policy>
+
+</busconfig>
diff --git a/src/core/org.freedesktop.systemd1.policy.in.in b/src/core/org.freedesktop.systemd1.policy.in.in
new file mode 100644 (file)
index 0000000..cc39a9e
--- /dev/null
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?> <!--*-nxml-*-->
+<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
+        "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
+
+<!--
+  This file is part of systemd.
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+-->
+
+<policyconfig>
+
+        <vendor>The systemd Project</vendor>
+        <vendor_url>http://www.freedesktop.org/wiki/Software/systemd</vendor_url>
+
+        <action id="org.freedesktop.systemd1.reply-password">
+                <_description>Send passphrase back to system</_description>
+                <_message>Authentication is required to send the entered passphrase back to the system.</_message>
+                <defaults>
+                        <allow_any>no</allow_any>
+                        <allow_inactive>no</allow_inactive>
+                        <allow_active>auth_admin_keep</allow_active>
+                </defaults>
+                <annotate key="org.freedesktop.policykit.exec.path">@rootlibexecdir@/systemd-reply-password</annotate>
+        </action>
+
+        <action id="org.freedesktop.systemd1.manage-units">
+                <_description>Manage system services or other units</_description>
+                <_message>Authentication is required to manage system services or other units.</_message>
+                <defaults>
+                        <allow_any>auth_admin</allow_any>
+                        <allow_inactive>auth_admin</allow_inactive>
+                        <allow_active>auth_admin_keep</allow_active>
+                </defaults>
+        </action>
+
+        <action id="org.freedesktop.systemd1.manage-unit-files">
+                <_description>Manage system service or unit files</_description>
+                <_message>Authentication is required to manage system service or unit files.</_message>
+                <defaults>
+                        <allow_any>auth_admin</allow_any>
+                        <allow_inactive>auth_admin</allow_inactive>
+                        <allow_active>auth_admin_keep</allow_active>
+                </defaults>
+        </action>
+
+        <action id="org.freedesktop.systemd1.set-environment">
+                <_description>Set or unset system and service manager environment variables</_description>
+                <_message>Authentication is required to set or unset system and service manager environment variables.</_message>
+                <defaults>
+                        <allow_any>auth_admin</allow_any>
+                        <allow_inactive>auth_admin</allow_inactive>
+                        <allow_active>auth_admin_keep</allow_active>
+                </defaults>
+        </action>
+
+        <action id="org.freedesktop.systemd1.reload-daemon">
+                <_description>Reload the systemd state</_description>
+                <_message>Authentication is required to reload the systemd state.</_message>
+                <defaults>
+                        <allow_any>auth_admin</allow_any>
+                        <allow_inactive>auth_admin</allow_inactive>
+                        <allow_active>auth_admin_keep</allow_active>
+                </defaults>
+        </action>
+
+</policyconfig>
diff --git a/src/core/org.freedesktop.systemd1.service b/src/core/org.freedesktop.systemd1.service
new file mode 100644 (file)
index 0000000..d4df3e9
--- /dev/null
@@ -0,0 +1,11 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+
+[D-BUS Service]
+Name=org.freedesktop.systemd1
+Exec=/bin/false
+User=root
diff --git a/src/core/system.conf b/src/core/system.conf
new file mode 100644 (file)
index 0000000..2316090
--- /dev/null
@@ -0,0 +1,57 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+#
+# Entries in this file show the compile time defaults.
+# You can change settings by editing this file.
+# Defaults can be restored by simply deleting this file.
+#
+# See systemd-system.conf(5) for details.
+
+[Manager]
+#LogLevel=info
+#LogTarget=journal-or-kmsg
+#LogColor=yes
+#LogLocation=no
+#DumpCore=yes
+#CrashShell=no
+#ShowStatus=yes
+#CrashChVT=1
+#CPUAffinity=1 2
+#JoinControllers=cpu,cpuacct net_cls,net_prio
+#RuntimeWatchdogSec=0
+#ShutdownWatchdogSec=10min
+#CapabilityBoundingSet=
+#SystemCallArchitectures=
+#TimerSlackNSec=
+#DefaultTimerAccuracySec=1min
+#DefaultStandardOutput=journal
+#DefaultStandardError=inherit
+#DefaultTimeoutStartSec=90s
+#DefaultTimeoutStopSec=90s
+#DefaultRestartSec=100ms
+#DefaultStartLimitInterval=10s
+#DefaultStartLimitBurst=5
+#DefaultEnvironment=
+#DefaultCPUAccounting=no
+#DefaultBlockIOAccounting=no
+#DefaultMemoryAccounting=no
+#DefaultLimitCPU=
+#DefaultLimitFSIZE=
+#DefaultLimitDATA=
+#DefaultLimitSTACK=
+#DefaultLimitCORE=
+#DefaultLimitRSS=
+#DefaultLimitNOFILE=
+#DefaultLimitAS=
+#DefaultLimitNPROC=
+#DefaultLimitMEMLOCK=
+#DefaultLimitLOCKS=
+#DefaultLimitSIGPENDING=
+#DefaultLimitMSGQUEUE=
+#DefaultLimitNICE=
+#DefaultLimitRTPRIO=
+#DefaultLimitRTTIME=
diff --git a/src/core/user.conf b/src/core/user.conf
new file mode 100644 (file)
index 0000000..87c8164
--- /dev/null
@@ -0,0 +1,44 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+#
+# You can override the directives in this file by creating files in
+# /etc/systemd/user.conf.d/*.conf.
+#
+# See systemd-user.conf(5) for details
+
+[Manager]
+#LogLevel=info
+#LogTarget=console
+#LogColor=yes
+#LogLocation=no
+#SystemCallArchitectures=
+#TimerSlackNSec=
+#DefaultTimerAccuracySec=1min
+#DefaultStandardOutput=inherit
+#DefaultStandardError=inherit
+#DefaultTimeoutStartSec=90s
+#DefaultTimeoutStopSec=90s
+#DefaultRestartSec=100ms
+#DefaultStartLimitInterval=10s
+#DefaultStartLimitBurst=5
+#DefaultEnvironment=
+#DefaultLimitCPU=
+#DefaultLimitFSIZE=
+#DefaultLimitDATA=
+#DefaultLimitSTACK=
+#DefaultLimitCORE=
+#DefaultLimitRSS=
+#DefaultLimitNOFILE=
+#DefaultLimitAS=
+#DefaultLimitNPROC=
+#DefaultLimitMEMLOCK=
+#DefaultLimitLOCKS=
+#DefaultLimitSIGPENDING=
+#DefaultLimitMSGQUEUE=
+#DefaultLimitNICE=
+#DefaultLimitRTPRIO=
+#DefaultLimitRTTIME=
diff --git a/src/libelogind/sd-bus/bus-container.c b/src/libelogind/sd-bus/bus-container.c
deleted file mode 100644 (file)
index fa7a207..0000000
+++ /dev/null
@@ -1,245 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
-  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