summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--CODING_STYLE31
-rw-r--r--Makefile.am20
-rw-r--r--NEWS204
-rw-r--r--TODO12
-rw-r--r--cb/elogind.cbp441
-rw-r--r--configure.ac52
-rw-r--r--m4/attributes.m44
l---------[-rw-r--r--]man/Makefile29
-rw-r--r--man/loginctl.xml4
-rw-r--r--po/LINGUAS4
-rw-r--r--po/POTFILES.in7
-rw-r--r--po/POTFILES.skip21
-rw-r--r--po/be.po101
-rw-r--r--po/be@latin.po111
-rw-r--r--po/de.po170
-rw-r--r--po/fr.po99
-rw-r--r--po/gl.po584
-rw-r--r--po/ko.po544
-rw-r--r--po/sr.po606
-rw-r--r--po/tr.po598
-rw-r--r--po/zh_TW.po2
-rw-r--r--src/basic/cgroup-util.c54
-rw-r--r--src/basic/cgroup-util.h35
-rw-r--r--src/basic/copy.c26
-rw-r--r--src/basic/copy.h2
-rw-r--r--src/basic/fileio.c34
-rw-r--r--src/basic/fileio.h2
-rw-r--r--src/basic/hashmap.c36
-rw-r--r--src/basic/hashmap.h11
-rw-r--r--src/basic/log.c6
-rw-r--r--src/basic/log.h12
-rw-r--r--src/basic/macro.h39
-rw-r--r--src/basic/memfd-util.c6
-rw-r--r--src/basic/memfd-util.h4
-rw-r--r--src/basic/missing.h69
-rw-r--r--src/basic/path-util.c2
-rw-r--r--src/basic/path-util.h2
-rw-r--r--src/basic/prioq.c12
-rw-r--r--src/basic/process-util.c4
-rw-r--r--src/basic/process-util.h2
-rw-r--r--src/basic/selinux-util.c10
-rw-r--r--src/basic/selinux-util.h3
-rw-r--r--src/basic/siphash24.c233
-rw-r--r--src/basic/siphash24.h13
-rw-r--r--src/basic/smack-util.c36
-rw-r--r--src/basic/smack-util.h22
-rw-r--r--src/basic/strv.c166
-rw-r--r--src/basic/strv.h9
-rw-r--r--src/basic/terminal-util.c31
-rw-r--r--src/basic/terminal-util.h46
-rw-r--r--src/basic/time-util.h4
-rw-r--r--src/basic/unit-name.c164
-rw-r--r--src/basic/unit-name.h227
-rw-r--r--src/basic/util.c529
-rw-r--r--src/basic/util.h106
-rw-r--r--src/basic/virt.c383
-rw-r--r--src/basic/virt.h46
-rw-r--r--src/cgroups-agent/cgroups-agent.c2
-rw-r--r--src/core/cgroup.c252
-rw-r--r--src/core/cgroup.h44
-rw-r--r--src/core/mount-setup.c13
l---------src/libelogind/Makefile1
-rw-r--r--src/libelogind/libelogind.sym54
l---------src/libelogind/sd-bus/Makefile1
-rw-r--r--src/libelogind/sd-bus/bus-container.c11
-rw-r--r--src/libelogind/sd-bus/bus-creds.c6
-rw-r--r--src/libelogind/sd-bus/bus-internal.h2
-rw-r--r--src/libelogind/sd-bus/bus-introspect.c3
-rw-r--r--src/libelogind/sd-bus/bus-message.c11
-rw-r--r--src/libelogind/sd-bus/bus-objects.c19
-rw-r--r--src/libelogind/sd-bus/bus-socket.c2
-rw-r--r--src/libelogind/sd-bus/sd-bus.c210
-rw-r--r--src/libelogind/sd-daemon/sd-daemon.c101
l---------src/libelogind/sd-event/Makefile1
-rw-r--r--src/libelogind/sd-event/sd-event.c51
-rw-r--r--src/libelogind/sd-id128/sd-id128.c2
-rw-r--r--src/libelogind/sd-login/sd-login.c10
-rw-r--r--src/login/.gitignore1
-rw-r--r--src/login/70-power-switch.rules2
-rw-r--r--src/login/elogind-user.m4 (renamed from src/login/elogind-user)5
-rw-r--r--src/login/inhibit.c4
-rw-r--r--src/login/loginctl.c162
-rw-r--r--src/login/logind-action.c1
-rw-r--r--src/login/logind-action.h2
-rw-r--r--src/login/logind-button.c14
-rw-r--r--src/login/logind-dbus.c2
-rw-r--r--src/login/logind-session.c23
-rw-r--r--src/login/logind-user.c14
-rw-r--r--src/login/logind.c2
-rw-r--r--src/login/pam_elogind.c2
-rw-r--r--src/login/sysfs-show.c2
l---------src/shared/Makefile1
-rw-r--r--src/shared/bus-util.c71
-rw-r--r--src/shared/bus-util.h4
-rw-r--r--src/shared/cgroup-show.c277
-rw-r--r--src/shared/cgroup-show.h33
-rw-r--r--src/shared/clean-ipc.c25
-rw-r--r--src/shared/conf-parser.c129
-rw-r--r--src/shared/conf-parser.h9
-rw-r--r--src/shared/pager.c41
-rw-r--r--src/shared/sleep-config.c2
-rw-r--r--src/systemd/sd-bus.h24
-rw-r--r--src/systemd/sd-daemon.h4
-rw-r--r--src/systemd/sd-event.h8
-rwxr-xr-xtools/make-directive-index.py14
106 files changed, 6154 insertions, 1554 deletions
diff --git a/.gitignore b/.gitignore
index ce344702a..681fc5697 100644
--- a/.gitignore
+++ b/.gitignore
@@ -293,9 +293,7 @@ stamp-*
/get_build_file_diff.sh
elogind_patches.lst
/patches/
-/elogind.cbp
-/elogind.layout*
+/cb/elogind.layout*
*.bak
/FIXME
/create_dist.sh
-
diff --git a/CODING_STYLE b/CODING_STYLE
index f13f9becb..7fd4af8b8 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -311,3 +311,34 @@
always-true expression for an infinite while() loop is our
recommendation is to simply write it without any such expression by
using "for (;;)".
+
+- Never use the "off_t" type, and particularly avoid it in public
+ APIs. It's really weirdly defined, as it usually is 64bit and we
+ don't support it any other way, but it could in theory also be
+ 32bit. Which one it is depends on a compiler switch chosen by the
+ compiled program, which hence corrupts APIs using it unless they can
+ also follow the program's choice. Moreover, in systemd we should
+ parse values the same way on all architectures and cannot expose
+ off_t values over D-Bus. To avoid any confusion regarding conversion
+ and ABIs, always use simply uint64_t directly.
+
+- Commit message subject lines should be prefixed with an appropriate
+ component name of some kind. For example "journal: ", "nspawn: " and
+ so on.
+
+- Do not use "Signed-Off-By:" in your commit messages. That's a kernel
+ thing we don't do in the systemd project.
+
+- Avoid leaving long-running child processes around, i.e. fork()s that
+ are not followed quickly by an execv() in the child. Resource
+ management is unclear in this case, and memory CoW will result in
+ unexpected penalties in the parent much much later on.
+
+- Don't block execution for arbitrary amounts of time using usleep()
+ or a similar call, unless you really know what you do. Just "giving
+ something some time", or so is a lazy excuse. Always wait for the
+ proper event, instead of doing time-based poll loops.
+
+- To determine the length of a constant string "foo", don't bother
+ with sizeof("foo")-1, please use strlen("foo") directly. gcc knows
+ strlen() anyway and turns it into a constant expression if possible.
diff --git a/Makefile.am b/Makefile.am
index c16eb5d0a..2bd2898c9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,9 +38,9 @@ SUBDIRS = . po
# Keep the test-suite.log
.PRECIOUS: $(TEST_SUITE_LOG) Makefile
-LIBELOGIND_CURRENT=11
+LIBELOGIND_CURRENT=12
LIBELOGIND_REVISION=0
-LIBELOGIND_AGE=11
+LIBELOGIND_AGE=12
# Dirs of external packages
dbuspolicydir=@dbuspolicydir@
@@ -52,8 +52,6 @@ pkgconfiglibdir=$(libdir)/pkgconfig
polkitpolicydir=$(datadir)/polkit-1/actions
bashcompletiondir=@bashcompletiondir@
zshcompletiondir=@zshcompletiondir@
-systemsleepdir=$(pkglibexecdir)/sleep.d
-systemshutdowndir=$(pkglibexecdir)/shutdown.d
CGROUP_CONTROLLER=@cgroup_controller@
PKTTYAGENT=$(bindir)/pkttyagent
@@ -65,13 +63,14 @@ udevrulesdir=@udevrulesdir@
udevbindir=@udevbindir@
udevlibexecdir=$(udevbindir)
udevhomedir=$(udevlibexecdir)
+systemshutdowndir=$(rootlibexecdir)/system-shutdown
+systemsleepdir=$(rootlibexecdir)/system-sleep
factory_pamdir = $(datadir)/factory/etc/pam.d
# And these are the special ones for /
rootprefix=@rootprefix@
-rootlibdir=@rootlibdir@
rootbindir=$(rootprefix)/bin
-
+rootlibexecdir=$(rootprefix)/lib/elogind
EXTRA_DIST =
BUILT_SOURCES =
@@ -122,7 +121,7 @@ AM_CPPFLAGS = \
-include $(top_builddir)/config.h \
-DPKGSYSCONFDIR=\"$(pkgsysconfdir)\" \
-DSYSTEMD_CGROUP_CONTROLLER=\"$(CGROUP_CONTROLLER)\" \
- -DELOGIND_CGROUP_AGENT_PATH=\"$(pkglibexecdir)/elogind-cgroups-agent\" \
+ -DELOGIND_CGROUP_AGENT_PATH=\"$(rootlibexecdir)/elogind-cgroups-agent\" \
-DUDEVLIBEXECDIR=\"$(udevlibexecdir)\" \
-DPOLKIT_AGENT_BINARY_PATH=\"$(PKTTYAGENT)\" \
-DSYSTEM_SLEEP_PATH=\"$(systemsleepdir)\" \
@@ -131,6 +130,8 @@ AM_CPPFLAGS = \
-DREBOOT=\"$(REBOOT)\" \
-DKEXEC=\"$(KEXEC)\" \
-DLIBDIR=\"$(libdir)\" \
+ -DROOTLIBDIR=\"$(rootlibdir)\" \
+ -DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \
-DTEST_DIR=\"$(abs_top_srcdir)/test\" \
-I $(top_srcdir)/src \
-I $(top_builddir)/src/basic \
@@ -404,8 +405,6 @@ libshared_la_SOURCES = \
src/shared/spawn-polkit-agent.h \
src/shared/clean-ipc.c \
src/shared/clean-ipc.h \
- src/shared/cgroup-show.c \
- src/shared/cgroup-show.h \
src/shared/utmp-wtmp.h \
src/shared/bus-util.c \
src/shared/bus-util.h
@@ -731,6 +730,8 @@ pamlib_LTLIBRARIES = \
dist_pamconf_DATA = \
src/login/elogind-user
+EXTRA_DIST += \
+ src/login/elogind-user.m4
endif
dist_dbussystemservice_DATA += \
@@ -765,6 +766,7 @@ EXTRA_DIST += \
# ------------------------------------------------------------------------------
substitutions = \
+ '|rootlibexecdir=$(rootlibexecdir)|' \
'|rootbindir=$(rootbindir)|' \
'|bindir=$(bindir)|' \
'|pkgsysconfdir=$(pkgsysconfdir)|' \
diff --git a/NEWS b/NEWS
index 6803c6588..1b7dc2183 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,209 @@
systemd System and Service Manager
+CHANGES WITH 227:
+
+ * systemd now depends on util-linux v2.27. More specifically,
+ the newly added mount monitor feature in libmount now
+ replaces systemd's former own implementation.
+
+ * libmount mandates /etc/mtab not to be regular file, and
+ systemd now enforces this condition at early boot.
+ /etc/mtab has been deprecated and warned about for a very
+ long time, so systems running systemd should already have
+ stopped having this file around as anything else than a
+ symlink to /proc/self/mounts.
+
+ * Support for the "pids" cgroup controller has been added. It
+ allows accounting the number of tasks in a cgroup and
+ enforcing limits on it. This adds two new setting
+ TasksAccounting= and TasksMax= to each unit, as well as a
+ global option DefaultTasksAccounting=.
+
+ * Support for the "net_cls" cgroup controller has been added.
+ It allows assigning a net class ID to each task in the
+ cgroup, which can then be used in firewall rules and traffic
+ shaping configurations. Note that the kernel netfilter net
+ class code does not currently work reliably for ingress
+ packets on unestablished sockets.
+
+ This adds a new config directive called NetClass= to CGroup
+ enabled units. Allowed values are positive numbers for fixed
+ assignments and "auto" for picking a free value
+ automatically.
+
+ * 'systemctl is-system-running' now returns 'offline' if the
+ system is not booted with systemd. This command can now be
+ used as a substitute for 'systemd-notify --booted'.
+
+ * Watchdog timeouts have been increased to 3 minutes for all
+ in-tree service files. Apparently, disk IO issues are more
+ frequent than we hoped, and user reported >1 minute waiting
+ for disk IO.
+
+ * 'machine-id-commit' functionality has been merged into
+ 'machine-id-setup --commit'. The separate binary has been
+ removed.
+
+ * The WorkingDirectory= directive in unit files may now be set
+ to the special value '~'. In this case, the working
+ directory is set to the home directory of the user
+ configured in User=.
+
+ * "machinectl shell" will now open the shell in the home
+ directory of the selected user by default.
+
+ * The CrashChVT= configuration file setting is renamed to
+ CrashChangeVT=, following our usual logic of not
+ abbreviating unnecessarily. The old directive is still
+ supported for compat reasons. Also, this directive now takes
+ an integer value between 1 and 63, or a boolean value. The
+ formerly supported '-1' value for disabling stays around for
+ compat reasons.
+
+ * The PrivateTmp=, PrivateDevices=, PrivateNetwork=,
+ NoNewPrivileges=, TTYPath=, WorkingDirectory= and
+ RootDirectory= properties can now be set for transient
+ units.
+
+ * The systemd-analyze tool gained a new "set-log-target" verb
+ to change the logging target the system manager logs to
+ dynamically during runtime. This is similar to how
+ "systemd-analyze set-log-level" already changes the log
+ level.
+
+ * In nspawn /sys is now mounted as tmpfs, with only a selected
+ set of subdirectories mounted in from the real sysfs. This
+ enhances security slightly, and is useful for ensuring user
+ namespaces work correctly.
+
+ * Support for USB FunctionFS activation has been added. This
+ allows implementation of USB gadget services that are
+ activated as soon as they are requested, so that they don't
+ have to run continously, similar to classic socket
+ activation.
+
+ * The "systemctl exit" command now optionally takes an
+ additional parameter that sets the exit code to return from
+ the systemd manager when exiting. This is only relevant when
+ running the systemd user instance, or when running the
+ system instance in a container.
+
+ * sd-bus gained the new API calls sd_bus_path_encode_many()
+ and sd_bus_path_decode_many() that allow easy encoding and
+ decoding of multiple identifier strings inside a D-Bus
+ object path. Another new call sd_bus_default_flush_close()
+ has been added to flush and close per-thread default
+ connections.
+
+ * systemd-cgtop gained support for a -M/--machine= switch to
+ show the control groups within a certain container only.
+
+ * "systemctl kill" gained support for an optional --fail
+ switch. If specified the requested operation will fail of no
+ processes have been killed, because the unit had no
+ processes attached, or similar.
+
+ * A new systemd.crash_reboot=1 kernel command line option has
+ been added that triggers a reboot after crashing. This can
+ also be set through CrashReboot= in systemd.conf.
+
+ * The RuntimeDirectory= setting now understands unit
+ specifiers like %i or %f.
+
+ * A new (still internal) libary API sd-ipv4acd has been added,
+ that implements address conflict detection for IPv4. It's
+ based on code from sd-ipv4ll, and will be useful for
+ detecting DHCP address conflicts.
+
+ * File descriptors passed during socket activation may now be
+ named. A new API sd_listen_fds_with_names() is added to
+ access the names. The default names may be overriden,
+ either in the .socket file using the FileDescriptorName=
+ parameter, or by passing FDNAME= when storing the file
+ descriptors using sd_notify().
+
+ * systemd-networkd gained support for:
+
+ - Setting the IPv6 Router Advertisment settings via
+ IPv6AcceptRouterAdvertisements= in .network files.
+
+ - Configuring the HelloTimeSec=, MaxAgeSec= and
+ ForwardDelaySec= bridge parameters in .netdev files.
+
+ - Configuring PreferredSource= for static routes in
+ .network files.
+
+ * The "ask-password" framework used to query for LUKS harddisk
+ passwords or SSL passwords during boot gained support for
+ caching passwords in the kernel keyring, if it is
+ available. This makes sure that the user only has to type in
+ a passphrase once if there are multiple objects to unlock
+ with the same one. Previously, such password caching was
+ available only when Plymouth was used; this moves the
+ caching logic into the systemd codebase itself. The
+ "systemd-ask-password" utility gained a new --keyname=
+ switch to control which kernel keyring key to use for
+ caching a password in. This functionality is also useful for
+ enabling display managers such as gdm to automatically
+ unlock the user's GNOME keyring if its passphrase, the
+ user's password and the harddisk password are the same, if
+ gdm-autologin is used.
+
+ * When downloading tar or raw images using "machinectl
+ pull-tar" or "machinectl pull-raw", a matching ".nspawn"
+ file is now also downloaded, if it is available and stored
+ next to the image file.
+
+ * Units of type ".socket" gained a new boolean setting
+ Writable= which is only useful in conjunction with
+ ListenSpecial=. If true, enables opening the specified
+ special file in O_RDWR mode rather than O_RDONLY mode.
+
+ * systemd-rfkill has been reworked to become a singleton
+ service that is activated through /dev/rfkill on each rfkill
+ state change and saves the settings to disk. This way,
+ systemd-rfkill is now compatible with devices that exist
+ only intermittendly, and even restores state if the previous
+ system shutdown was abrupt rather than clean.
+
+ * The journal daemon gained support for vacuuming old journal
+ files controlled by the number of files that shall remain,
+ in addition to the already existing control by size and by
+ date. This is useful as journal interleaving performance
+ degrades with too many seperate journal files, and allows
+ putting an effective limit on them. The new setting defaults
+ to 100, but this may be changed by setting SystemMaxFiles=
+ and RuntimeMaxFiles= in journald.conf. Also, the
+ "journalctl" tool gained the new --vacuum-files= switch to
+ manually vacuum journal files to leave only the specified
+ number of files in place.
+
+ * udev will now create /dev/disk/by-path links for ATA devices
+ on kernels where that is supported.
+
+ * Galician, Serbian, Turkish and Korean translations were added.
+
+ Contributions from: Aaro Koskinen, Alban Crequy, Beniamino
+ Galvani, Benjamin Robin, Branislav Blaskovic, Chen-Han Hsiao
+ (Stanley), Daniel Buch, Daniel Machon, Daniel Mack, David
+ Herrmann, David Milburn, doubleodoug, Evgeny Vereshchagin,
+ Felipe Franciosi, Filipe Brandenburger, Fran Dieguez, Gabriel
+ de Perthuis, Georg Müller, Hans de Goede, Hendrik Brueckner,
+ Ivan Shapovalov, Jacob Keller, Jan Engelhardt, Jan Janssen,
+ Jan Synacek, Jens Kuske, Karel Zak, Kay Sievers, Krzesimir
+ Nowak, Krzysztof Kotlenga, Lars Uebernickel, Lennart
+ Poettering, Lukas Nykryn, Åukasz Stelmach, Maciej Wereski,
+ Marcel Holtmann, Marius Thesing, Martin Pitt, Michael Biebl,
+ Michael Gebetsroither, Michal Schmidt, Michal Sekletar, Mike
+ Gilbert, Muhammet Kara, nazgul77, Nicolas Cornu, NoXPhasma,
+ Olof Johansson, Patrik Flykt, Pawel Szewczyk, reverendhomer,
+ Ronny Chevalier, Sangjung Woo, Seong-ho Cho, Susant Sahani,
+ Sylvain Plantefève, Thomas Haller, Thomas Hindoe Paaboel
+ Andersen, Tom Gundersen, Tom Lyon, Viktar Vauchkevich,
+ Zbigniew JÄ™drzejewski-Szmek, Марко Ðœ. КоÑтић
+
+ -- Berlin, 2015-10-07
+
CHANGES WITH 226:
* The DHCP implementation of systemd-networkd gained a set of
diff --git a/TODO b/TODO
index 4fdecebd0..066d0ae6b 100644
--- a/TODO
+++ b/TODO
@@ -26,6 +26,16 @@ External:
Features:
+* add a concept of RemainAfterExit= to scope units
+
+* add journal vacuum by max number of files
+
+* add a new command "systemctl revert" or so, that removes all dropin
+ snippets in /run and /etc, and all unit files with counterparts in
+ /usr, and thus undoes what "systemctl set-property" and "systemctl
+ edit" create. Maybe even add "systemctl revert -a" to do this for
+ all units.
+
* sd-event: maybe add support for inotify events
* PID 1 should send out sd_notify("WATCHDOG=1") messages (for usage in the --user mode, and when run via nspawn)
@@ -59,8 +69,6 @@ Features:
* install: include generator dirs in unit file search paths
-* stop using off_t, it's a crazy type. Use uint64_t instead.
-
* logind: follow PropertiesChanged state more closely, to deal with quick logouts and relogins
* invent a better systemd-run scheme for naming scopes, that works with remoting
diff --git a/cb/elogind.cbp b/cb/elogind.cbp
new file mode 100644
index 000000000..945761cd5
--- /dev/null
+++ b/cb/elogind.cbp
@@ -0,0 +1,441 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+ <FileVersion major="1" minor="6" />
+ <Project>
+ <Option title="elogind" />
+ <Option makefile_is_custom="1" />
+ <Option execution_dir="../../elogind" />
+ <Option pch_mode="2" />
+ <Option compiler="gcc" />
+ <Build>
+ <Target title="all">
+ <Option output="../.libs/libelogind" prefix_auto="1" extension_auto="1" />
+ <Option object_output="./" />
+ <Option type="1" />
+ <Option compiler="gcc" />
+ <Compiler>
+ <Add option="-g" />
+ </Compiler>
+ </Target>
+ <Target title="clean">
+ <Option output="../.libs/libelogind" prefix_auto="1" extension_auto="1" />
+ <Option object_output="./" />
+ <Option type="1" />
+ <Option compiler="gcc" />
+ <Compiler>
+ <Add option="-O2" />
+ </Compiler>
+ <Linker>
+ <Add option="-s" />
+ </Linker>
+ </Target>
+ </Build>
+ <Compiler>
+ <Add option="-Wall" />
+ </Compiler>
+ <Unit filename="../Makefile.am" />
+ <Unit filename="../config.h.in" />
+ <Unit filename="../configure.ac" />
+ <Unit filename="../src/basic/audit.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/audit.h" />
+ <Unit filename="../src/basic/build.h" />
+ <Unit filename="../src/basic/bus-label.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/bus-label.h" />
+ <Unit filename="../src/basic/capability.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/capability.h" />
+ <Unit filename="../src/basic/cgroup-util.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/cgroup-util.h" />
+ <Unit filename="../src/basic/conf-files.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/conf-files.h" />
+ <Unit filename="../src/basic/copy.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/copy.h" />
+ <Unit filename="../src/basic/def.h" />
+ <Unit filename="../src/basic/errno-list.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/errno-list.h" />
+ <Unit filename="../src/basic/fileio-label.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/fileio-label.h" />
+ <Unit filename="../src/basic/fileio.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/fileio.h" />
+ <Unit filename="../src/basic/gunicode.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/gunicode.h" />
+ <Unit filename="../src/basic/hashmap.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/hashmap.h" />
+ <Unit filename="../src/basic/hostname-util.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/hostname-util.h" />
+ <Unit filename="../src/basic/label.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/label.h" />
+ <Unit filename="../src/basic/list.h" />
+ <Unit filename="../src/basic/log.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/log.h" />
+ <Unit filename="../src/basic/login-util.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/login-util.h" />
+ <Unit filename="../src/basic/macro.h" />
+ <Unit filename="../src/basic/memfd-util.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/memfd-util.h" />
+ <Unit filename="../src/basic/mempool.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/mempool.h" />
+ <Unit filename="../src/basic/missing.h" />
+ <Unit filename="../src/basic/mkdir-label.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/mkdir.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/mkdir.h" />
+ <Unit filename="../src/basic/musl_missing.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/musl_missing.h" />
+ <Unit filename="../src/basic/parse-printf-format.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/parse-printf-format.h" />
+ <Unit filename="../src/basic/path-util.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/path-util.h" />
+ <Unit filename="../src/basic/prioq.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/prioq.h" />
+ <Unit filename="../src/basic/process-util.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/process-util.h" />
+ <Unit filename="../src/basic/random-util.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/random-util.h" />
+ <Unit filename="../src/basic/refcnt.h" />
+ <Unit filename="../src/basic/rm-rf.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/rm-rf.h" />
+ <Unit filename="../src/basic/selinux-util.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/selinux-util.h" />
+ <Unit filename="../src/basic/set.h" />
+ <Unit filename="../src/basic/signal-util.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/signal-util.h" />
+ <Unit filename="../src/basic/siphash24.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/siphash24.h" />
+ <Unit filename="../src/basic/smack-util.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/smack-util.h" />
+ <Unit filename="../src/basic/socket-util.h" />
+ <Unit filename="../src/basic/sparse-endian.h" />
+ <Unit filename="../src/basic/strv.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/strv.h" />
+ <Unit filename="../src/basic/terminal-util.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/terminal-util.h" />
+ <Unit filename="../src/basic/time-util.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/time-util.h" />
+ <Unit filename="../src/basic/unit-name.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/unit-name.h" />
+ <Unit filename="../src/basic/utf8.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/utf8.h" />
+ <Unit filename="../src/basic/util.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/util.h" />
+ <Unit filename="../src/basic/verbs.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/verbs.h" />
+ <Unit filename="../src/basic/virt.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/basic/virt.h" />
+ <Unit filename="../src/cgroups-agent/cgroups-agent.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/core/cgroup.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/core/cgroup.h" />
+ <Unit filename="../src/core/mount-setup.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/core/mount-setup.h" />
+ <Unit filename="../src/libelogind/libelogind.sym" />
+ <Unit filename="../src/libelogind/sd-bus/bus-bloom.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-bus/bus-bloom.h" />
+ <Unit filename="../src/libelogind/sd-bus/bus-common-errors.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-bus/bus-common-errors.h" />
+ <Unit filename="../src/libelogind/sd-bus/bus-container.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-bus/bus-container.h" />
+ <Unit filename="../src/libelogind/sd-bus/bus-control.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-bus/bus-control.h" />
+ <Unit filename="../src/libelogind/sd-bus/bus-convenience.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-bus/bus-creds.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-bus/bus-creds.h" />
+ <Unit filename="../src/libelogind/sd-bus/bus-error.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-bus/bus-error.h" />
+ <Unit filename="../src/libelogind/sd-bus/bus-gvariant.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-bus/bus-gvariant.h" />
+ <Unit filename="../src/libelogind/sd-bus/bus-internal.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-bus/bus-internal.h" />
+ <Unit filename="../src/libelogind/sd-bus/bus-introspect.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-bus/bus-introspect.h" />
+ <Unit filename="../src/libelogind/sd-bus/bus-kernel.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-bus/bus-kernel.h" />
+ <Unit filename="../src/libelogind/sd-bus/bus-match.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-bus/bus-match.h" />
+ <Unit filename="../src/libelogind/sd-bus/bus-message.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-bus/bus-message.h" />
+ <Unit filename="../src/libelogind/sd-bus/bus-objects.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-bus/bus-objects.h" />
+ <Unit filename="../src/libelogind/sd-bus/bus-protocol.h" />
+ <Unit filename="../src/libelogind/sd-bus/bus-signature.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-bus/bus-signature.h" />
+ <Unit filename="../src/libelogind/sd-bus/bus-slot.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-bus/bus-slot.h" />
+ <Unit filename="../src/libelogind/sd-bus/bus-socket.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-bus/bus-socket.h" />
+ <Unit filename="../src/libelogind/sd-bus/bus-track.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-bus/bus-track.h" />
+ <Unit filename="../src/libelogind/sd-bus/bus-type.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-bus/bus-type.h" />
+ <Unit filename="../src/libelogind/sd-bus/kdbus.h" />
+ <Unit filename="../src/libelogind/sd-bus/sd-bus.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-daemon/sd-daemon.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-event/sd-event.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-id128/sd-id128.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-login/sd-login.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/libelogind/sd-login/test-login.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/inhibit.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/loginctl.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/logind-acl.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/logind-acl.h" />
+ <Unit filename="../src/login/logind-action.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/logind-action.h" />
+ <Unit filename="../src/login/logind-button.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/logind-button.h" />
+ <Unit filename="../src/login/logind-core.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/logind-dbus.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/logind-device.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/logind-device.h" />
+ <Unit filename="../src/login/logind-gperf.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/logind-inhibit.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/logind-inhibit.h" />
+ <Unit filename="../src/login/logind-seat-dbus.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/logind-seat.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/logind-seat.h" />
+ <Unit filename="../src/login/logind-session-dbus.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/logind-session-device.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/logind-session-device.h" />
+ <Unit filename="../src/login/logind-session.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/logind-session.h" />
+ <Unit filename="../src/login/logind-user-dbus.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/logind-user.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/logind-user.h" />
+ <Unit filename="../src/login/logind-utmp.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/logind.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/logind.h" />
+ <Unit filename="../src/login/pam_elogind.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/sysfs-show.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/sysfs-show.h" />
+ <Unit filename="../src/login/test-inhibit.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/test-login-shared.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/login/test-login-tables.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/shared/acl-util.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/shared/acl-util.h" />
+ <Unit filename="../src/shared/bus-util.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/shared/bus-util.h" />
+ <Unit filename="../src/shared/clean-ipc.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/shared/clean-ipc.h" />
+ <Unit filename="../src/shared/conf-parser.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/shared/conf-parser.h" />
+ <Unit filename="../src/shared/efivars.h" />
+ <Unit filename="../src/shared/formats-util.h" />
+ <Unit filename="../src/shared/output-mode.h" />
+ <Unit filename="../src/shared/pager.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/shared/pager.h" />
+ <Unit filename="../src/shared/path-lookup.h" />
+ <Unit filename="../src/shared/sleep-config.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/shared/sleep-config.h" />
+ <Unit filename="../src/shared/spawn-polkit-agent.c">
+ <Option compilerVar="CC" />
+ </Unit>
+ <Unit filename="../src/shared/spawn-polkit-agent.h" />
+ <Unit filename="../src/shared/test-tables.h" />
+ <Unit filename="../src/shared/udev-util.h" />
+ <Unit filename="../src/shared/utmp-wtmp.h" />
+ <Unit filename="../src/systemd/_sd-common.h" />
+ <Unit filename="../src/systemd/sd-bus-protocol.h" />
+ <Unit filename="../src/systemd/sd-bus-vtable.h" />
+ <Unit filename="../src/systemd/sd-bus.h" />
+ <Unit filename="../src/systemd/sd-daemon.h" />
+ <Unit filename="../src/systemd/sd-event.h" />
+ <Unit filename="../src/systemd/sd-id128.h" />
+ <Unit filename="../src/systemd/sd-login.h" />
+ <Unit filename="../src/systemd/sd-messages.h" />
+ <Extensions>
+ <envvars />
+ <code_completion />
+ <debugger />
+ <lib_finder disable_auto="1" />
+ <editor_config active="1" use_tabs="0" tab_indents="0" tab_width="8" indent="8" eol_mode="2" />
+ </Extensions>
+ </Project>
+</CodeBlocks_project_file>
diff --git a/configure.ac b/configure.ac
index 57bbb1d00..25832100a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,7 +20,7 @@
AC_PREREQ([2.64])
AC_INIT([elogind],
- [226.5],
+ [227.2],
[https://github.com/elogind/elogind/issues],
[elogind],
[https://github.com/elogind/elogind])
@@ -175,7 +175,6 @@ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
-Werror=implicit-function-declaration \
-Werror=missing-declarations \
-Werror=return-type \
- -Werror=shadow \
-Wstrict-prototypes \
-Wredundant-decls \
-Wmissing-noreturn \
@@ -200,17 +199,28 @@ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
-fPIE \
--param=ssp-buffer-size=4])
+CC_CHECK_FLAG_APPEND([with_cflags], [CFLAGS], [-Werror=shadow], [
+#include <time.h>
+#include <inttypes.h>
+typedef uint64_t usec_t;
+usec_t now(clockid_t clock);
+int main(void) {
+ struct timespec now;
+ return 0;
+}
+])
+
AS_CASE([$CC], [*clang*],
[CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
-Wno-typedef-redefinition \
-Wno-gnu-variable-sized-type-not-at-end \
])])
-dnl AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
-dnl [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
-dnl -flto])],
-dnl [AC_MSG_RESULT([skipping -flto, optimization not enabled])])
-dnl AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")
+AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
+ [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
+ -flto])],
+ [AC_MSG_RESULT([skipping -flto, optimization not enabled])])
+AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")
AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
[CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
@@ -296,7 +306,6 @@ AS_IF([test "$have_python" != "yes"], [
AS_IF([test "$with_python" != "no"],
[AC_MSG_WARN([*** python support not found, some documentation cannot be built])])
])
-
AM_CONDITIONAL([HAVE_PYTHON], [test "x$have_python" = "xyes"])
# ------------------------------------------------------------------------------
@@ -316,24 +325,15 @@ AS_IF([test x$have_printf_h = xyes], [
dnl AC_SEARCH_LIBS([clock_gettime], [rt], [], [])
dnl AC_SEARCH_LIBS([mq_unlink], [rt], [], [])
-AC_ARG_WITH([libcap],
- AS_HELP_STRING([--with-libcap=DIR], [Prefix for libcap]),
- [CAP_LDFLAGS="-L$with_libcap/lib"],
- [CAP_LDFLAGS=""])
save_LIBS="$LIBS"
-save_LDFLAGS="$LDFLAGS"
LIBS=
-LDFLAGS="$LDFLAGS $CAP_LDFLAGS"
AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
CAP_LIBS="$LIBS"
AC_SUBST(CAP_LIBS)
-AC_SUBST(CAP_LDFLAGS)
-LIBS="$save_LIBS"
-LDFLAGS="$save_LDFLAGS"
AC_CHECK_FUNCS([memfd_create])
AC_CHECK_FUNCS([__secure_getenv secure_getenv])
-AC_CHECK_DECLS([gettid, pivot_root, name_to_handle_at, setns, getrandom, renameat2, kcmp, LO_FLAGS_PARTSCAN],
+AC_CHECK_DECLS([gettid, pivot_root, name_to_handle_at, setns, getrandom, renameat2, kcmp, keyctl, key_serial_t, LO_FLAGS_PARTSCAN],
[], [], [[
#include <sys/types.h>
#include <unistd.h>
@@ -352,11 +352,11 @@ AC_CHECK_DECLS([IFLA_INET6_ADDR_GEN_MODE,
IFLA_BOND_AD_INFO,
IFLA_VLAN_PROTOCOL,
IFLA_VXLAN_REMCSUM_NOPARTIAL,
- IFLA_VXLAN_LOCAL6,
IFLA_IPTUN_ENCAP_DPORT,
IFLA_GRE_ENCAP_DPORT,
IFLA_BRIDGE_VLAN_INFO,
IFLA_BRPORT_LEARNING_SYNC,
+ IFLA_BR_PRIORITY,
NDA_IFINDEX,
IFA_FLAGS],
[], [], [[
@@ -522,12 +522,17 @@ if test "x${have_smack}" = xauto; then
have_smack=yes
fi
+have_smack_run_label=no
AC_ARG_WITH(smack-run-label,
AS_HELP_STRING([--with-smack-run-label=STRING],
- [run elogind --system itself with a specific SMACK label]),
- [AC_DEFINE_UNQUOTED(SMACK_RUN_LABEL, ["$withval"], [Run elogind itself with SMACK label])],
+ [run systemd --system itself with a specific SMACK label]),
+ [AC_DEFINE_UNQUOTED(SMACK_RUN_LABEL, ["$withval"], [Run systemd itself with SMACK label]) have_smack_run_label=yes],
[])
+if test "x${have_smack_run_label}" = xyes; then
+ M4_DEFINES="$M4_DEFINES -DHAVE_SMACK_RUN_LABEL"
+fi
+
AC_ARG_WITH(smack-default-process-label,
AS_HELP_STRING([--with-smack-default-process-label=STRING],
[default SMACK label for executed processes]),
@@ -583,11 +588,6 @@ AM_CONDITIONAL(ENABLE_KDBUS, [test "$have_kdbus" = "yes"])
AC_CHECK_HEADERS_ONCE([valgrind/memcheck.h valgrind/valgrind.h])
# ------------------------------------------------------------------------------
-PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0 gio-2.0],
- [have_glib=yes], [have_glib=no])
-AS_IF([test "x$have_glib" = "xyes"], [ AC_DEFINE(HAVE_GLIB, 1, [Define if glib is available]) ])
-
-# ------------------------------------------------------------------------------
have_manpages=no
AC_ARG_ENABLE(manpages, AS_HELP_STRING([--disable-manpages], [disable manpages]))
AS_IF([test "x$enable_manpages" != xno], [have_manpages=yes])
diff --git a/m4/attributes.m4 b/m4/attributes.m4
index 97f094b07..4b0fcdce3 100644
--- a/m4/attributes.m4
+++ b/m4/attributes.m4
@@ -54,8 +54,8 @@ AC_DEFUN([CC_CHECK_FLAG_APPEND], [
dnl CC_CHECK_FLAGS_APPEND([WHERE-TO-APPEND], [ENV-VAR], [FLAG1 FLAG2])
AC_DEFUN([CC_CHECK_FLAGS_APPEND], [
- for flag in $3; do
- CC_CHECK_FLAG_APPEND($1, $2, $flag)
+ for flag in [$3]; do
+ CC_CHECK_FLAG_APPEND([$1], [$2], $flag)
done
])
diff --git a/man/Makefile b/man/Makefile
index 1bc1831e9..bd1047548 100644..120000
--- a/man/Makefile
+++ b/man/Makefile
@@ -1,28 +1 @@
-# This file is part of elogind.
-#
-# Copyright 2010 Lennart Poettering
-#
-# elogind is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2.1 of the License, or
-# (at your option) any later version.
-#
-# elogind 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 elogind; If not, see <http://www.gnu.org/licenses/>.
-
-# This file is a dirty trick to simplify compilation from within
-# emacs. This file is not intended to be distributed. So, don't touch
-# it, even better ignore it!
-
-all:
- $(MAKE) -C ..
-
-clean:
- $(MAKE) -C .. clean
-
-.PHONY: all clean
+../src/Makefile \ No newline at end of file
diff --git a/man/loginctl.xml b/man/loginctl.xml
index 45b0cf312..42485a498 100644
--- a/man/loginctl.xml
+++ b/man/loginctl.xml
@@ -62,8 +62,7 @@
<para><command>loginctl</command> may be used to introspect and
control the state of the
<citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>1</manvolnum></citerefentry>
- login manager
- <citerefentry><refentrytitle>logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
+ login manager.</para>
</refsect1>
<refsect1>
@@ -406,7 +405,6 @@
<para>
<citerefentry><refentrytitle>elogind</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>
</para>
</refsect1>
diff --git a/po/LINGUAS b/po/LINGUAS
index 859d2383a..93c5c5302 100644
--- a/po/LINGUAS
+++ b/po/LINGUAS
@@ -1,14 +1,18 @@
de
el
fr
+gl
hu
it
+ko
pl
pt_BR
ru
uk
sv
+sr
es
zh_TW
be
be@latin
+tr
diff --git a/po/POTFILES.in b/po/POTFILES.in
index ffb5c0b5f..f33c53fb4 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1 +1,8 @@
+src/core/org.freedesktop.systemd1.policy.in.in
+src/hostname/org.freedesktop.hostname1.policy.in
+src/import/org.freedesktop.import1.policy.in
+src/locale/org.freedesktop.locale1.policy.in
src/login/org.freedesktop.login1.policy.in
+src/machine/org.freedesktop.machine1.policy.in
+src/timedate/org.freedesktop.timedate1.policy.in
+src/core/dbus-unit.c
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
new file mode 100644
index 000000000..51254ec53
--- /dev/null
+++ b/po/POTFILES.skip
@@ -0,0 +1,21 @@
+src/core/dbus-automount.c
+src/core/dbus-device.c
+src/core/dbus-job.c
+src/core/dbus-manager.c
+src/core/dbus-mount.c
+src/core/dbus-path.c
+src/core/dbus-service.c
+src/core/dbus-slice.c
+src/core/dbus-snapshot.c
+src/core/dbus-socket.c
+src/core/dbus-swap.c
+src/core/dbus-target.c
+src/core/dbus-timer.c
+src/core/dbus-unit.c
+src/core/dbus-scope.c
+src/hostname/hostnamed.c
+src/locale/localed.c
+src/core/org.freedesktop.systemd1.policy.in
+src/timedate/timedated.c
+units/user@.service.in
+units/debug-shell.service.in
diff --git a/po/be.po b/po/be.po
index 6e5661f03..d682f3202 100644
--- a/po/be.po
+++ b/po/be.po
@@ -2,14 +2,14 @@
# Copyright (C) 2015 systemd's COPYRIGHT HOLDER
# This file is distributed under the same license as the systemd package.
#
-# Viktar VaÅ­ÄkieviÄ <victorenator@gmail.com>, 2015.
#
+# Viktar VaÅ­ÄkieviÄ <victorenator@gmail.com>, 2015.
msgid ""
msgstr ""
"Project-Id-Version: systemd master\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-06-18 00:53+0200\n"
-"PO-Revision-Date: 2015-06-14 11:17+0300\n"
+"POT-Creation-Date: 2015-09-12 13:42+0300\n"
+"PO-Revision-Date: 2015-09-12 16:25+0300\n"
"Last-Translator: Viktar VaÅ­ÄkieviÄ <victorenator@gmail.com>\n"
"Language-Team: \n"
"Language: be\n"
@@ -18,7 +18,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
-"X-Generator: Lokalize 1.5\n"
+"X-Generator: Lokalize 2.0\n"
#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:1
msgid "Send passphrase back to system"
@@ -369,7 +369,7 @@ msgstr ""
#: ../src/login/org.freedesktop.login1.policy.in.h:43
msgid "Hibernate the system"
-msgstr "Гіберніраваць ÑÑ–ÑÑ‚Ñму"
+msgstr "Гібернаваць ÑÑ–ÑÑ‚Ñму"
#: ../src/login/org.freedesktop.login1.policy.in.h:44
msgid "Authentication is required for hibernating the system."
@@ -377,7 +377,7 @@ msgstr "Ðеабходна аўтÑÐ½Ñ‚Ñ‹Ñ„Ñ–ÐºÐ°Ñ†Ñ‹Ñ Ð´Ð»Ñ Ð³Ñ–Ð±ÐµÑ€Ð½Ð°Ñ†Ñ
#: ../src/login/org.freedesktop.login1.policy.in.h:45
msgid "Hibernate the system while other users are logged in"
-msgstr "Гіберніраваць ÑÑ–ÑÑ‚Ñму пры прыÑутнаÑці іншых карыÑтальнікаў"
+msgstr "Гібернаваць ÑÑ–ÑÑ‚Ñму пры прыÑутнаÑці іншых карыÑтальнікаў"
#: ../src/login/org.freedesktop.login1.policy.in.h:46
msgid ""
@@ -389,7 +389,7 @@ msgstr ""
#: ../src/login/org.freedesktop.login1.policy.in.h:47
msgid "Hibernate the system while an application asked to inhibit it"
-msgstr "Гіберніраваць ÑÑ–ÑÑ‚Ñму, калі праграмы перашкаджаюць гÑтаму"
+msgstr "Гібернаваць ÑÑ–ÑÑ‚Ñму, калі праграмы перашкаджаюць гÑтаму"
#: ../src/login/org.freedesktop.login1.policy.in.h:48
msgid ""
@@ -412,7 +412,7 @@ msgstr ""
#: ../src/login/org.freedesktop.login1.policy.in.h:51
msgid "Lock or unlock active sessions"
-msgstr "Блакіраваць або разблакіраваць актыўную ÑеÑÑ–ÑŽ"
+msgstr "Блакаваць або разблакаваць актыўную ÑеÑÑ–ÑŽ"
#: ../src/login/org.freedesktop.login1.policy.in.h:52
msgid "Authentication is required to lock or unlock active sessions."
@@ -430,6 +430,14 @@ msgid ""
msgstr ""
"Ðеабходна аўтÑÐ½Ñ‚Ñ‹Ñ„Ñ–ÐºÐ°Ñ†Ñ‹Ñ Ð´Ð»Ñ ÑžÐºÐ°Ð·Ð°Ð½Ð½Ñ Ð¿Ñ€Ð°ÑˆÑ‹ÑžÑ†Ñ‹ на загрузку інтÑрфейÑу налад."
+#: ../src/login/org.freedesktop.login1.policy.in.h:55
+msgid "Set a wall message"
+msgstr "УÑталÑваць уÑеагульнае паведамленне"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:56
+msgid "Authentication is required to set a wall message"
+msgstr "Ðеабходна аўтÑÐ½Ñ‚Ñ‹Ñ„Ñ–ÐºÐ°Ñ†Ñ‹Ñ Ð´Ð»Ñ ÑžÑталÑÐ²Ð°Ð½Ð½Ñ ÑƒÑеагульнага паведамленнÑ."
+
#: ../src/machine/org.freedesktop.machine1.policy.in.h:1
msgid "Log into a local container"
msgstr "УвайÑці Ñž лакальны кантÑйнер"
@@ -439,21 +447,64 @@ msgid "Authentication is required to log into a local container."
msgstr "Ðеабходна аўтÑÐ½Ñ‚Ñ‹Ñ„Ñ–ÐºÐ°Ñ†Ñ‹Ñ Ð´Ð»Ñ ÑžÐ²Ð°Ñ…Ð¾Ð´Ñƒ Ñž лакальны кантÑйнер."
#: ../src/machine/org.freedesktop.machine1.policy.in.h:3
+msgid "Log into the local host"
+msgstr "УвайÑці Ñž лакальны вузел"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:4
+msgid "Authentication is required to log into the local host."
+msgstr "Ðеабходна аўтÑÐ½Ñ‚Ñ‹Ñ„Ñ–ÐºÐ°Ñ†Ñ‹Ñ Ð´Ð»Ñ ÑžÐ²Ð°Ñ…Ð¾Ð´Ñƒ Ñž лакальны вузел."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:5
+msgid "Acquire a shell in a local container"
+msgstr "Ðтрымаць абалонку на лакальным кантÑйнеры"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:6
+msgid "Authentication is required to acquire a shell in a local container."
+msgstr ""
+"Ðеабходна аўтÑÐ½Ñ‚Ñ‹Ñ„Ñ–ÐºÐ°Ñ†Ñ‹Ñ Ð´Ð»Ñ Ð°Ñ‚Ñ€Ñ‹Ð¼Ð°Ð½Ð½Ñ Ð°Ð±Ð°Ð»Ð¾Ð½ÐºÑ– на лакальным кантÑйнеры."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:7
+msgid "Acquire a shell on the local host"
+msgstr "Ðтрымаць абалонку на лакальным вузле"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:8
+msgid "Authentication is required to acquire a shell on the local host."
+msgstr "Ðеабходна аўтÑÐ½Ñ‚Ñ‹Ñ„Ñ–ÐºÐ°Ñ†Ñ‹Ñ Ð´Ð»Ñ Ð°Ñ‚Ñ€Ñ‹Ð¼Ð°Ð½Ð½Ñ Ð°Ð±Ð°Ð»Ð¾Ð½ÐºÑ– на лакальным вузле."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:9
+msgid "Acquire a pseudo TTY in a local container"
+msgstr "Ðтрымаць пÑеўда TTY на лакальным кантÑйнеры"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:10
+msgid ""
+"Authentication is required to acquire a pseudo TTY in a local container."
+msgstr ""
+"Ðеабходна аўтÑÐ½Ñ‚Ñ‹Ñ„Ñ–ÐºÐ°Ñ†Ñ‹Ñ Ð´Ð»Ñ Ð°Ñ‚Ñ€Ñ‹Ð¼Ð°Ð½Ð½Ñ Ð¿Ñеўда TTY на лакальным кантÑйнеры."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:11
+msgid "Acquire a pseudo TTY on the local host"
+msgstr "Ðтрымаць пÑеўда TTY на лакальным вузле"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:12
+msgid "Authentication is required to acquire a pseudo TTY on the local host."
+msgstr "Ðеабходна аўтÑÐ½Ñ‚Ñ‹Ñ„Ñ–ÐºÐ°Ñ†Ñ‹Ñ Ð´Ð»Ñ Ð°Ñ‚Ñ€Ñ‹Ð¼Ð°Ð½Ð½Ñ Ð¿Ñеўда TTY на лакальным вузле."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:13
msgid "Manage local virtual machines and containers"
msgstr "Кіраваць лакальнымі віртуальнымі машынамі або кантÑйнерамі"
-#: ../src/machine/org.freedesktop.machine1.policy.in.h:4
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:14
msgid ""
"Authentication is required to manage local virtual machines and containers."
msgstr ""
"Ðеабходна аўтÑÐ½Ñ‚Ñ‹Ñ„Ñ–ÐºÐ°Ñ†Ñ‹Ñ Ð´Ð»Ñ ÐºÑ–Ñ€Ð°Ð²Ð°Ð½Ð½Ñ Ð»Ð°ÐºÐ°Ð»ÑŒÐ½Ñ‹Ð¼Ñ– віртуальнымі машынамі Ñ– "
"кантÑйнерамі."
-#: ../src/machine/org.freedesktop.machine1.policy.in.h:5
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:15
msgid "Manage local virtual machine and container images"
msgstr "Кіраваць вобразамі лакальных віртуальных машын Ñ– кантÑйнераў"
-#: ../src/machine/org.freedesktop.machine1.policy.in.h:6
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:16
msgid ""
"Authentication is required to manage local virtual machine and container "
"images."
@@ -500,3 +551,31 @@ msgid ""
msgstr ""
"Ðеабходна аўтÑÐ½Ñ‚Ñ‹Ñ„Ñ–ÐºÐ°Ñ†Ñ‹Ñ Ð´Ð»Ñ ÑžÐºÐ»ÑŽÑ‡ÑÐ½Ð½Ñ Ð°Ð±Ð¾ выключÑÐ½Ð½Ñ Ñінхранізацыі чаÑу па "
"Ñетцы."
+
+#: ../src/core/dbus-unit.c:428
+msgid "Authentication is required to start '$(unit)'."
+msgstr "Ðеабходна аўтÑÐ½Ñ‚Ñ‹Ñ„Ñ–ÐºÐ°Ñ†Ñ‹Ñ Ð´Ð»Ñ Ð·Ð°Ð¿ÑƒÑку '$(unit)'."
+
+#: ../src/core/dbus-unit.c:429
+msgid "Authentication is required to stop '$(unit)'."
+msgstr "Ðеабходна аўтÑÐ½Ñ‚Ñ‹Ñ„Ñ–ÐºÐ°Ñ†Ñ‹Ñ Ð´Ð»Ñ ."
+
+#: ../src/core/dbus-unit.c:430
+msgid "Authentication is required to reload '$(unit)'."
+msgstr "Ðеабходна аўтÑÐ½Ñ‚Ñ‹Ñ„Ñ–ÐºÐ°Ñ†Ñ‹Ñ Ð´Ð»Ñ Ð¿ÐµÑ€Ð°Ñ‡Ñ‹Ñ‚Ð°Ð½Ð½Ñ Ñтану '$(unit)'."
+
+#: ../src/core/dbus-unit.c:431 ../src/core/dbus-unit.c:432
+msgid "Authentication is required to restart '$(unit)'."
+msgstr "Ðеабходна аўтÑÐ½Ñ‚Ñ‹Ñ„Ñ–ÐºÐ°Ñ†Ñ‹Ñ Ð´Ð»Ñ Ð¿ÐµÑ€Ð°Ð·Ð°Ð¿ÑƒÑку '$(unit)'."
+
+#: ../src/core/dbus-unit.c:535
+msgid "Authentication is required to kill '$(unit)'."
+msgstr "Ðеабходна аўтÑÐ½Ñ‚Ñ‹Ñ„Ñ–ÐºÐ°Ñ†Ñ‹Ñ Ð´Ð»Ñ Ð·Ð°Ð±Ð¾Ð¹Ñтва '$(unit)'."
+
+#: ../src/core/dbus-unit.c:565
+msgid "Authentication is required to reset the \"failed\" state of '$(unit)'."
+msgstr "Ðеабходна аўтÑÐ½Ñ‚Ñ‹Ñ„Ñ–ÐºÐ°Ñ†Ñ‹Ñ Ð´Ð»Ñ Ð°Ð½ÑƒÐ»ÑÐ²Ð°Ð½Ð½Ñ Ð¿Ð°Ð¼Ñ‹Ð»ÐºÐ¾Ð²Ð°Ð³Ð° Ñтану '$(unit)'."
+
+#: ../src/core/dbus-unit.c:597
+msgid "Authentication is required to set properties on '$(unit)'."
+msgstr "Ðеабходна аўтÑÐ½Ñ‚Ñ‹Ñ„Ñ–ÐºÐ°Ñ†Ñ‹Ñ Ð´Ð»Ñ ÑžÑталÑÐ²Ð°Ð½Ð½Ñ ÑžÐ»Ð°ÑціваÑцей '$(unit)'."
diff --git a/po/be@latin.po b/po/be@latin.po
index a3a5cf6e4..15488b2c8 100644
--- a/po/be@latin.po
+++ b/po/be@latin.po
@@ -1,24 +1,24 @@
-# Belarusian Latin translation for systemd.
+# Belarusian translation for systemd.
# Copyright (C) 2015 systemd's COPYRIGHT HOLDER
# This file is distributed under the same license as the systemd package.
#
-# Viktar VaÅ­ÄkieviÄ <victorenator@gmail.com>, 2015.
#
+# Viktar VaÅ­ÄkieviÄ <victorenator@gmail.com>, 2015.
msgid ""
msgstr ""
"Project-Id-Version: systemd master\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-06-18 00:53+0200\n"
-"PO-Revision-Date: 2015-06-14 11:17+0300\n"
+"POT-Creation-Date: 2015-09-12 13:42+0300\n"
+"PO-Revision-Date: 2015-09-12 16:25+0300\n"
"Last-Translator: Viktar VaÅ­ÄkieviÄ <victorenator@gmail.com>\n"
"Language-Team: \n"
-"Language: be\n"
+"Language: be@latin\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
-"X-Generator: Lokalize 1.5\n"
+"X-Generator: Lokalize 2.0\n"
#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:1
msgid "Send passphrase back to system"
@@ -373,7 +373,7 @@ msgstr ""
#: ../src/login/org.freedesktop.login1.policy.in.h:43
msgid "Hibernate the system"
-msgstr "Hibierniravać sistemu"
+msgstr "Hibiernavać sistemu"
#: ../src/login/org.freedesktop.login1.policy.in.h:44
msgid "Authentication is required for hibernating the system."
@@ -381,7 +381,7 @@ msgstr "Nieabchodna aÅ­tentyfikacyja dlia hibiernacyi sistemy."
#: ../src/login/org.freedesktop.login1.policy.in.h:45
msgid "Hibernate the system while other users are logged in"
-msgstr "Hibierniravać sistemu pry prysutnasci inšych karystaĺnikaŭ"
+msgstr "Hibiernavać sistemu pry prysutnasci inšych karystaĺnikaŭ"
#: ../src/login/org.freedesktop.login1.policy.in.h:46
msgid ""
@@ -393,7 +393,7 @@ msgstr ""
#: ../src/login/org.freedesktop.login1.policy.in.h:47
msgid "Hibernate the system while an application asked to inhibit it"
-msgstr "Hibierniravać sistemu, kali prahramy pieraškadžajuć hetamu"
+msgstr "Hibiernavać sistemu, kali prahramy pieraškadžajuć hetamu"
#: ../src/login/org.freedesktop.login1.policy.in.h:48
msgid ""
@@ -416,7 +416,7 @@ msgstr ""
#: ../src/login/org.freedesktop.login1.policy.in.h:51
msgid "Lock or unlock active sessions"
-msgstr "Blakiravać abo razblakiravać aktyŭnuju siesiju"
+msgstr "Blakavać abo razblakavać aktyŭnuju siesiju"
#: ../src/login/org.freedesktop.login1.policy.in.h:52
msgid "Authentication is required to lock or unlock active sessions."
@@ -436,6 +436,15 @@ msgstr ""
"Nieabchodna aŭtentyfikacyja dlia ŭkazannia prašyŭcy na zahruzku interfiejsu "
"nalad."
+#: ../src/login/org.freedesktop.login1.policy.in.h:55
+msgid "Set a wall message"
+msgstr "Ustaliavać usieahuĺnaje paviedamliennie"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:56
+msgid "Authentication is required to set a wall message"
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia ŭstaliavannia usieahuĺnaha paviedamliennia."
+
#: ../src/machine/org.freedesktop.machine1.policy.in.h:1
msgid "Log into a local container"
msgstr "Uvajsci ŭ lakaĺny kantejnier"
@@ -445,21 +454,67 @@ msgid "Authentication is required to log into a local container."
msgstr "Nieabchodna aŭtentyfikacyja dlia ŭvachodu ŭ lakaĺny kantejnier."
#: ../src/machine/org.freedesktop.machine1.policy.in.h:3
+msgid "Log into the local host"
+msgstr "Uvajsci ŭ lakaĺny vuziel"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:4
+msgid "Authentication is required to log into the local host."
+msgstr "Nieabchodna aŭtentyfikacyja dlia ŭvachodu ŭ lakaĺny vuziel."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:5
+msgid "Acquire a shell in a local container"
+msgstr "Atrymać abalonku na lakaĺnym kantejniery"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:6
+msgid "Authentication is required to acquire a shell in a local container."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia atrymannia abalonki na lakaĺnym kantejniery."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:7
+msgid "Acquire a shell on the local host"
+msgstr "Atrymać abalonku na lakaĺnym vuzlie"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:8
+msgid "Authentication is required to acquire a shell on the local host."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia atrymannia abalonki na lakaĺnym vuzlie."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:9
+msgid "Acquire a pseudo TTY in a local container"
+msgstr "Atrymać psieŭda TTY na lakaĺnym kantejniery"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:10
+msgid ""
+"Authentication is required to acquire a pseudo TTY in a local container."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia atrymannia psieŭda TTY na lakaĺnym "
+"kantejniery."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:11
+msgid "Acquire a pseudo TTY on the local host"
+msgstr "Atrymać psieŭda TTY na lakaĺnym vuzlie"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:12
+msgid "Authentication is required to acquire a pseudo TTY on the local host."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia atrymannia psieŭda TTY na lakaĺnym vuzlie."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:13
msgid "Manage local virtual machines and containers"
msgstr "Kiravać lakaĺnymi virtuaĺnymi mašynami abo kantejnierami"
-#: ../src/machine/org.freedesktop.machine1.policy.in.h:4
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:14
msgid ""
"Authentication is required to manage local virtual machines and containers."
msgstr ""
"Nieabchodna aŭtentyfikacyja dlia kiravannia lakaĺnymi virtuaĺnymi mašynami i "
"kantejnierami."
-#: ../src/machine/org.freedesktop.machine1.policy.in.h:5
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:15
msgid "Manage local virtual machine and container images"
msgstr "Kiravać vobrazami lakaĺnych virtuaĺnych mašyn i kantejnieraŭ"
-#: ../src/machine/org.freedesktop.machine1.policy.in.h:6
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:16
msgid ""
"Authentication is required to manage local virtual machine and container "
"images."
@@ -507,3 +562,33 @@ msgid ""
msgstr ""
"Nieabchodna aÅ­tentyfikacyja dlia Å­kliuÄennia abo vykliuÄennia sinchranizacyi "
"Äasu pa sietcy."
+
+#: ../src/core/dbus-unit.c:428
+msgid "Authentication is required to start '$(unit)'."
+msgstr "Nieabchodna aÅ­tentyfikacyja dlia zapusku '$(unit)'."
+
+#: ../src/core/dbus-unit.c:429
+msgid "Authentication is required to stop '$(unit)'."
+msgstr "Nieabchodna aÅ­tentyfikacyja dlia ."
+
+#: ../src/core/dbus-unit.c:430
+msgid "Authentication is required to reload '$(unit)'."
+msgstr "Nieabchodna aÅ­tentyfikacyja dlia pieraÄytannia stanu '$(unit)'."
+
+#: ../src/core/dbus-unit.c:431 ../src/core/dbus-unit.c:432
+msgid "Authentication is required to restart '$(unit)'."
+msgstr "Nieabchodna aÅ­tentyfikacyja dlia pierazapusku '$(unit)'."
+
+#: ../src/core/dbus-unit.c:535
+msgid "Authentication is required to kill '$(unit)'."
+msgstr "Nieabchodna aÅ­tentyfikacyja dlia zabojstva '$(unit)'."
+
+#: ../src/core/dbus-unit.c:565
+msgid "Authentication is required to reset the \"failed\" state of '$(unit)'."
+msgstr ""
+"Nieabchodna aÅ­tentyfikacyja dlia anuliavannia pamylkovaha stanu '$(unit)'."
+
+#: ../src/core/dbus-unit.c:597
+msgid "Authentication is required to set properties on '$(unit)'."
+msgstr ""
+"Nieabchodna aÅ­tentyfikacyja dlia Å­staliavannia Å­lascivasciej '$(unit)'."
diff --git a/po/de.po b/po/de.po
index fa13d3434..72075e81f 100644
--- a/po/de.po
+++ b/po/de.po
@@ -1,23 +1,24 @@
# German translation for systemd.
# Copyright (C) 2014 systemd's COPYRIGHT HOLDER
# This file is distributed under the same license as the systemd package.
-# Christian Kirbach <Christian.Kirbach@gmail.com>, 2014.
+# Christian Kirbach <Christian.Kirbach@gmail.com>, 2014, 2015.
# Benjamin Steinwender <b@stbe.at>, 2014.
+# Bernd Homuth <dev@hmt.im>, 2015.
#
msgid ""
msgstr ""
"Project-Id-Version: systemd master\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-06-18 00:53+0200\n"
-"PO-Revision-Date: 2015-02-18 17:08+0100\n"
-"Last-Translator: Martin Pitt <martin.pitt@ubuntu.com>\n"
-"Language-Team: German <gnome-de@gnome.org>\n"
+"Report-Msgid-Bugs-To: https://github.com/systemd/systemd/issues\n"
+"POT-Creation-Date: 2015-09-19 12:09+0000\n"
+"PO-Revision-Date: 2015-09-19 20:02+0200\n"
+"Last-Translator: Bernd Homuth <dev@hmt.im>\n"
+"Language-Team: Deutsch <gnome-de@gnome.org>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-"X-Generator: Poedit 1.5.4\n"
+"X-Generator: Gtranslator 2.91.6\n"
#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:1
msgid "Send passphrase back to system"
@@ -31,16 +32,14 @@ msgstr ""
"notwendig."
#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:3
-#, fuzzy
msgid "Manage system services or other units"
-msgstr "Systemdienste und Einheiten verwalten"
+msgstr "Systemdienste und andere Einheiten verwalten"
#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:4
-#, fuzzy
msgid "Authentication is required to manage system services or other units."
msgstr ""
"Legitimierung ist notwendig für die Verwaltung von Systemdiensten und "
-"Einheiten"
+"anderen Einheiten."
#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:5
msgid "Manage system service or unit files"
@@ -53,18 +52,15 @@ msgstr ""
"Einheitendateien."
#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:7
-#, fuzzy
msgid "Set or unset system and service manager environment variables"
-msgstr "Privilegierter Zugriff auf die System- und Dienstverwaltung"
+msgstr ""
+"Umgebungsvariablen der System- und Dienstverwaltung festlegen oder entfernen"
#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:8
-#, fuzzy
msgid ""
"Authentication is required to set or unset system and service manager "
"environment variables."
-msgstr ""
-"Legitimierung ist notwendig für die Verwaltung von Systemdiensten und "
-"Einheitendateien."
+msgstr "Legitimierung ist notwendig für die System- und Dienstverwaltung."
#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:9
msgid "Reload the systemd state"
@@ -105,27 +101,23 @@ msgstr ""
"erforderlich."
#: ../src/import/org.freedesktop.import1.policy.in.h:1
-#, fuzzy
msgid "Import a VM or container image"
-msgstr "Abbild einer VM oder eines Containers herunterladen"
+msgstr "Abbild einer VM oder eines Containers importieren"
#: ../src/import/org.freedesktop.import1.policy.in.h:2
-#, fuzzy
msgid "Authentication is required to import a VM or container image"
msgstr ""
-"Legitimierung ist zum Herunterladen eines VM- oder Containerabbilds "
+"Legitimierung ist zum Importieren eines VM- oder Containerabbilds "
"erforderlich"
#: ../src/import/org.freedesktop.import1.policy.in.h:3
-#, fuzzy
msgid "Export a VM or container image"
-msgstr "Abbild einer VM oder eines Containers herunterladen"
+msgstr "Abbild einer VM oder eines Containers exportieren"
#: ../src/import/org.freedesktop.import1.policy.in.h:4
-#, fuzzy
msgid "Authentication is required to export a VM or container image"
msgstr ""
-"Legitimierung ist zum Herunterladen eines VM- oder Containerabbilds "
+"Legitimierung ist zum Exportieren eines VM- oder Containerabbilds "
"erforderlich"
#: ../src/import/org.freedesktop.import1.policy.in.h:5
@@ -441,70 +433,125 @@ msgstr ""
#: ../src/login/org.freedesktop.login1.policy.in.h:49
msgid "Manage active sessions, users and seats"
-msgstr ""
+msgstr "Aktive Sitzungen, Benutzer und Arbeitsstationen verwalten"
# www.freedesktop.org/wiki/Software/systemd/multiseat/
#: ../src/login/org.freedesktop.login1.policy.in.h:50
-#, fuzzy
msgid ""
"Authentication is required for managing active sessions, users and seats."
msgstr ""
-"Legitimierung ist zum Anschließen eines Geräts an eine Arbeitsstation "
-"notwendig."
+"Legitimierung ist zur Verwaltung aktiver Sitzungen, Benutzern und "
+"Arbeitsstationen notwendig."
#: ../src/login/org.freedesktop.login1.policy.in.h:51
msgid "Lock or unlock active sessions"
-msgstr ""
+msgstr "Aktive Sitzungen sperren und entsperren"
#: ../src/login/org.freedesktop.login1.policy.in.h:52
-#, fuzzy
msgid "Authentication is required to lock or unlock active sessions."
-msgstr "Legitimierung ist zum Anmelden in einem lokalen Container notwendig"
+msgstr ""
+"Legitimierung ist zum Sperren und Entsperren aktiver Sitzungen notwendig."
#: ../src/login/org.freedesktop.login1.policy.in.h:53
msgid "Allow indication to the firmware to boot to setup interface"
msgstr ""
+"Mitteilungen an die Firmware zum Starten in die Einrichtungsoberfläche "
+"zulassen"
#: ../src/login/org.freedesktop.login1.policy.in.h:54
-#, fuzzy
msgid ""
"Authentication is required to indicate to the firmware to boot to setup "
"interface."
-msgstr "Legitimierung ist zum Festlegen des lokalen Rechnernamens notwendig"
+msgstr ""
+"Legitimierung ist zum Starten der Firmware in die Einrichtungsoberfläche "
+"notwendig."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:55
+msgid "Set a wall message"
+msgstr "Nachricht an alle einstellen"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:56
+msgid "Authentication is required to set a wall message"
+msgstr "Legitimierung ist zum Einstellen einer Nachricht an alle notwendig"
#: ../src/machine/org.freedesktop.machine1.policy.in.h:1
msgid "Log into a local container"
msgstr "In einem lokalen Container anmelden"
#: ../src/machine/org.freedesktop.machine1.policy.in.h:2
-#, fuzzy
msgid "Authentication is required to log into a local container."
-msgstr "Legitimierung ist zum Anmelden in einem lokalen Container notwendig"
+msgstr "Legitimierung ist zum Anmelden in einem lokalen Container notwendig."
#: ../src/machine/org.freedesktop.machine1.policy.in.h:3
-msgid "Manage local virtual machines and containers"
-msgstr ""
+msgid "Log into the local host"
+msgstr "Am lokalen Rechner anmelden"
#: ../src/machine/org.freedesktop.machine1.policy.in.h:4
-#, fuzzy
+msgid "Authentication is required to log into the local host."
+msgstr "Legitimierung ist zum Anmelden am lokalen Rechner notwendig."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:5
+msgid "Acquire a shell in a local container"
+msgstr "Eine Shell in einem lokalen Container erhalten"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:6
+msgid "Authentication is required to acquire a shell in a local container."
+msgstr ""
+"Legitimierung ist zum Erhalten einer Shell in einem lokalen Container "
+"notwendig."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:7
+msgid "Acquire a shell on the local host"
+msgstr "Eine Shell auf dem lokalen Rechner erhalten"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:8
+msgid "Authentication is required to acquire a shell on the local host."
+msgstr ""
+"Legitimierung ist zum Erhalten einer Shell auf dem lokalen Rechner notwendig."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:9
+msgid "Acquire a pseudo TTY in a local container"
+msgstr "Ein Pseudo-TTY in einem lokalen Container erhalten"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:10
+msgid ""
+"Authentication is required to acquire a pseudo TTY in a local container."
+msgstr ""
+"Legitimierung ist zum Erhalten eines Pseudo-TTY in einem lokalen Container "
+"notwendig."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:11
+msgid "Acquire a pseudo TTY on the local host"
+msgstr "Ein Pseudo-TTY auf dem lokalen Rechner erhalten"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:12
+msgid "Authentication is required to acquire a pseudo TTY on the local host."
+msgstr ""
+"Legitimierung ist zum Erhalten eines Pseudo-TTY auf dem lokalen Rechner "
+"notwendig."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:13
+msgid "Manage local virtual machines and containers"
+msgstr "Lokale virtuelle Maschinen und Container verwalten"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:14
msgid ""
"Authentication is required to manage local virtual machines and containers."
msgstr ""
-"Legitimierung ist zum Festlegen der lokalen Maschinen-Information "
+"Legitimierung ist zum Verwalten lokaler virtueller Maschinen und Container "
"erforderlich."
-#: ../src/machine/org.freedesktop.machine1.policy.in.h:5
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:15
msgid "Manage local virtual machine and container images"
-msgstr ""
+msgstr "Lokale virtuelle Maschinen und Containerabbilder verwalten"
-#: ../src/machine/org.freedesktop.machine1.policy.in.h:6
-#, fuzzy
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:16
msgid ""
"Authentication is required to manage local virtual machine and container "
"images."
msgstr ""
-"Legitimierung ist zum Herunterladen eines VM- oder Containerabbilds "
-"erforderlich"
+"Legitimierung ist zum Verwalten lokaler virtueller Maschinen und "
+"Containerabbildern erforderlich."
#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:1
msgid "Set system time"
@@ -546,6 +593,37 @@ msgstr ""
"Legitimierung ist zum Festlegen, ob Netzwerkzeitabgeich eingeschaltet sein "
"soll, erforderlich."
+#: ../src/core/dbus-unit.c:428
+msgid "Authentication is required to start '$(unit)'."
+msgstr "Legitimierung ist zum Starten von »$(unit)« notwendig."
+
+#: ../src/core/dbus-unit.c:429
+msgid "Authentication is required to stop '$(unit)'."
+msgstr "Legitimierung ist zum Stoppen von »$(unit)« notwendig."
+
+#: ../src/core/dbus-unit.c:430
+msgid "Authentication is required to reload '$(unit)'."
+msgstr "Legitimierung ist zum erneuten Laden von »$(unit)« notwendig."
+
+#: ../src/core/dbus-unit.c:431 ../src/core/dbus-unit.c:432
+msgid "Authentication is required to restart '$(unit)'."
+msgstr "Legitimierung ist zum Neustarten von »$(unit)« notwendig."
+
+#: ../src/core/dbus-unit.c:535
+msgid "Authentication is required to kill '$(unit)'."
+msgstr "Legitimierung ist zum Eliminieren von »$(unit)« notwendig."
+
+#: ../src/core/dbus-unit.c:565
+msgid "Authentication is required to reset the \"failed\" state of '$(unit)'."
+msgstr ""
+"Legitimierung ist zum Zurücksetzen des Status »fehlgeschlagen« von »$(unit)« "
+"notwendig"
+
+#: ../src/core/dbus-unit.c:597
+msgid "Authentication is required to set properties on '$(unit)'."
+msgstr ""
+"Legitimierung ist zum Festlegen der Eigenschaften von »$(unit)« notwendig."
+
#~ msgid "Press Ctrl+C to cancel all filesystem checks in progress"
#~ msgstr "Strl+C drücken um laufende Dateisystem-Prüfungen abzubrechen"
diff --git a/po/fr.po b/po/fr.po
index 8b9f16db5..96cdc7e77 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: systemd\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-06-18 00:53+0200\n"
+"POT-Creation-Date: 2015-09-21 20:11+0200\n"
"PO-Revision-Date: 2014-12-28 13:04+0100\n"
"Last-Translator: Sylvain Plantefève <sylvain.plantefeve@gmail.com>\n"
"Language-Team: French\n"
@@ -200,7 +200,7 @@ msgstr ""
#: ../src/login/org.freedesktop.login1.policy.in.h:11
msgid "Allow applications to inhibit system handling of the power key"
msgstr ""
-"Permet aux applications d'empêcher la gestion du bouton d'alimentation du "
+"Permet aux applications d'empêcher la gestion du bouton d'alimentation du "
"système"
#: ../src/login/org.freedesktop.login1.policy.in.h:12
@@ -344,8 +344,8 @@ msgid ""
"Authentication is required for rebooting the system while an application "
"asked to inhibit it."
msgstr ""
-"Authentification requise pour redémarrer le système alors qu'une "
-"application a demandé de l'empêcher."
+"Authentification requise pour redémarrer le système alors qu'une application "
+"a demandé de l'empêcher."
#: ../src/login/org.freedesktop.login1.policy.in.h:37
msgid "Suspend the system"
@@ -452,6 +452,14 @@ msgstr ""
"Authentification requise pour indiquer au micrologiciel de démarrer sur "
"l'interface de configuration."
+#: ../src/login/org.freedesktop.login1.policy.in.h:55
+msgid "Set a wall message"
+msgstr "Définir un message wall"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:56
+msgid "Authentication is required to set a wall message"
+msgstr "Authentification requise pour définir un message wall."
+
#: ../src/machine/org.freedesktop.machine1.policy.in.h:1
msgid "Log into a local container"
msgstr "Connexion dans un conteneur local"
@@ -462,21 +470,68 @@ msgstr ""
"Authentification requise pour permettre la connexion dans un conteneur local."
#: ../src/machine/org.freedesktop.machine1.policy.in.h:3
+msgid "Log into the local host"
+msgstr "Connexion à l'hôte local"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:4
+msgid "Authentication is required to log into the local host."
+msgstr "Authentification requise pour permettre la connexion à l'hôte local."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:5
+msgid "Acquire a shell in a local container"
+msgstr "Obtenir une interface système dans un conteneur local"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:6
+msgid "Authentication is required to acquire a shell in a local container."
+msgstr ""
+"Authentification requise pour obtenir une interface système dans un "
+"conteneur local."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:7
+msgid "Acquire a shell on the local host"
+msgstr "Obtenir une interface système sur l'hôte local"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:8
+msgid "Authentication is required to acquire a shell on the local host."
+msgstr ""
+"Authentification requise pour obtenir une interface système sur l'hôte local."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:9
+msgid "Acquire a pseudo TTY in a local container"
+msgstr "Obtenir un pseudo terminal dans un conteneur local"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:10
+msgid ""
+"Authentication is required to acquire a pseudo TTY in a local container."
+msgstr ""
+"Authentification requise pour obtenir un pseudo terminal dans un conteneur "
+"local."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:11
+msgid "Acquire a pseudo TTY on the local host"
+msgstr "Obtenir un pseudo terminal sur l'hôte local"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:12
+msgid "Authentication is required to acquire a pseudo TTY on the local host."
+msgstr ""
+"Authentification requise pour obtenir un pseudo terminal sur l'hôte local."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:13
msgid "Manage local virtual machines and containers"
msgstr "Gérer les machines virtuelles (VM) et conteneurs locaux"
-#: ../src/machine/org.freedesktop.machine1.policy.in.h:4
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:14
msgid ""
"Authentication is required to manage local virtual machines and containers."
msgstr ""
"Authentification requise pour gérer les machines virtuelles (VM) et les "
"conteneurs locaux."
-#: ../src/machine/org.freedesktop.machine1.policy.in.h:5
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:15
msgid "Manage local virtual machine and container images"
msgstr "Gérer les images locales de machines virtuelles (VM) et de conteneurs"
-#: ../src/machine/org.freedesktop.machine1.policy.in.h:6
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:16
msgid ""
"Authentication is required to manage local virtual machine and container "
"images."
@@ -526,6 +581,36 @@ msgstr ""
"Authentification requise pour activer ou désactiver la synchronisation de "
"l'heure avec le réseau."
+#: ../src/core/dbus-unit.c:428
+msgid "Authentication is required to start '$(unit)'."
+msgstr "Authentification requise pour démarrer « $(unit) »."
+
+#: ../src/core/dbus-unit.c:429
+msgid "Authentication is required to stop '$(unit)'."
+msgstr "Authentification requise pour arrêter « $(unit) »."
+
+#: ../src/core/dbus-unit.c:430
+msgid "Authentication is required to reload '$(unit)'."
+msgstr "Authentification requise pour recharger « $(unit) »."
+
+#: ../src/core/dbus-unit.c:431 ../src/core/dbus-unit.c:432
+msgid "Authentication is required to restart '$(unit)'."
+msgstr "Authentification requise pour redémarrer « $(unit) »."
+
+#: ../src/core/dbus-unit.c:535
+msgid "Authentication is required to kill '$(unit)'."
+msgstr "Authentification requise pour tuer « $(unit) »."
+
+#: ../src/core/dbus-unit.c:565
+msgid "Authentication is required to reset the \"failed\" state of '$(unit)'."
+msgstr ""
+"Authentification requise pour réinitialiser l'état d'« échec » de "
+"« $(unit) »."
+
+#: ../src/core/dbus-unit.c:597
+msgid "Authentication is required to set properties on '$(unit)'."
+msgstr "Authentification requise pour définir des propriétés de « $(unit) »."
+
#~ msgid "Press Ctrl+C to cancel all filesystem checks in progress"
#~ msgstr ""
#~ "Appuyez sur Ctrl+C pour annuler toutes vérifications en cours du système "
diff --git a/po/gl.po b/po/gl.po
new file mode 100644
index 000000000..59d92e1f7
--- /dev/null
+++ b/po/gl.po
@@ -0,0 +1,584 @@
+# Copyright (C) 2015
+# This file is distributed under the same license as the systemd package.
+# Fran Dieguez <frandieguez@gnome.org>, 2015.
+msgid ""
+msgstr ""
+"Project-Id-Version: systemd\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-09-14 23:55+0200\n"
+"PO-Revision-Date: 2015-09-15 00:20+0200\n"
+"Last-Translator: Fran Dieguez <frandieguez@gnome.org>\n"
+"Language-Team: gnome-l10n-gl@gnome.org\n"
+"Language: gl\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Virtaal 0.7.1\n"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:1
+msgid "Send passphrase back to system"
+msgstr "Enviar frase de paso de volta ao sistema"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:2
+msgid ""
+"Authentication is required to send the entered passphrase back to the system."
+msgstr ""
+"Requírese autenticación para enviar a frase de paso escrita de volta ao "
+"sistema."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:3
+msgid "Manage system services or other units"
+msgstr "Xestionar os servizos do sistema ou outras unidades"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:4
+msgid "Authentication is required to manage system services or other units."
+msgstr ""
+"Requírese autenticación para xestionar os servizos do sistema ou outras "
+"unidades"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:5
+msgid "Manage system service or unit files"
+msgstr "Xestionar os servizos do sistema ou outros ficheiros"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:6
+msgid "Authentication is required to manage system service or unit files."
+msgstr ""
+"Requírese autenticación para xestionar os servizos do sistema ou outros "
+"ficheiros."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:7
+msgid "Set or unset system and service manager environment variables"
+msgstr ""
+"Estabelecer ou desestabelecer as variables de ambiente do sistema ou do "
+"xestor de servizos"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:8
+msgid ""
+"Authentication is required to set or unset system and service manager "
+"environment variables."
+msgstr ""
+"Requírese autenticación para estabelecer ou desestabelecer as variables de "
+"ambiente do sistema ou do xestor de servizos"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:9
+msgid "Reload the systemd state"
+msgstr "Recargar o estado de systemd"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:10
+msgid "Authentication is required to reload the systemd state."
+msgstr "Requírese autenticación para recargar o estado de systemd."
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:1
+msgid "Set host name"
+msgstr "Estabelecer o nome do equipo"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:2
+msgid "Authentication is required to set the local host name."
+msgstr "Requírese autenticación para estabelecer o nome local do equiupo."
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:3
+msgid "Set static host name"
+msgstr "Estabelecer o nome do equipo estático"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:4
+msgid ""
+"Authentication is required to set the statically configured local host name, "
+"as well as the pretty host name."
+msgstr ""
+"Requírese autenticación para estabelecer de forma o nome do equipo local "
+"estabelecido de forma estática, así como o nome do equipo lexíbel por "
+"persoas."
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:5
+msgid "Set machine information"
+msgstr "Estabelecer a información da máquina"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:6
+msgid "Authentication is required to set local machine information."
+msgstr "Requírese autenticación para estabelecer a información da máquina local"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:1
+msgid "Import a VM or container image"
+msgstr "Importar unha imaxe de MV ou contenedor"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:2
+msgid "Authentication is required to import a VM or container image"
+msgstr "Requírese autenticación para imporar unha imaxe de MV ou contenedor"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:3
+msgid "Export a VM or container image"
+msgstr "Exportar unha imaxe de MV ou contenedor"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:4
+msgid "Authentication is required to export a VM or container image"
+msgstr "Requírese autenticación para exportar unha imaxe de MV ou contenedor"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:5
+msgid "Download a VM or container image"
+msgstr "Descargar unha imaxe de MV ou contenedor"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:6
+msgid "Authentication is required to download a VM or container image"
+msgstr "Requírese autenticación para descargar unha imaxe de MV ou contenedor"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:1
+msgid "Set system locale"
+msgstr "Estabelecer a configuración rexional do sistema"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:2
+msgid "Authentication is required to set the system locale."
+msgstr ""
+"Requírese autenticación para estabelecer a configuración rexional do sistema"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:3
+msgid "Set system keyboard settings"
+msgstr "Estabelecer as preferencias do teclado do sistema"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:4
+msgid "Authentication is required to set the system keyboard settings."
+msgstr ""
+"Requírese autenticación para estabelecer as preferencias do teclado do "
+"sistema."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:1
+msgid "Allow applications to inhibit system shutdown"
+msgstr "Permitir aos aplicativos inhibit o apagado do sistema"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:2
+msgid ""
+"Authentication is required for an application to inhibit system shutdown."
+msgstr ""
+"Requírese autenticación para permitirlle a un aplicativo poida inhibir o "
+"apagado do sistema."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:3
+msgid "Allow applications to delay system shutdown"
+msgstr "Permitir aos aplicativos retrasar o apagado do sistema"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:4
+msgid "Authentication is required for an application to delay system shutdown."
+msgstr ""
+"Requírese autenticación para permitirlle a un aplicativo retrasar o apagado "
+"do sistema"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:5
+msgid "Allow applications to inhibit system sleep"
+msgstr "Permitir aos aplicativos inhibir a suspensión do sistema"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:6
+msgid "Authentication is required for an application to inhibit system sleep."
+msgstr ""
+"Requírese autenticación para permitirlle a un aplicativo inhibir a "
+"suspensión do sistema."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:7
+msgid "Allow applications to delay system sleep"
+msgstr "Permitir aos aplicativos retrasar a suspensión do sistema"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:8
+msgid "Authentication is required for an application to delay system sleep."
+msgstr ""
+"Requírese autenticación para permitirlle a un aplicativo retrasar a "
+"suspensión do sistema"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:9
+msgid "Allow applications to inhibit automatic system suspend"
+msgstr "Permitir aos aplicativos inhibir a suspensión automática do sistema"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:10
+msgid ""
+"Authentication is required for an application to inhibit automatic system "
+"suspend."
+msgstr ""
+"Requírese autenticación para permitirlle a un aplicativo inhibir a "
+"suspensión automática do sistema."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:11
+msgid "Allow applications to inhibit system handling of the power key"
+msgstr ""
+"Permitir aos aplicativos inhibir a xestión do sistema da tecla de acendido"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:12
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the power key."
+msgstr ""
+"Requírese autenticación para permitirlle a un aplicativo inhibir a xestión "
+"do sistema da tecla de acendido."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:13
+msgid "Allow applications to inhibit system handling of the suspend key"
+msgstr ""
+"Permitir aos aplicativos inhibir a xestión do sistema da tecla de suspensión"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:14
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the suspend key."
+msgstr ""
+"Requírese autenticación para permitirlle a un aplicativo inhibir a xestión "
+"do sistema da tecla de suspensión."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:15
+msgid "Allow applications to inhibit system handling of the hibernate key"
+msgstr ""
+"Permitir aos aplicativos inhibir a xestión do sistema da tecla de hibernado"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:16
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the hibernate key."
+msgstr ""
+"Requírese autenticación para permitirlle a un aplicativo inhibir a xestión "
+"do sistema da tecla de hibernado."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:17
+msgid "Allow applications to inhibit system handling of the lid switch"
+msgstr ""
+"Permitir aos aplicativos inhibir a xestión do sistema do interruptor da tapa."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:18
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the lid switch."
+msgstr ""
+"Requírese autenticación para permitirlle a un aplicativo inhibir a xestión "
+"do sistema do interruptor da tapa."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:19
+msgid "Allow non-logged-in users to run programs"
+msgstr "Permitirlle a usuarios sen unha sesión iniciada executar programas"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:20
+msgid "Authentication is required to run programs as a non-logged-in user."
+msgstr ""
+"Requírese autenticación para permitirlle executar programas a un usuario sen "
+"unha sesión iniciada."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:21
+msgid "Allow attaching devices to seats"
+msgstr "Permitir conectar anexar a asentos"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:22
+msgid "Authentication is required for attaching a device to a seat."
+msgstr "Requírese autenticación para anexar un dispositivo a un asento."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:23
+msgid "Flush device to seat attachments"
+msgstr "Reiniciar os anexos do dispositivo aos asentos"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:24
+msgid ""
+"Authentication is required for resetting how devices are attached to seats."
+msgstr ""
+"Requírese autenticación para reiniciar como os dispositivos están anexados "
+"aos asentos."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:25
+msgid "Power off the system"
+msgstr "Apagar o sistema"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:26
+msgid "Authentication is required for powering off the system."
+msgstr "Requírese autenticación para apagar o sistema."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:27
+msgid "Power off the system while other users are logged in"
+msgstr "Apagar o sistema mentres hai usuarios con unha sesión iniciada"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:28
+msgid ""
+"Authentication is required for powering off the system while other users are "
+"logged in."
+msgstr ""
+"Requírese autenticación para apagar o sistema mentres hai usuarios con unha "
+"sesión iniciada."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:29
+msgid "Power off the system while an application asked to inhibit it"
+msgstr "Apagar o sistema cando un aplicativo solicitou a súa inhibición"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:30
+msgid ""
+"Authentication is required for powering off the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Requírese autenticación para apagar o sistema mentres un aplicativo "
+"solicitou a súa inhibición."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:31
+msgid "Reboot the system"
+msgstr "Reiniciar o sistema"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:32
+msgid "Authentication is required for rebooting the system."
+msgstr "Requírese autenticación para reiniciar o sistema."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:33
+msgid "Reboot the system while other users are logged in"
+msgstr "Reiniciar o sistema mentres outros usuarios teñen unha sesión iniciada"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:34
+msgid ""
+"Authentication is required for rebooting the system while other users are "
+"logged in."
+msgstr ""
+"Requírese autenticación para reiniciar o sistema mentres outros usuarios "
+"teñen unha sesión iniciada."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:35
+msgid "Reboot the system while an application asked to inhibit it"
+msgstr "Reiniciar o sistema cando un aplicativo solicitou a súa inhibición"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:36
+msgid ""
+"Authentication is required for rebooting the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Requírese autenticación para reiniciar o sistema mentres un aplicativo "
+"solicitou a súa inhibición."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:37
+msgid "Suspend the system"
+msgstr "Suspender o sistema"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:38
+msgid "Authentication is required for suspending the system."
+msgstr "Requírese autenticación para suspender o sistema."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:39
+msgid "Suspend the system while other users are logged in"
+msgstr "Suspender o sistema mentres outros usuarios teñen unha sesión iniciada"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:40
+msgid ""
+"Authentication is required for suspending the system while other users are "
+"logged in."
+msgstr ""
+"Requírese autenticación para suspender o sistema mentres outros usuarios "
+"teñen unha sesión iniciada."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:41
+msgid "Suspend the system while an application asked to inhibit it"
+msgstr "Suspender o sistema cando un aplicativo solicitou a súa inhibición"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:42
+msgid ""
+"Authentication is required for suspending the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Requírese autenticación para suspender o sistema mentres un aplicativo "
+"solicitou a súa inhibición."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:43
+msgid "Hibernate the system"
+msgstr "Hibernar o sistema"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:44
+msgid "Authentication is required for hibernating the system."
+msgstr "Requírese autenticación para hibernar o sistema."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:45
+msgid "Hibernate the system while other users are logged in"
+msgstr "Hibernar o sistema mentres outros usuarios teñen unha sesión iniciada"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:46
+msgid ""
+"Authentication is required for hibernating the system while other users are "
+"logged in."
+msgstr ""
+"Requírese autenticación para hibernar o sistema mentres outros usuarios "
+"teñen unha sesión iniciada."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:47
+msgid "Hibernate the system while an application asked to inhibit it"
+msgstr "Hibernar o sistema cando un aplicativo solicitou a súa inhibición"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:48
+msgid ""
+"Authentication is required for hibernating the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Requírese autenticación para hibernar o sistema mentres un aplicativo "
+"solicitou a súa inhibición."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:49
+msgid "Manage active sessions, users and seats"
+msgstr "Xestionar as sesións, usuarios e asentos activos"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:50
+msgid ""
+"Authentication is required for managing active sessions, users and seats."
+msgstr ""
+"Requírese autenticación para xestionar as sesións, usuariso e asentos activos"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:51
+msgid "Lock or unlock active sessions"
+msgstr "Bloquear ou desbloquear sesión activas"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:52
+msgid "Authentication is required to lock or unlock active sessions."
+msgstr ""
+"Requírese autenticación para bloquear ou desbloquear as sesións activas."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:53
+msgid "Allow indication to the firmware to boot to setup interface"
+msgstr "Permitir indicarlle ao firmware arrincar para configurar unha interface"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:54
+msgid ""
+"Authentication is required to indicate to the firmware to boot to setup "
+"interface."
+msgstr ""
+"Requírese autenticación para indicarlle ao firmware arrincar para configurar "
+"unha interface."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:55
+msgid "Set a wall message"
+msgstr "Estabelecer a mensaxe do muro"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:56
+msgid "Authentication is required to set a wall message"
+msgstr "Requírese autenticación para estabelecer unha mensaxe de muro"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:1
+msgid "Log into a local container"
+msgstr "Iniciar sesión nun contenedor local"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:2
+msgid "Authentication is required to log into a local container."
+msgstr "Requírese autenticación para iniciar sesión nun contenedor local."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:3
+msgid "Log into the local host"
+msgstr "Iniciar sesión nun equipo local"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:4
+msgid "Authentication is required to log into the local host."
+msgstr "Requírese autenticación para iniciar sesión nun equipo local."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:5
+msgid "Acquire a shell in a local container"
+msgstr "Adquirir unha shell nun contenedor local"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:6
+msgid "Authentication is required to acquire a shell in a local container."
+msgstr "Requírese autenticación para adquirir unha shell nun contenedor local."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:7
+msgid "Acquire a shell on the local host"
+msgstr "Adquirir unha shell nun equipo local"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:8
+msgid "Authentication is required to acquire a shell on the local host."
+msgstr "Requírese autenticación para adquirir unha shell nun equipo local."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:9
+msgid "Acquire a pseudo TTY in a local container"
+msgstr "Adquirir unha pseudo TTY nun contenedor local"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:10
+msgid ""
+"Authentication is required to acquire a pseudo TTY in a local container."
+msgstr ""
+"Requírese autenticación para adquirir unha pseudo TTY nun contenedor local."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:11
+msgid "Acquire a pseudo TTY on the local host"
+msgstr "Adquirir unha pseudo TTY nun equipo local"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:12
+msgid "Authentication is required to acquire a pseudo TTY on the local host."
+msgstr "Requírese autenticación para adquirir unha pseudo TTY nun equipo local."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:13
+msgid "Manage local virtual machines and containers"
+msgstr "Xestionar máquinas virtuais e contenedores locais"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:14
+msgid ""
+"Authentication is required to manage local virtual machines and containers."
+msgstr ""
+"Requírese autenticación para xestionar máquinas virtuais e contenedores "
+"locais."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:15
+msgid "Manage local virtual machine and container images"
+msgstr "Xestionar imaxes locais virtuais e contenedores locais"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:16
+msgid ""
+"Authentication is required to manage local virtual machine and container "
+"images."
+msgstr ""
+"Requírese autenticación para xestionar imaxes de máquinas virtuais e "
+"contenedores locais."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:1
+msgid "Set system time"
+msgstr "Estabelecer a hora do sistema"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:2
+msgid "Authentication is required to set the system time."
+msgstr "Requírese autenticación para estabelecer a hora do sistema."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:3
+msgid "Set system timezone"
+msgstr "Estabelecer o fuso horario"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:4
+msgid "Authentication is required to set the system timezone."
+msgstr "Requírese autenticación para estabelecer o fuso horario do sistema."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:5
+msgid "Set RTC to local timezone or UTC"
+msgstr "Estabelecer o RTC ao fuso horario ou UTC"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:6
+msgid ""
+"Authentication is required to control whether the RTC stores the local or "
+"UTC time."
+msgstr ""
+"Requírese autenticación para controlar se o RTC almacena a hora local ou a "
+"UTC."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:7
+msgid "Turn network time synchronization on or off"
+msgstr "Activar ou desactivar a sincronización de hora por rede"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:8
+msgid ""
+"Authentication is required to control whether network time synchronization "
+"shall be enabled."
+msgstr ""
+"Requírese autenticación para controlar se a sincronización de hora por rede "
+"debería activarse."
+
+#: ../src/core/dbus-unit.c:428
+msgid "Authentication is required to start '$(unit)'."
+msgstr "Requírese autenticación para inciar '$(unit)'."
+
+#: ../src/core/dbus-unit.c:429
+msgid "Authentication is required to stop '$(unit)'."
+msgstr "Requírese autenticación para deter '$(unit)'."
+
+#: ../src/core/dbus-unit.c:430
+msgid "Authentication is required to reload '$(unit)'."
+msgstr "Requírese autenticación para recargar '$(unit)'."
+
+#: ../src/core/dbus-unit.c:431 ../src/core/dbus-unit.c:432
+msgid "Authentication is required to restart '$(unit)'."
+msgstr "Requírese autenticación para reiniciar '$(unit)'."
+
+#: ../src/core/dbus-unit.c:535
+msgid "Authentication is required to kill '$(unit)'."
+msgstr "Requírese autenticación para matar '$(unit)'."
+
+#: ../src/core/dbus-unit.c:565
+msgid "Authentication is required to reset the \"failed\" state of '$(unit)'."
+msgstr "Requírese autenticación para reinicair o estado «fallido» de '$(unit)'."
+
+#: ../src/core/dbus-unit.c:597
+msgid "Authentication is required to set properties on '$(unit)'."
+msgstr "Requírese autenticación para estabelecer as propiedades en '$(unit)'."
diff --git a/po/ko.po b/po/ko.po
new file mode 100644
index 000000000..382c011cd
--- /dev/null
+++ b/po/ko.po
@@ -0,0 +1,544 @@
+# Korean translation for the systemd.
+# Copyright (C) 2015 systemd author and translators.
+# This file is distributed under the same license as the systemd package.
+# Seong-ho Cho <shcho@gnome.org>, 2015.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: systemd\n"
+"Report-Msgid-Bugs-To: https://github.com/systemd/systemd/issues\n"
+"POT-Creation-Date: 2015-09-25 22:52+0900\n"
+"PO-Revision-Date: 2015-09-25 23:50+0900\n"
+"Last-Translator: Seong-ho Cho <shcho@gnome.org>\n"
+"Language-Team: GNOME Korea <gnome-kr@googlegroups.com>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.5.5\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+"Language: ko\n"
+"X-Poedit-SourceCharset: UTF-8\n"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:1
+msgid "Send passphrase back to system"
+msgstr "ì‹œìŠ¤í…œì— ì•”í˜¸ë¬¸ 보내기"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:2
+msgid ""
+"Authentication is required to send the entered passphrase back to the system."
+msgstr "ì‹œìŠ¤í…œì— ìž…ë ¥í•œ 암호를 보내려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:3
+msgid "Manage system services or other units"
+msgstr "시스템 서비스 ë˜ëŠ” 기타 유닛 관리"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:4
+msgid "Authentication is required to manage system services or other units."
+msgstr "시스템 서비스 ë˜ëŠ” 기타 ìœ ë‹›ì„ ê´€ë¦¬í•˜ë ¤ë©´ ì¸ì¦ì´ 필요합니다."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:5
+msgid "Manage system service or unit files"
+msgstr "시스템 서비스 ë˜ëŠ” 유닛 íŒŒì¼ ê´€ë¦¬"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:6
+msgid "Authentication is required to manage system service or unit files."
+msgstr "시스템 서비스 ë˜ëŠ” 유닛 파ì¼ì„ 관리하려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:7
+msgid "Set or unset system and service manager environment variables"
+msgstr "시스템 ë° ì„œë¹„ìŠ¤ ê´€ë¦¬ìž í™˜ê²½ 변수 설정 ë˜ëŠ” 설정 í•´ì œ"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:8
+msgid ""
+"Authentication is required to set or unset system and service manager "
+"environment variables."
+msgstr ""
+"시스템 ë° ì„œë¹„ìŠ¤ ê´€ë¦¬ìž í™˜ê²½ 변수를 설정하거나 설정 해제하려면 ì¸ì¦ì´ 필요합"
+"니다."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:9
+msgid "Reload the systemd state"
+msgstr "systemd ìƒíƒœ 다시 불러오기"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:10
+msgid "Authentication is required to reload the systemd state."
+msgstr "systemd ìƒíƒœë¥¼ 다시 불러오려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:1
+msgid "Set host name"
+msgstr "호스트 ì´ë¦„ 설정"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:2
+msgid "Authentication is required to set the local host name."
+msgstr "로컬 호스트 ì´ë¦„ì„ ì„¤ì •í•˜ë ¤ë©´ ì¸ì¦ì´ 필요합니다."
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:3
+msgid "Set static host name"
+msgstr "ì •ì  í˜¸ìŠ¤íŠ¸ ì´ë¦„ 설정"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:4
+msgid ""
+"Authentication is required to set the statically configured local host name, "
+"as well as the pretty host name."
+msgstr ""
+"로컬 호스트 ì´ë¦„ì„ ëª¨ì–‘ìƒˆë¥¼ 갖춘 호스트 ì´ë¦„ 처럼 ì •ì ìœ¼ë¡œ 설정하려면 ì¸ì¦"
+"ì´ í•„ìš”í•©ë‹ˆë‹¤."
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:5
+msgid "Set machine information"
+msgstr "머신 정보 설정"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:6
+msgid "Authentication is required to set local machine information."
+msgstr "로컬 머신 정보를 설정하려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:1
+msgid "Import a VM or container image"
+msgstr "VM ë˜ëŠ” 컨테ì´ë„ˆì˜ ì´ë¯¸ì§€ 가져오기"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:2
+msgid "Authentication is required to import a VM or container image"
+msgstr "VM ë˜ëŠ” 컨테ì´ë„ˆì˜ ì´ë¯¸ì§€ë¥¼ 가져오려면 ì¸ì¦ì´ 필요합니다"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:3
+msgid "Export a VM or container image"
+msgstr "ê°€ìƒ ë¨¸ì‹  ë˜ëŠ” 컨테ì´ë„ˆì˜ ì´ë¯¸ì§€ 내보내기"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:4
+msgid "Authentication is required to export a VM or container image"
+msgstr "ê°€ìƒ ë¨¸ì‹  ë˜ëŠ” 컨테ì´ë„ˆì˜ ì´ë¯¸ì§€ë¥¼ 내보내려면 ì¸ì¦ì´ 필요합니다"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:5
+msgid "Download a VM or container image"
+msgstr "ê°€ìƒë¨¸ì‹  ë˜ëŠ” 컨테ì´ë„ˆ ì´ë¯¸ì§€ 다운로드"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:6
+msgid "Authentication is required to download a VM or container image"
+msgstr "ê°€ìƒë¨¸ì‹  ë˜ëŠ” 컨테ì´ë„ˆ ì´ë¯¸ì§€ë¥¼ 다운로드하려면 ì¸ì¦ì´ 필요합니다"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:1
+msgid "Set system locale"
+msgstr "시스템 로캘 설정"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:2
+msgid "Authentication is required to set the system locale."
+msgstr "시스템 ë¡œìº˜ì„ ì„¤ì •í•˜ë ¤ë©´ ì¸ì¦ì´ 필요합니다."
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:3
+msgid "Set system keyboard settings"
+msgstr "시스템 키보드 설정"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:4
+msgid "Authentication is required to set the system keyboard settings."
+msgstr "시스템 키보드를 설정하려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:1
+msgid "Allow applications to inhibit system shutdown"
+msgstr "í”„ë¡œê·¸ëž¨ì˜ ì‹œìŠ¤í…œ ì „ì› ë„기 방지 요청 허용"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:2
+msgid ""
+"Authentication is required for an application to inhibit system shutdown."
+msgstr "í”„ë¡œê·¸ëž¨ì˜ ì‹œìŠ¤í…œ ì „ì› ë„기 방지 ìš”ì²­ì„ í—ˆìš©í•˜ë ¤ë©´ ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:3
+msgid "Allow applications to delay system shutdown"
+msgstr "í”„ë¡œê·¸ëž¨ì˜ ì‹œìŠ¤í…œ ì „ì› ë„기 지연 허용"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:4
+msgid "Authentication is required for an application to delay system shutdown."
+msgstr "í”„ë¡œê·¸ëž¨ì˜ ì‹œìŠ¤í…œ ì „ì› ë„기 지연 ë™ìž‘ì„ í—ˆìš©í•˜ë ¤ë©´ ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:5
+msgid "Allow applications to inhibit system sleep"
+msgstr "í”„ë¡œê·¸ëž¨ì˜ ì‹œìŠ¤í…œ 대기 ìƒíƒœ 진입 방지 요청 허용"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:6
+msgid "Authentication is required for an application to inhibit system sleep."
+msgstr ""
+"í”„ë¡œê·¸ëž¨ì˜ ì‹œìŠ¤í…œ 대기 ìƒíƒœ 진입 방지 ìš”ì²­ì„ í—ˆìš©í•˜ë ¤ë©´ ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:7
+msgid "Allow applications to delay system sleep"
+msgstr "í”„ë¡œê·¸ëž¨ì˜ ì‹œìŠ¤í…œ 대기 ìƒíƒœ 진입 지연 허용"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:8
+msgid "Authentication is required for an application to delay system sleep."
+msgstr ""
+"í”„ë¡œê·¸ëž¨ì˜ ì‹œìŠ¤í…œ 대기 ìƒíƒœ 진입 지연 ë™ìž‘ì„ í—ˆìš©í•˜ë ¤ë©´ ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:9
+msgid "Allow applications to inhibit automatic system suspend"
+msgstr "í”„ë¡œê·¸ëž¨ì˜ ì‹œìŠ¤í…œ ìžë™ 절전 ìƒíƒœ 진입 방지 요청 허용"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:10
+msgid ""
+"Authentication is required for an application to inhibit automatic system "
+"suspend."
+msgstr ""
+"í”„ë¡œê·¸ëž¨ì˜ ì‹œìŠ¤í…œ ìžë™ 절전 ìƒíƒœ 진입 방지 ìš”ì²­ì„ í—ˆìš©í•˜ë ¤ë©´ ì¸ì¦ì´ 필요합니"
+"다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:11
+msgid "Allow applications to inhibit system handling of the power key"
+msgstr "í”„ë¡œê·¸ëž¨ì˜ ì‹œìŠ¤í…œ ì „ì› í‚¤ 처리 방지 요청 허용"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:12
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the power key."
+msgstr ""
+"í”„ë¡œê·¸ëž¨ì˜ ì‹œìŠ¤í…œ ì „ì› í‚¤ 처리 방지 ìš”ì²­ì„ í—ˆìš©í•˜ë ¤ë©´ ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:13
+msgid "Allow applications to inhibit system handling of the suspend key"
+msgstr "í”„ë¡œê·¸ëž¨ì˜ ì‹œìŠ¤í…œ 절전 키 처리 방지 요청 허용"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:14
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the suspend key."
+msgstr ""
+"í”„ë¡œê·¸ëž¨ì˜ ì‹œìŠ¤í…œ 절전 키 처리 방지 ìš”ì²­ì„ í—ˆìš©í•˜ë ¤ë©´ ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:15
+msgid "Allow applications to inhibit system handling of the hibernate key"
+msgstr "í”„ë¡œê·¸ëž¨ì˜ ì‹œìŠ¤í…œ 최대 절전 키 처리 방지 요청 허용"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:16
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the hibernate key."
+msgstr ""
+"í”„ë¡œê·¸ëž¨ì˜ ì‹œìŠ¤í…œ 최대 절전 키 처리 방지 ìš”ì²­ì„ í—ˆìš©í•˜ë ¤ë©´ ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:17
+msgid "Allow applications to inhibit system handling of the lid switch"
+msgstr "í”„ë¡œê·¸ëž¨ì˜ ì‹œìŠ¤í…œ 랩톱 ë®ê°œ 스위치 처리 방지 요청 허용"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:18
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the lid switch."
+msgstr ""
+"í”„ë¡œê·¸ëž¨ì˜ ì‹œìŠ¤í…œ 랩톱 ë®ê°œ 스위치 처리 방지 ìš”ì²­ì„ í—ˆìš©í•˜ë ¤ë©´ ì¸ì¦ì´ 필요합"
+"니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:19
+msgid "Allow non-logged-in users to run programs"
+msgstr "비 ë¡œê·¸ì¸ ì‚¬ìš©ìž í”„ë¡œê·¸ëž¨ 실행 허용"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:20
+msgid "Authentication is required to run programs as a non-logged-in user."
+msgstr "비 ë¡œê·¸ì¸ ì‚¬ìš©ìžì—게 프로그램 ì‹¤í–‰ì„ í—ˆìš©í•˜ë ¤ë©´ ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:21
+msgid "Allow attaching devices to seats"
+msgstr "ì‹œíŠ¸ì— ìž¥ì¹˜ 부착 허용"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:22
+msgid "Authentication is required for attaching a device to a seat."
+msgstr "ì‹œíŠ¸ì— ìž¥ì¹˜ ë¶€ì°©ì„ í—ˆìš©í•˜ë ¤ë©´ ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:23
+msgid "Flush device to seat attachments"
+msgstr "시트로부터 장치 탈거 허용"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:24
+msgid ""
+"Authentication is required for resetting how devices are attached to seats."
+msgstr "ì‹œíŠ¸ì— ë¶™ì¸ ìž¥ì¹˜ ìƒíƒœë¥¼ 초기화하려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:25
+msgid "Power off the system"
+msgstr "시스템 ë„기"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:26
+msgid "Authentication is required for powering off the system."
+msgstr "ì‹œìŠ¤í…œì„ ë„려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:27
+msgid "Power off the system while other users are logged in"
+msgstr "다른 사용ìžê°€ ë¡œê·¸ì¸ í–ˆì„ ë•Œ 시스템 ë„기"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:28
+msgid ""
+"Authentication is required for powering off the system while other users are "
+"logged in."
+msgstr "다른 사용ìžê°€ ë¡œê·¸ì¸ í–ˆì„ ë•Œ 시스템 ì „ì›ì„ ë„려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:29
+msgid "Power off the system while an application asked to inhibit it"
+msgstr "í”„ë¡œê·¸ëž¨ì´ ì‹œìŠ¤í…œì„ ë„지 못하게 요청할 ë•Œ 시스템 ì „ì› ë„기"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:30
+msgid ""
+"Authentication is required for powering off the system while an application "
+"asked to inhibit it."
+msgstr ""
+"í”„ë¡œê·¸ëž¨ì´ ì‹œìŠ¤í…œì„ ë„지 못하게 요청할 ë•Œ 시스템 ì „ì›ì„ ë„려면 ì¸ì¦ì´ 필요합"
+"니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:31
+msgid "Reboot the system"
+msgstr "시스템 다시 시작"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:32
+msgid "Authentication is required for rebooting the system."
+msgstr "ì‹œìŠ¤í…œì„ ë‹¤ì‹œ 시작하려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:33
+msgid "Reboot the system while other users are logged in"
+msgstr "다른 사용ìžê°€ ë¡œê·¸ì¸ í–ˆì„ ë•Œ 시스템 다시 시작"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:34
+msgid ""
+"Authentication is required for rebooting the system while other users are "
+"logged in."
+msgstr ""
+"다른 사용ìžê°€ ë¡œê·¸ì¸ í–ˆì„ ë•Œ ì‹œìŠ¤í…œì„ ë‹¤ì‹œ 시작하려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:35
+msgid "Reboot the system while an application asked to inhibit it"
+msgstr "í”„ë¡œê·¸ëž¨ì´ ì‹œìŠ¤í…œì„ ë‹¤ì‹œ 시작하지 못하게 요청할 ë•Œ 시스템 다시 시작"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:36
+msgid ""
+"Authentication is required for rebooting the system while an application "
+"asked to inhibit it."
+msgstr ""
+"í”„ë¡œê·¸ëž¨ì´ ì‹œìŠ¤í…œì„ ë‹¤ì‹œ 시작하지 못하게 요청할 ë•Œ ì‹œìŠ¤í…œì„ ë‹¤ì‹œ 시작하려면 "
+"ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:37
+msgid "Suspend the system"
+msgstr "시스템 절전 ìƒíƒœ 진입"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:38
+msgid "Authentication is required for suspending the system."
+msgstr "ì‹œìŠ¤í…œì„ ì ˆì „ ìƒíƒœë¡œ 놓으려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:39
+msgid "Suspend the system while other users are logged in"
+msgstr "다른 사용ìžê°€ ë¡œê·¸ì¸ í–ˆì„ ë•Œ 시스템 절전 ìƒíƒœ 진입"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:40
+msgid ""
+"Authentication is required for suspending the system while other users are "
+"logged in."
+msgstr ""
+"다른 사용ìžê°€ ë¡œê·¸ì¸ í–ˆì„ ë•Œ ì‹œìŠ¤í…œì„ ì ˆì „ ìƒíƒœë¡œ 놓으려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:41
+msgid "Suspend the system while an application asked to inhibit it"
+msgstr "í”„ë¡œê·¸ëž¨ì´ ì ˆì „ ìƒíƒœ ì§„ìž…ì„ ëª»í•˜ê²Œ 요청할 ë•Œ 시스템 절전 ìƒíƒœ 진입"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:42
+msgid ""
+"Authentication is required for suspending the system while an application "
+"asked to inhibit it."
+msgstr ""
+"í”„ë¡œê·¸ëž¨ì´ ì ˆì „ ìƒíƒœ ì§„ìž…ì„ ëª»í•˜ê²Œ 요청할 ë•Œ ì‹œìŠ¤í…œì„ ì ˆì „ ìƒíƒœë¡œ 놓으려면 ì¸"
+"ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:43
+msgid "Hibernate the system"
+msgstr "시스템 최대 절전 ìƒíƒœ 진입"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:44
+msgid "Authentication is required for hibernating the system."
+msgstr "ì‹œìŠ¤í…œì„ ìµœëŒ€ 절전 ìƒíƒœë¡œ 놓으려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:45
+msgid "Hibernate the system while other users are logged in"
+msgstr "다른 사용ìžê°€ ë¡œê·¸ì¸ í–ˆì„ ë•Œ 시스템 최대 절전 ìƒíƒœ 진입"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:46
+msgid ""
+"Authentication is required for hibernating the system while other users are "
+"logged in."
+msgstr ""
+"다른 사용ìžê°€ ë¡œê·¸ì¸ í–ˆì„ ë•Œ ì‹œìŠ¤í…œì„ ìµœëŒ€ 절전 ìƒíƒœë¡œ 놓으려면 ì¸ì¦ì´ 필요합"
+"니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:47
+msgid "Hibernate the system while an application asked to inhibit it"
+msgstr ""
+"í”„ë¡œê·¸ëž¨ì´ ìµœëŒ€ 절전 ìƒíƒœ ì§„ìž…ì„ ëª»í•˜ê²Œ 요청할 ë•Œ 시스템 최대 절전 ìƒíƒœ 진입"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:48
+msgid ""
+"Authentication is required for hibernating the system while an application "
+"asked to inhibit it."
+msgstr ""
+"í”„ë¡œê·¸ëž¨ì´ ìµœëŒ€ 절전 ìƒíƒœ ì§„ìž…ì„ ëª»í•˜ê²Œ 요청할 ë•Œ ì‹œìŠ¤í…œì„ ìµœëŒ€ 절전 ìƒíƒœë¡œ "
+"놓으려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:49
+msgid "Manage active sessions, users and seats"
+msgstr "활성 세션, 사용ìž, 시트 관리"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:50
+msgid ""
+"Authentication is required for managing active sessions, users and seats."
+msgstr "활성 세션, ì‚¬ìš©ìž ì‹œíŠ¸ë¥¼ 관리하려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:51
+msgid "Lock or unlock active sessions"
+msgstr "활성 세션 잠금 ë˜ëŠ” 잠금 í•´ì œ"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:52
+msgid "Authentication is required to lock or unlock active sessions."
+msgstr "활성화 ì„¸ì…˜ì„ ìž ê¸ˆ ë˜ëŠ” 잠금 해제하려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:53
+msgid "Allow indication to the firmware to boot to setup interface"
+msgstr "ì¸í„°íŽ˜ì´ìŠ¤ë¥¼ 설정하ë„ë¡ íŽŒì›¨ì–´ 부팅 지시 허용"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:54
+msgid ""
+"Authentication is required to indicate to the firmware to boot to setup "
+"interface."
+msgstr "ì¸í„°íŽ˜ì´ìŠ¤ë¥¼ 설정하ë„ë¡ íŽŒì›¨ì–´ ë¶€íŒ…ì„ ì§€ì‹œí•˜ë ¤ë©´ ì¸ì¦ì´ 필요합니다."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:55
+msgid "Set a wall message"
+msgstr "wall 메시지 설정"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:56
+msgid "Authentication is required to set a wall message"
+msgstr "wall 메시지를 설정하려면 ì¸ì¦ì´ 필요합니다"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:1
+msgid "Log into a local container"
+msgstr "로컬 컨테ì´ë„ˆ 로그ì¸"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:2
+msgid "Authentication is required to log into a local container."
+msgstr "로컬 컨테ì´ë„ˆë¡œ 로그ì¸í•˜ë ¤ë©´ ì¸ì¦ì´ 필요합니다."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:3
+msgid "Log into the local host"
+msgstr "로컬 호스트 로그ì¸"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:4
+msgid "Authentication is required to log into the local host."
+msgstr "로컬 호스트로 로그ì¸í•˜ë ¤ë©´ ì¸ì¦ì´ 필요합니다."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:5
+msgid "Acquire a shell in a local container"
+msgstr "로컬 컨테ì´ë„ˆì˜ 쉘 íšë“"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:6
+msgid "Authentication is required to acquire a shell in a local container."
+msgstr "로컬 컨테ì´ë„ˆì—ì„œ ì‰˜ì„ íšë“하려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:7
+msgid "Acquire a shell on the local host"
+msgstr "로컬 호스트 쉘 íšë“"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:8
+msgid "Authentication is required to acquire a shell on the local host."
+msgstr "로컬 í˜¸ìŠ¤íŠ¸ì˜ ì‰˜ì„ íšë“하려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:9
+msgid "Acquire a pseudo TTY in a local container"
+msgstr "로컬 컨테ì´ë„ˆì—ì„œ ì˜ì‚¬ TTY íšë“"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:10
+msgid ""
+"Authentication is required to acquire a pseudo TTY in a local container."
+msgstr "로컬 컨테ì´ë„ˆì—ì„œ ì˜ì‚¬ TTY를 íšë“하려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:11
+msgid "Acquire a pseudo TTY on the local host"
+msgstr "로컬 호스트ì—ì„œ ì˜ì‚¬ TTY íšë“"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:12
+msgid "Authentication is required to acquire a pseudo TTY on the local host."
+msgstr "로컬 호스트ì—ì„œ ì˜ì‚¬ TTY를 íšë“하려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:13
+msgid "Manage local virtual machines and containers"
+msgstr "로컬 ê°€ìƒ ë¨¸ì‹  ë° ì»¨í…Œì´ë„ˆ 관리"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:14
+msgid ""
+"Authentication is required to manage local virtual machines and containers."
+msgstr "로컬 ê°€ìƒ ë¨¸ì‹  ë° ì»¨í…Œì´ë„ˆë¥¼ 관리하려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:15
+msgid "Manage local virtual machine and container images"
+msgstr "로컬 ê°€ìƒ ë¨¸ì‹  ë° ì»¨í…Œì´ë„ˆ ì´ë¯¸ì§€ 관리"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:16
+msgid ""
+"Authentication is required to manage local virtual machine and container "
+"images."
+msgstr "로컬 ê°€ìƒ ë¨¸ì‹  ë° ì»¨í…Œì´ë„ˆ ì´ë¯¸ì§€ë¥¼ 관리하려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:1
+msgid "Set system time"
+msgstr "시스템 시간 설정"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:2
+msgid "Authentication is required to set the system time."
+msgstr "시스템 ì‹œê°„ì„ ì„¤ì •í•˜ë ¤ë©´ ì¸ì¦ì´ 필요합니다."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:3
+msgid "Set system timezone"
+msgstr "시스템 시간대 설정"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:4
+msgid "Authentication is required to set the system timezone."
+msgstr "시스템 시간대를 설정하려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:5
+msgid "Set RTC to local timezone or UTC"
+msgstr "RTC를 로컬 시간대 ë˜ëŠ” UTCë¡œ 설정"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:6
+msgid ""
+"Authentication is required to control whether the RTC stores the local or "
+"UTC time."
+msgstr ""
+"RTC를 로컬 시간 ë˜ëŠ” UTC 시간으로 저장할 지 여부를 제어하려면 ì¸ì¦ì´ 필요합니"
+"다."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:7
+msgid "Turn network time synchronization on or off"
+msgstr "ë„¤íŠ¸ì›Œí¬ ì‹œê°„ ë™ê¸°í™” 켜거나 ë„기"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:8
+msgid ""
+"Authentication is required to control whether network time synchronization "
+"shall be enabled."
+msgstr "ë„¤íŠ¸ì›Œí¬ ì‹œê°„ ë™ê¸°í™”ì˜ í™œì„±í™” 여부를 제어하려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/core/dbus-unit.c:428
+msgid "Authentication is required to start '$(unit)'."
+msgstr "'$(unit)' 서비스 ìœ ë‹›ì„ ì‹œìž‘í•˜ë ¤ë©´ ì¸ì¦ì´ 필요합니다."
+
+#: ../src/core/dbus-unit.c:429
+msgid "Authentication is required to stop '$(unit)'."
+msgstr "'$(unit)' 서비스 ìœ ë‹›ì„ ë©ˆì¶”ë ¤ë©´ ì¸ì¦ì´ 필요합니다."
+
+#: ../src/core/dbus-unit.c:430
+msgid "Authentication is required to reload '$(unit)'."
+msgstr "'$(unit)' 서비스 ìœ ë‹›ì„ ë‹¤ì‹œ 불러오려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/core/dbus-unit.c:431 ../src/core/dbus-unit.c:432
+msgid "Authentication is required to restart '$(unit)'."
+msgstr "'$(unit)' 서비스 ìœ ë‹›ì„ ë‹¤ì‹œ 시작하려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/core/dbus-unit.c:535
+msgid "Authentication is required to kill '$(unit)'."
+msgstr "'$(unit)' 서비스 ìœ ë‹›ì„ ê°•ì œë¡œ ë내려면 ì¸ì¦ì´ 필요합니다."
+
+#: ../src/core/dbus-unit.c:565
+msgid "Authentication is required to reset the \"failed\" state of '$(unit)'."
+msgstr "'$(unit)' 서비스 ìœ ë‹›ì˜ \"실패\" ìƒíƒœë¥¼ ë˜ëŒë¦¬ë ¤ë©´ ì¸ì¦ì´ 필요합니다."
+
+#: ../src/core/dbus-unit.c:597
+msgid "Authentication is required to set properties on '$(unit)'."
+msgstr "'$(unit)' 서비스 유닛 ì†ì„±ì„ 설정하려면 ì¸ì¦ì´ 필요합니다."
diff --git a/po/sr.po b/po/sr.po
new file mode 100644
index 000000000..7f9b2b31c
--- /dev/null
+++ b/po/sr.po
@@ -0,0 +1,606 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: \n"
+"Report-Msgid-Bugs-To: https://github.com/systemd/systemd/issues\n"
+"POT-Creation-Date: 2015-10-03 18:14+0200\n"
+"PO-Revision-Date: 2015-10-03 21:01+0200\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.8.4\n"
+"Last-Translator: Марко Ðœ. КоÑтић (Marko M. Kostić) <marko.m.kostic@gmail."
+"com>\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
+"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
+"Language: sr\n"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:1
+msgid "Send passphrase back to system"
+msgstr "Пошаљите фразу ка ÑиÑтему"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:2
+msgid ""
+"Authentication is required to send the entered passphrase back to the system."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте поÑлали фразу назад у ÑиÑтем."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:3
+msgid "Manage system services or other units"
+msgstr "Управљајте ÑиÑтемÑким уÑлугама и другим јединицама"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:4
+msgid "Authentication is required to manage system services or other units."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте управљали ÑиÑтемÑким уÑлугама или "
+"другим јединицама."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:5
+msgid "Manage system service or unit files"
+msgstr "Управљајте ÑиÑтемÑком уÑлугом или јединичним датотекама"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:6
+msgid "Authentication is required to manage system service or unit files."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте управљали ÑиÑтемÑком уÑлугом или "
+"јединичним датотекама."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:7
+msgid "Set or unset system and service manager environment variables"
+msgstr "Мењајте променљиве окружења на ÑиÑтему и унутар управника уÑлуга"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:8
+msgid ""
+"Authentication is required to set or unset system and service manager "
+"environment variables."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте мењали променљиве окружења на "
+"ÑиÑтему и унутар управника уÑлуга."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:9
+msgid "Reload the systemd state"
+msgstr "Поново учитајте Ñтање ÑиÑтем-деа"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:10
+msgid "Authentication is required to reload the systemd state."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте поново учитали Ñтање ÑиÑтем-деа."
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:1
+msgid "Set host name"
+msgstr "ПоÑтавите назив машине"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:2
+msgid "Authentication is required to set the local host name."
+msgstr "Потребно је да Ñе идентификујете да биÑте поÑтавили назив машине."
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:3
+msgid "Set static host name"
+msgstr "ПоÑтавите Ñтатички назив машине"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:4
+msgid ""
+"Authentication is required to set the statically configured local host name, "
+"as well as the pretty host name."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте поÑтавили Ñтатички назив машине и "
+"да биÑте поÑтавили леп назив машине."
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:5
+msgid "Set machine information"
+msgstr "ПоÑтавите податке о машини"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:6
+msgid "Authentication is required to set local machine information."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте поÑтавили податке о локалној "
+"машини."
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:1
+msgid "Import a VM or container image"
+msgstr "Увезите Ð’Ðœ или Ñлику контејнера"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:2
+msgid "Authentication is required to import a VM or container image"
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте увезли виртуелну машину или Ñлику "
+"контејнера"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:3
+msgid "Export a VM or container image"
+msgstr "Извезите Ð’Ðœ или Ñлику контејнера"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:4
+msgid "Authentication is required to export a VM or container image"
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте извезли виртуелну машину или Ñлику "
+"контејнера"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:5
+msgid "Download a VM or container image"
+msgstr "Преузмите Ð’Ðœ или Ñлику контејнера"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:6
+msgid "Authentication is required to download a VM or container image"
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте преузели виртуелну машину или "
+"Ñлику контејнера"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:1
+msgid "Set system locale"
+msgstr "ПоÑтавите оÑновни језик ÑиÑтема"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:2
+msgid "Authentication is required to set the system locale."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте поÑтавили оÑновни језик ÑиÑтема."
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:3
+msgid "Set system keyboard settings"
+msgstr "ПоÑтавите подешавање ÑиÑтемÑке таÑтатуре"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:4
+msgid "Authentication is required to set the system keyboard settings."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте поÑтавили подешавања ÑиÑтемÑке "
+"таÑтатуре."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:1
+msgid "Allow applications to inhibit system shutdown"
+msgstr "Дозволите програмима да Ñпрече гашење ÑиÑтема"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:2
+msgid ""
+"Authentication is required for an application to inhibit system shutdown."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте дозволили програму да Ñпречи "
+"гашење ÑиÑтема."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:3
+msgid "Allow applications to delay system shutdown"
+msgstr "Дозволите програмима да одложе гашење ÑиÑтема"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:4
+msgid "Authentication is required for an application to delay system shutdown."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте дозволили програму да одложи "
+"гашење ÑиÑтема."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:5
+msgid "Allow applications to inhibit system sleep"
+msgstr "Дозволите програмима да Ñпрече Ñпавање ÑиÑтема"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:6
+msgid "Authentication is required for an application to inhibit system sleep."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте дозволили програму да Ñпречи "
+"Ñпавање ÑиÑтема."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:7
+msgid "Allow applications to delay system sleep"
+msgstr "Дозволите програмима да одложе Ñпавање ÑиÑтема"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:8
+msgid "Authentication is required for an application to delay system sleep."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте дозволили програму да одложи "
+"Ñпавање ÑиÑтема."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:9
+msgid "Allow applications to inhibit automatic system suspend"
+msgstr "Дозволите програмима да Ñпрече ÑамоÑталну обуÑтаву ÑиÑтема"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:10
+msgid ""
+"Authentication is required for an application to inhibit automatic system "
+"suspend."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте дозволили програму да Ñпречи "
+"ÑамоÑталну обуÑтаву ÑиÑтема."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:11
+msgid "Allow applications to inhibit system handling of the power key"
+msgstr "Дозволите програмима да Ñпрече ÑиÑтему управљање дугметом за напајање"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:12
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the power key."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте дозволили програму да Ñпречи "
+"ÑиÑтему управљање дугметом за напајање."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:13
+msgid "Allow applications to inhibit system handling of the suspend key"
+msgstr "Дозволите програмима да Ñпрече ÑиÑтему управљање дугметом за обуÑтаву"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:14
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the suspend key."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте дозволили програму да Ñпречи "
+"ÑиÑтему управљање дугметом за обуÑтаву."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:15
+msgid "Allow applications to inhibit system handling of the hibernate key"
+msgstr "Дозволите програмима да Ñпрече ÑиÑтему управљање дугметом за Ñпавање"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:16
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the hibernate key."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте дозволили програму да Ñпречи "
+"ÑиÑтему управљање дугметом за Ñпавање."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:17
+msgid "Allow applications to inhibit system handling of the lid switch"
+msgstr ""
+"Дозволите програмима да Ñпрече ÑиÑтему да уради било шта приликом заклапања "
+"екрана"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:18
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the lid switch."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте дозволили програму да Ñпречи "
+"ÑиÑтему да уради било шта приликом заклапања екрана."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:19
+msgid "Allow non-logged-in users to run programs"
+msgstr "Дозволите непријављеним кориÑницима да покрећу програме"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:20
+msgid "Authentication is required to run programs as a non-logged-in user."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте покретали програме као непријављен "
+"кориÑник."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:21
+msgid "Allow attaching devices to seats"
+msgstr "Дозволите качење уређаја на Ñедишта"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:22
+msgid "Authentication is required for attaching a device to a seat."
+msgstr "Потребно је да Ñе идентификујете да биÑте закачили уређај на Ñедиште."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:23
+msgid "Flush device to seat attachments"
+msgstr "ИÑпери уређај да би уÑедиштио закачено"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:24
+msgid ""
+"Authentication is required for resetting how devices are attached to seats."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте поново подеÑили како Ñе уређаји "
+"каче на Ñедишта."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:25
+msgid "Power off the system"
+msgstr "ИÑкључите ÑиÑтем"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:26
+msgid "Authentication is required for powering off the system."
+msgstr "Потребно је да Ñе идентификујете да биÑте иÑкључили ÑиÑтем."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:27
+msgid "Power off the system while other users are logged in"
+msgstr "ИÑкључите ÑиÑтем док Ñу други кориÑници пријављени"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:28
+msgid ""
+"Authentication is required for powering off the system while other users are "
+"logged in."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте иÑкључили ÑиÑтем док Ñу други "
+"кориÑници пријављени."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:29
+msgid "Power off the system while an application asked to inhibit it"
+msgstr "ИÑкључите ÑиÑтем иако је програм затражио да Ñе Ñпречи гашење"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:30
+msgid ""
+"Authentication is required for powering off the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте иÑкључили ÑиÑтем иако је програм "
+"затражио да Ñе Ñпречи гашење ÑиÑтема."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:31
+msgid "Reboot the system"
+msgstr "Поново покрените ÑиÑтем"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:32
+msgid "Authentication is required for rebooting the system."
+msgstr "Потребно је да Ñе идентификујете да биÑте поново покренули ÑиÑтем."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:33
+msgid "Reboot the system while other users are logged in"
+msgstr "Поново покрените ÑиÑтем док Ñу други кориÑници пријављени"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:34
+msgid ""
+"Authentication is required for rebooting the system while other users are "
+"logged in."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте поново покренули ÑиÑтем док Ñу "
+"други кориÑници пријављени."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:35
+msgid "Reboot the system while an application asked to inhibit it"
+msgstr "Поново покрените ÑиÑтем иако је програм затражио да Ñе Ñпречи гашење"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:36
+msgid ""
+"Authentication is required for rebooting the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте поново покренули ÑиÑтем иако је "
+"програм затражио да Ñе Ñпречи гашење ÑиÑтема."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:37
+msgid "Suspend the system"
+msgstr "ОбуÑтавите ÑиÑтем"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:38
+msgid "Authentication is required for suspending the system."
+msgstr "Потребно је да Ñе идентификујете да биÑте обуÑтавили ÑиÑтем."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:39
+msgid "Suspend the system while other users are logged in"
+msgstr "ОбуÑтавите ÑиÑтем док Ñу други кориÑници пријављени"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:40
+msgid ""
+"Authentication is required for suspending the system while other users are "
+"logged in."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте обуÑтавили ÑиÑтем док Ñу други "
+"кориÑници пријављени."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:41
+msgid "Suspend the system while an application asked to inhibit it"
+msgstr "ОбуÑтавите ÑиÑтем иако је програм затражио да Ñе Ñпречи обуÑтава"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:42
+msgid ""
+"Authentication is required for suspending the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте обуÑтавили ÑиÑтем иако је програм "
+"затражио да Ñе Ñпречи обуÑтава ÑиÑтема."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:43
+msgid "Hibernate the system"
+msgstr "УÑпавајте ÑиÑтем"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:44
+msgid "Authentication is required for hibernating the system."
+msgstr "Потребно је да Ñе идентификујете да биÑте уÑпавали ÑиÑтем."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:45
+msgid "Hibernate the system while other users are logged in"
+msgstr "УÑпавајте ÑиÑтем док Ñу други кориÑници пријављени"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:46
+msgid ""
+"Authentication is required for hibernating the system while other users are "
+"logged in."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте уÑпавали ÑиÑтем док Ñу други "
+"кориÑници пријављени."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:47
+msgid "Hibernate the system while an application asked to inhibit it"
+msgstr "УÑпавајте ÑиÑтем иако је програм затражио да Ñе Ñпречи Ñпавање"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:48
+msgid ""
+"Authentication is required for hibernating the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте уÑпавали ÑиÑтем иако је програм "
+"затражио да Ñе Ñпречи уÑпављивање ÑиÑтема."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:49
+msgid "Manage active sessions, users and seats"
+msgstr "Управљајте покренутим ÑеÑијама, кориÑницима и Ñедиштима"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:50
+msgid ""
+"Authentication is required for managing active sessions, users and seats."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте управљали покренутим ÑеÑијама, "
+"кориÑницима и Ñедиштима."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:51
+msgid "Lock or unlock active sessions"
+msgstr "Закључајте или откључајте покренуте ÑеÑије"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:52
+msgid "Authentication is required to lock or unlock active sessions."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте закључавали или откључавали "
+"покренуте ÑеÑије."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:53
+msgid "Allow indication to the firmware to boot to setup interface"
+msgstr "Ðапомените фирмверу да Ñе подигне у режим подешавања интерфејÑа"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:54
+msgid ""
+"Authentication is required to indicate to the firmware to boot to setup "
+"interface."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте напоменули фирмверу да Ñе подигне "
+"у режиму подешавања интерфејÑа."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:55
+msgid "Set a wall message"
+msgstr "ПоÑтавите зидну поруку"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:56
+msgid "Authentication is required to set a wall message"
+msgstr "Потребно је да Ñе идентификујете да биÑте поÑтавили зидну поруку"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:1
+msgid "Log into a local container"
+msgstr "Пријавите Ñе у локални контејнер"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:2
+msgid "Authentication is required to log into a local container."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте Ñе пријавили у локални контејнер."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:3
+msgid "Log into the local host"
+msgstr "Пријавите Ñе у локалног домаћина"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:4
+msgid "Authentication is required to log into the local host."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте Ñе пријавили у локалног домаћина."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:5
+msgid "Acquire a shell in a local container"
+msgstr "Добијте приÑтуп шкољци унутар локалног контејнера"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:6
+msgid "Authentication is required to acquire a shell in a local container."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте добили приÑтуп шкољци унутар "
+"локалног контејнера."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:7
+msgid "Acquire a shell on the local host"
+msgstr "Добијте приÑтуп шкољци на локалном домаћину"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:8
+msgid "Authentication is required to acquire a shell on the local host."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте добили приÑтуп шкољци на локалном "
+"домаћину."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:9
+msgid "Acquire a pseudo TTY in a local container"
+msgstr "Добијте приÑтуп пÑеудо пиÑаћој машини унутар локалног контејнера"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:10
+msgid ""
+"Authentication is required to acquire a pseudo TTY in a local container."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте добили приÑтуп пÑеудо пиÑаћој "
+"машини унутар локалног контејнера."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:11
+msgid "Acquire a pseudo TTY on the local host"
+msgstr "Добијте приÑтуп пÑеудо пиÑаћој машини на локалном домаћину"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:12
+msgid "Authentication is required to acquire a pseudo TTY on the local host."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте добили приÑтуп пÑеудо пиÑаћој "
+"машини на локалном домаћину."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:13
+msgid "Manage local virtual machines and containers"
+msgstr "Управљајте локалним виртуелним машинама и контејнерима"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:14
+msgid ""
+"Authentication is required to manage local virtual machines and containers."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте управљали локалним виртуелним "
+"машинама и контејнерима."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:15
+msgid "Manage local virtual machine and container images"
+msgstr "Управљајте локалним виртуелним машинама и Ñликама контејнера"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:16
+msgid ""
+"Authentication is required to manage local virtual machine and container "
+"images."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте управљали локалним виртуелним "
+"машинама и Ñликама контејнера."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:1
+msgid "Set system time"
+msgstr "ПоÑтавите ÑиÑтемÑко време"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:2
+msgid "Authentication is required to set the system time."
+msgstr "Потребно је да Ñе идентификујете да биÑте поÑтавили ÑиÑтемÑко време."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:3
+msgid "Set system timezone"
+msgstr "ПоÑтавите ÑиÑтемÑку временÑку зону"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:4
+msgid "Authentication is required to set the system timezone."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте поÑтавили ÑиÑтемÑку временÑку зону."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:5
+msgid "Set RTC to local timezone or UTC"
+msgstr "ПоÑтавите RTC на локалну временÑку зону или UTC зону"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:6
+msgid ""
+"Authentication is required to control whether the RTC stores the local or "
+"UTC time."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте подеÑили да ли RTC чува локално "
+"или UTC време."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:7
+msgid "Turn network time synchronization on or off"
+msgstr "Укључите или иÑкључите уÑклађивање времена Ñа мреже"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:8
+msgid ""
+"Authentication is required to control whether network time synchronization "
+"shall be enabled."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте подеÑили да ли Ñе време уÑклађује "
+"Ñа мреже."
+
+#: ../src/core/dbus-unit.c:428
+msgid "Authentication is required to start '$(unit)'."
+msgstr "Потребно је да Ñе идентификујете да биÑте покренули „$(unit)“."
+
+#: ../src/core/dbus-unit.c:429
+msgid "Authentication is required to stop '$(unit)'."
+msgstr "Потребно је да Ñе идентификујете да биÑте зауÑтавили „$(unit)“."
+
+#: ../src/core/dbus-unit.c:430
+msgid "Authentication is required to reload '$(unit)'."
+msgstr "Потребно је да Ñе идентификујете да биÑте поново учитали „$(unit)“."
+
+#: ../src/core/dbus-unit.c:431 ../src/core/dbus-unit.c:432
+msgid "Authentication is required to restart '$(unit)'."
+msgstr "Потребно је да Ñе идентификујете да биÑте поново покренули „$(unit)“."
+
+#: ../src/core/dbus-unit.c:535
+msgid "Authentication is required to kill '$(unit)'."
+msgstr "Потребно је да Ñе идентификујете да биÑте убили „$(unit)“."
+
+#: ../src/core/dbus-unit.c:565
+msgid "Authentication is required to reset the \"failed\" state of '$(unit)'."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте поново поÑтавили „неуÑпешно“ Ñтање "
+"за „$(unit)“."
+
+#: ../src/core/dbus-unit.c:597
+msgid "Authentication is required to set properties on '$(unit)'."
+msgstr ""
+"Потребно је да Ñе идентификујете да биÑте поÑтавили ÑвојÑтва за „$(unit)“."
diff --git a/po/tr.po b/po/tr.po
new file mode 100644
index 000000000..076627e42
--- /dev/null
+++ b/po/tr.po
@@ -0,0 +1,598 @@
+# Turkish translation for systemd.
+# Copyright (C) 2014-2015 systemd's COPYRIGHT HOLDER
+# This file is distributed under the same license as the systemd package.
+# Necdet Yücel <necdetyucel@gmail.com>, 2014.
+# Gökhan Gurbetoğlu <ggurbet@gmail.com>, 2015.
+# Muhammet Kara <muhammetk@gmail.com>, 2015.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: systemd master\n"
+"Report-Msgid-Bugs-To: https://github.com/systemd/systemd/issues\n"
+"POT-Creation-Date: 2015-09-18 00:07+0000\n"
+"PO-Revision-Date: 2015-09-19 08:31+0300\n"
+"Last-Translator: Muhammet Kara <muhammetk@gmail.com>\n"
+"Language-Team: Türkçe <gnome-turk@gnome.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: tr_TR\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+"X-Generator: Gtranslator 2.91.7\n"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:1
+msgid "Send passphrase back to system"
+msgstr "Sisteme parolayı geri gönder"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:2
+msgid ""
+"Authentication is required to send the entered passphrase back to the system."
+msgstr "Sisteme parolayı geri göndermek kimlik doğrulaması gerektiriyor."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:3
+msgid "Manage system services or other units"
+msgstr "Sistem servislerini veya diğer birimlerini yönet"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:4
+msgid "Authentication is required to manage system services or other units."
+msgstr ""
+"Sistem servislerini veya diğer birimlerini yönetmek kimlik doğrulaması "
+"gerektiriyor."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:5
+msgid "Manage system service or unit files"
+msgstr "Sistem servislerini veya birim dosyalarını yönet"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:6
+msgid "Authentication is required to manage system service or unit files."
+msgstr ""
+"Sistem servislerini veya birim dosyalarını yönetmek kimlik doğrulaması "
+"gerektiriyor."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:7
+msgid "Set or unset system and service manager environment variables"
+msgstr "Sistem ve servis yöneticisi ortam değişkenlerini ayarla ya da kaldır"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:8
+msgid ""
+"Authentication is required to set or unset system and service manager "
+"environment variables."
+msgstr ""
+"Sistem ve servis yöneticisi ortam değişkenlerini ayarlamak ya da kaldırmak "
+"kimlik doğrulaması gerektiriyor."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:9
+msgid "Reload the systemd state"
+msgstr "systemd durumunu yeniden yükle"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:10
+msgid "Authentication is required to reload the systemd state."
+msgstr "systemd durumunu yeniden yüklemek kimlik doğrulaması gerektiriyor."
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:1
+msgid "Set host name"
+msgstr "Makine adını ayarla"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:2
+msgid "Authentication is required to set the local host name."
+msgstr "Yerel makine adını ayarlamak kimlik doğrulaması gerektiriyor."
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:3
+msgid "Set static host name"
+msgstr "Statik makine adı ayarla"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:4
+msgid ""
+"Authentication is required to set the statically configured local host name, "
+"as well as the pretty host name."
+msgstr ""
+"Statik olarak yapılandırılmış konak makine adını ve yerel makine adını "
+"ayarlamak kimlik doğrulaması gerektiriyor."
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:5
+msgid "Set machine information"
+msgstr "Makine bilgisini ayarla"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:6
+msgid "Authentication is required to set local machine information."
+msgstr "Yerel makine bilgisini ayarlamak kimlik doğrulaması gerektiriyor."
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:1
+msgid "Import a VM or container image"
+msgstr "Bir SM ya da kapsayıcı kalıbını içe aktar"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:2
+msgid "Authentication is required to import a VM or container image"
+msgstr ""
+"Bir SM ya da kapsayıcı kalıbını içe aktarmak için kimlik doğrulaması "
+"gereklidir"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:3
+msgid "Export a VM or container image"
+msgstr "Bir SM ya da kapsayıcı kalıbını dışa aktar"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:4
+msgid "Authentication is required to export a VM or container image"
+msgstr ""
+"Bir SM ya da kapsayıcı kalıbını dışa aktarmak için kimlik doğrulaması "
+"gereklidir"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:5
+msgid "Download a VM or container image"
+msgstr "Bir SM ya da kapsayıcı kalıbını indir"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:6
+msgid "Authentication is required to download a VM or container image"
+msgstr ""
+"Bir SM ya da kapsayıcı kalıbını indirmek için kimlik doğrulaması gereklidir"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:1
+msgid "Set system locale"
+msgstr "Sistem yerelini ayarla"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:2
+msgid "Authentication is required to set the system locale."
+msgstr "Sistem yerelini ayarlamak kimlik doğrulaması gerektiriyor."
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:3
+msgid "Set system keyboard settings"
+msgstr "Sistem klavye ayarlarını ayarla"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:4
+msgid "Authentication is required to set the system keyboard settings."
+msgstr "Sistem klavye ayarlarını ayarlamak kimlik doğrulaması gerektiriyor."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:1
+msgid "Allow applications to inhibit system shutdown"
+msgstr "Uygulamaların sistemin kapanmasına engel olmasına izin ver"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:2
+msgid ""
+"Authentication is required for an application to inhibit system shutdown."
+msgstr ""
+"Bir uygulamanın sistemin kapanmasına engel olması için kimlik doğrulaması "
+"gereklidir."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:3
+msgid "Allow applications to delay system shutdown"
+msgstr "Uygulamaların sistemin kapanmasını geciktirmelerine izin ver"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:4
+msgid "Authentication is required for an application to delay system shutdown."
+msgstr ""
+"Bir uygulamanın sistemin kapanmasını geciktirmesi için kimlik doğrulaması "
+"gereklidir."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:5
+msgid "Allow applications to inhibit system sleep"
+msgstr "Uygulamaların sistemin beklemeye geçmesini engellemesine izin ver"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:6
+msgid "Authentication is required for an application to inhibit system sleep."
+msgstr ""
+"Bir uygulamanın sistemin uykuya geçmesine engel olması için kimlik "
+"doğrulaması gereklidir."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:7
+msgid "Allow applications to delay system sleep"
+msgstr "Uygulamaların sistemin beklemeye geçmesini ertelemesine izin ver"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:8
+msgid "Authentication is required for an application to delay system sleep."
+msgstr ""
+"Bir uygulamanın sistemin uykuya geçmesini geciktirmesi için kimlik "
+"doğrulaması gereklidir."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:9
+msgid "Allow applications to inhibit automatic system suspend"
+msgstr ""
+"Uygulamaların sistemin otomatik bekletmeye geçmesini engellemesine izin ver"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:10
+msgid ""
+"Authentication is required for an application to inhibit automatic system "
+"suspend."
+msgstr ""
+"Bir uygulamanın sistemin otomatik olarak askıya alınmasına engel olması için "
+"kimlik doğrulaması gereklidir."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:11
+msgid "Allow applications to inhibit system handling of the power key"
+msgstr "Uygulamaların sistemin güç tuşunun kullanımını engellemesine izin ver"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:12
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the power key."
+msgstr ""
+"Bir uygulamanın sistemin güç tuşunu idare etmesine engel olması için kimlik "
+"doğrulaması gereklidir."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:13
+msgid "Allow applications to inhibit system handling of the suspend key"
+msgstr ""
+"Uygulamaların sistemin beklet tuşunun kullanımını engellemesine izin ver"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:14
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the suspend key."
+msgstr ""
+"Bir uygulamanın sistemin askıya alma tuşunu idare etmesine engel olması için "
+"kimlik doğrulaması gereklidir."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:15
+msgid "Allow applications to inhibit system handling of the hibernate key"
+msgstr ""
+"Uygulamaların sistemin uykuya geçme tuşunun kullanımını engellemesine izin "
+"ver"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:16
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the hibernate key."
+msgstr ""
+"Bir uygulamanın sistemin hazırda bekletme tuşunu idare etmesine engel olması "
+"için kimlik doğrulaması gereklidir."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:17
+msgid "Allow applications to inhibit system handling of the lid switch"
+msgstr ""
+"Uygulamaların sistemin kapak anahtarının kullanımını engellemesine izin ver"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:18
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the lid switch."
+msgstr ""
+"Bir uygulamanın sistemin kapak anahtarını idare etmesine engel olması için "
+"kimlik doğrulaması gereklidir."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:19
+msgid "Allow non-logged-in users to run programs"
+msgstr "Oturum açmamış kullanıcıların program çalıştırmasına izin ver"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:20
+msgid "Authentication is required to run programs as a non-logged-in user."
+msgstr ""
+"Oturum açmamış bir kullanıcı olarak program çalıştırmak için kimlik "
+"doğrulaması gereklidir."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:21
+msgid "Allow attaching devices to seats"
+msgstr "Aygıtların yuvaya takılmasına izin ver"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:22
+msgid "Authentication is required for attaching a device to a seat."
+msgstr ""
+"Bir aygıtın yuvaya takılmasına izin vermek kimlik doğrulaması gerektiriyor."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:23
+msgid "Flush device to seat attachments"
+msgstr "Aygıtın yuvaya eklenmesini sıfırla"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:24
+msgid ""
+"Authentication is required for resetting how devices are attached to seats."
+msgstr ""
+"Aygıtların yuvalara nasıl takıldığını sıfırlamak kimlik doğrulama "
+"gerektiriyor."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:25
+msgid "Power off the system"
+msgstr "Sistemi kapat"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:26
+msgid "Authentication is required for powering off the system."
+msgstr "Sistemi kapatmak için kimlik doğrulaması gerekiyor."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:27
+msgid "Power off the system while other users are logged in"
+msgstr "Diğer kullanıcılar oturum açmışken sistemi kapat"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:28
+msgid ""
+"Authentication is required for powering off the system while other users are "
+"logged in."
+msgstr ""
+"Diğer kullanıcılar oturum açmışken sistemi kapatmak kimlik doğrulaması "
+"gerektiriyor."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:29
+msgid "Power off the system while an application asked to inhibit it"
+msgstr "Bir uygulama engellenmesini isterken sistemi kapat"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:30
+msgid ""
+"Authentication is required for powering off the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Bir uygulama engellenmesini isterken sistemi kapatmak kimlik doğrulaması "
+"gerektiriyor."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:31
+msgid "Reboot the system"
+msgstr "Sistemi yeniden baÅŸlat"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:32
+msgid "Authentication is required for rebooting the system."
+msgstr "Sistemi yeniden başlatmak kimlik doğrulaması gerektiriyor."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:33
+msgid "Reboot the system while other users are logged in"
+msgstr "Diğer kullanıcılar oturum açmışken sistemi yeniden başlat"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:34
+msgid ""
+"Authentication is required for rebooting the system while other users are "
+"logged in."
+msgstr ""
+"Diğer kullanıcılar oturum açmışken sistemi yeniden başlatmak kimlik "
+"doğrulaması gerektiriyor."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:35
+msgid "Reboot the system while an application asked to inhibit it"
+msgstr "Bir uygulama engellenmesini isterken sistemi yeniden baÅŸlat"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:36
+msgid ""
+"Authentication is required for rebooting the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Bir uygulama engellenmesini isterken sistemi yeniden baÅŸlatmak kimlik "
+"doğrulaması gerektiriyor."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:37
+msgid "Suspend the system"
+msgstr "Sistemi askıya al"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:38
+msgid "Authentication is required for suspending the system."
+msgstr "Sistemi askıya almak kimlik doğrulaması gerektiriyor."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:39
+msgid "Suspend the system while other users are logged in"
+msgstr "Diğer kullanıcılar oturum açmışken sistemi askıya al"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:40
+msgid ""
+"Authentication is required for suspending the system while other users are "
+"logged in."
+msgstr ""
+"Diğer kullanıcılar oturum açmışken sistemi askıya almak kimlik doğrulaması "
+"gerektiriyor."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:41
+msgid "Suspend the system while an application asked to inhibit it"
+msgstr "Bir uygulama engellenmesini isterken sistemi askıya al"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:42
+msgid ""
+"Authentication is required for suspending the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Bir uygulama engellenmesini isterken sistemi askıya almak kimlik doğrulaması "
+"gerektiriyor."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:43
+msgid "Hibernate the system"
+msgstr "Sistemi hazırda beklet"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:44
+msgid "Authentication is required for hibernating the system."
+msgstr "Sistemi hazırda bekletmek kimlik doğrulaması gerektiriyor."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:45
+msgid "Hibernate the system while other users are logged in"
+msgstr "Diğer kullanıcılar oturum açmışken sistemi hazırda beklet"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:46
+msgid ""
+"Authentication is required for hibernating the system while other users are "
+"logged in."
+msgstr ""
+"Diğer kullanıcılar oturum açmışken sistemi hazırda bekletmek kimlik "
+"doğrulaması gerektiriyor."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:47
+msgid "Hibernate the system while an application asked to inhibit it"
+msgstr "Bir uygulama engellenmesini isterken sistemi hazırda beklet"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:48
+msgid ""
+"Authentication is required for hibernating the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Bir uygulama engellenmesini isterken sistemi hazırda bekletmek kimlik "
+"doğrulaması gerektiriyor."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:49
+msgid "Manage active sessions, users and seats"
+msgstr "Aktif oturumları, kullanıcıları ve yuvaları yönet"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:50
+msgid ""
+"Authentication is required for managing active sessions, users and seats."
+msgstr ""
+"Aktif oturumları, kullanıcıları ve yuvaları yönetmek için kimlik doğrulaması "
+"gereklidir."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:51
+msgid "Lock or unlock active sessions"
+msgstr "Aktif oturumları kilitle ya da kilidini aç"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:52
+msgid "Authentication is required to lock or unlock active sessions."
+msgstr ""
+"Aktif oturumları kilitlemek ve bunların kilidini açmak için kimlik "
+"doğrulaması gereklidir."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:53
+msgid "Allow indication to the firmware to boot to setup interface"
+msgstr ""
+"Kurulum arayüzünü önyüklemek için ürün yazılımının belirtilmesine izin ver"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:54
+msgid ""
+"Authentication is required to indicate to the firmware to boot to setup "
+"interface."
+msgstr ""
+"Kurulum arayüzünü önyüklemek için ürün yazılımının belirtilmesi için kimlik "
+"doğrulaması gereklidir."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:55
+msgid "Set a wall message"
+msgstr "Bir duvar mesajı ayarla"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:56
+msgid "Authentication is required to set a wall message"
+msgstr "Duvar mesajı ayarlamak için kimlik doğrulaması gereklidir"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:1
+msgid "Log into a local container"
+msgstr "Yerel kapsayıcıya giriş yap"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:2
+msgid "Authentication is required to log into a local container."
+msgstr "Yerel kapsayıcıda oturum açmak için kimlik doğrulaması gereklidir."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:3
+msgid "Log into the local host"
+msgstr "Yerel (ana) makineye giriÅŸ yap"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:4
+msgid "Authentication is required to log into the local host."
+msgstr "Yerel (ana) makinede oturum açmak için kimlik doğrulaması gereklidir."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:5
+msgid "Acquire a shell in a local container"
+msgstr "Yerel kapsayıcıda kabuk (shell) aç"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:6
+msgid "Authentication is required to acquire a shell in a local container."
+msgstr ""
+"Yerel kapsayıcıda kabuk (shell) açmak için kimlik doğrulaması gereklidir."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:7
+msgid "Acquire a shell on the local host"
+msgstr "Yerel (ana) makinede kabuk (shell) aç"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:8
+msgid "Authentication is required to acquire a shell on the local host."
+msgstr ""
+"Yerel (ana) makinede kabuk (shell) açmak için kimlik doğrulaması gereklidir."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:9
+msgid "Acquire a pseudo TTY in a local container"
+msgstr "Yerel kapsayıcıda sözde (pseudo) TTY al"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:10
+msgid ""
+"Authentication is required to acquire a pseudo TTY in a local container."
+msgstr ""
+"Yerel kapsayıcıda sözde (pseudo) TTY almak için kimlik doğrulaması "
+"gereklidir."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:11
+msgid "Acquire a pseudo TTY on the local host"
+msgstr "Yerel (ana) makinede sözde (pseudo) TTY al"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:12
+msgid "Authentication is required to acquire a pseudo TTY on the local host."
+msgstr ""
+"Yerel (ana) makinede sözde (pseudo) TTY almak için kimlik doğrulaması "
+"gereklidir."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:13
+msgid "Manage local virtual machines and containers"
+msgstr "Yerel sanal makineleri ve kapsayıcıları yönet"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:14
+msgid ""
+"Authentication is required to manage local virtual machines and containers."
+msgstr ""
+"Yerel sanal makineleri ve kapsayıcıları yönetmek için kimlik doğrulaması "
+"gereklidir."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:15
+msgid "Manage local virtual machine and container images"
+msgstr "Yerel sanal makine ve kapsayıcı kalıplarını yönet"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:16
+msgid ""
+"Authentication is required to manage local virtual machine and container "
+"images."
+msgstr ""
+"Yerel sanal makineler ve kapsayıcı kalıplarını yönetmek için kimlik "
+"doğrulaması gereklidir."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:1
+msgid "Set system time"
+msgstr "Sistem zamanını ayarla"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:2
+msgid "Authentication is required to set the system time."
+msgstr "Sistem zamanını ayarlamak kimlik doğrulaması gerektiriyor."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:3
+msgid "Set system timezone"
+msgstr "Sistem zaman dilimini ayarla"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:4
+msgid "Authentication is required to set the system timezone."
+msgstr "Sistem zaman dilimini ayarlamak kimlik doğrulaması gerektiriyor."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:5
+msgid "Set RTC to local timezone or UTC"
+msgstr "Gerçek zamanlı saat olarak yerel zaman dilimini veya UTC'yi ayarla"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:6
+msgid ""
+"Authentication is required to control whether the RTC stores the local or "
+"UTC time."
+msgstr ""
+"Gerçek zamanlı saat olarak yerel zaman dilimini veya UTC'yi ayarlamak kimlik "
+"doğrulaması gerektiriyor."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:7
+msgid "Turn network time synchronization on or off"
+msgstr "Ağ zaman eş zamanlamasını aç veya kapat"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:8
+msgid ""
+"Authentication is required to control whether network time synchronization "
+"shall be enabled."
+msgstr ""
+"Ağ zaman eş zamanlamasını kontrol etmek kimlik doğrulaması gerektiriyor."
+
+#: ../src/core/dbus-unit.c:428
+msgid "Authentication is required to start '$(unit)'."
+msgstr "'$(unit)' başlatmak için kimlik doğrulaması gereklidir."
+
+#: ../src/core/dbus-unit.c:429
+msgid "Authentication is required to stop '$(unit)'."
+msgstr "'$(unit)' durdurmak için kimlik doğrulaması gereklidir."
+
+#: ../src/core/dbus-unit.c:430
+msgid "Authentication is required to reload '$(unit)'."
+msgstr "'$(unit)' yeniden yüklemek için kimlik doğrulaması gereklidir."
+
+#: ../src/core/dbus-unit.c:431 ../src/core/dbus-unit.c:432
+msgid "Authentication is required to restart '$(unit)'."
+msgstr "'$(unit)' yeniden başlatmak için kimlik doğrulaması gereklidir."
+
+#: ../src/core/dbus-unit.c:535
+msgid "Authentication is required to kill '$(unit)'."
+msgstr "'$(unit)' sonlandırmak için kimlik doğrulaması gereklidir."
+
+#: ../src/core/dbus-unit.c:565
+msgid "Authentication is required to reset the \"failed\" state of '$(unit)'."
+msgstr ""
+"'$(unit)'in \"failed\" (başarısız) durumunu sıfırlamak için kimlik "
+"doğrulaması gereklidir."
+
+#: ../src/core/dbus-unit.c:597
+msgid "Authentication is required to set properties on '$(unit)'."
+msgstr ""
+"'$(unit)' üzerindeki özellikleri ayarlamak için kimlik doğrulaması "
+"gereklidir."
diff --git a/po/zh_TW.po b/po/zh_TW.po
index ee9f4d09a..fb276a157 100644
--- a/po/zh_TW.po
+++ b/po/zh_TW.po
@@ -9,7 +9,7 @@ msgstr ""
"POT-Creation-Date: 2015-06-18 00:53+0200\n"
"PO-Revision-Date: 2015-06-11 12:44+0800\n"
"Last-Translator: Jeff Huang <s8321414@gmail.com>\n"
-"Language-Team: Chinese Traditional <kde-i18n-doc@kde.org>\n"
+"Language-Team: chinese-l10n <chinese-l10n@googlegroups.com>\n"
"Language: zh_TW\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
index 5cbe45a7e..502fe4609 100644
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
@@ -2073,9 +2073,10 @@ int cg_mask_supported(CGroupMask *ret) {
mask |= CGROUP_CONTROLLER_TO_MASK(v);
}
- /* Currently, we only support the memory controller in
- * the unified hierarchy, mask everything else off. */
- mask &= CGROUP_MASK_MEMORY;
+ /* Currently, we only support the memory and pids
+ * controller in the unified hierarchy, mask
+ * everything else off. */
+ mask &= CGROUP_MASK_MEMORY | CGROUP_MASK_PIDS;
} else {
CGroupController c;
@@ -2280,12 +2281,57 @@ bool cg_is_legacy_wanted(void) {
}
#endif // 0
+/// UNNEEDED by elogind
+#if 0
+int cg_cpu_shares_parse(const char *s, uint64_t *ret) {
+ uint64_t u;
+ int r;
+
+ if (isempty(s)) {
+ *ret = CGROUP_CPU_SHARES_INVALID;
+ return 0;
+ }
+
+ r = safe_atou64(s, &u);
+ if (r < 0)
+ return r;
+
+ if (u < CGROUP_CPU_SHARES_MIN || u > CGROUP_CPU_SHARES_MAX)
+ return -ERANGE;
+
+ *ret = u;
+ return 0;
+}
+
+int cg_blkio_weight_parse(const char *s, uint64_t *ret) {
+ uint64_t u;
+ int r;
+
+ if (isempty(s)) {
+ *ret = CGROUP_BLKIO_WEIGHT_INVALID;
+ return 0;
+ }
+
+ r = safe_atou64(s, &u);
+ if (r < 0)
+ return r;
+
+ if (u < CGROUP_BLKIO_WEIGHT_MIN || u > CGROUP_BLKIO_WEIGHT_MAX)
+ return -ERANGE;
+
+ *ret = u;
+ return 0;
+}
+#endif // 0
+
static const char *cgroup_controller_table[_CGROUP_CONTROLLER_MAX] = {
[CGROUP_CONTROLLER_CPU] = "cpu",
[CGROUP_CONTROLLER_CPUACCT] = "cpuacct",
[CGROUP_CONTROLLER_BLKIO] = "blkio",
[CGROUP_CONTROLLER_MEMORY] = "memory",
- [CGROUP_CONTROLLER_DEVICE] = "devices",
+ [CGROUP_CONTROLLER_DEVICES] = "devices",
+ [CGROUP_CONTROLLER_PIDS] = "pids",
+ [CGROUP_CONTROLLER_NET_CLS] = "net_cls",
};
DEFINE_STRING_TABLE_LOOKUP(cgroup_controller, CGroupController);
diff --git a/src/basic/cgroup-util.h b/src/basic/cgroup-util.h
index 974355957..e3f3bf080 100644
--- a/src/basic/cgroup-util.h
+++ b/src/basic/cgroup-util.h
@@ -34,7 +34,9 @@ typedef enum CGroupController {
CGROUP_CONTROLLER_CPUACCT,
CGROUP_CONTROLLER_BLKIO,
CGROUP_CONTROLLER_MEMORY,
- CGROUP_CONTROLLER_DEVICE,
+ CGROUP_CONTROLLER_DEVICES,
+ CGROUP_CONTROLLER_PIDS,
+ CGROUP_CONTROLLER_NET_CLS,
_CGROUP_CONTROLLER_MAX,
_CGROUP_CONTROLLER_INVALID = -1,
} CGroupController;
@@ -47,10 +49,36 @@ typedef enum CGroupMask {
CGROUP_MASK_CPUACCT = CGROUP_CONTROLLER_TO_MASK(CGROUP_CONTROLLER_CPUACCT),
CGROUP_MASK_BLKIO = CGROUP_CONTROLLER_TO_MASK(CGROUP_CONTROLLER_BLKIO),
CGROUP_MASK_MEMORY = CGROUP_CONTROLLER_TO_MASK(CGROUP_CONTROLLER_MEMORY),
- CGROUP_MASK_DEVICE = CGROUP_CONTROLLER_TO_MASK(CGROUP_CONTROLLER_DEVICE),
+ CGROUP_MASK_DEVICES = CGROUP_CONTROLLER_TO_MASK(CGROUP_CONTROLLER_DEVICES),
+ CGROUP_MASK_PIDS = CGROUP_CONTROLLER_TO_MASK(CGROUP_CONTROLLER_PIDS),
+ CGROUP_MASK_NET_CLS = CGROUP_CONTROLLER_TO_MASK(CGROUP_CONTROLLER_NET_CLS),
_CGROUP_MASK_ALL = CGROUP_CONTROLLER_TO_MASK(_CGROUP_CONTROLLER_MAX) - 1
} CGroupMask;
+/* Special values for the cpu.shares attribute */
+#define CGROUP_CPU_SHARES_INVALID ((uint64_t) -1)
+#define CGROUP_CPU_SHARES_MIN UINT64_C(2)
+#define CGROUP_CPU_SHARES_MAX UINT64_C(262144)
+#define CGROUP_CPU_SHARES_DEFAULT UINT64_C(1024)
+
+static inline bool CGROUP_CPU_SHARES_IS_OK(uint64_t x) {
+ return
+ x == CGROUP_CPU_SHARES_INVALID ||
+ (x >= CGROUP_CPU_SHARES_MIN && x <= CGROUP_CPU_SHARES_MAX);
+}
+
+/* Special values for the blkio.weight attribute */
+#define CGROUP_BLKIO_WEIGHT_INVALID ((uint64_t) -1)
+#define CGROUP_BLKIO_WEIGHT_MIN UINT64_C(10)
+#define CGROUP_BLKIO_WEIGHT_MAX UINT64_C(1000)
+#define CGROUP_BLKIO_WEIGHT_DEFAULT UINT64_C(500)
+
+static inline bool CGROUP_BLKIO_WEIGHT_IS_OK(uint64_t x) {
+ return
+ x == CGROUP_BLKIO_WEIGHT_INVALID ||
+ (x >= CGROUP_BLKIO_WEIGHT_MIN && x <= CGROUP_BLKIO_WEIGHT_MAX);
+}
+
/*
* General rules:
*
@@ -159,3 +187,6 @@ bool cg_is_legacy_wanted(void);
const char* cgroup_controller_to_string(CGroupController c) _const_;
CGroupController cgroup_controller_from_string(const char *s) _pure_;
+
+// UNNEEDED int cg_cpu_shares_parse(const char *s, uint64_t *ret);
+// UNNEEDED int cg_blkio_weight_parse(const char *s, uint64_t *ret);
diff --git a/src/basic/copy.c b/src/basic/copy.c
index 163bbf7c7..3c02fd41e 100644
--- a/src/basic/copy.c
+++ b/src/basic/copy.c
@@ -29,7 +29,7 @@
#define COPY_BUFFER_SIZE (16*1024)
-int copy_bytes(int fdf, int fdt, off_t max_bytes, bool try_reflink) {
+int copy_bytes(int fdf, int fdt, uint64_t max_bytes, bool try_reflink) {
bool try_sendfile = true, try_splice = true;
int r;
@@ -37,22 +37,26 @@ int copy_bytes(int fdf, int fdt, off_t max_bytes, bool try_reflink) {
assert(fdt >= 0);
#if 0
/* Try btrfs reflinks first. */
- if (try_reflink && max_bytes == (off_t) -1) {
+ if (try_reflink &&
+ max_bytes == (uint64_t) -1 &&
+ lseek(fdf, 0, SEEK_CUR) == 0 &&
+ lseek(fdt, 0, SEEK_CUR) == 0) {
+
r = btrfs_reflink(fdf, fdt);
if (r >= 0)
- return r;
+ return 0; /* we copied the whole thing, hence hit EOF, return 0 */
}
#endif // 0
for (;;) {
size_t m = COPY_BUFFER_SIZE;
ssize_t n;
- if (max_bytes != (off_t) -1) {
+ if (max_bytes != (uint64_t) -1) {
if (max_bytes <= 0)
return -EFBIG;
- if ((off_t) m > max_bytes)
+ if ((uint64_t) m > max_bytes)
m = (size_t) max_bytes;
}
@@ -91,7 +95,7 @@ int copy_bytes(int fdf, int fdt, off_t max_bytes, bool try_reflink) {
/* As a fallback just copy bits by hand */
{
- char buf[m];
+ uint8_t buf[m];
n = read(fdf, buf, m);
if (n < 0)
@@ -105,13 +109,13 @@ int copy_bytes(int fdf, int fdt, off_t max_bytes, bool try_reflink) {
}
next:
- if (max_bytes != (off_t) -1) {
- assert(max_bytes >= n);
+ if (max_bytes != (uint64_t) -1) {
+ assert(max_bytes >= (uint64_t) n);
max_bytes -= n;
}
}
- return 0;
+ return 0; /* return 0 if we hit EOF earlier than the size limit */
}
// UNNEEDED by elogind
@@ -154,7 +158,7 @@ static int fd_copy_regular(int df, const char *from, const struct stat *st, int
if (fdt < 0)
return -errno;
- r = copy_bytes(fdf, fdt, (off_t) -1, true);
+ r = copy_bytes(fdf, fdt, (uint64_t) -1, true);
if (r < 0) {
unlinkat(dt, to, 0);
return r;
@@ -373,7 +377,7 @@ int copy_file_fd(const char *from, int fdt, bool try_reflink) {
if (fdf < 0)
return -errno;
- r = copy_bytes(fdf, fdt, (off_t) -1, try_reflink);
+ r = copy_bytes(fdf, fdt, (uint64_t) -1, try_reflink);
(void) copy_times(fdf, fdt);
(void) copy_xattr(fdf, fdt);
diff --git a/src/basic/copy.h b/src/basic/copy.h
index 1909de4b8..0cb8cf766 100644
--- a/src/basic/copy.h
+++ b/src/basic/copy.h
@@ -30,6 +30,6 @@
// UNNEEDED int copy_tree(const char *from, const char *to, bool merge);
// UNNEEDED int copy_tree_at(int fdf, const char *from, int fdt, const char *to, bool merge);
// UNNEEDED int copy_directory_fd(int dirfd, const char *to, bool merge);
-int copy_bytes(int fdf, int fdt, off_t max_bytes, bool try_reflink);
+int copy_bytes(int fdf, int fdt, uint64_t max_bytes, bool try_reflink);
// UNNEEDED int copy_times(int fdf, int fdt);
// UNNEEDED int copy_xattr(int fdf, int fdt);
diff --git a/src/basic/fileio.c b/src/basic/fileio.c
index f666380a4..a3f8d42f5 100644
--- a/src/basic/fileio.c
+++ b/src/basic/fileio.c
@@ -784,15 +784,19 @@ int executable_is_script(const char *path, char **interpreter) {
/**
* Retrieve one field from a file like /proc/self/status. pattern
- * should start with '\n' and end with a ':'. Whitespace and zeros
- * after the ':' will be skipped. field must be freed afterwards.
+ * should not include whitespace or the delimiter (':'). pattern matches only
+ * the beginning of a line. Whitespace before ':' is skipped. Whitespace and
+ * zeros after the ':' will be skipped. field must be freed afterwards.
+ * terminator specifies the terminating characters of the field value (not
+ * included in the value).
*/
-int get_status_field(const char *filename, const char *pattern, char **field) {
+int get_proc_field(const char *filename, const char *pattern, const char *terminator, char **field) {
_cleanup_free_ char *status = NULL;
char *t, *f;
size_t len;
int r;
+ assert(terminator);
assert(filename);
assert(pattern);
assert(field);
@@ -801,11 +805,31 @@ int get_status_field(const char *filename, const char *pattern, char **field) {
if (r < 0)
return r;
- t = strstr(status, pattern);
+ t = status;
+
+ do {
+ bool pattern_ok;
+
+ do {
+ t = strstr(t, pattern);
if (!t)
return -ENOENT;
+ /* Check that pattern occurs in beginning of line. */
+ pattern_ok = (t == status || t[-1] == '\n');
+
t += strlen(pattern);
+
+ } while (!pattern_ok);
+
+ t += strspn(t, " \t");
+ if (!*t)
+ return -ENOENT;
+
+ } while (*t != ':');
+
+ t++;
+
if (*t) {
t += strspn(t, " \t");
@@ -821,7 +845,7 @@ int get_status_field(const char *filename, const char *pattern, char **field) {
t --;
}
- len = strcspn(t, WHITESPACE);
+ len = strcspn(t, terminator);
f = strndup(t, len);
if (!f)
diff --git a/src/basic/fileio.h b/src/basic/fileio.h
index edae438e4..e071bea3a 100644
--- a/src/basic/fileio.h
+++ b/src/basic/fileio.h
@@ -48,4 +48,4 @@ int write_env_file(const char *fname, char **l);
// UNNEEDED int executable_is_script(const char *path, char **interpreter);
-int get_status_field(const char *filename, const char *pattern, char **field);
+int get_proc_field(const char *filename, const char *pattern, const char *terminator, char **field);
diff --git a/src/basic/hashmap.c b/src/basic/hashmap.c
index 83c76ae0d..3c0e70b9c 100644
--- a/src/basic/hashmap.c
+++ b/src/basic/hashmap.c
@@ -276,10 +276,8 @@ static const struct hashmap_type_info hashmap_type_info[_HASHMAP_TYPE_MAX] = {
},
};
-unsigned long string_hash_func(const void *p, const uint8_t hash_key[HASH_KEY_SIZE]) {
- uint64_t u;
- siphash24((uint8_t*) &u, p, strlen(p), hash_key);
- return (unsigned long) u;
+void string_hash_func(const void *p, struct siphash *state) {
+ siphash24_compress(p, strlen(p) + 1, state);
}
int string_compare_func(const void *a, const void *b) {
@@ -291,10 +289,8 @@ const struct hash_ops string_hash_ops = {
.compare = string_compare_func
};
-unsigned long trivial_hash_func(const void *p, const uint8_t hash_key[HASH_KEY_SIZE]) {
- uint64_t u;
- siphash24((uint8_t*) &u, &p, sizeof(p), hash_key);
- return (unsigned long) u;
+void trivial_hash_func(const void *p, struct siphash *state) {
+ siphash24_compress(&p, sizeof(p), state);
}
int trivial_compare_func(const void *a, const void *b) {
@@ -306,10 +302,8 @@ const struct hash_ops trivial_hash_ops = {
.compare = trivial_compare_func
};
-unsigned long uint64_hash_func(const void *p, const uint8_t hash_key[HASH_KEY_SIZE]) {
- uint64_t u;
- siphash24((uint8_t*) &u, p, sizeof(uint64_t), hash_key);
- return (unsigned long) u;
+void uint64_hash_func(const void *p, struct siphash *state) {
+ siphash24_compress(p, sizeof(uint64_t), state);
}
int uint64_compare_func(const void *_a, const void *_b) {
@@ -325,10 +319,8 @@ const struct hash_ops uint64_hash_ops = {
};
#if SIZEOF_DEV_T != 8
-unsigned long devt_hash_func(const void *p, const uint8_t hash_key[HASH_KEY_SIZE]) {
- uint64_t u;
- siphash24((uint8_t*) &u, p, sizeof(dev_t), hash_key);
- return (unsigned long) u;
+void devt_hash_func(const void *p, struct siphash *state) {
+ siphash24_compress(p, sizeof(dev_t), state);
}
int devt_compare_func(const void *_a, const void *_b) {
@@ -379,7 +371,16 @@ static uint8_t *hash_key(HashmapBase *h) {
}
static unsigned base_bucket_hash(HashmapBase *h, const void *p) {
- return (unsigned) (h->hash_ops->hash(p, hash_key(h)) % n_buckets(h));
+ struct siphash state;
+ uint64_t hash;
+
+ siphash24_init(&state, hash_key(h));
+
+ h->hash_ops->hash(p, &state);
+
+ siphash24_finalize((uint8_t*)&hash, &state);
+
+ return (unsigned) (hash % n_buckets(h));
}
#define bucket_hash(h, p) base_bucket_hash(HASHMAP_BASE(h), p)
@@ -1823,6 +1824,7 @@ void *ordered_hashmap_next(OrderedHashmap *h, const void *key) {
return ordered_bucket_at(h, e->iterate_next)->p.value;
}
#endif // 0
+
int set_consume(Set *s, void *value) {
int r;
diff --git a/src/basic/hashmap.h b/src/basic/hashmap.h
index 03c8ae1c5..54f60258d 100644
--- a/src/basic/hashmap.h
+++ b/src/basic/hashmap.h
@@ -25,6 +25,7 @@
#include <stdbool.h>
#include "macro.h"
+#include "siphash24.h"
#include "util.h"
/*
@@ -67,7 +68,7 @@ typedef struct {
#define _IDX_ITERATOR_FIRST (UINT_MAX - 1)
#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]);
+typedef void (*hash_func_t)(const void *p, struct siphash *state);
typedef int (*compare_func_t)(const void *a, const void *b);
struct hash_ops {
@@ -75,28 +76,28 @@ struct hash_ops {
compare_func_t compare;
};
-unsigned long string_hash_func(const void *p, const uint8_t hash_key[HASH_KEY_SIZE]) _pure_;
+void string_hash_func(const void *p, struct siphash *state);
int string_compare_func(const void *a, const void *b) _pure_;
extern const struct hash_ops string_hash_ops;
/* This will compare the passed pointers directly, and will not
* dereference them. This is hence not useful for strings or
* suchlike. */
-unsigned long trivial_hash_func(const void *p, const uint8_t hash_key[HASH_KEY_SIZE]) _pure_;
+void trivial_hash_func(const void *p, struct siphash *state);
int trivial_compare_func(const void *a, const void *b) _const_;
extern const struct hash_ops trivial_hash_ops;
/* 32bit values we can always just embedd in the pointer itself, but
* in order to support 32bit archs we need store 64bit values
* indirectly, since they don't fit in a pointer. */
-unsigned long uint64_hash_func(const void *p, const uint8_t hash_key[HASH_KEY_SIZE]) _pure_;
+void uint64_hash_func(const void *p, struct siphash *state);
int uint64_compare_func(const void *a, const void *b) _pure_;
extern const struct hash_ops uint64_hash_ops;
/* On some archs dev_t is 32bit, and on others 64bit. And sometimes
* it's 64bit on 32bit archs, and sometimes 32bit on 64bit archs. Yuck! */
#if SIZEOF_DEV_T != 8
-unsigned long devt_hash_func(const void *p, const uint8_t hash_key[HASH_KEY_SIZE]) _pure_;
+void devt_hash_func(const void *p, struct siphash *state) _pure_;
int devt_compare_func(const void *a, const void *b) _pure_;
extern const struct hash_ops devt_hash_ops = {
.hash = devt_hash_func,
diff --git a/src/basic/log.c b/src/basic/log.c
index 921c952f8..c6f70a187 100644
--- a/src/basic/log.c
+++ b/src/basic/log.c
@@ -351,10 +351,10 @@ static int write_to_console(
}
if (highlight)
- IOVEC_SET_STRING(iovec[n++], ANSI_HIGHLIGHT_RED_ON);
+ IOVEC_SET_STRING(iovec[n++], ANSI_HIGHLIGHT_RED);
IOVEC_SET_STRING(iovec[n++], buffer);
if (highlight)
- IOVEC_SET_STRING(iovec[n++], ANSI_HIGHLIGHT_OFF);
+ IOVEC_SET_STRING(iovec[n++], ANSI_NORMAL);
IOVEC_SET_STRING(iovec[n++], "\n");
if (writev(console_fd, iovec, n) < 0) {
@@ -942,7 +942,7 @@ int log_set_max_level_from_string(const char *e) {
t = log_level_from_string(e);
if (t < 0)
- return t;
+ return -EINVAL;
log_set_max_level(t);
return 0;
diff --git a/src/basic/log.h b/src/basic/log.h
index 5fb223de5..fe59fb0ad 100644
--- a/src/basic/log.h
+++ b/src/basic/log.h
@@ -236,3 +236,15 @@ int log_syntax_internal(
? log_syntax_internal(unit, _level, config_file, config_line, _e, __FILE__, __LINE__, __func__, __VA_ARGS__) \
: -abs(_e); \
})
+
+#define log_syntax_invalid_utf8(unit, level, config_file, config_line, rvalue) \
+ ({ \
+ int _level = (level); \
+ if (log_get_max_level() >= LOG_PRI(_level)) { \
+ _cleanup_free_ char *_p = NULL; \
+ _p = utf8_escape_invalid(rvalue); \
+ log_syntax_internal(unit, _level, config_file, config_line, 0, __FILE__, __LINE__, __func__, \
+ "String is not UTF-8 clean, ignoring assignment: %s", strna(_p)); \
+ } \
+ -EINVAL; \
+ })
diff --git a/src/basic/macro.h b/src/basic/macro.h
index 7715c6e69..53d7f9baf 100644
--- a/src/basic/macro.h
+++ b/src/basic/macro.h
@@ -124,8 +124,11 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) {
return 1UL << (sizeof(u) * 8 - __builtin_clzl(u - 1UL));
}
-#define ELEMENTSOF(x) (sizeof(x)/sizeof((x)[0]))
-
+#define ELEMENTSOF(x) \
+ __extension__ (__builtin_choose_expr( \
+ !__builtin_types_compatible_p(typeof(x), typeof(&*(x))), \
+ sizeof(x)/sizeof((x)[0]), \
+ (void)0))
/*
* container_of - cast a member of a structure out to the containing structure
* @ptr: the pointer to the member.
@@ -214,18 +217,20 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) {
(__x / __y + !!(__x % __y)); \
})
-#define assert_se(expr) \
+#define assert_message_se(expr, message) \
do { \
if (_unlikely_(!(expr))) \
- log_assert_failed(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
- } while (false) \
+ log_assert_failed(message, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
+ } while (false)
+
+#define assert_se(expr) assert_message_se(expr, #expr)
/* We override the glibc assert() here. */
#undef assert
#ifdef NDEBUG
#define assert(expr) do {} while(false)
#else
-#define assert(expr) assert_se(expr)
+#define assert(expr) assert_message_se(expr, #expr)
#endif
#define assert_not_reached(t) \
@@ -250,19 +255,19 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) {
REENABLE_WARNING
#endif
-#define assert_log(expr) ((_likely_(expr)) \
- ? (true) \
- : (log_assert_failed_return(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__), false))
+#define assert_log(expr, message) ((_likely_(expr)) \
+ ? (true) \
+ : (log_assert_failed_return(message, __FILE__, __LINE__, __PRETTY_FUNCTION__), false))
#define assert_return(expr, r) \
do { \
- if (!assert_log(expr)) \
+ if (!assert_log(expr, #expr)) \
return (r); \
} while (false)
#define assert_return_errno(expr, r, err) \
do { \
- if (!assert_log(expr)) { \
+ if (!assert_log(expr, #expr)) { \
errno = err; \
return (r); \
} \
@@ -466,18 +471,6 @@ do { \
#define GID_INVALID ((gid_t) -1)
#define MODE_INVALID ((mode_t) -1)
-static inline bool UID_IS_INVALID(uid_t uid) {
- /* We consider both the old 16bit -1 user and the newer 32bit
- * -1 user invalid, since they are or used to be incompatible
- * with syscalls such as setresuid() or chown(). */
-
- return uid == (uid_t) ((uint32_t) -1) || uid == (uid_t) ((uint16_t) -1);
-}
-
-static inline bool GID_IS_INVALID(gid_t gid) {
- return gid == (gid_t) ((uint32_t) -1) || gid == (gid_t) ((uint16_t) -1);
-}
-
#define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \
static inline void func##p(type *p) { \
if (*p) \
diff --git a/src/basic/memfd-util.c b/src/basic/memfd-util.c
index b6dc19082..fef163457 100644
--- a/src/basic/memfd-util.c
+++ b/src/basic/memfd-util.c
@@ -70,6 +70,8 @@ int memfd_new(const char *name) {
return fd;
}
+/// UNNEEDED by elogind
+#if 0
int memfd_map(int fd, uint64_t offset, size_t size, void **p) {
void *q;
int sealed;
@@ -93,6 +95,7 @@ int memfd_map(int fd, uint64_t offset, size_t size, void **p) {
*p = q;
return 0;
}
+#endif // 0
int memfd_set_sealed(int fd) {
int r;
@@ -118,6 +121,8 @@ int memfd_get_sealed(int fd) {
return r == (F_SEAL_SHRINK | F_SEAL_GROW | F_SEAL_WRITE | F_SEAL_SEAL);
}
+/// UNNEEDED by elogind
+#if 0
int memfd_get_size(int fd, uint64_t *sz) {
struct stat stat;
int r;
@@ -132,6 +137,7 @@ int memfd_get_size(int fd, uint64_t *sz) {
*sz = stat.st_size;
return 0;
}
+#endif // 0
int memfd_set_size(int fd, uint64_t sz) {
int r;
diff --git a/src/basic/memfd-util.h b/src/basic/memfd-util.h
index 9aa87b783..d96fd160e 100644
--- a/src/basic/memfd-util.h
+++ b/src/basic/memfd-util.h
@@ -26,10 +26,10 @@
int memfd_new(const char *name);
// 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);
+// UNNEEDED int memfd_map(int fd, uint64_t offset, size_t size, void **p);
int memfd_set_sealed(int fd);
int memfd_get_sealed(int fd);
-int memfd_get_size(int fd, uint64_t *sz);
+// UNNEEDED int memfd_get_size(int fd, uint64_t *sz);
int memfd_set_size(int fd, uint64_t sz);
diff --git a/src/basic/missing.h b/src/basic/missing.h
index bc6fbc539..7ba1c68e8 100644
--- a/src/basic/missing.h
+++ b/src/basic/missing.h
@@ -39,6 +39,10 @@
#include "musl_missing.h"
+#ifdef HAVE_AUDIT
+#include <libaudit.h>
+#endif
+
#ifdef ARCH_MIPS
#include <asm/sgidefs.h>
#endif
@@ -137,6 +141,8 @@ static inline int pivot_root(const char *new_root, const char *put_old) {
# define __NR_memfd_create 385
# elif defined __aarch64__
# define __NR_memfd_create 279
+# elif defined __s390__
+# define __NR_memfd_create 350
# elif defined _MIPS_SIM
# if _MIPS_SIM == _MIPS_SIM_ABI32
# define __NR_memfd_create 4354
@@ -838,6 +844,19 @@ static inline int setns(int fd, int nstype) {
#define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
#endif
+#if !HAVE_DECL_IFLA_BR_PRIORITY
+#define IFLA_BR_UNSPEC 0
+#define IFLA_BR_FORWARD_DELAY 1
+#define IFLA_BR_HELLO_TIME 2
+#define IFLA_BR_MAX_AGE 3
+#define IFLA_BR_AGEING_TIME 4
+#define IFLA_BR_STP_STATE 5
+#define IFLA_BR_PRIORITY 6
+#define __IFLA_BR_MAX 7
+
+#define IFLA_BR_MAX (__IFLA_BR_MAX - 1)
+#endif
+
#if !HAVE_DECL_IFLA_BRPORT_LEARNING_SYNC
#define IFLA_BRPORT_UNSPEC 0
#define IFLA_BRPORT_STATE 1
@@ -1026,7 +1045,12 @@ static inline int renameat2(int oldfd, const char *oldname, int newfd, const cha
#if !HAVE_DECL_KCMP
static inline int kcmp(pid_t pid1, pid_t pid2, int type, unsigned long idx1, unsigned long idx2) {
+#if defined(__NR_kcmp)
return syscall(__NR_kcmp, pid1, pid2, type, idx1, idx2);
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
}
#endif
@@ -1041,3 +1065,48 @@ static inline int kcmp(pid_t pid1, pid_t pid2, int type, unsigned long idx1, uns
#ifndef INPUT_PROP_ACCELEROMETER
#define INPUT_PROP_ACCELEROMETER 0x06
#endif
+
+#if !HAVE_DECL_KEY_SERIAL_T
+typedef int32_t key_serial_t;
+#endif
+
+#if !HAVE_DECL_KEYCTL
+static inline long keyctl(int cmd, unsigned long arg2, unsigned long arg3, unsigned long arg4,unsigned long arg5) {
+#if defined(__NR_keyctl)
+ return syscall(__NR_keyctl, cmd, arg2, arg3, arg4, arg5);
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+static inline key_serial_t add_key(const char *type, const char *description, const void *payload, size_t plen, key_serial_t ringid) {
+#if defined (__NR_add_key)
+ return syscall(__NR_add_key, type, description, payload, plen, ringid);
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+static inline key_serial_t request_key(const char *type, const char *description, const char * callout_info, key_serial_t destringid) {
+#if defined (__NR_request_key)
+ return syscall(__NR_request_key, type, description, callout_info, destringid);
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+#endif
+
+#ifndef KEYCTL_READ
+#define KEYCTL_READ 11
+#endif
+
+#ifndef KEYCTL_SET_TIMEOUT
+#define KEYCTL_SET_TIMEOUT 15
+#endif
+
+#ifndef KEY_SPEC_USER_KEYRING
+#define KEY_SPEC_USER_KEYRING -4
+#endif
diff --git a/src/basic/path-util.c b/src/basic/path-util.c
index 238252eeb..3998fc98a 100644
--- a/src/basic/path-util.c
+++ b/src/basic/path-util.c
@@ -219,7 +219,6 @@ 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;
@@ -241,6 +240,7 @@ char **path_strv_make_absolute_cwd(char **l) {
return l;
}
+#endif // 0
char **path_strv_resolve(char **l, const char *prefix) {
char **s;
diff --git a/src/basic/path-util.h b/src/basic/path-util.h
index 90b405dc8..a0a8dc619 100644
--- a/src/basic/path-util.h
+++ b/src/basic/path-util.h
@@ -49,7 +49,7 @@ bool path_equal(const char *a, const char *b) _pure_;
// UNNEEDED bool path_equal_or_files_same(const char *a, const char *b);
// UNNEEDED char* path_join(const char *root, const char *path, const char *rest);
-char** path_strv_make_absolute_cwd(char **l);
+// UNNEEDED char** path_strv_make_absolute_cwd(char **l);
char** path_strv_resolve(char **l, const char *prefix);
char** path_strv_resolve_uniq(char **l, const char *prefix);
diff --git a/src/basic/prioq.c b/src/basic/prioq.c
index b89888be0..d55b348c2 100644
--- a/src/basic/prioq.c
+++ b/src/basic/prioq.c
@@ -19,6 +19,16 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+/*
+ * Priority Queue
+ * The prioq object implements a priority queue. That is, it orders objects by
+ * their priority and allows O(1) access to the object with the highest
+ * priority. Insertion and removal are Θ(log n). Optionally, the caller can
+ * provide a pointer to an index which will be kept up-to-date by the prioq.
+ *
+ * The underlying algorithm used in this implementation is a Heap.
+ */
+
#include "util.h"
#include "prioq.h"
@@ -101,7 +111,7 @@ static unsigned shuffle_up(Prioq *q, unsigned idx) {
k = (idx-1)/2;
- if (q->compare_func(q->items[k].data, q->items[idx].data) < 0)
+ if (q->compare_func(q->items[k].data, q->items[idx].data) <= 0)
break;
swap(q, idx, k);
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index 0fc9ba463..8a1f54db8 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -217,7 +217,7 @@ int get_process_capeff(pid_t pid, char **capeff) {
p = procfs_file_alloca(pid, "status");
- r = get_status_field(p, "\nCapEff:", capeff);
+ r = get_proc_field(p, "CapEff", WHITESPACE, capeff);
if (r == -ENOENT)
return -ESRCH;
@@ -368,7 +368,6 @@ 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;
@@ -414,6 +413,7 @@ int get_parent_of_pid(pid_t pid, pid_t *_ppid) {
return 0;
}
+#endif // 0
int wait_for_terminate(pid_t pid, siginfo_t *status) {
siginfo_t dummy;
diff --git a/src/basic/process-util.h b/src/basic/process-util.h
index 1482cca34..8e0b58975 100644
--- a/src/basic/process-util.h
+++ b/src/basic/process-util.h
@@ -56,7 +56,7 @@ 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);
// UNNEEDED int kill_and_sigcont(pid_t pid, int sig);
-pid_t get_parent_of_pid(pid_t pid, pid_t *ppid);
+// UNNEEDED pid_t get_parent_of_pid(pid_t pid, pid_t *ppid);
// UNNEEDED void rename_process(const char name[8]);
int is_kernel_thread(pid_t pid);
int getenv_for_pid(pid_t pid, const char *field, char **_value);
diff --git a/src/basic/selinux-util.c b/src/basic/selinux-util.c
index cea80b678..239900b79 100644
--- a/src/basic/selinux-util.c
+++ b/src/basic/selinux-util.c
@@ -303,14 +303,20 @@ int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *
return r;
}
-void mac_selinux_free(char *label) {
+char* mac_selinux_free(char *label) {
#ifdef HAVE_SELINUX
+ if (!label)
+ return NULL;
+
if (!mac_selinux_use())
- return;
+ return NULL;
+
freecon((security_context_t) label);
#endif
+
+ return NULL;
}
#endif // 0
diff --git a/src/basic/selinux-util.h b/src/basic/selinux-util.h
index 559b0d6df..caac8dfb7 100644
--- a/src/basic/selinux-util.h
+++ b/src/basic/selinux-util.h
@@ -21,10 +21,11 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <sys/types.h>
#include <sys/socket.h>
#include <stdbool.h>
+#include "macro.h"
+
bool mac_selinux_use(void);
// UNNEEDED void mac_selinux_retest(void);
diff --git a/src/basic/siphash24.c b/src/basic/siphash24.c
index f68bd283a..fa94f80ae 100644
--- a/src/basic/siphash24.c
+++ b/src/basic/siphash24.c
@@ -13,123 +13,170 @@
this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
(Minimal changes made by Lennart Poettering, to make clean for inclusion in systemd)
+ (Refactored by Tom Gundersen to split up in several functions and follow systemd
+ coding style)
*/
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
+
+#include "sparse-endian.h"
#include "siphash24.h"
+#include "util.h"
-typedef uint64_t u64;
-typedef uint32_t u32;
-typedef uint8_t u8;
-
-#define ROTL(x,b) (u64)( ((x) << (b)) | ( (x) >> (64 - (b))) )
-
-#define U32TO8_LE(p, v) \
- (p)[0] = (u8)((v) ); (p)[1] = (u8)((v) >> 8); \
- (p)[2] = (u8)((v) >> 16); (p)[3] = (u8)((v) >> 24);
-
-#define U64TO8_LE(p, v) \
- U32TO8_LE((p), (u32)((v) )); \
- U32TO8_LE((p) + 4, (u32)((v) >> 32));
-
-#define U8TO64_LE(p) \
- (((u64)((p)[0]) ) | \
- ((u64)((p)[1]) << 8) | \
- ((u64)((p)[2]) << 16) | \
- ((u64)((p)[3]) << 24) | \
- ((u64)((p)[4]) << 32) | \
- ((u64)((p)[5]) << 40) | \
- ((u64)((p)[6]) << 48) | \
- ((u64)((p)[7]) << 56))
-
-#define SIPROUND \
- do { \
- v0 += v1; v1=ROTL(v1,13); v1 ^= v0; v0=ROTL(v0,32); \
- v2 += v3; v3=ROTL(v3,16); v3 ^= v2; \
- v0 += v3; v3=ROTL(v3,21); v3 ^= v0; \
- v2 += v1; v1=ROTL(v1,17); v1 ^= v2; v2=ROTL(v2,32); \
- } while(0)
+static inline uint64_t rotate_left(uint64_t x, uint8_t b) {
+ assert(b < 64);
+
+ return (x << b) | (x >> (64 - b));
+}
+
+static inline void sipround(struct siphash *state) {
+ assert(state);
+
+ state->v0 += state->v1;
+ state->v1 = rotate_left(state->v1, 13);
+ state->v1 ^= state->v0;
+ state->v0 = rotate_left(state->v0, 32);
+ state->v2 += state->v3;
+ state->v3 = rotate_left(state->v3, 16);
+ state->v3 ^= state->v2;
+ state->v0 += state->v3;
+ state->v3 = rotate_left(state->v3, 21);
+ state->v3 ^= state->v0;
+ state->v2 += state->v1;
+ state->v1 = rotate_left(state->v1, 17);
+ state->v1 ^= state->v2;
+ state->v2 = rotate_left(state->v2, 32);
+}
+
+void siphash24_init(struct siphash *state, const uint8_t k[16]) {
+ uint64_t k0, k1;
+
+ assert(state);
+ assert(k);
+
+ k0 = le64toh(*(le64_t*) k);
+ k1 = le64toh(*(le64_t*) (k + 8));
-/* SipHash-2-4 */
-void siphash24(uint8_t out[8], const void *_in, size_t inlen, const uint8_t k[16])
-{
/* "somepseudorandomlygeneratedbytes" */
- u64 v0 = 0x736f6d6570736575ULL;
- u64 v1 = 0x646f72616e646f6dULL;
- u64 v2 = 0x6c7967656e657261ULL;
- u64 v3 = 0x7465646279746573ULL;
- u64 b;
- u64 k0 = U8TO64_LE( k );
- u64 k1 = U8TO64_LE( k + 8 );
- u64 m;
- const u8 *in = _in;
- const u8 *end = in + inlen - ( inlen % sizeof( u64 ) );
- const int left = inlen & 7;
- b = ( ( u64 )inlen ) << 56;
- v3 ^= k1;
- v2 ^= k0;
- v1 ^= k1;
- v0 ^= k0;
-
- for ( ; in != end; in += 8 )
- {
- m = U8TO64_LE( in );
+ state->v0 = 0x736f6d6570736575ULL ^ k0;
+ state->v1 = 0x646f72616e646f6dULL ^ k1;
+ state->v2 = 0x6c7967656e657261ULL ^ k0;
+ state->v3 = 0x7465646279746573ULL ^ k1;
+ state->padding = 0;
+ state->inlen = 0;
+}
+
+void siphash24_compress(const void *_in, size_t inlen, struct siphash *state) {
+ uint64_t m;
+ const uint8_t *in = _in;
+ const uint8_t *end = in + inlen;
+ unsigned left = state->inlen & 7;
+
+ assert(in);
+ assert(state);
+
+ /* update total length */
+ state->inlen += inlen;
+
+ /* if padding exists, fill it out */
+ if (left > 0) {
+ for ( ; in < end && left < 8; in ++, left ++ )
+ state->padding |= ( ( uint64_t )*in ) << (left * 8);
+
+ if (in == end && left < 8)
+ /* we did not have enough input to fill out the padding completely */
+ return;
+
#ifdef DEBUG
- printf( "(%3d) v0 %08x %08x\n", ( int )inlen, ( u32 )( v0 >> 32 ), ( u32 )v0 );
- printf( "(%3d) v1 %08x %08x\n", ( int )inlen, ( u32 )( v1 >> 32 ), ( u32 )v1 );
- printf( "(%3d) v2 %08x %08x\n", ( int )inlen, ( u32 )( v2 >> 32 ), ( u32 )v2 );
- printf( "(%3d) v3 %08x %08x\n", ( int )inlen, ( u32 )( v3 >> 32 ), ( u32 )v3 );
- printf( "(%3d) compress %08x %08x\n", ( int )inlen, ( u32 )( m >> 32 ), ( u32 )m );
+ printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0);
+ printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t) state->v1);
+ printf("(%3zu) v2 %08x %08x\n", state->inlen, (uint32_t) (state->v2 >> 32), (uint32_t) state->v2);
+ printf("(%3zu) v3 %08x %08x\n", state->inlen, (uint32_t) (state->v3 >> 32), (uint32_t) state->v3);
+ printf("(%3zu) compress padding %08x %08x\n", state->inlen, (uint32_t) (state->padding >> 32), (uint32_t)state->padding);
#endif
- v3 ^= m;
- SIPROUND;
- SIPROUND;
- v0 ^= m;
+ state->v3 ^= state->padding;
+ sipround(state);
+ sipround(state);
+ state->v0 ^= state->padding;
+
+ state->padding = 0;
+ }
+
+ end -= ( state->inlen % sizeof (uint64_t) );
+
+ for ( ; in < end; in += 8 ) {
+ m = le64toh(*(le64_t*) in);
+#ifdef DEBUG
+ printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0);
+ printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t) state->v1);
+ printf("(%3zu) v2 %08x %08x\n", state->inlen, (uint32_t) (state->v2 >> 32), (uint32_t) state->v2);
+ printf("(%3zu) v3 %08x %08x\n", state->inlen, (uint32_t) (state->v3 >> 32), (uint32_t) state->v3);
+ printf("(%3zu) compress %08x %08x\n", state->inlen, (uint32_t) (m >> 32), (uint32_t) m);
+#endif
+ state->v3 ^= m;
+ sipround(state);
+ sipround(state);
+ state->v0 ^= m;
}
+ left = state->inlen & 7;
+
switch( left )
{
- case 7: b |= ( ( u64 )in[ 6] ) << 48;
+ case 7: state->padding |= ((uint64_t) in[6]) << 48;
- case 6: b |= ( ( u64 )in[ 5] ) << 40;
+ case 6: state->padding |= ((uint64_t) in[5]) << 40;
- case 5: b |= ( ( u64 )in[ 4] ) << 32;
+ case 5: state->padding |= ((uint64_t) in[4]) << 32;
- case 4: b |= ( ( u64 )in[ 3] ) << 24;
+ case 4: state->padding |= ((uint64_t) in[3]) << 24;
- case 3: b |= ( ( u64 )in[ 2] ) << 16;
+ case 3: state->padding |= ((uint64_t) in[2]) << 16;
- case 2: b |= ( ( u64 )in[ 1] ) << 8;
+ case 2: state->padding |= ((uint64_t) in[1]) << 8;
- case 1: b |= ( ( u64 )in[ 0] ); break;
+ case 1: state->padding |= ((uint64_t) in[0]); break;
case 0: break;
}
+}
+void siphash24_finalize(uint8_t out[8], struct siphash *state) {
+ uint64_t b;
+
+ b = state->padding | (( ( uint64_t )state->inlen ) << 56);
#ifdef DEBUG
- printf( "(%3d) v0 %08x %08x\n", ( int )inlen, ( u32 )( v0 >> 32 ), ( u32 )v0 );
- printf( "(%3d) v1 %08x %08x\n", ( int )inlen, ( u32 )( v1 >> 32 ), ( u32 )v1 );
- printf( "(%3d) v2 %08x %08x\n", ( int )inlen, ( u32 )( v2 >> 32 ), ( u32 )v2 );
- printf( "(%3d) v3 %08x %08x\n", ( int )inlen, ( u32 )( v3 >> 32 ), ( u32 )v3 );
- printf( "(%3d) padding %08x %08x\n", ( int )inlen, ( u32 )( b >> 32 ), ( u32 )b );
+ printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t)state->v0);
+ printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t)state->v1);
+ printf("(%3zu) v2 %08x %08x\n", state->inlen, (uint32_t) (state->v2 >> 32), (uint32_t)state->v2);
+ printf("(%3zu) v3 %08x %08x\n", state->inlen, (uint32_t) (state->v3 >> 32), (uint32_t)state->v3);
+ printf("(%3zu) padding %08x %08x\n", state->inlen, (uint32_t) (state->padding >> 32), (uint32_t) state->padding);
#endif
- v3 ^= b;
- SIPROUND;
- SIPROUND;
- v0 ^= b;
+ state->v3 ^= b;
+ sipround(state);
+ sipround(state);
+ state->v0 ^= b;
+
#ifdef DEBUG
- printf( "(%3d) v0 %08x %08x\n", ( int )inlen, ( u32 )( v0 >> 32 ), ( u32 )v0 );
- printf( "(%3d) v1 %08x %08x\n", ( int )inlen, ( u32 )( v1 >> 32 ), ( u32 )v1 );
- printf( "(%3d) v2 %08x %08x\n", ( int )inlen, ( u32 )( v2 >> 32 ), ( u32 )v2 );
- printf( "(%3d) v3 %08x %08x\n", ( int )inlen, ( u32 )( v3 >> 32 ), ( u32 )v3 );
+ printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0);
+ printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t) state->v1);
+ printf("(%3zu) v2 %08x %08x\n", state->inlen, (uint32_t) (state->v2 >> 32), (uint32_t) state->v2);
+ printf("(%3zu) v3 %08x %08x\n", state->inlen, (uint32_t) (state->v3 >> 32), (uint32_t) state->v3);
#endif
- v2 ^= 0xff;
- SIPROUND;
- SIPROUND;
- SIPROUND;
- SIPROUND;
- b = v0 ^ v1 ^ v2 ^ v3;
- U64TO8_LE( out, b );
+ state->v2 ^= 0xff;
+
+ sipround(state);
+ sipround(state);
+ sipround(state);
+ sipround(state);
+
+ *(le64_t*)out = htole64(state->v0 ^ state->v1 ^ state->v2 ^ state->v3);
+}
+
+/* SipHash-2-4 */
+void siphash24(uint8_t out[8], const void *_in, size_t inlen, const uint8_t k[16]) {
+ struct siphash state;
+
+ siphash24_init(&state, k);
+ siphash24_compress(_in, inlen, &state);
+ siphash24_finalize(out, &state);
}
diff --git a/src/basic/siphash24.h b/src/basic/siphash24.h
index 62e1168a7..6c5cd98ee 100644
--- a/src/basic/siphash24.h
+++ b/src/basic/siphash24.h
@@ -3,4 +3,17 @@
#include <inttypes.h>
#include <sys/types.h>
+struct siphash {
+ uint64_t v0;
+ uint64_t v1;
+ uint64_t v2;
+ uint64_t v3;
+ uint64_t padding;
+ size_t inlen;
+};
+
+void siphash24_init(struct siphash *state, const uint8_t k[16]);
+void siphash24_compress(const void *in, size_t inlen, struct siphash *state);
+void siphash24_finalize(uint8_t out[8], struct siphash *state);
+
void siphash24(uint8_t out[8], const void *in, size_t inlen, const uint8_t k[16]);
diff --git a/src/basic/smack-util.c b/src/basic/smack-util.c
index 6d5c20511..a5fd687b8 100644
--- a/src/basic/smack-util.c
+++ b/src/basic/smack-util.c
@@ -29,9 +29,6 @@
#include "fileio.h"
#include "smack-util.h"
-#define SMACK_FLOOR_LABEL "_"
-#define SMACK_STAR_LABEL "*"
-
#ifdef HAVE_SMACK
bool mac_smack_use(void) {
static int cached_use = -1;
@@ -42,6 +39,8 @@ bool mac_smack_use(void) {
return cached_use;
}
+/// UNNEEDED by elogind
+#if 0
static const char* const smack_attr_table[_SMACK_ATTR_MAX] = {
[SMACK_ATTR_ACCESS] = "security.SMACK64",
[SMACK_ATTR_EXEC] = "security.SMACK64EXEC",
@@ -129,6 +128,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) {
return r;
}
+#endif // 0
int mac_smack_fix(const char *path, bool ignore_enoent, bool ignore_erofs) {
struct stat st;
@@ -185,12 +185,34 @@ int mac_smack_fix(const char *path, bool ignore_enoent, bool ignore_erofs) {
return r;
}
+/// UNNEEDED by elogind
+#if 0
+int mac_smack_copy(const char *dest, const char *src) {
+ int r = 0;
+ _cleanup_free_ char *label = NULL;
+
+ assert(dest);
+ assert(src);
+
+ r = mac_smack_read(src, SMACK_ATTR_ACCESS, &label);
+ if (r < 0)
+ return r;
+
+ r = mac_smack_apply(dest, SMACK_ATTR_ACCESS, label);
+ if (r < 0)
+ return r;
+
+ return r;
+}
+#endif // 0
#else
bool mac_smack_use(void) {
return false;
}
+/// UNNEEDED by elogind
+#if 0
int mac_smack_read(const char *path, SmackAttr attr, char **label) {
return -EOPNOTSUPP;
}
@@ -210,8 +232,16 @@ int mac_smack_apply_fd(int fd, SmackAttr attr, const char *label) {
int mac_smack_apply_pid(pid_t pid, const char *label) {
return 0;
}
+#endif // 0
int mac_smack_fix(const char *path, bool ignore_enoent, bool ignore_erofs) {
return 0;
}
+
+/// UNNEEDED by elogind
+#if 0
+int mac_smack_copy(const char *dest, const char *src) {
+ return 0;
+}
+#endif // 0
#endif
diff --git a/src/basic/smack-util.h b/src/basic/smack-util.h
index 1052cecf4..327a07821 100644
--- a/src/basic/smack-util.h
+++ b/src/basic/smack-util.h
@@ -27,6 +27,11 @@
#include "macro.h"
+#define SMACK_FLOOR_LABEL "_"
+#define SMACK_STAR_LABEL "*"
+
+/// UNNEEDED by elogind
+#if 0
typedef enum SmackAttr {
SMACK_ATTR_ACCESS = 0,
SMACK_ATTR_EXEC = 1,
@@ -37,16 +42,17 @@ typedef enum SmackAttr {
_SMACK_ATTR_MAX,
_SMACK_ATTR_INVALID = -1,
} SmackAttr;
+#endif // 0
bool mac_smack_use(void);
int mac_smack_fix(const char *path, bool ignore_enoent, bool ignore_erofs);
-const char* smack_attr_to_string(SmackAttr i) _const_;
-SmackAttr smack_attr_from_string(const char *s) _pure_;
-int mac_smack_read(const char *path, SmackAttr attr, char **label);
-int mac_smack_read_fd(int fd, SmackAttr attr, char **label);
-int mac_smack_apply(const char *path, SmackAttr attr, const char *label);
-int mac_smack_apply_fd(int fd, SmackAttr attr, const char *label);
-
-int mac_smack_apply_pid(pid_t pid, const char *label);
+// UNNEEDED const char* smack_attr_to_string(SmackAttr i) _const_;
+// UNNEEDED SmackAttr smack_attr_from_string(const char *s) _pure_;
+// UNNEEDED int mac_smack_read(const char *path, SmackAttr attr, char **label);
+// UNNEEDED int mac_smack_read_fd(int fd, SmackAttr attr, char **label);
+// UNNEEDED int mac_smack_apply(const char *path, SmackAttr attr, const char *label);
+// UNNEEDED int mac_smack_apply_fd(int fd, SmackAttr attr, const char *label);
+// UNNEEDED int mac_smack_apply_pid(pid_t pid, const char *label);
+// UNNEEDED int mac_smack_copy(const char *dest, const char *src);
diff --git a/src/basic/strv.c b/src/basic/strv.c
index dab34d8e7..d4a1b80d0 100644
--- a/src/basic/strv.c
+++ b/src/basic/strv.c
@@ -188,17 +188,48 @@ char **strv_new(const char *x, ...) {
return r;
}
-int strv_extend_strv(char ***a, char **b) {
- int r;
- char **s;
+int strv_extend_strv(char ***a, char **b, bool filter_duplicates) {
+ char **s, **t;
+ size_t p, q, i = 0, j;
+
+ assert(a);
+
+ if (strv_isempty(b))
+ return 0;
+
+ p = strv_length(*a);
+ q = strv_length(b);
+
+ t = realloc(*a, sizeof(char*) * (p + q + 1));
+ if (!t)
+ return -ENOMEM;
+
+ t[p] = NULL;
+ *a = t;
STRV_FOREACH(s, b) {
- r = strv_extend(a, *s);
- if (r < 0)
- return r;
+
+ if (filter_duplicates && strv_contains(t, *s))
+ continue;
+
+ t[p+i] = strdup(*s);
+ if (!t[p+i])
+ goto rollback;
+
+ i++;
+ t[p+i] = NULL;
}
- return 0;
+ assert(i <= q);
+
+ return (int) i;
+
+rollback:
+ for (j = 0; j < i; j++)
+ free(t[p + j]);
+
+ t[p] = NULL;
+ return -ENOMEM;
}
/// UNNEEDED by elogind
@@ -275,16 +306,15 @@ char **strv_split_newlines(const char *s) {
if (n <= 0)
return l;
- if (isempty(l[n-1])) {
+ if (isempty(l[n - 1]))
l[n-1] = mfree(l[n-1]);
- }
return l;
}
int strv_split_extract(char ***t, const char *s, const char *separators, ExtractFlags flags) {
- size_t n = 0, allocated = 0;
_cleanup_strv_free_ char **l = NULL;
+ size_t n = 0, allocated = 0;
int r;
assert(t);
@@ -296,9 +326,8 @@ int strv_split_extract(char ***t, const char *s, const char *separators, Extract
r = extract_first_word(&s, &word, separators, flags);
if (r < 0)
return r;
- if (r == 0) {
+ if (r == 0)
break;
- }
if (!GREEDY_REALLOC(l, allocated, n + 2))
return -ENOMEM;
@@ -309,13 +338,16 @@ int strv_split_extract(char ***t, const char *s, const char *separators, Extract
l[n] = NULL;
}
- if (!l)
+ if (!l) {
l = new0(char*, 1);
+ if (!l)
+ return -ENOMEM;
+ }
*t = l;
l = NULL;
- return 0;
+ return (int) n;
}
#endif // 0
@@ -632,6 +664,41 @@ char **strv_split_nulstr(const char *s) {
return r;
}
+int strv_make_nulstr(char **l, char **p, size_t *q) {
+ size_t n_allocated = 0, n = 0;
+ _cleanup_free_ char *m = NULL;
+ char **i;
+
+ assert(p);
+ assert(q);
+
+ STRV_FOREACH(i, l) {
+ size_t z;
+
+ z = strlen(*i);
+
+ if (!GREEDY_REALLOC(m, n_allocated, n + z + 1))
+ return -ENOMEM;
+
+ memcpy(m + n, *i, z + 1);
+ n += z + 1;
+ }
+
+ if (!m) {
+ m = new0(char, 1);
+ if (!m)
+ return -ENOMEM;
+ n = 0;
+ }
+
+ *p = m;
+ *q = n;
+
+ m = NULL;
+
+ return 0;
+}
+
/// UNNEEDED by elogind
#if 0
bool strv_overlap(char **a, char **b) {
@@ -660,8 +727,12 @@ char **strv_sort(char **l) {
}
bool strv_equal(char **a, char **b) {
- if (!a || !b)
- return a == b;
+
+ if (strv_isempty(a))
+ return strv_isempty(b);
+
+ if (strv_isempty(b))
+ return false;
for ( ; *a || *b; ++a, ++b)
if (!streq_ptr(*a, *b))
@@ -740,3 +811,66 @@ bool strv_fnmatch(char* const* patterns, const char *s, int flags) {
return false;
}
+
+char ***strv_free_free(char ***l) {
+ char ***i;
+
+ if (!l)
+ return NULL;
+
+ for (i = l; *i; i++)
+ strv_free(*i);
+
+ free(l);
+ return NULL;
+}
+
+char **strv_skip(char **l, size_t n) {
+
+ while (n > 0) {
+ if (strv_isempty(l))
+ return l;
+
+ l++, n--;
+ }
+
+ return l;
+}
+
+int strv_extend_n(char ***l, const char *value, size_t n) {
+ size_t i, j, k;
+ char **nl;
+
+ assert(l);
+
+ if (!value)
+ return 0;
+ if (n == 0)
+ return 0;
+
+ /* Adds the value value n times to l */
+
+ k = strv_length(*l);
+
+ nl = realloc(*l, sizeof(char*) * (k + n + 1));
+ if (!nl)
+ return -ENOMEM;
+
+ *l = nl;
+
+ for (i = k; i < k + n; i++) {
+ nl[i] = strdup(value);
+ if (!nl[i])
+ goto rollback;
+ }
+
+ nl[i] = NULL;
+ return 0;
+
+rollback:
+ for (j = k; j < i; j++)
+ free(nl[j]);
+
+ nl[k] = NULL;
+ return -ENOMEM;
+}
diff --git a/src/basic/strv.h b/src/basic/strv.h
index 682bb3f75..5ab17acc9 100644
--- a/src/basic/strv.h
+++ b/src/basic/strv.h
@@ -40,7 +40,7 @@ void strv_clear(char **l);
char **strv_copy(char * const *l);
unsigned strv_length(char * const *l) _pure_;
-int strv_extend_strv(char ***a, char **b);
+int strv_extend_strv(char ***a, char **b, bool filter_duplicates);
// UNNEEDED int strv_extend_strv_concat(char ***a, char **b, const char *suffix);
int strv_extend(char ***l, const char *value);
// UNNEEDED int strv_extendf(char ***l, const char *format, ...) _printf_(2,0);
@@ -80,6 +80,7 @@ char *strv_join(char **l, const char *separator);
char **strv_parse_nulstr(const char *s, size_t l);
char **strv_split_nulstr(const char *s);
+int strv_make_nulstr(char **l, char **p, size_t *n);
// UNNEEDED bool strv_overlap(char **a, char **b) _pure_;
@@ -154,3 +155,9 @@ static inline bool strv_fnmatch_or_empty(char* const* patterns, const char *s, i
return strv_isempty(patterns) ||
strv_fnmatch(patterns, s, flags);
}
+
+char ***strv_free_free(char ***l);
+
+char **strv_skip(char **l, size_t n);
+
+int strv_extend_n(char ***l, const char *value, size_t n);
diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c
index 8e101c60a..8f63695cf 100644
--- a/src/basic/terminal-util.c
+++ b/src/basic/terminal-util.c
@@ -48,7 +48,7 @@ int chvt(int vt) {
if (fd < 0)
return -errno;
- if (vt < 0) {
+ if (vt <= 0) {
int tiocl[2] = {
TIOCL_GETKMSGREDIRECT,
0
@@ -141,14 +141,14 @@ int ask_char(char *ret, const char *replies, const char *text, ...) {
bool need_nl = true;
if (on_tty())
- fputs(ANSI_HIGHLIGHT_ON, stdout);
+ fputs(ANSI_HIGHLIGHT, stdout);
va_start(ap, text);
vprintf(text, ap);
va_end(ap);
if (on_tty())
- fputs(ANSI_HIGHLIGHT_OFF, stdout);
+ fputs(ANSI_NORMAL, stdout);
fflush(stdout);
@@ -185,14 +185,14 @@ int ask_string(char **ret, const char *text, ...) {
va_list ap;
if (on_tty())
- fputs(ANSI_HIGHLIGHT_ON, stdout);
+ fputs(ANSI_HIGHLIGHT, stdout);
va_start(ap, text);
vprintf(text, ap);
va_end(ap);
if (on_tty())
- fputs(ANSI_HIGHLIGHT_OFF, stdout);
+ fputs(ANSI_NORMAL, stdout);
fflush(stdout);
@@ -613,27 +613,6 @@ int vt_disallocate(const char *name) {
return 0;
}
-void warn_melody(void) {
- _cleanup_close_ int fd = -1;
-
- fd = open("/dev/console", O_WRONLY|O_CLOEXEC|O_NOCTTY);
- if (fd < 0)
- return;
-
- /* Yeah, this is synchronous. Kinda sucks. But well... */
-
- (void) ioctl(fd, KIOCSOUND, (int)(1193180/440));
- usleep(125*USEC_PER_MSEC);
-
- (void) ioctl(fd, KIOCSOUND, (int)(1193180/220));
- usleep(125*USEC_PER_MSEC);
-
- (void) ioctl(fd, KIOCSOUND, (int)(1193180/220));
- usleep(125*USEC_PER_MSEC);
-
- (void) ioctl(fd, KIOCSOUND, 0);
-}
-
/// UNNEEDED by elogind
#if 0
int make_console_stdio(void) {
diff --git a/src/basic/terminal-util.h b/src/basic/terminal-util.h
index 7fddb2959..41a7a725e 100644
--- a/src/basic/terminal-util.h
+++ b/src/basic/terminal-util.h
@@ -26,16 +26,22 @@
#include "macro.h"
#include "time-util.h"
-#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_RED "\x1B[0;31m"
+#define ANSI_GREEN "\x1B[0;32m"
+#define ANSI_UNDERLINE "\x1B[0;4m"
+#define ANSI_HIGHLIGHT "\x1B[0;1;39m"
+#define ANSI_HIGHLIGHT_RED "\x1B[0;1;31m"
+#define ANSI_HIGHLIGHT_GREEN "\x1B[0;1;32m"
+#define ANSI_HIGHLIGHT_YELLOW "\x1B[0;1;33m"
+#define ANSI_HIGHLIGHT_BLUE "\x1B[0;1;34m"
+#define ANSI_HIGHLIGHT_UNDERLINE "\x1B[0;1;4m"
+#define ANSI_NORMAL "\x1B[0m"
+
#define ANSI_ERASE_TO_END_OF_LINE "\x1B[K"
+/* Set cursor to top left corner and clear screen */
+#define ANSI_HOME_CLEAR "\x1B[H\x1B[2J"
+
int reset_terminal_fd(int fd, bool switch_to_text);
int reset_terminal(const char *name);
@@ -61,8 +67,6 @@ bool tty_is_console(const char *tty) _pure_;
int vtnr_from_tty(const char *tty);
// UNNEEDED const char *default_term_for_tty(const char *tty);
-void warn_melody(void);
-
int make_stdio(int fd);
int make_null_stdio(void);
// UNNEEDED int make_console_stdio(void);
@@ -78,28 +82,36 @@ unsigned lines(void);
bool on_tty(void);
+static inline const char *ansi_underline(void) {
+ return on_tty() ? ANSI_UNDERLINE : "";
+}
+
static inline const char *ansi_highlight(void) {
- return on_tty() ? ANSI_HIGHLIGHT_ON : "";
+ return on_tty() ? ANSI_HIGHLIGHT : "";
+}
+
+static inline const char *ansi_highlight_underline(void) {
+ return on_tty() ? ANSI_HIGHLIGHT_UNDERLINE : "";
}
static inline const char *ansi_highlight_red(void) {
- return on_tty() ? ANSI_HIGHLIGHT_RED_ON : "";
+ return on_tty() ? ANSI_HIGHLIGHT_RED : "";
}
static inline const char *ansi_highlight_green(void) {
- return on_tty() ? ANSI_HIGHLIGHT_GREEN_ON : "";
+ return on_tty() ? ANSI_HIGHLIGHT_GREEN : "";
}
static inline const char *ansi_highlight_yellow(void) {
- return on_tty() ? ANSI_HIGHLIGHT_YELLOW_ON : "";
+ return on_tty() ? ANSI_HIGHLIGHT_YELLOW : "";
}
static inline const char *ansi_highlight_blue(void) {
- return on_tty() ? ANSI_HIGHLIGHT_BLUE_ON : "";
+ return on_tty() ? ANSI_HIGHLIGHT_BLUE : "";
}
-static inline const char *ansi_highlight_off(void) {
- return on_tty() ? ANSI_HIGHLIGHT_OFF : "";
+static inline const char *ansi_normal(void) {
+ return on_tty() ? ANSI_NORMAL : "";
}
int get_ctty_devnr(pid_t pid, dev_t *d);
diff --git a/src/basic/time-util.h b/src/basic/time-util.h
index a0c850b08..ef49343a8 100644
--- a/src/basic/time-util.h
+++ b/src/basic/time-util.h
@@ -112,6 +112,8 @@ int parse_sec(const char *t, usec_t *usec);
// UNNEEDED clockid_t clock_boottime_or_monotonic(void);
-#define xstrftime(buf, fmt, tm) assert_se(strftime(buf, ELEMENTSOF(buf), fmt, tm) > 0)
+#define xstrftime(buf, fmt, tm) \
+ assert_message_se(strftime(buf, ELEMENTSOF(buf), fmt, tm) > 0, \
+ "xstrftime: " #buf "[] must be big enough")
// UNNEEDED int get_timezone(char **timezone);
diff --git a/src/basic/unit-name.c b/src/basic/unit-name.c
index de1683536..d7a6927ef 100644
--- a/src/basic/unit-name.c
+++ b/src/basic/unit-name.c
@@ -847,6 +847,170 @@ static const char* const unit_load_state_table[_UNIT_LOAD_STATE_MAX] = {
DEFINE_STRING_TABLE_LOOKUP(unit_load_state, UnitLoadState);
+static const char* const unit_active_state_table[_UNIT_ACTIVE_STATE_MAX] = {
+ [UNIT_ACTIVE] = "active",
+ [UNIT_RELOADING] = "reloading",
+ [UNIT_INACTIVE] = "inactive",
+ [UNIT_FAILED] = "failed",
+ [UNIT_ACTIVATING] = "activating",
+ [UNIT_DEACTIVATING] = "deactivating"
+};
+
+DEFINE_STRING_TABLE_LOOKUP(unit_active_state, UnitActiveState);
+
+static const char* const automount_state_table[_AUTOMOUNT_STATE_MAX] = {
+ [AUTOMOUNT_DEAD] = "dead",
+ [AUTOMOUNT_WAITING] = "waiting",
+ [AUTOMOUNT_RUNNING] = "running",
+ [AUTOMOUNT_FAILED] = "failed"
+};
+
+DEFINE_STRING_TABLE_LOOKUP(automount_state, AutomountState);
+
+static const char* const busname_state_table[_BUSNAME_STATE_MAX] = {
+ [BUSNAME_DEAD] = "dead",
+ [BUSNAME_MAKING] = "making",
+ [BUSNAME_REGISTERED] = "registered",
+ [BUSNAME_LISTENING] = "listening",
+ [BUSNAME_RUNNING] = "running",
+ [BUSNAME_SIGTERM] = "sigterm",
+ [BUSNAME_SIGKILL] = "sigkill",
+ [BUSNAME_FAILED] = "failed",
+};
+
+DEFINE_STRING_TABLE_LOOKUP(busname_state, BusNameState);
+
+static const char* const device_state_table[_DEVICE_STATE_MAX] = {
+ [DEVICE_DEAD] = "dead",
+ [DEVICE_TENTATIVE] = "tentative",
+ [DEVICE_PLUGGED] = "plugged",
+};
+
+DEFINE_STRING_TABLE_LOOKUP(device_state, DeviceState);
+
+static const char* const mount_state_table[_MOUNT_STATE_MAX] = {
+ [MOUNT_DEAD] = "dead",
+ [MOUNT_MOUNTING] = "mounting",
+ [MOUNT_MOUNTING_DONE] = "mounting-done",
+ [MOUNT_MOUNTED] = "mounted",
+ [MOUNT_REMOUNTING] = "remounting",
+ [MOUNT_UNMOUNTING] = "unmounting",
+ [MOUNT_MOUNTING_SIGTERM] = "mounting-sigterm",
+ [MOUNT_MOUNTING_SIGKILL] = "mounting-sigkill",
+ [MOUNT_REMOUNTING_SIGTERM] = "remounting-sigterm",
+ [MOUNT_REMOUNTING_SIGKILL] = "remounting-sigkill",
+ [MOUNT_UNMOUNTING_SIGTERM] = "unmounting-sigterm",
+ [MOUNT_UNMOUNTING_SIGKILL] = "unmounting-sigkill",
+ [MOUNT_FAILED] = "failed"
+};
+
+DEFINE_STRING_TABLE_LOOKUP(mount_state, MountState);
+
+static const char* const path_state_table[_PATH_STATE_MAX] = {
+ [PATH_DEAD] = "dead",
+ [PATH_WAITING] = "waiting",
+ [PATH_RUNNING] = "running",
+ [PATH_FAILED] = "failed"
+};
+
+DEFINE_STRING_TABLE_LOOKUP(path_state, PathState);
+
+static const char* const scope_state_table[_SCOPE_STATE_MAX] = {
+ [SCOPE_DEAD] = "dead",
+ [SCOPE_RUNNING] = "running",
+ [SCOPE_ABANDONED] = "abandoned",
+ [SCOPE_STOP_SIGTERM] = "stop-sigterm",
+ [SCOPE_STOP_SIGKILL] = "stop-sigkill",
+ [SCOPE_FAILED] = "failed",
+};
+
+DEFINE_STRING_TABLE_LOOKUP(scope_state, ScopeState);
+
+static const char* const service_state_table[_SERVICE_STATE_MAX] = {
+ [SERVICE_DEAD] = "dead",
+ [SERVICE_START_PRE] = "start-pre",
+ [SERVICE_START] = "start",
+ [SERVICE_START_POST] = "start-post",
+ [SERVICE_RUNNING] = "running",
+ [SERVICE_EXITED] = "exited",
+ [SERVICE_RELOAD] = "reload",
+ [SERVICE_STOP] = "stop",
+ [SERVICE_STOP_SIGABRT] = "stop-sigabrt",
+ [SERVICE_STOP_SIGTERM] = "stop-sigterm",
+ [SERVICE_STOP_SIGKILL] = "stop-sigkill",
+ [SERVICE_STOP_POST] = "stop-post",
+ [SERVICE_FINAL_SIGTERM] = "final-sigterm",
+ [SERVICE_FINAL_SIGKILL] = "final-sigkill",
+ [SERVICE_FAILED] = "failed",
+ [SERVICE_AUTO_RESTART] = "auto-restart",
+};
+
+DEFINE_STRING_TABLE_LOOKUP(service_state, ServiceState);
+
+static const char* const slice_state_table[_SLICE_STATE_MAX] = {
+ [SLICE_DEAD] = "dead",
+ [SLICE_ACTIVE] = "active"
+};
+
+DEFINE_STRING_TABLE_LOOKUP(slice_state, SliceState);
+
+static const char* const snapshot_state_table[_SNAPSHOT_STATE_MAX] = {
+ [SNAPSHOT_DEAD] = "dead",
+ [SNAPSHOT_ACTIVE] = "active"
+};
+
+DEFINE_STRING_TABLE_LOOKUP(snapshot_state, SnapshotState);
+
+static const char* const socket_state_table[_SOCKET_STATE_MAX] = {
+ [SOCKET_DEAD] = "dead",
+ [SOCKET_START_PRE] = "start-pre",
+ [SOCKET_START_CHOWN] = "start-chown",
+ [SOCKET_START_POST] = "start-post",
+ [SOCKET_LISTENING] = "listening",
+ [SOCKET_RUNNING] = "running",
+ [SOCKET_STOP_PRE] = "stop-pre",
+ [SOCKET_STOP_PRE_SIGTERM] = "stop-pre-sigterm",
+ [SOCKET_STOP_PRE_SIGKILL] = "stop-pre-sigkill",
+ [SOCKET_STOP_POST] = "stop-post",
+ [SOCKET_FINAL_SIGTERM] = "final-sigterm",
+ [SOCKET_FINAL_SIGKILL] = "final-sigkill",
+ [SOCKET_FAILED] = "failed"
+};
+
+DEFINE_STRING_TABLE_LOOKUP(socket_state, SocketState);
+
+static const char* const swap_state_table[_SWAP_STATE_MAX] = {
+ [SWAP_DEAD] = "dead",
+ [SWAP_ACTIVATING] = "activating",
+ [SWAP_ACTIVATING_DONE] = "activating-done",
+ [SWAP_ACTIVE] = "active",
+ [SWAP_DEACTIVATING] = "deactivating",
+ [SWAP_ACTIVATING_SIGTERM] = "activating-sigterm",
+ [SWAP_ACTIVATING_SIGKILL] = "activating-sigkill",
+ [SWAP_DEACTIVATING_SIGTERM] = "deactivating-sigterm",
+ [SWAP_DEACTIVATING_SIGKILL] = "deactivating-sigkill",
+ [SWAP_FAILED] = "failed"
+};
+
+DEFINE_STRING_TABLE_LOOKUP(swap_state, SwapState);
+
+static const char* const target_state_table[_TARGET_STATE_MAX] = {
+ [TARGET_DEAD] = "dead",
+ [TARGET_ACTIVE] = "active"
+};
+
+DEFINE_STRING_TABLE_LOOKUP(target_state, TargetState);
+
+static const char* const timer_state_table[_TIMER_STATE_MAX] = {
+ [TIMER_DEAD] = "dead",
+ [TIMER_WAITING] = "waiting",
+ [TIMER_RUNNING] = "running",
+ [TIMER_ELAPSED] = "elapsed",
+ [TIMER_FAILED] = "failed"
+};
+
+DEFINE_STRING_TABLE_LOOKUP(timer_state, TimerState);
+
static const char* const unit_dependency_table[_UNIT_DEPENDENCY_MAX] = {
[UNIT_REQUIRES] = "Requires",
[UNIT_REQUIRES_OVERRIDABLE] = "RequiresOverridable",
diff --git a/src/basic/unit-name.h b/src/basic/unit-name.h
index e07f7917b..c23ccc803 100644
--- a/src/basic/unit-name.h
+++ b/src/basic/unit-name.h
@@ -27,11 +27,7 @@
#define UNIT_NAME_MAX 256
-typedef enum UnitType UnitType;
-// UNNEEDED typedef enum UnitLoadState UnitLoadState;
-// UNNNEEDED typedef enum UnitDependency UnitDependency;
-
-enum UnitType {
+typedef enum UnitType {
UNIT_SERVICE = 0,
UNIT_SOCKET,
UNIT_BUSNAME,
@@ -47,11 +43,11 @@ enum UnitType {
UNIT_SCOPE,
_UNIT_TYPE_MAX,
_UNIT_TYPE_INVALID = -1
-};
+} UnitType;
/// UNNEEDED by elogind
#if 0
-enum UnitLoadState {
+typedef enum UnitLoadState {
UNIT_STUB = 0,
UNIT_LOADED,
UNIT_NOT_FOUND,
@@ -60,9 +56,176 @@ enum UnitLoadState {
UNIT_MASKED,
_UNIT_LOAD_STATE_MAX,
_UNIT_LOAD_STATE_INVALID = -1
-};
-
-enum UnitDependency {
+} UnitLoadState;
+
+typedef enum UnitActiveState {
+ UNIT_ACTIVE,
+ UNIT_RELOADING,
+ UNIT_INACTIVE,
+ UNIT_FAILED,
+ UNIT_ACTIVATING,
+ UNIT_DEACTIVATING,
+ _UNIT_ACTIVE_STATE_MAX,
+ _UNIT_ACTIVE_STATE_INVALID = -1
+} UnitActiveState;
+
+typedef enum AutomountState {
+ AUTOMOUNT_DEAD,
+ AUTOMOUNT_WAITING,
+ AUTOMOUNT_RUNNING,
+ AUTOMOUNT_FAILED,
+ _AUTOMOUNT_STATE_MAX,
+ _AUTOMOUNT_STATE_INVALID = -1
+} AutomountState;
+
+typedef enum BusNameState {
+ BUSNAME_DEAD,
+ BUSNAME_MAKING,
+ BUSNAME_REGISTERED,
+ BUSNAME_LISTENING,
+ BUSNAME_RUNNING,
+ BUSNAME_SIGTERM,
+ BUSNAME_SIGKILL,
+ BUSNAME_FAILED,
+ _BUSNAME_STATE_MAX,
+ _BUSNAME_STATE_INVALID = -1
+} BusNameState;
+
+/* We simply watch devices, we cannot plug/unplug them. That
+ * simplifies the state engine greatly */
+typedef enum DeviceState {
+ DEVICE_DEAD,
+ DEVICE_TENTATIVE, /* mounted or swapped, but not (yet) announced by udev */
+ DEVICE_PLUGGED, /* announced by udev */
+ _DEVICE_STATE_MAX,
+ _DEVICE_STATE_INVALID = -1
+} DeviceState;
+
+typedef enum MountState {
+ MOUNT_DEAD,
+ MOUNT_MOUNTING, /* /usr/bin/mount is running, but the mount is not done yet. */
+ MOUNT_MOUNTING_DONE, /* /usr/bin/mount is running, and the mount is done. */
+ MOUNT_MOUNTED,
+ MOUNT_REMOUNTING,
+ MOUNT_UNMOUNTING,
+ MOUNT_MOUNTING_SIGTERM,
+ MOUNT_MOUNTING_SIGKILL,
+ MOUNT_REMOUNTING_SIGTERM,
+ MOUNT_REMOUNTING_SIGKILL,
+ MOUNT_UNMOUNTING_SIGTERM,
+ MOUNT_UNMOUNTING_SIGKILL,
+ MOUNT_FAILED,
+ _MOUNT_STATE_MAX,
+ _MOUNT_STATE_INVALID = -1
+} MountState;
+
+typedef enum PathState {
+ PATH_DEAD,
+ PATH_WAITING,
+ PATH_RUNNING,
+ PATH_FAILED,
+ _PATH_STATE_MAX,
+ _PATH_STATE_INVALID = -1
+} PathState;
+
+typedef enum ScopeState {
+ SCOPE_DEAD,
+ SCOPE_RUNNING,
+ SCOPE_ABANDONED,
+ SCOPE_STOP_SIGTERM,
+ SCOPE_STOP_SIGKILL,
+ SCOPE_FAILED,
+ _SCOPE_STATE_MAX,
+ _SCOPE_STATE_INVALID = -1
+} ScopeState;
+
+typedef enum ServiceState {
+ SERVICE_DEAD,
+ SERVICE_START_PRE,
+ SERVICE_START,
+ SERVICE_START_POST,
+ SERVICE_RUNNING,
+ SERVICE_EXITED, /* Nothing is running anymore, but RemainAfterExit is true hence this is OK */
+ SERVICE_RELOAD,
+ SERVICE_STOP, /* No STOP_PRE state, instead just register multiple STOP executables */
+ SERVICE_STOP_SIGABRT, /* Watchdog timeout */
+ SERVICE_STOP_SIGTERM,
+ SERVICE_STOP_SIGKILL,
+ SERVICE_STOP_POST,
+ SERVICE_FINAL_SIGTERM, /* In case the STOP_POST executable hangs, we shoot that down, too */
+ SERVICE_FINAL_SIGKILL,
+ SERVICE_FAILED,
+ SERVICE_AUTO_RESTART,
+ _SERVICE_STATE_MAX,
+ _SERVICE_STATE_INVALID = -1
+} ServiceState;
+
+typedef enum SliceState {
+ SLICE_DEAD,
+ SLICE_ACTIVE,
+ _SLICE_STATE_MAX,
+ _SLICE_STATE_INVALID = -1
+} SliceState;
+
+typedef enum SnapshotState {
+ SNAPSHOT_DEAD,
+ SNAPSHOT_ACTIVE,
+ _SNAPSHOT_STATE_MAX,
+ _SNAPSHOT_STATE_INVALID = -1
+} SnapshotState;
+
+typedef enum SocketState {
+ SOCKET_DEAD,
+ SOCKET_START_PRE,
+ SOCKET_START_CHOWN,
+ SOCKET_START_POST,
+ SOCKET_LISTENING,
+ SOCKET_RUNNING,
+ SOCKET_STOP_PRE,
+ SOCKET_STOP_PRE_SIGTERM,
+ SOCKET_STOP_PRE_SIGKILL,
+ SOCKET_STOP_POST,
+ SOCKET_FINAL_SIGTERM,
+ SOCKET_FINAL_SIGKILL,
+ SOCKET_FAILED,
+ _SOCKET_STATE_MAX,
+ _SOCKET_STATE_INVALID = -1
+} SocketState;
+
+typedef enum SwapState {
+ SWAP_DEAD,
+ SWAP_ACTIVATING, /* /sbin/swapon is running, but the swap not yet enabled. */
+ SWAP_ACTIVATING_DONE, /* /sbin/swapon is running, and the swap is done. */
+ SWAP_ACTIVE,
+ SWAP_DEACTIVATING,
+ SWAP_ACTIVATING_SIGTERM,
+ SWAP_ACTIVATING_SIGKILL,
+ SWAP_DEACTIVATING_SIGTERM,
+ SWAP_DEACTIVATING_SIGKILL,
+ SWAP_FAILED,
+ _SWAP_STATE_MAX,
+ _SWAP_STATE_INVALID = -1
+} SwapState;
+
+
+typedef enum TargetState {
+ TARGET_DEAD,
+ TARGET_ACTIVE,
+ _TARGET_STATE_MAX,
+ _TARGET_STATE_INVALID = -1
+} TargetState;
+
+typedef enum TimerState {
+ TIMER_DEAD,
+ TIMER_WAITING,
+ TIMER_RUNNING,
+ TIMER_ELAPSED,
+ TIMER_FAILED,
+ _TIMER_STATE_MAX,
+ _TIMER_STATE_INVALID = -1
+} TimerState;
+
+typedef enum UnitDependency {
/* Positive dependencies */
UNIT_REQUIRES,
UNIT_REQUIRES_OVERRIDABLE,
@@ -109,7 +272,7 @@ enum UnitDependency {
_UNIT_DEPENDENCY_MAX,
_UNIT_DEPENDENCY_INVALID = -1
-};
+} UnitDependency;
#endif // 0
typedef enum UnitNameFlags {
@@ -185,5 +348,47 @@ UnitType unit_type_from_string(const char *s) _pure_;
// UNNEEDED const char *unit_load_state_to_string(UnitLoadState i) _const_;
// UNNEEDED UnitLoadState unit_load_state_from_string(const char *s) _pure_;
+// UNNEEDED const char *unit_active_state_to_string(UnitActiveState i) _const_;
+// UNNEEDED UnitActiveState unit_active_state_from_string(const char *s) _pure_;
+
+// UNNEEDED const char* automount_state_to_string(AutomountState i) _const_;
+// UNNEEDED AutomountState automount_state_from_string(const char *s) _pure_;
+
+// UNNEEDED const char* busname_state_to_string(BusNameState i) _const_;
+// UNNEEDED BusNameState busname_state_from_string(const char *s) _pure_;
+
+// UNNEEDED const char* device_state_to_string(DeviceState i) _const_;
+// UNNEEDED DeviceState device_state_from_string(const char *s) _pure_;
+
+// UNNEEDED const char* mount_state_to_string(MountState i) _const_;
+// UNNEEDED MountState mount_state_from_string(const char *s) _pure_;
+
+// UNNEEDED const char* path_state_to_string(PathState i) _const_;
+// UNNEEDED PathState path_state_from_string(const char *s) _pure_;
+
+// UNNEEDED const char* scope_state_to_string(ScopeState i) _const_;
+// UNNEEDED ScopeState scope_state_from_string(const char *s) _pure_;
+
+// UNNEEDED const char* service_state_to_string(ServiceState i) _const_;
+// UNNEEDED ServiceState service_state_from_string(const char *s) _pure_;
+
+// UNNEEDED const char* slice_state_to_string(SliceState i) _const_;
+// UNNEEDED SliceState slice_state_from_string(const char *s) _pure_;
+
+// UNNEEDED const char* snapshot_state_to_string(SnapshotState i) _const_;
+// UNNEEDED SnapshotState snapshot_state_from_string(const char *s) _pure_;
+
+// UNNEEDED const char* socket_state_to_string(SocketState i) _const_;
+// UNNEEDED SocketState socket_state_from_string(const char *s) _pure_;
+
+// UNNEEDED const char* swap_state_to_string(SwapState i) _const_;
+// UNNEEDED SwapState swap_state_from_string(const char *s) _pure_;
+
+// UNNEEDED const char* target_state_to_string(TargetState i) _const_;
+// UNNEEDED TargetState target_state_from_string(const char *s) _pure_;
+
+// UNNEEDED const char *timer_state_to_string(TimerState i) _const_;
+// UNNEEDED TimerState timer_state_from_string(const char *s) _pure_;
+
// UNNEEDED const char *unit_dependency_to_string(UnitDependency i) _const_;
// UNNEEDED UnitDependency unit_dependency_from_string(const char *s) _pure_;
diff --git a/src/basic/util.c b/src/basic/util.c
index 7e0a913f5..97a07b93c 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -19,82 +19,85 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-// #include <string.h>
-// #include <unistd.h>
-#include <errno.h>
-// #include <stdlib.h>
-// #include <signal.h>
-// #include <libintl.h>
-// #include <stdio.h>
-// #include <syslog.h>
-// #include <sched.h>
-// #include <sys/resource.h>
-// #include <linux/sched.h>
-// #include <sys/types.h>
-// #include <sys/stat.h>
-// #include <fcntl.h>
-// #include <dirent.h>
-// #include <sys/ioctl.h>
-// #include <stdarg.h>
-#include <poll.h>
-// #include <ctype.h>
-#include <sys/prctl.h>
-// #include <sys/utsname.h>
-#include <pwd.h>
-#include <netinet/ip.h>
-// #include <sys/wait.h>
-// #include <sys/time.h>
-// #include <glob.h>
-#include <grp.h>
-// #include <sys/mman.h>
-// #include <sys/vfs.h>
-// #include <sys/mount.h>
-#include <linux/magic.h>
-// #include <limits.h>
-#include <langinfo.h>
-// #include <locale.h>
-// #include <sys/personality.h>
-#include <sys/xattr.h>
-// #include <sys/statvfs.h>
-// #include <sys/file.h>
-#include <linux/fs.h>
+//#include <ctype.h>
+//#include <dirent.h>
+//#include <errno.h>
+//#include <fcntl.h>
+//#include <glob.h>
+#include <grp.h>
+#include <langinfo.h>
+//#include <libintl.h>
+//#include <limits.h>
+#include <linux/magic.h>
+//#include <linux/sched.h>
+//#include <locale.h>
+#include <netinet/ip.h>
+#include <poll.h>
+#include <pwd.h>
+#include <sched.h>
+//#include <signal.h>
+//#include <stdarg.h>
+//#include <stdio.h>
+//#include <stdlib.h>
+//#include <string.h>
+//#include <sys/file.h>
+//#include <sys/ioctl.h>
+//#include <sys/mman.h>
+//#include <sys/mount.h>
+//#include <sys/personality.h>
+#include <sys/prctl.h>
+//#include <sys/resource.h>
+//#include <sys/stat.h>
+//#include <sys/statvfs.h>
+//#include <sys/time.h>
+//#include <sys/types.h>
+//#include <sys/utsname.h>
+//#include <sys/vfs.h>
+//#include <sys/wait.h>
+#include <sys/xattr.h>
+//#include <syslog.h>
+//#include <unistd.h>
/* When we include libgen.h because we need dirname() we immediately
- * undefine basename() since libgen.h defines it as a macro to the POSIX
- * version which is really broken. We prefer GNU basename(). */
-// #include <libgen.h>
-// #undef basename
+ * undefine basename() since libgen.h defines it as a macro to the
+ * POSIX version which is really broken. We prefer GNU basename(). */
+//#include <libgen.h>
+//#undef basename
#ifdef HAVE_SYS_AUXV_H
#include <sys/auxv.h>
#endif
-#include "config.h"
-#include "macro.h"
-#include "util.h"
-// #include "ioprio.h"
-// #include "missing.h"
-// #include "log.h"
-#include "strv.h"
-#include "mkdir.h"
-#include "path-util.h"
-// #include "exit-status.h"
-#include "hashmap.h"
-#include "set.h"
-// #include "env-util.h"
-#include "fileio.h"
-// #include "device-nodes.h"
-#include "utf8.h"
-#include "gunicode.h"
-#include "virt.h"
-// #include "def.h"
-#include "sparse-endian.h"
-// #include "formats-util.h"
-#include "process-util.h"
-#include "random-util.h"
-// #include "terminal-util.h"
-#include "hostname-util.h"
-#include "signal-util.h"
+/* We include linux/fs.h as last of the system headers, as it
+ * otherwise conflicts with sys/mount.h. Yay, Linux is great! */
+//#include <linux/fs.h>
+
+#include "build.h"
+//#include "def.h"
+//#include "device-nodes.h"
+//#include "env-util.h"
+//#include "exit-status.h"
+#include "fileio.h"
+//#include "formats-util.h"
+#include "gunicode.h"
+#include "hashmap.h"
+#include "hostname-util.h"
+//#include "ioprio.h"
+//#include "log.h"
+//#include "macro.h"
+//#include "missing.h"
+#include "mkdir.h"
+#include "path-util.h"
+#include "process-util.h"
+#include "random-util.h"
+#include "signal-util.h"
+#include "sparse-endian.h"
+#include "strv.h"
+//#include "terminal-util.h"
+#include "utf8.h"
+#include "util.h"
+#include "virt.h"
+#include "set.h"
/* Put this test here for a lack of better place */
assert_cc(EAGAIN == EWOULDBLOCK);
@@ -328,6 +331,44 @@ void close_many(const int fds[], unsigned n_fd) {
safe_close(fds[i]);
}
+int fclose_nointr(FILE *f) {
+ assert(f);
+
+ /* Same as close_nointr(), but for fclose() */
+
+ if (fclose(f) == 0)
+ return 0;
+
+ if (errno == EINTR)
+ return 0;
+
+ return -errno;
+}
+
+FILE* safe_fclose(FILE *f) {
+
+ /* Same as safe_close(), but for fclose() */
+
+ if (f) {
+ PROTECT_ERRNO;
+
+ assert_se(fclose_nointr(f) != EBADF);
+ }
+
+ return NULL;
+}
+
+DIR* safe_closedir(DIR *d) {
+
+ if (d) {
+ PROTECT_ERRNO;
+
+ assert_se(closedir(d) >= 0 || errno != EBADF);
+ }
+
+ return NULL;
+}
+
int unlink_noerrno(const char *path) {
PROTECT_ERRNO;
int r;
@@ -2125,7 +2166,13 @@ ssize_t loop_read(int fd, void *buf, size_t nbytes, bool do_poll) {
assert(fd >= 0);
assert(buf);
- while (nbytes > 0) {
+ /* If called with nbytes == 0, let's call read() at least
+ * once, to validate the operation */
+
+ if (nbytes > (size_t) SSIZE_MAX)
+ return -EINVAL;
+
+ do {
ssize_t k;
k = read(fd, p, nbytes);
@@ -2139,7 +2186,7 @@ ssize_t loop_read(int fd, void *buf, size_t nbytes, bool do_poll) {
* and expect that any error/EOF is reported
* via read() */
- fd_wait_for_event(fd, POLLIN, USEC_INFINITY);
+ (void) fd_wait_for_event(fd, POLLIN, USEC_INFINITY);
continue;
}
@@ -2149,10 +2196,12 @@ ssize_t loop_read(int fd, void *buf, size_t nbytes, bool do_poll) {
if (k == 0)
return n;
+ assert((size_t) k <= nbytes);
+
p += k;
nbytes -= k;
n += k;
- }
+ } while (nbytes > 0);
return n;
}
@@ -2162,9 +2211,10 @@ int loop_read_exact(int fd, void *buf, size_t nbytes, bool do_poll) {
n = loop_read(fd, buf, nbytes, do_poll);
if (n < 0)
- return n;
+ return (int) n;
if ((size_t) n != nbytes)
return -EIO;
+
return 0;
}
@@ -2174,7 +2224,8 @@ int loop_write(int fd, const void *buf, size_t nbytes, bool do_poll) {
assert(fd >= 0);
assert(buf);
- errno = 0;
+ if (nbytes > (size_t) SSIZE_MAX)
+ return -EINVAL;
do {
ssize_t k;
@@ -2189,16 +2240,18 @@ int loop_write(int fd, const void *buf, size_t nbytes, bool do_poll) {
* and expect that any error/EOF is reported
* via write() */
- fd_wait_for_event(fd, POLLOUT, USEC_INFINITY);
+ (void) fd_wait_for_event(fd, POLLOUT, USEC_INFINITY);
continue;
}
return -errno;
}
- if (nbytes > 0 && k == 0) /* Can't really happen */
+ if (_unlikely_(nbytes > 0 && k == 0)) /* Can't really happen */
return -EIO;
+ assert((size_t) k <= nbytes);
+
p += k;
nbytes -= k;
} while (nbytes > 0);
@@ -2206,7 +2259,7 @@ int loop_write(int fd, const void *buf, size_t nbytes, bool do_poll) {
return 0;
}
-int parse_size(const char *t, off_t base, off_t *size) {
+int parse_size(const char *t, uint64_t base, uint64_t *size) {
/* Soo, sometimes we want to parse IEC binary suffixes, and
* sometimes SI decimal suffixes. This function can parse
@@ -2234,8 +2287,8 @@ int parse_size(const char *t, off_t base, off_t *size) {
{ "G", 1024ULL*1024ULL*1024ULL },
{ "M", 1024ULL*1024ULL },
{ "K", 1024ULL },
- { "B", 1 },
- { "", 1 },
+ { "B", 1ULL },
+ { "", 1ULL },
};
static const struct table si[] = {
@@ -2245,8 +2298,8 @@ int parse_size(const char *t, off_t base, off_t *size) {
{ "G", 1000ULL*1000ULL*1000ULL },
{ "M", 1000ULL*1000ULL },
{ "K", 1000ULL },
- { "B", 1 },
- { "", 1 },
+ { "B", 1ULL },
+ { "", 1ULL },
};
const struct table *table;
@@ -2268,33 +2321,32 @@ int parse_size(const char *t, off_t base, off_t *size) {
p = t;
do {
- long long l;
- unsigned long long l2;
+ unsigned long long l, tmp;
double frac = 0;
char *e;
unsigned i;
- errno = 0;
- l = strtoll(p, &e, 10);
+ p += strspn(p, WHITESPACE);
+ if (*p == '-')
+ return -ERANGE;
+ errno = 0;
+ l = strtoull(p, &e, 10);
if (errno > 0)
return -errno;
-
- if (l < 0)
- return -ERANGE;
-
if (e == p)
return -EINVAL;
if (*e == '.') {
e++;
+
+ /* strtoull() itself would accept space/+/- */
if (*e >= '0' && *e <= '9') {
+ unsigned long long l2;
char *e2;
- /* strotoull itself would accept space/+/- */
l2 = strtoull(e, &e2, 10);
-
- if (errno == ERANGE)
+ if (errno > 0)
return -errno;
/* Ignore failure. E.g. 10.M is valid */
@@ -2307,26 +2359,26 @@ int parse_size(const char *t, off_t base, off_t *size) {
e += strspn(e, WHITESPACE);
for (i = start_pos; i < n_entries; i++)
- if (startswith(e, table[i].suffix)) {
- unsigned long long tmp;
- if ((unsigned long long) l + (frac > 0) > ULLONG_MAX / table[i].factor)
+ if (startswith(e, table[i].suffix))
+ break;
+
+ if (i >= n_entries)
+ return -EINVAL;
+
+ if (l + (frac > 0) > ULLONG_MAX / table[i].factor)
return -ERANGE;
+
tmp = l * table[i].factor + (unsigned long long) (frac * table[i].factor);
if (tmp > ULLONG_MAX - r)
return -ERANGE;
r += tmp;
- if ((unsigned long long) (off_t) r != r)
+ if ((unsigned long long) (uint64_t) r != r)
return -ERANGE;
p = e + strlen(table[i].suffix);
start_pos = i + 1;
- break;
- }
-
- if (i >= n_entries)
- return -EINVAL;
} while (*p);
@@ -2526,33 +2578,6 @@ int fchmod_and_fchown(int fd, mode_t mode, uid_t uid, gid_t gid) {
return 0;
}
-cpu_set_t* cpu_set_malloc(unsigned *ncpus) {
- cpu_set_t *r;
- unsigned n = 1024;
-
- /* Allocates the cpuset in the right size */
-
- for (;;) {
- if (!(r = CPU_ALLOC(n)))
- return NULL;
-
- if (sched_getaffinity(0, CPU_ALLOC_SIZE(n), r) >= 0) {
- CPU_ZERO_S(CPU_ALLOC_SIZE(n), r);
-
- if (ncpus)
- *ncpus = n;
-
- return r;
- }
-
- CPU_FREE(r);
-
- if (errno != EINVAL)
- return NULL;
-
- n *= 2;
- }
-}
#endif // 0
int files_same(const char *filea, const char *fileb) {
@@ -3686,7 +3711,6 @@ static const char *const ioprio_class_table[] = {
};
DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(ioprio_class, int, INT_MAX);
-#endif // 0
static const char *const sigchld_code_table[] = {
[CLD_EXITED] = "exited",
@@ -3723,6 +3747,7 @@ static const char *const log_facility_unshifted_table[LOG_NFACILITIES] = {
};
DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(log_facility_unshifted, int, LOG_FAC(~0));
+#endif // 0
static const char *const log_level_table[] = {
[LOG_EMERG] = "emerg",
@@ -3737,6 +3762,8 @@ static const char *const log_level_table[] = {
DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(log_level, int, LOG_DEBUG);
+/// UNNEEDED by elogind
+#if 0
static const char* const sched_policy_table[] = {
[SCHED_OTHER] = "other",
[SCHED_BATCH] = "batch",
@@ -3746,6 +3773,7 @@ static const char* const sched_policy_table[] = {
};
DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(sched_policy, int, INT_MAX);
+#endif // 0
static const char* const rlimit_table[_RLIMIT_MAX] = {
[RLIMIT_CPU] = "LimitCPU",
@@ -3768,6 +3796,8 @@ static const char* const rlimit_table[_RLIMIT_MAX] = {
DEFINE_STRING_TABLE_LOOKUP(rlimit, int);
+/// UNNEEDED by elogind
+#if 0
static const char* const ip_tos_table[] = {
[IPTOS_LOWDELAY] = "low-delay",
[IPTOS_THROUGHPUT] = "throughput",
@@ -3789,8 +3819,6 @@ bool kexec_loaded(void) {
return loaded;
}
-/// UNNEEDED by elogind
-#if 0
int prot_from_flags(int flags) {
switch (flags & O_ACCMODE) {
@@ -3809,38 +3837,38 @@ int prot_from_flags(int flags) {
}
}
-char *format_bytes(char *buf, size_t l, off_t t) {
+char *format_bytes(char *buf, size_t l, uint64_t t) {
unsigned i;
static const struct {
const char *suffix;
- off_t factor;
+ uint64_t factor;
} table[] = {
- { "E", 1024ULL*1024ULL*1024ULL*1024ULL*1024ULL*1024ULL },
- { "P", 1024ULL*1024ULL*1024ULL*1024ULL*1024ULL },
- { "T", 1024ULL*1024ULL*1024ULL*1024ULL },
- { "G", 1024ULL*1024ULL*1024ULL },
- { "M", 1024ULL*1024ULL },
- { "K", 1024ULL },
+ { "E", UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024) },
+ { "P", UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024) },
+ { "T", UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024) },
+ { "G", UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024) },
+ { "M", UINT64_C(1024)*UINT64_C(1024) },
+ { "K", UINT64_C(1024) },
};
- if (t == (off_t) -1)
+ if (t == (uint64_t) -1)
return NULL;
for (i = 0; i < ELEMENTSOF(table); i++) {
if (t >= table[i].factor) {
snprintf(buf, l,
- "%llu.%llu%s",
- (unsigned long long) (t / table[i].factor),
- (unsigned long long) (((t*10ULL) / table[i].factor) % 10ULL),
+ "%" PRIu64 ".%" PRIu64 "%s",
+ t / table[i].factor,
+ ((t*UINT64_C(10)) / table[i].factor) % UINT64_C(10),
table[i].suffix);
goto finish;
}
}
- snprintf(buf, l, "%lluB", (unsigned long long) t);
+ snprintf(buf, l, "%" PRIu64 "B", t);
finish:
buf[l-1] = 0;
@@ -4887,7 +4915,7 @@ int shall_restore_state(void) {
int proc_cmdline(char **ret) {
assert(ret);
- if (detect_container(NULL) > 0)
+ if (detect_container() > 0)
return get_process_cmdline(1, 0, false, ret);
else
return read_one_line_file("/proc/cmdline", ret);
@@ -5285,6 +5313,19 @@ unsigned long personality_from_string(const char *p) {
if (streq(p, "x86"))
return PER_LINUX;
+
+#elif defined(__s390x__)
+
+ if (streq(p, "s390"))
+ return PER_LINUX32;
+
+ if (streq(p, "s390x"))
+ return PER_LINUX;
+
+#elif defined(__s390__)
+
+ if (streq(p, "s390"))
+ return PER_LINUX;
#endif
return PERSONALITY_INVALID;
@@ -5304,6 +5345,20 @@ const char* personality_to_string(unsigned long p) {
if (p == PER_LINUX)
return "x86";
+
+#elif defined(__s390x__)
+
+ if (p == PER_LINUX)
+ return "s390x";
+
+ if (p == PER_LINUX32)
+ return "s390";
+
+#elif defined(__s390__)
+
+ if (p == PER_LINUX)
+ return "s390";
+
#endif
return NULL;
@@ -5371,15 +5426,13 @@ int update_reboot_param_file(const char *param) {
int r = 0;
if (param) {
-
r = write_string_file(REBOOT_PARAM_FILE, param, WRITE_STRING_FILE_CREATE);
if (r < 0)
- log_error("Failed to write reboot param to "
- REBOOT_PARAM_FILE": %s", strerror(-r));
+ return log_error_errno(r, "Failed to write reboot param to "REBOOT_PARAM_FILE": %m");
} else
- unlink(REBOOT_PARAM_FILE);
+ (void) unlink(REBOOT_PARAM_FILE);
- return r;
+ return 0;
}
int umount_recursive(const char *prefix, int flags) {
@@ -6022,6 +6075,7 @@ int extract_first_word_and_warn(
const char *filename,
unsigned line,
const char *rvalue) {
+
/* Try to unquote it, if it fails, warn about it and try again but this
* time using EXTRACT_CUNESCAPE_RELAX to keep the backslashes verbatim
* in invalid escape sequences. */
@@ -6031,16 +6085,16 @@ int extract_first_word_and_warn(
save = *p;
r = extract_first_word(p, ret, separators, flags);
if (r < 0 && !(flags&EXTRACT_CUNESCAPE_RELAX)) {
+
/* Retry it with EXTRACT_CUNESCAPE_RELAX. */
*p = save;
r = extract_first_word(p, ret, separators, flags|EXTRACT_CUNESCAPE_RELAX);
if (r < 0)
- log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "Unbalanced quoting in command line, ignoring: \"%s\"", rvalue);
+ log_syntax(unit, LOG_ERR, filename, line, r, "Unbalanced quoting in command line, ignoring: \"%s\"", rvalue);
else
- log_syntax(unit, LOG_WARNING, filename, line, EINVAL,
- "Invalid escape sequences in command line: \"%s\"", rvalue);
+ log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid escape sequences in command line: \"%s\"", rvalue);
}
+
return r;
}
@@ -6157,15 +6211,6 @@ int ptsname_malloc(int fd, char **ret) {
int openpt_in_namespace(pid_t pid, int flags) {
_cleanup_close_ int pidnsfd = -1, mntnsfd = -1, usernsfd = -1, rootfd = -1;
_cleanup_close_pair_ int pair[2] = { -1, -1 };
- union {
- struct cmsghdr cmsghdr;
- uint8_t buf[CMSG_SPACE(sizeof(int))];
- } control = {};
- struct msghdr mh = {
- .msg_control = &control,
- .msg_controllen = sizeof(control),
- };
- struct cmsghdr *cmsg;
siginfo_t si;
pid_t child;
int r;
@@ -6199,15 +6244,7 @@ int openpt_in_namespace(pid_t pid, int flags) {
if (unlockpt(master) < 0)
_exit(EXIT_FAILURE);
- cmsg = CMSG_FIRSTHDR(&mh);
- cmsg->cmsg_level = SOL_SOCKET;
- cmsg->cmsg_type = SCM_RIGHTS;
- cmsg->cmsg_len = CMSG_LEN(sizeof(int));
- memcpy(CMSG_DATA(cmsg), &master, sizeof(int));
-
- mh.msg_controllen = cmsg->cmsg_len;
-
- if (sendmsg(pair[1], &mh, MSG_NOSIGNAL) < 0)
+ if (send_one_fd(pair[1], master, 0) < 0)
_exit(EXIT_FAILURE);
_exit(EXIT_SUCCESS);
@@ -6221,40 +6258,24 @@ int openpt_in_namespace(pid_t pid, int flags) {
if (si.si_code != CLD_EXITED || si.si_status != EXIT_SUCCESS)
return -EIO;
- if (recvmsg(pair[0], &mh, MSG_NOSIGNAL|MSG_CMSG_CLOEXEC) < 0)
- return -errno;
-
- CMSG_FOREACH(cmsg, &mh)
- if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) {
- int *fds;
- unsigned n_fds;
-
- fds = (int*) CMSG_DATA(cmsg);
- n_fds = (cmsg->cmsg_len - CMSG_LEN(0)) / sizeof(int);
-
- if (n_fds != 1) {
- close_many(fds, n_fds);
- return -EIO;
- }
-
- return fds[0];
- }
-
- return -EIO;
+ return receive_one_fd(pair[0], 0);
}
#endif // 0
ssize_t fgetxattrat_fake(int dirfd, const char *filename, const char *attribute, void *value, size_t size, int flags) {
+ char fn[strlen("/proc/self/fd/") + DECIMAL_STR_MAX(int) + 1];
_cleanup_close_ int fd = -1;
ssize_t l;
/* The kernel doesn't have a fgetxattrat() command, hence let's emulate one */
- fd = openat(dirfd, filename, O_RDONLY|O_CLOEXEC|O_NOCTTY|O_NOATIME|(flags & AT_SYMLINK_NOFOLLOW ? O_NOFOLLOW : 0));
+ fd = openat(dirfd, filename, O_RDONLY|O_CLOEXEC|O_NOCTTY|O_PATH|(flags & AT_SYMLINK_NOFOLLOW ? O_NOFOLLOW : 0));
if (fd < 0)
return -errno;
- l = fgetxattr(fd, attribute, value, size);
+ xsprintf(fn, "/proc/self/fd/%i", fd);
+
+ l = getxattr(fn, attribute, value, size);
if (l < 0)
return -errno;
@@ -6403,7 +6424,6 @@ int same_fd(int a, int b) {
return fa == fb;
}
-#endif // 0
int chattr_fd(int fd, unsigned value, unsigned mask) {
unsigned old_attr, new_attr;
@@ -6439,8 +6459,6 @@ int chattr_fd(int fd, unsigned value, unsigned mask) {
return 1;
}
-/// UNNEEDED by elogind
-#if 0
int chattr_path(const char *p, unsigned value, unsigned mask) {
_cleanup_close_ int fd = -1;
@@ -6455,7 +6473,6 @@ int chattr_path(const char *p, unsigned value, unsigned mask) {
return chattr_fd(fd, value, mask);
}
-#endif // 0
int read_attr_fd(int fd, unsigned *ret) {
struct stat st;
@@ -6474,8 +6491,6 @@ int read_attr_fd(int fd, unsigned *ret) {
return 0;
}
-/// UNNEEDED by elogind
-#if 0
int read_attr_path(const char *p, unsigned *ret) {
_cleanup_close_ int fd = -1;
@@ -6615,7 +6630,7 @@ ssize_t string_table_lookup(const char * const *table, size_t len, const char *k
for (i = 0; i < len; ++i)
if (streq_ptr(table[i], key))
- return (ssize_t)i;
+ return (ssize_t) i;
return -1;
}
@@ -6858,3 +6873,115 @@ int fgetxattr_malloc(int fd, const char *name, char **value) {
return -errno;
}
}
+
+int send_one_fd(int transport_fd, int fd, int flags) {
+ union {
+ struct cmsghdr cmsghdr;
+ uint8_t buf[CMSG_SPACE(sizeof(int))];
+ } control = {};
+ struct msghdr mh = {
+ .msg_control = &control,
+ .msg_controllen = sizeof(control),
+ };
+ struct cmsghdr *cmsg;
+
+ assert(transport_fd >= 0);
+ assert(fd >= 0);
+
+ cmsg = CMSG_FIRSTHDR(&mh);
+ cmsg->cmsg_level = SOL_SOCKET;
+ cmsg->cmsg_type = SCM_RIGHTS;
+ cmsg->cmsg_len = CMSG_LEN(sizeof(int));
+ memcpy(CMSG_DATA(cmsg), &fd, sizeof(int));
+
+ mh.msg_controllen = CMSG_SPACE(sizeof(int));
+ if (sendmsg(transport_fd, &mh, MSG_NOSIGNAL | flags) < 0)
+ return -errno;
+
+ return 0;
+}
+
+/// UNNEEDED by elogind
+#if 0
+int receive_one_fd(int transport_fd, int flags) {
+ union {
+ struct cmsghdr cmsghdr;
+ uint8_t buf[CMSG_SPACE(sizeof(int))];
+ } control = {};
+ struct msghdr mh = {
+ .msg_control = &control,
+ .msg_controllen = sizeof(control),
+ };
+ struct cmsghdr *cmsg, *found = NULL;
+
+ assert(transport_fd >= 0);
+
+ /*
+ * Receive a single FD via @transport_fd. We don't care for
+ * the transport-type. We retrieve a single FD at most, so for
+ * packet-based transports, the caller must ensure to send
+ * only a single FD per packet. This is best used in
+ * combination with send_one_fd().
+ */
+
+ if (recvmsg(transport_fd, &mh, MSG_NOSIGNAL | MSG_CMSG_CLOEXEC | flags) < 0)
+ return -errno;
+
+ CMSG_FOREACH(cmsg, &mh) {
+ if (cmsg->cmsg_level == SOL_SOCKET &&
+ cmsg->cmsg_type == SCM_RIGHTS &&
+ cmsg->cmsg_len == CMSG_LEN(sizeof(int))) {
+ assert(!found);
+ found = cmsg;
+ break;
+ }
+ }
+
+ if (!found) {
+ cmsg_close_all(&mh);
+ return -EIO;
+ }
+
+ return *(int*) CMSG_DATA(found);
+}
+
+void nop_signal_handler(int sig) {
+ /* nothing here */
+}
+#endif // 0
+
+int version(void) {
+ puts(PACKAGE_STRING "\n"
+ SYSTEMD_FEATURES);
+ return 0;
+}
+
+/// UNNEEDED by elogind
+#if 0
+bool fdname_is_valid(const char *s) {
+ const char *p;
+
+ /* Validates a name for $LISTEN_FDNAMES. We basically allow
+ * everything ASCII that's not a control character. Also, as
+ * special exception the ":" character is not allowed, as we
+ * use that as field separator in $LISTEN_FDNAMES.
+ *
+ * Note that the empty string is explicitly allowed
+ * here. However, we limit the length of the names to 255
+ * characters. */
+
+ if (!s)
+ return false;
+
+ for (p = s; *p; p++) {
+ if (*p < ' ')
+ return false;
+ if (*p >= 127)
+ return false;
+ if (*p == ':')
+ return false;
+ }
+
+ return p - s < 256;
+}
+#endif // 0
diff --git a/src/basic/util.h b/src/basic/util.h
index 42117ed31..f55480abe 100644
--- a/src/basic/util.h
+++ b/src/basic/util.h
@@ -22,31 +22,30 @@
***/
#include <alloca.h>
+#include <dirent.h>
#include <fcntl.h>
#include <inttypes.h>
-#include <time.h>
+#include <limits.h>
+#include <locale.h>
+#include <mntent.h>
#include <stdarg.h>
#include <stdbool.h>
-#include <stdlib.h>
+#include <stddef.h>
#include <stdio.h>
-#include <sched.h>
-#include <limits.h>
-#include <sys/types.h>
+#include <stdlib.h>
+#include <sys/inotify.h>
#include <sys/socket.h>
#include <sys/stat.h>
-#include <dirent.h>
-#include <stddef.h>
-#include <unistd.h>
-#include <locale.h>
-#include <mntent.h>
-#include <sys/inotify.h>
#include <sys/statfs.h>
#include <sys/sysmacros.h>
+#include <sys/types.h>
+#include <time.h>
+#include <unistd.h>
+#include "formats-util.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"
@@ -150,7 +149,11 @@ void safe_close_pair(int p[]);
void close_many(const int fds[], unsigned n_fd);
-int parse_size(const char *t, off_t base, off_t *size);
+int fclose_nointr(FILE *f);
+FILE* safe_fclose(FILE *f);
+DIR* safe_closedir(DIR *f);
+
+int parse_size(const char *t, uint64_t base, uint64_t *size);
int parse_boolean(const char *v) _pure_;
int parse_pid(const char *s, pid_t* ret_pid);
@@ -158,7 +161,10 @@ int parse_uid(const char *s, uid_t* ret_uid);
#define parse_gid(s, ret_gid) parse_uid(s, ret_gid)
bool uid_is_valid(uid_t uid);
-#define gid_is_valid(gid) uid_is_valid(gid)
+
+static inline bool gid_is_valid(gid_t gid) {
+ return uid_is_valid((uid_t) gid);
+}
int safe_atou(const char *s, unsigned *ret_u);
int safe_atoi(const char *s, int *ret_i);
@@ -287,9 +293,9 @@ bool chars_intersect(const char *a, const char *b) _pure_;
ssize_t string_table_lookup(const char * const *table, size_t len, const char *key);
-#define _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(name,type,scope) \
- scope inline type name##_from_string(const char *s) { \
- return (type)string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \
+#define _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(name,type,scope) \
+ scope type name##_from_string(const char *s) { \
+ return (type) string_table_lookup(name##_table, ELEMENTSOF(name##_table), s); \
}
#define _DEFINE_STRING_TABLE_LOOKUP(name,type,scope) \
@@ -306,17 +312,15 @@ ssize_t string_table_lookup(const char * const *table, size_t len, const char *k
#define DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(name,type,max) \
int name##_to_string_alloc(type i, char **str) { \
char *s; \
- int r; \
if (i < 0 || i > max) \
return -ERANGE; \
if (i < (type) ELEMENTSOF(name##_table)) { \
s = strdup(name##_table[i]); \
if (!s) \
- return log_oom(); \
+ return -ENOMEM; \
} else { \
- r = asprintf(&s, "%i", i); \
- if (r < 0) \
- return log_oom(); \
+ if (asprintf(&s, "%i", i) < 0) \
+ return -ENOMEM; \
} \
*str = s; \
return 0; \
@@ -324,10 +328,10 @@ ssize_t string_table_lookup(const char * const *table, size_t len, const char *k
type name##_from_string(const char *s) { \
type i; \
unsigned u = 0; \
- assert(s); \
- for (i = 0; i < (type)ELEMENTSOF(name##_table); i++) \
- if (name##_table[i] && \
- streq(name##_table[i], s)) \
+ if (!s) \
+ return (type) -1; \
+ for (i = 0; i < (type) ELEMENTSOF(name##_table); i++) \
+ if (streq_ptr(name##_table[i], s)) \
return i; \
if (safe_atou(s, &u) >= 0 && u <= max) \
return (type) u; \
@@ -367,12 +371,9 @@ int fd_is_temporary_fs(int fd);
int pipe_eof(int fd);
-DEFINE_TRIVIAL_CLEANUP_FUNC(cpu_set_t*, CPU_FREE);
-#define _cleanup_cpu_free_ _cleanup_(CPU_FREEp)
-
-// UNNEEDED cpu_set_t* cpu_set_malloc(unsigned *ncpus);
-
-#define xsprintf(buf, fmt, ...) assert_se((size_t) snprintf(buf, ELEMENTSOF(buf), fmt, __VA_ARGS__) < ELEMENTSOF(buf))
+#define xsprintf(buf, fmt, ...) \
+ assert_message_se((size_t) snprintf(buf, ELEMENTSOF(buf), fmt, __VA_ARGS__) < ELEMENTSOF(buf), \
+ "xsprintf: " #buf "[] must be big enough")
int files_same(const char *filea, const char *fileb);
@@ -451,28 +452,28 @@ static inline bool _pure_ in_charset(const char *s, const char* charset) {
int ioprio_class_to_string_alloc(int i, char **s);
int ioprio_class_from_string(const char *s);
-const char *sigchld_code_to_string(int i) _const_;
-int sigchld_code_from_string(const char *s) _pure_;
+// UNNEEDED const char *sigchld_code_to_string(int i) _const_;
+// UNNEEDED int sigchld_code_from_string(const char *s) _pure_;
-int log_facility_unshifted_to_string_alloc(int i, char **s);
-int log_facility_unshifted_from_string(const char *s);
+// UNNEEDED int log_facility_unshifted_to_string_alloc(int i, char **s);
+// UNNEEDED int log_facility_unshifted_from_string(const char *s);
int log_level_to_string_alloc(int i, char **s);
int log_level_from_string(const char *s);
-int sched_policy_to_string_alloc(int i, char **s);
-int sched_policy_from_string(const char *s);
+// UNNEEDED int sched_policy_to_string_alloc(int i, char **s);
+// UNNEEDED int sched_policy_from_string(const char *s);
const char *rlimit_to_string(int i) _const_;
int rlimit_from_string(const char *s) _pure_;
-int ip_tos_to_string_alloc(int i, char **s);
-int ip_tos_from_string(const char *s);
+// UNNEEDED int ip_tos_to_string_alloc(int i, char **s);
+// UNNEEDED int ip_tos_from_string(const char *s);
extern int saved_argc;
extern char **saved_argv;
-bool kexec_loaded(void);
+// UNNEEDED bool kexec_loaded(void);
// UNNEEDED int prot_from_flags(int flags) _const_;
@@ -515,7 +516,10 @@ static inline void close_pairp(int (*p)[2]) {
safe_close_pair(*p);
}
-DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, fclose);
+static inline void fclosep(FILE **f) {
+ safe_fclose(*f);
+}
+
DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, pclose);
DEFINE_TRIVIAL_CLEANUP_FUNC(DIR*, closedir);
DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, endmntent);
@@ -872,11 +876,6 @@ int extract_first_word(const char **p, char **ret, const char *separators, Extra
// UNNEEDED int extract_first_word_and_warn(const char **p, char **ret, const char *separators, ExtractFlags flags, const char *unit, const char *filename, unsigned line, const char *rvalue);
// UNNEEDED int extract_many_words(const char **p, const char *separators, ExtractFlags flags, ...) _sentinel_;
-static inline void free_and_replace(char **s, char *v) {
- free(*s);
- *s = v;
-}
-
int free_and_strdup(char **p, const char *s);
#define INOTIFY_EVENT_MAX (sizeof(struct inotify_event) + NAME_MAX + 1)
@@ -910,10 +909,10 @@ int fd_getcrtime(int fd, usec_t *usec);
// UNNEEDED int same_fd(int a, int b);
-int chattr_fd(int fd, unsigned value, unsigned mask);
+// UNNEEDED int chattr_fd(int fd, unsigned value, unsigned mask);
// UNNEEDED int chattr_path(const char *p, unsigned value, unsigned mask);
-int read_attr_fd(int fd, unsigned *ret);
+// UNNEEDED int read_attr_fd(int fd, unsigned *ret);
// UNNEEDED int read_attr_path(const char *p, unsigned *ret);
#define RLIMIT_MAKE_CONST(lim) ((struct rlimit) { lim, lim })
@@ -940,3 +939,12 @@ int reset_uid_gid(void);
int getxattr_malloc(const char *path, const char *name, char **value, bool allow_symlink);
int fgetxattr_malloc(int fd, const char *name, char **value);
+
+int send_one_fd(int transport_fd, int fd, int flags);
+// UNNEEDED int receive_one_fd(int transport_fd, int flags);
+
+// UNNEEDED void nop_signal_handler(int sig);
+
+int version(void);
+
+// UNNEEDED bool fdname_is_valid(const char *s);
diff --git a/src/basic/virt.c b/src/basic/virt.c
index 1f9843bab..8e398e506 100644
--- a/src/basic/virt.c
+++ b/src/basic/virt.c
@@ -28,25 +28,24 @@
#include "virt.h"
#include "fileio.h"
-static int detect_vm_cpuid(const char **_id) {
+static int detect_vm_cpuid(void) {
/* Both CPUID and DMI are x86 specific interfaces... */
#if defined(__i386__) || defined(__x86_64__)
- static const char cpuid_vendor_table[] =
- "XenVMMXenVMM\0" "xen\0"
- "KVMKVMKVM\0" "kvm\0"
+ static const struct {
+ const char *cpuid;
+ int id;
+ } cpuid_vendor_table[] = {
+ { "XenVMMXenVMM", VIRTUALIZATION_XEN },
+ { "KVMKVMKVM", VIRTUALIZATION_KVM },
/* http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458 */
- "VMwareVMware\0" "vmware\0"
+ { "VMwareVMware", VIRTUALIZATION_VMWARE },
/* http://msdn.microsoft.com/en-us/library/ff542428.aspx */
- "Microsoft Hv\0" "microsoft\0";
+ { "Microsoft Hv", VIRTUALIZATION_MICROSOFT },
+ };
uint32_t eax, ecx;
- union {
- uint32_t sig32[3];
- char text[13];
- } sig = {};
- const char *j, *k;
bool hypervisor;
/* http://lwn.net/Articles/301888/ */
@@ -74,6 +73,11 @@ static int detect_vm_cpuid(const char **_id) {
hypervisor = !!(ecx & 0x80000000U);
if (hypervisor) {
+ union {
+ uint32_t sig32[3];
+ char text[13];
+ } sig = {};
+ unsigned j;
/* There is a hypervisor, see what it is */
eax = 0x40000000U;
@@ -88,57 +92,54 @@ static int detect_vm_cpuid(const char **_id) {
: "0" (eax)
);
- NULSTR_FOREACH_PAIR(j, k, cpuid_vendor_table)
- if (streq(sig.text, j)) {
- *_id = k;
- return 1;
- }
+ for (j = 0; j < ELEMENTSOF(cpuid_vendor_table); j ++)
+ if (streq(sig.text, cpuid_vendor_table[j].cpuid))
+ return cpuid_vendor_table[j].id;
- *_id = "other";
- return 0;
+ return VIRTUALIZATION_VM_OTHER;
}
#endif
- return 0;
+ return VIRTUALIZATION_NONE;
}
-static int detect_vm_devicetree(const char **_id) {
+static int detect_vm_device_tree(void) {
#if defined(__arm__) || defined(__aarch64__) || defined(__powerpc__) || defined(__powerpc64__)
_cleanup_free_ char *hvtype = NULL;
int r;
r = read_one_line_file("/proc/device-tree/hypervisor/compatible", &hvtype);
- if (r >= 0) {
- if (streq(hvtype, "linux,kvm")) {
- *_id = "kvm";
- return 1;
- } else if (strstr(hvtype, "xen")) {
- *_id = "xen";
- return 1;
- }
- } else if (r == -ENOENT) {
+ if (r == -ENOENT) {
_cleanup_closedir_ DIR *dir = NULL;
struct dirent *dent;
dir = opendir("/proc/device-tree");
if (!dir) {
if (errno == ENOENT)
- return 0;
+ return VIRTUALIZATION_NONE;
return -errno;
}
- FOREACH_DIRENT(dent, dir, return -errno) {
- if (strstr(dent->d_name, "fw-cfg")) {
- *_id = "qemu";
- return 1;
- }
- }
- }
+ FOREACH_DIRENT(dent, dir, return -errno)
+ if (strstr(dent->d_name, "fw-cfg"))
+ return VIRTUALIZATION_QEMU;
+
+ return VIRTUALIZATION_NONE;
+ } else if (r < 0)
+ return r;
+
+ if (streq(hvtype, "linux,kvm"))
+ return VIRTUALIZATION_KVM;
+ else if (strstr(hvtype, "xen"))
+ return VIRTUALIZATION_XEN;
+ else
+ return VIRTUALIZATION_VM_OTHER;
+#else
+ return VIRTUALIZATION_NONE;
#endif
- return 0;
}
-static int detect_vm_dmi(const char **_id) {
+static int detect_vm_dmi(void) {
/* Both CPUID and DMI are x86 specific interfaces... */
#if defined(__i386__) || defined(__x86_64__)
@@ -149,188 +150,195 @@ static int detect_vm_dmi(const char **_id) {
"/sys/class/dmi/id/bios_vendor"
};
- static const char dmi_vendor_table[] =
- "QEMU\0" "qemu\0"
+ static const struct {
+ const char *vendor;
+ int id;
+ } dmi_vendor_table[] = {
+ { "QEMU", VIRTUALIZATION_QEMU },
/* http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458 */
- "VMware\0" "vmware\0"
- "VMW\0" "vmware\0"
- "innotek GmbH\0" "oracle\0"
- "Xen\0" "xen\0"
- "Bochs\0" "bochs\0"
- "Parallels\0" "parallels\0";
+ { "VMware", VIRTUALIZATION_VMWARE },
+ { "VMW", VIRTUALIZATION_VMWARE },
+ { "innotek GmbH", VIRTUALIZATION_ORACLE },
+ { "Xen", VIRTUALIZATION_XEN },
+ { "Bochs", VIRTUALIZATION_BOCHS },
+ { "Parallels", VIRTUALIZATION_PARALLELS },
+ };
unsigned i;
+ int r;
for (i = 0; i < ELEMENTSOF(dmi_vendors); i++) {
_cleanup_free_ char *s = NULL;
- const char *j, *k;
- int r;
+ unsigned j;
r = read_one_line_file(dmi_vendors[i], &s);
if (r < 0) {
- if (r != -ENOENT)
- return r;
-
+ if (r == -ENOENT)
continue;
- }
- NULSTR_FOREACH_PAIR(j, k, dmi_vendor_table)
- if (startswith(s, j)) {
- *_id = k;
- return 1;
+ return r;
}
+
+ for (j = 0; j < ELEMENTSOF(dmi_vendor_table); j++)
+ if (startswith(s, dmi_vendor_table[j].vendor))
+ return dmi_vendor_table[j].id;
}
#endif
- return 0;
+ return VIRTUALIZATION_NONE;
}
-/* Returns a short identifier for the various VM implementations */
-int detect_vm(const char **id) {
- _cleanup_free_ char *domcap = NULL, *cpuinfo_contents = NULL;
- static thread_local int cached_found = -1;
- static thread_local const char *cached_id = NULL;
- const char *_id = NULL, *_id_cpuid = NULL;
+static int detect_vm_xen(void) {
+ _cleanup_free_ char *domcap = NULL;
+ char *cap, *i;
int r;
- if (_likely_(cached_found >= 0)) {
-
- if (id)
- *id = cached_id;
-
- return cached_found;
- }
-
- /* Try xen capabilities file first, if not found try high-level hypervisor sysfs file:
- *
- * https://bugs.freedesktop.org/show_bug.cgi?id=77271 */
r = read_one_line_file("/proc/xen/capabilities", &domcap);
- if (r >= 0) {
- char *cap, *i = domcap;
+ if (r == -ENOENT)
+ return VIRTUALIZATION_NONE;
+ i = domcap;
while ((cap = strsep(&i, ",")))
if (streq(cap, "control_d"))
break;
- if (!cap) {
- _id = "xen";
- r = 1;
+ return cap ? VIRTUALIZATION_NONE : VIRTUALIZATION_XEN;
}
- goto finish;
-
- } else if (r == -ENOENT) {
+static int detect_vm_hypervisor(void) {
_cleanup_free_ char *hvtype = NULL;
+ int r;
r = read_one_line_file("/sys/hypervisor/type", &hvtype);
- if (r >= 0) {
- if (streq(hvtype, "xen")) {
- _id = "xen";
- r = 1;
- goto finish;
- }
- } else if (r != -ENOENT)
- return r;
- } else
+ if (r == -ENOENT)
+ return VIRTUALIZATION_NONE;
+ if (r < 0)
return r;
- /* this will set _id to "other" and return 0 for unknown hypervisors */
- r = detect_vm_cpuid(&_id);
+ if (streq(hvtype, "xen"))
+ return VIRTUALIZATION_XEN;
+ else
+ return VIRTUALIZATION_VM_OTHER;
+}
- /* finish when found a known hypervisor other than kvm */
- if (r < 0 || (r > 0 && !streq(_id, "kvm")))
- goto finish;
+static int detect_vm_uml(void) {
+ _cleanup_free_ char *cpuinfo_contents = NULL;
+ int r;
+
+ /* Detect User-Mode Linux by reading /proc/cpuinfo */
+ r = read_full_file("/proc/cpuinfo", &cpuinfo_contents, NULL);
+ if (r < 0)
+ return r;
+ if (strstr(cpuinfo_contents, "\nvendor_id\t: User Mode Linux\n"))
+ return VIRTUALIZATION_UML;
- _id_cpuid = _id;
+ return VIRTUALIZATION_NONE;
+}
- r = detect_vm_dmi(&_id);
+static int detect_vm_zvm(void) {
- /* kvm with and without Virtualbox */
- /* Parallels exports KVMKVMKVM leaf */
- if (streq_ptr(_id_cpuid, "kvm")) {
- if (r > 0 && (streq(_id, "oracle") || streq(_id, "parallels")))
- goto finish;
+#if defined(__s390__)
+ _cleanup_free_ char *t = NULL;
+ int r;
- _id = _id_cpuid;
- r = 1;
- goto finish;
+ r = get_proc_field("/proc/sysinfo", "VM00 Control Program", WHITESPACE, &t);
+ if (r == -ENOENT)
+ return VIRTUALIZATION_NONE;
+ if (r < 0)
+ return r;
+
+ if (streq(t, "z/VM"))
+ return VIRTUALIZATION_ZVM;
+ else
+ return VIRTUALIZATION_KVM;
+#else
+ return VIRTUALIZATION_NONE;
+#endif
}
- /* information from dmi */
- if (r != 0)
- goto finish;
+/* Returns a short identifier for the various VM implementations */
+int detect_vm(void) {
+ static thread_local int cached_found = _VIRTUALIZATION_INVALID;
+ int r;
- r = detect_vm_devicetree(&_id);
- if (r != 0)
+ if (cached_found >= 0)
+ return cached_found;
+
+ /* Try xen capabilities file first, if not found try
+ * high-level hypervisor sysfs file:
+ *
+ * https://bugs.freedesktop.org/show_bug.cgi?id=77271 */
+
+ r = detect_vm_xen();
+ if (r < 0)
+ return r;
+ if (r != VIRTUALIZATION_NONE)
goto finish;
- if (_id) {
- /* "other" */
- r = 1;
+ r = detect_vm_dmi();
+ if (r < 0)
+ return r;
+ if (r != VIRTUALIZATION_NONE)
goto finish;
- }
- /* Detect User-Mode Linux by reading /proc/cpuinfo */
- r = read_full_file("/proc/cpuinfo", &cpuinfo_contents, NULL);
+ r = detect_vm_cpuid();
if (r < 0)
return r;
- if (strstr(cpuinfo_contents, "\nvendor_id\t: User Mode Linux\n")) {
- _id = "uml";
- r = 1;
+ if (r != VIRTUALIZATION_NONE)
goto finish;
- }
-#if defined(__s390__)
- {
- _cleanup_free_ char *t = NULL;
+ r = detect_vm_hypervisor();
+ if (r < 0)
+ return r;
+ if (r != VIRTUALIZATION_NONE)
+ goto finish;
- r = get_status_field("/proc/sysinfo", "VM00 Control Program:", &t);
- if (r >= 0) {
- if (streq(t, "z/VM"))
- _id = "zvm";
- else
- _id = "kvm";
- r = 1;
+ r = detect_vm_device_tree();
+ if (r < 0)
+ return r;
+ if (r != VIRTUALIZATION_NONE)
+ goto finish;
+ r = detect_vm_uml();
+ if (r < 0)
+ return r;
+ if (r != VIRTUALIZATION_NONE)
goto finish;
- }
- }
-#endif
- r = 0;
+ r = detect_vm_zvm();
+ if (r < 0)
+ return r;
finish:
cached_found = r;
-
- cached_id = _id;
- if (id)
- *id = _id;
-
return r;
}
-int detect_container(const char **id) {
+int detect_container(void) {
- static thread_local int cached_found = -1;
- static thread_local const char *cached_id = NULL;
+ static const struct {
+ const char *value;
+ int id;
+ } value_table[] = {
+ { "lxc", VIRTUALIZATION_LXC },
+ { "lxc-libvirt", VIRTUALIZATION_LXC_LIBVIRT },
+ { "systemd-nspawn", VIRTUALIZATION_SYSTEMD_NSPAWN },
+ { "docker", VIRTUALIZATION_DOCKER },
+ };
+ static thread_local int cached_found = _VIRTUALIZATION_INVALID;
_cleanup_free_ char *m = NULL;
- const char *_id = NULL, *e = NULL;
+ const char *e = NULL;
+ unsigned j;
int r;
- if (_likely_(cached_found >= 0)) {
-
- if (id)
- *id = cached_id;
-
+ if (cached_found >= 0)
return cached_found;
- }
/* /proc/vz exists in container and outside of the container,
* /proc/bc only outside of the container. */
if (access("/proc/vz", F_OK) >= 0 &&
access("/proc/bc", F_OK) < 0) {
- _id = "openvz";
- r = 1;
+ r = VIRTUALIZATION_OPENVZ;
goto finish;
}
@@ -340,7 +348,7 @@ int detect_container(const char **id) {
e = getenv("container");
if (isempty(e)) {
- r = 0;
+ r = VIRTUALIZATION_NONE;
goto finish;
}
} else {
@@ -369,7 +377,7 @@ int detect_container(const char **id) {
* as /proc/1/environ is only readable
* with privileges. */
- r = 0;
+ r = VIRTUALIZATION_NONE;
goto finish;
}
}
@@ -379,49 +387,52 @@ int detect_container(const char **id) {
e = m;
}
- /* We only recognize a selected few here, since we want to
- * enforce a redacted namespace */
- if (streq(e, "lxc"))
- _id ="lxc";
- else if (streq(e, "lxc-libvirt"))
- _id = "lxc-libvirt";
- else if (streq(e, "systemd-nspawn"))
- _id = "systemd-nspawn";
- else if (streq(e, "docker"))
- _id = "docker";
- else
- _id = "other";
+ for (j = 0; j < ELEMENTSOF(value_table); j++)
+ if (streq(e, value_table[j].value)) {
+ r = value_table[j].id;
+ goto finish;
+ }
- r = 1;
+ r = VIRTUALIZATION_NONE;
finish:
cached_found = r;
-
- cached_id = _id;
- if (id)
- *id = _id;
-
return r;
}
/// UNNEEDED by elogind
#if 0
-/* Returns a short identifier for the various VM/container implementations */
-int detect_virtualization(const char **id) {
+int detect_virtualization(void) {
int r;
- r = detect_container(id);
- if (r < 0)
- return r;
- if (r > 0)
- return VIRTUALIZATION_CONTAINER;
-
- r = detect_vm(id);
- if (r < 0)
+ r = detect_container();
+ if (r != 0)
return r;
- if (r > 0)
- return VIRTUALIZATION_VM;
- return VIRTUALIZATION_NONE;
+ return detect_vm();
}
#endif // 0
+
+static const char *const virtualization_table[_VIRTUALIZATION_MAX] = {
+ [VIRTUALIZATION_NONE] = "none",
+ [VIRTUALIZATION_KVM] = "kvm",
+ [VIRTUALIZATION_QEMU] = "qemu",
+ [VIRTUALIZATION_BOCHS] = "bochs",
+ [VIRTUALIZATION_XEN] = "xen",
+ [VIRTUALIZATION_UML] = "uml",
+ [VIRTUALIZATION_VMWARE] = "vmware",
+ [VIRTUALIZATION_ORACLE] = "oracle",
+ [VIRTUALIZATION_MICROSOFT] = "microsoft",
+ [VIRTUALIZATION_ZVM] = "zvm",
+ [VIRTUALIZATION_PARALLELS] = "parallels",
+ [VIRTUALIZATION_VM_OTHER] = "vm-other",
+
+ [VIRTUALIZATION_SYSTEMD_NSPAWN] = "systemd-nspawn",
+ [VIRTUALIZATION_LXC_LIBVIRT] = "lxc-libvirt",
+ [VIRTUALIZATION_LXC] = "lxc",
+ [VIRTUALIZATION_OPENVZ] = "openvz",
+ [VIRTUALIZATION_DOCKER] = "docker",
+ [VIRTUALIZATION_CONTAINER_OTHER] = "container-other",
+};
+
+DEFINE_STRING_TABLE_LOOKUP(virtualization, int);
diff --git a/src/basic/virt.h b/src/basic/virt.h
index 0f390981d..d63e028a2 100644
--- a/src/basic/virt.h
+++ b/src/basic/virt.h
@@ -21,15 +21,51 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-int detect_vm(const char **id);
-int detect_container(const char **id);
+#include <stdbool.h>
+
+#include "macro.h"
enum {
VIRTUALIZATION_NONE = 0,
- VIRTUALIZATION_VM,
- VIRTUALIZATION_CONTAINER,
+
+ VIRTUALIZATION_VM_FIRST,
+ VIRTUALIZATION_KVM = VIRTUALIZATION_VM_FIRST,
+ VIRTUALIZATION_QEMU,
+ VIRTUALIZATION_BOCHS,
+ VIRTUALIZATION_XEN,
+ VIRTUALIZATION_UML,
+ VIRTUALIZATION_VMWARE,
+ VIRTUALIZATION_ORACLE,
+ VIRTUALIZATION_MICROSOFT,
+ VIRTUALIZATION_ZVM,
+ VIRTUALIZATION_PARALLELS,
+ VIRTUALIZATION_VM_OTHER,
+ VIRTUALIZATION_VM_LAST = VIRTUALIZATION_VM_OTHER,
+
+ VIRTUALIZATION_CONTAINER_FIRST,
+ VIRTUALIZATION_SYSTEMD_NSPAWN = VIRTUALIZATION_CONTAINER_FIRST,
+ VIRTUALIZATION_LXC_LIBVIRT,
+ VIRTUALIZATION_LXC,
+ VIRTUALIZATION_OPENVZ,
+ VIRTUALIZATION_DOCKER,
+ VIRTUALIZATION_CONTAINER_OTHER,
+ VIRTUALIZATION_CONTAINER_LAST = VIRTUALIZATION_CONTAINER_OTHER,
+
_VIRTUALIZATION_MAX,
_VIRTUALIZATION_INVALID = -1
};
-// UNNEEDED int detect_virtualization(const char **id);
+static inline bool VIRTUALIZATION_IS_VM(int x) {
+ return x >= VIRTUALIZATION_VM_FIRST && x <= VIRTUALIZATION_VM_LAST;
+}
+
+static inline bool VIRTUALIZATION_IS_CONTAINER(int x) {
+ return x >= VIRTUALIZATION_CONTAINER_FIRST && x <= VIRTUALIZATION_CONTAINER_LAST;
+}
+
+int detect_vm(void);
+int detect_container(void);
+// UNNEEDED int detect_virtualization(void);
+
+const char *virtualization_to_string(int v) _const_;
+int virtualization_from_string(const char *s) _pure_;
diff --git a/src/cgroups-agent/cgroups-agent.c b/src/cgroups-agent/cgroups-agent.c
index c0ce357f3..0e0ca77b3 100644
--- a/src/cgroups-agent/cgroups-agent.c
+++ b/src/cgroups-agent/cgroups-agent.c
@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) {
* this to avoid an activation loop when we start dbus when we
* are called when the dbus service is shut down. */
- r = bus_open_system_systemd(&bus);
+ r = bus_connect_system_systemd(&bus);
#else
/* Unlike in systemd where this has to use a private socket,
since elogind doesn't associate control groups with services
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 54da47182..c877c3c32 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -22,10 +22,11 @@
#include <fcntl.h>
#include <fnmatch.h>
-#include "process-util.h"
-#include "path-util.h"
-// #include "special.h"
#include "cgroup-util.h"
+#include "path-util.h"
+#include "process-util.h"
+//#include "special.h"
+
#include "cgroup.h"
#define CGROUP_CPU_QUOTA_PERIOD_USEC ((usec_t) 100 * USEC_PER_MSEC)
@@ -38,13 +39,18 @@ void cgroup_context_init(CGroupContext *c) {
/* Initialize everything to the kernel defaults, assuming the
* structure is preinitialized to 0 */
- c->cpu_shares = (unsigned long) -1;
- c->startup_cpu_shares = (unsigned long) -1;
+ c->cpu_shares = CGROUP_CPU_SHARES_INVALID;
+ c->startup_cpu_shares = CGROUP_CPU_SHARES_INVALID;
+ c->cpu_quota_per_sec_usec = USEC_INFINITY;
+
c->memory_limit = (uint64_t) -1;
- c->blockio_weight = (unsigned long) -1;
- c->startup_blockio_weight = (unsigned long) -1;
- c->cpu_quota_per_sec_usec = USEC_INFINITY;
+ c->blockio_weight = CGROUP_BLKIO_WEIGHT_INVALID;
+ c->startup_blockio_weight = CGROUP_BLKIO_WEIGHT_INVALID;
+
+ c->tasks_max = (uint64_t) -1;
+
+ c->netclass_type = CGROUP_NETCLASS_TYPE_NONE;
}
void cgroup_context_free_device_allow(CGroupContext *c, CGroupDeviceAllow *a) {
@@ -102,23 +108,27 @@ void cgroup_context_dump(CGroupContext *c, FILE* f, const char *prefix) {
"%sCPUAccounting=%s\n"
"%sBlockIOAccounting=%s\n"
"%sMemoryAccounting=%s\n"
- "%sCPUShares=%lu\n"
- "%sStartupCPUShares=%lu\n"
+ "%sTasksAccounting=%s\n"
+ "%sCPUShares=%" PRIu64 "\n"
+ "%sStartupCPUShares=%" PRIu64 "\n"
"%sCPUQuotaPerSecSec=%s\n"
- "%sBlockIOWeight=%lu\n"
- "%sStartupBlockIOWeight=%lu\n"
+ "%sBlockIOWeight=%" PRIu64 "\n"
+ "%sStartupBlockIOWeight=%" PRIu64 "\n"
"%sMemoryLimit=%" PRIu64 "\n"
+ "%sTasksMax=%" PRIu64 "\n"
"%sDevicePolicy=%s\n"
"%sDelegate=%s\n",
prefix, yes_no(c->cpu_accounting),
prefix, yes_no(c->blockio_accounting),
prefix, yes_no(c->memory_accounting),
+ prefix, yes_no(c->tasks_accounting),
prefix, c->cpu_shares,
prefix, c->startup_cpu_shares,
prefix, format_timespan(u, sizeof(u), c->cpu_quota_per_sec_usec, 1),
prefix, c->blockio_weight,
prefix, c->startup_blockio_weight,
prefix, c->memory_limit,
+ prefix, c->tasks_max,
prefix, cgroup_device_policy_to_string(c->device_policy),
prefix, yes_no(c->delegate));
@@ -131,7 +141,7 @@ void cgroup_context_dump(CGroupContext *c, FILE* f, const char *prefix) {
LIST_FOREACH(device_weights, w, c->blockio_device_weights)
fprintf(f,
- "%sBlockIODeviceWeight=%s %lu",
+ "%sBlockIODeviceWeight=%s %" PRIu64,
prefix,
w->path,
w->weight);
@@ -285,7 +295,7 @@ fail:
return -errno;
}
-void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, ManagerState state) {
+void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, uint32_t netclass, ManagerState state) {
bool is_root;
int r;
@@ -307,11 +317,11 @@ void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, M
* and missing cgroups, i.e. EROFS and ENOENT. */
if ((mask & CGROUP_MASK_CPU) && !is_root) {
- char buf[MAX(DECIMAL_STR_MAX(unsigned long), DECIMAL_STR_MAX(usec_t)) + 1];
+ char buf[MAX(DECIMAL_STR_MAX(uint64_t), DECIMAL_STR_MAX(usec_t)) + 1];
- sprintf(buf, "%lu\n",
- IN_SET(state, MANAGER_STARTING, MANAGER_INITIALIZING) && c->startup_cpu_shares != (unsigned long) -1 ? c->startup_cpu_shares :
- c->cpu_shares != (unsigned long) -1 ? c->cpu_shares : 1024);
+ sprintf(buf, "%" PRIu64 "\n",
+ IN_SET(state, MANAGER_STARTING, MANAGER_INITIALIZING) && c->startup_cpu_shares != CGROUP_CPU_SHARES_INVALID ? c->startup_cpu_shares :
+ c->cpu_shares != CGROUP_CPU_SHARES_INVALID ? c->cpu_shares : CGROUP_CPU_SHARES_DEFAULT);
r = cg_set_attribute("cpu", path, "cpu.shares", buf);
if (r < 0)
log_full_errno(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, r,
@@ -334,15 +344,15 @@ void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, M
}
if (mask & CGROUP_MASK_BLKIO) {
- char buf[MAX3(DECIMAL_STR_MAX(unsigned long)+1,
- DECIMAL_STR_MAX(dev_t)*2+2+DECIMAL_STR_MAX(unsigned long)*1,
+ char buf[MAX(DECIMAL_STR_MAX(uint64_t)+1,
DECIMAL_STR_MAX(dev_t)*2+2+DECIMAL_STR_MAX(uint64_t)+1)];
CGroupBlockIODeviceWeight *w;
CGroupBlockIODeviceBandwidth *b;
if (!is_root) {
- sprintf(buf, "%lu\n", IN_SET(state, MANAGER_STARTING, MANAGER_INITIALIZING) && c->startup_blockio_weight != (unsigned long) -1 ? c->startup_blockio_weight :
- c->blockio_weight != (unsigned long) -1 ? c->blockio_weight : 1000);
+ sprintf(buf, "%" PRIu64 "\n",
+ IN_SET(state, MANAGER_STARTING, MANAGER_INITIALIZING) && c->startup_blockio_weight != CGROUP_BLKIO_WEIGHT_INVALID ? c->startup_blockio_weight :
+ c->blockio_weight != CGROUP_BLKIO_WEIGHT_INVALID ? c->blockio_weight : CGROUP_BLKIO_WEIGHT_DEFAULT);
r = cg_set_attribute("blkio", path, "blkio.weight", buf);
if (r < 0)
log_full_errno(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, r,
@@ -356,7 +366,7 @@ void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, M
if (r < 0)
continue;
- sprintf(buf, "%u:%u %lu", major(dev), minor(dev), w->weight);
+ sprintf(buf, "%u:%u %" PRIu64 "\n", major(dev), minor(dev), w->weight);
r = cg_set_attribute("blkio", path, "blkio.weight_device", buf);
if (r < 0)
log_full_errno(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, r,
@@ -406,7 +416,7 @@ void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, M
"Failed to set memory.limit_in_bytes/memory.max on %s: %m", path);
}
- if ((mask & CGROUP_MASK_DEVICE) && !is_root) {
+ if ((mask & CGROUP_MASK_DEVICES) && !is_root) {
CGroupDeviceAllow *a;
/* Changing the devices list of a populated cgroup
@@ -468,6 +478,32 @@ void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, M
log_debug("Ignoring device %s while writing cgroup attribute.", a->path);
}
}
+
+ if ((mask & CGROUP_MASK_PIDS) && !is_root) {
+
+ if (c->tasks_max != (uint64_t) -1) {
+ char buf[DECIMAL_STR_MAX(uint64_t) + 2];
+
+ sprintf(buf, "%" PRIu64 "\n", c->tasks_max);
+ r = cg_set_attribute("pids", path, "pids.max", buf);
+ } else
+ r = cg_set_attribute("pids", path, "pids.max", "max");
+
+ if (r < 0)
+ log_full_errno(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, r,
+ "Failed to set pids.max on %s: %m", path);
+ }
+
+ if (mask & CGROUP_MASK_NET_CLS) {
+ char buf[DECIMAL_STR_MAX(uint32_t)];
+
+ sprintf(buf, "%" PRIu32, netclass);
+
+ r = cg_set_attribute("net_cls", path, "net_cls.classid", buf);
+ if (r < 0)
+ log_full_errno(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, r,
+ "Failed to set net_cls.classid on %s: %m", path);
+ }
}
CGroupMask cgroup_context_get_mask(CGroupContext *c) {
@@ -476,14 +512,14 @@ CGroupMask cgroup_context_get_mask(CGroupContext *c) {
/* Figure out which controllers we need */
if (c->cpu_accounting ||
- c->cpu_shares != (unsigned long) -1 ||
- c->startup_cpu_shares != (unsigned long) -1 ||
+ c->cpu_shares != CGROUP_CPU_SHARES_INVALID ||
+ c->startup_cpu_shares != CGROUP_CPU_SHARES_INVALID ||
c->cpu_quota_per_sec_usec != USEC_INFINITY)
mask |= CGROUP_MASK_CPUACCT | CGROUP_MASK_CPU;
if (c->blockio_accounting ||
- c->blockio_weight != (unsigned long) -1 ||
- c->startup_blockio_weight != (unsigned long) -1 ||
+ c->blockio_weight != CGROUP_BLKIO_WEIGHT_INVALID ||
+ c->startup_blockio_weight != CGROUP_BLKIO_WEIGHT_INVALID ||
c->blockio_device_weights ||
c->blockio_device_bandwidths)
mask |= CGROUP_MASK_BLKIO;
@@ -494,7 +530,14 @@ CGroupMask cgroup_context_get_mask(CGroupContext *c) {
if (c->device_allow ||
c->device_policy != CGROUP_AUTO)
- mask |= CGROUP_MASK_DEVICE;
+ mask |= CGROUP_MASK_DEVICES;
+
+ if (c->tasks_accounting ||
+ c->tasks_max != (uint64_t) -1)
+ mask |= CGROUP_MASK_PIDS;
+
+ if (c->netclass_type != CGROUP_NETCLASS_TYPE_NONE)
+ mask |= CGROUP_MASK_NET_CLS;
return mask;
}
@@ -863,6 +906,103 @@ static bool unit_has_mask_realized(Unit *u, CGroupMask target_mask) {
return u->cgroup_realized && u->cgroup_realized_mask == target_mask;
}
+static int unit_find_free_netclass_cgroup(Unit *u, uint32_t *ret) {
+
+ uint32_t start, i;
+ Manager *m;
+
+ assert(u);
+
+ m = u->manager;
+
+ i = start = m->cgroup_netclass_registry_last;
+
+ do {
+ i++;
+
+ if (!hashmap_get(m->cgroup_netclass_registry, UINT_TO_PTR(i))) {
+ m->cgroup_netclass_registry_last = i;
+ *ret = i;
+ return 0;
+ }
+
+ if (i == UINT32_MAX)
+ i = CGROUP_NETCLASS_FIXED_MAX;
+
+ } while (i != start);
+
+ return -ENOBUFS;
+}
+
+int unit_add_to_netclass_cgroup(Unit *u) {
+
+ CGroupContext *cc;
+ Unit *first;
+ void *key;
+ int r;
+
+ assert(u);
+
+ cc = unit_get_cgroup_context(u);
+ if (!cc)
+ return 0;
+
+ switch (cc->netclass_type) {
+ case CGROUP_NETCLASS_TYPE_NONE:
+ return 0;
+
+ case CGROUP_NETCLASS_TYPE_FIXED:
+ u->cgroup_netclass_id = cc->netclass_id;
+ break;
+
+ case CGROUP_NETCLASS_TYPE_AUTO:
+ /* Allocate a new ID in case it was requested and not done yet */
+ if (u->cgroup_netclass_id == 0) {
+ r = unit_find_free_netclass_cgroup(u, &u->cgroup_netclass_id);
+ if (r < 0)
+ return r;
+
+ log_debug("Dynamically assigned netclass cgroup id %" PRIu32 " to %s", u->cgroup_netclass_id, u->id);
+ }
+
+ break;
+ }
+
+ r = hashmap_ensure_allocated(&u->manager->cgroup_netclass_registry, &trivial_hash_ops);
+ if (r < 0)
+ return r;
+
+ key = UINT32_TO_PTR(u->cgroup_netclass_id);
+ first = hashmap_get(u->manager->cgroup_netclass_registry, key);
+
+ if (first) {
+ LIST_PREPEND(cgroup_netclass, first, u);
+ return hashmap_replace(u->manager->cgroup_netclass_registry, key, u);
+ }
+
+ return hashmap_put(u->manager->cgroup_netclass_registry, key, u);
+}
+
+int unit_remove_from_netclass_cgroup(Unit *u) {
+
+ Unit *head;
+ void *key;
+
+ assert(u);
+
+ key = UINT32_TO_PTR(u->cgroup_netclass_id);
+
+ LIST_FIND_HEAD(cgroup_netclass, u, head);
+ LIST_REMOVE(cgroup_netclass, head, u);
+
+ if (head)
+ return hashmap_replace(u->manager->cgroup_netclass_registry, key, head);
+
+ hashmap_remove(u->manager->cgroup_netclass_registry, key);
+
+ return 0;
+}
+
/* Check if necessary controllers and attributes for a unit are in place.
*
* If so, do nothing.
@@ -898,7 +1038,7 @@ static int unit_realize_cgroup_now(Unit *u, ManagerState state) {
return r;
/* Finally, apply the necessary attributes. */
- cgroup_context_apply(unit_get_cgroup_context(u), target_mask, u->cgroup_path, state);
+ cgroup_context_apply(unit_get_cgroup_context(u), target_mask, u->cgroup_path, u->cgroup_netclass_id, state);
return 0;
}
@@ -1239,7 +1379,7 @@ int manager_setup_cgroup(Manager *m) {
* it. This is to support live upgrades from older systemd
* versions where PID 1 was moved there. Also see
* cg_get_root_path(). */
- if (!e) {
+ if (!e && m->running_as == MANAGER_SYSTEM) {
e = endswith(m->cgroup_root, "/" SPECIAL_SYSTEM_SLICE);
if (!e)
e = endswith(m->cgroup_root, "/system"); /* even more legacy */
@@ -1277,6 +1417,7 @@ int manager_setup_cgroup(Manager *m) {
/* In the unified hierarchy we can can get
* cgroup empty notifications via inotify. */
+
/// elogind does not support the unified hierarchy, yet.
#if 0
m->cgroup_inotify_event_source = sd_event_source_unref(m->cgroup_inotify_event_source);
@@ -1300,6 +1441,7 @@ int manager_setup_cgroup(Manager *m) {
return log_error_errno(EOPNOTSUPP, "Unified cgroup hierarchy not supported: %m");
#endif // 0
} else if (m->running_as == MANAGER_SYSTEM) {
+
/* On the legacy hierarchy we only get
* notifications via cgroup agents. (Which
* isn't really reliable, since it does not
@@ -1492,6 +1634,28 @@ int unit_get_memory_current(Unit *u, uint64_t *ret) {
return safe_atou64(v, ret);
}
+int unit_get_tasks_current(Unit *u, uint64_t *ret) {
+ _cleanup_free_ char *v = NULL;
+ int r;
+
+ assert(u);
+ assert(ret);
+
+ if (!u->cgroup_path)
+ return -ENODATA;
+
+ if ((u->cgroup_realized_mask & CGROUP_MASK_PIDS) == 0)
+ return -ENODATA;
+
+ r = cg_get_attribute("pids", u->cgroup_path, "pids.current", &v);
+ if (r == -ENOENT)
+ return -ENODATA;
+ if (r < 0)
+ return r;
+
+ return safe_atou64(v, ret);
+}
+
static int unit_get_cpu_usage_raw(Unit *u, nsec_t *ret) {
_cleanup_free_ char *v = NULL;
uint64_t ns;
@@ -1565,6 +1729,32 @@ bool unit_cgroup_delegate(Unit *u) {
return c->delegate;
}
+void unit_invalidate_cgroup(Unit *u, CGroupMask m) {
+ assert(u);
+
+ if (!UNIT_HAS_CGROUP_CONTEXT(u))
+ return;
+
+ if (m == 0)
+ return;
+
+ if ((u->cgroup_realized_mask & m) == 0)
+ return;
+
+ u->cgroup_realized_mask &= ~m;
+ unit_add_to_cgroup_queue(u);
+}
+
+void manager_invalidate_startup_units(Manager *m) {
+ Iterator i;
+ Unit *u;
+
+ assert(m);
+
+ SET_FOREACH(u, m->startup_units, i)
+ unit_invalidate_cgroup(u, CGROUP_MASK_CPU|CGROUP_MASK_BLKIO);
+}
+
static const char* const cgroup_device_policy_table[_CGROUP_DEVICE_POLICY_MAX] = {
[CGROUP_AUTO] = "auto",
[CGROUP_CLOSED] = "closed",
diff --git a/src/core/cgroup.h b/src/core/cgroup.h
index be882a0b6..29782c58c 100644
--- a/src/core/cgroup.h
+++ b/src/core/cgroup.h
@@ -32,6 +32,16 @@
// UNNEEDED typedef struct CGroupBlockIODeviceWeight CGroupBlockIODeviceWeight;
// UNNEEDED typedef struct CGroupBlockIODeviceBandwidth CGroupBlockIODeviceBandwidth;
+/* Maximum value for fixed (manual) net class ID assignment,
+ * and also the value at which the range of automatic assignments starts
+ */
+// UNNEEDED #define CGROUP_NETCLASS_FIXED_MAX UINT32_C(65535)
+
+// UNNEEDED typedef struct CGroupContext CGroupContext;
+// UNNEEDED typedef struct CGroupDeviceAllow CGroupDeviceAllow;
+// UNNEEDED typedef struct CGroupBlockIODeviceWeight CGroupBlockIODeviceWeight;
+// UNNEEDED typedef struct CGroupBlockIODeviceBandwidth CGroupBlockIODeviceBandwidth;
+
/// UNNEEDED by elogind
#if 0
typedef enum CGroupDevicePolicy {
@@ -50,6 +60,17 @@ typedef enum CGroupDevicePolicy {
_CGROUP_DEVICE_POLICY_INVALID = -1
} CGroupDevicePolicy;
+typedef enum CGroupNetClassType {
+ /* Default - do not assign a net class */
+ CGROUP_NETCLASS_TYPE_NONE,
+
+ /* Automatically assign a net class */
+ CGROUP_NETCLASS_TYPE_AUTO,
+
+ /* Assign the net class that was provided by the user */
+ CGROUP_NETCLASS_TYPE_FIXED,
+} CGroupNetClassType;
+
struct CGroupDeviceAllow {
LIST_FIELDS(CGroupDeviceAllow, device_allow);
char *path;
@@ -61,7 +82,7 @@ struct CGroupDeviceAllow {
struct CGroupBlockIODeviceWeight {
LIST_FIELDS(CGroupBlockIODeviceWeight, device_weights);
char *path;
- unsigned long weight;
+ uint64_t weight;
};
struct CGroupBlockIODeviceBandwidth {
@@ -76,12 +97,12 @@ struct CGroupContext {
bool blockio_accounting;
bool memory_accounting;
- unsigned long cpu_shares;
- unsigned long startup_cpu_shares;
+ uint64_t cpu_shares;
+ uint64_t startup_cpu_shares;
usec_t cpu_quota_per_sec_usec;
- unsigned long blockio_weight;
- unsigned long startup_blockio_weight;
+ uint64_t blockio_weight;
+ uint64_t startup_blockio_weight;
LIST_HEAD(CGroupBlockIODeviceWeight, blockio_device_weights);
LIST_HEAD(CGroupBlockIODeviceBandwidth, blockio_device_bandwidths);
@@ -90,6 +111,11 @@ struct CGroupContext {
CGroupDevicePolicy device_policy;
LIST_HEAD(CGroupDeviceAllow, device_allow);
+ CGroupNetClassType netclass_type;
+ uint32_t netclass_id;
+
+ uint64_t tasks_max;
+
bool delegate;
};
#endif // 0
@@ -128,6 +154,9 @@ struct CGroupContext {
// UNNEEDED int unit_attach_pids_to_cgroup(Unit *u);
+// UNNEEDED int unit_add_to_netclass_cgroup(Unit *u);
+// UNNEEDED int unit_remove_from_netclass_cgroup(Unit *u);
+
int manager_setup_cgroup(Manager *m);
void manager_shutdown_cgroup(Manager *m, bool delete);
@@ -141,6 +170,7 @@ void manager_shutdown_cgroup(Manager *m, bool delete);
// UNNEEDED int unit_watch_all_pids(Unit *u);
// UNNEEDED int unit_get_memory_current(Unit *u, uint64_t *ret);
+// UNNEEDED int unit_get_tasks_current(Unit *u, uint64_t *ret);
// UNNEEDED int unit_get_cpu_usage(Unit *u, nsec_t *ret);
// UNNEEDED int unit_reset_cpu_usage(Unit *u);
@@ -149,5 +179,9 @@ void manager_shutdown_cgroup(Manager *m, bool delete);
// UNNEEDED int unit_notify_cgroup_empty(Unit *u);
// UNNEEDED int manager_notify_cgroup_empty(Manager *m, const char *group);
+// UNNEEDED void unit_invalidate_cgroup(Unit *u, CGroupMask m);
+
+// UNNEEDED void manager_invalidate_startup_units(Manager *m);
+
// UNNEEDED const char* cgroup_device_policy_to_string(CGroupDevicePolicy i) _const_;
// UNNEEDED CGroupDevicePolicy cgroup_device_policy_from_string(const char *s) _pure_;
diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c
index ed95cbbc2..9dfa77823 100644
--- a/src/core/mount-setup.c
+++ b/src/core/mount-setup.c
@@ -181,7 +181,7 @@ static int mount_one(const MountPoint *p, bool relabel) {
return 0;
/* Skip securityfs in a container */
- if (!(p->mode & MNT_IN_CONTAINER) && detect_container(NULL) > 0)
+ if (!(p->mode & MNT_IN_CONTAINER) && detect_container() > 0)
return 0;
/* The access mode here doesn't really matter too much, since
@@ -227,7 +227,7 @@ int mount_setup_early(void) {
int j;
j = mount_one(mount_table + i, false);
- if (r == 0)
+ if (j != 0 && r >= 0)
r = j;
}
@@ -322,6 +322,11 @@ int mount_cgroup_controllers(char ***join_controllers) {
r = symlink(options, t);
if (r < 0 && errno != EEXIST)
return log_error_errno(errno, "Failed to create symlink %s: %m", t);
+#ifdef SMACK_RUN_LABEL
+ r = mac_smack_copy(t, options);
+ if (r < 0 && r != -EOPNOTSUPP)
+ return log_error_errno(r, "Failed to copy smack label from %s to %s: %m", options, t);
+#endif
}
}
}
@@ -366,7 +371,7 @@ int mount_setup(bool loaded_policy) {
int j;
j = mount_one(mount_table + i, loaded_policy);
- if (r == 0)
+ if (j != 0 && r >= 0)
r = j;
}
@@ -407,7 +412,7 @@ int mount_setup(bool loaded_policy) {
* nspawn and the container tools work out of the box. If
* specific setups need other settings they can reset the
* propagation mode to private if needed. */
- if (detect_container(NULL) <= 0)
+ if (detect_container() <= 0)
if (mount(NULL, "/", NULL, MS_REC|MS_SHARED, NULL) < 0)
log_warning_errno(errno, "Failed to set up the root directory for shared mount propagation: %m");
diff --git a/src/libelogind/Makefile b/src/libelogind/Makefile
new file mode 120000
index 000000000..d0b0e8e00
--- /dev/null
+++ b/src/libelogind/Makefile
@@ -0,0 +1 @@
+../Makefile \ No newline at end of file
diff --git a/src/libelogind/libelogind.sym b/src/libelogind/libelogind.sym
index b79d0a3f4..77c69f8fd 100644
--- a/src/libelogind/libelogind.sym
+++ b/src/libelogind/libelogind.sym
@@ -142,16 +142,19 @@ global:
sd_uid_get_display;
} LIBSYSTEMD_211;
-LIBSYSTEMD_214 {
-global:
- sd_pid_notify;
- /* sd_pid_notifyf; */
-} LIBSYSTEMD_213;
+/*
+ * These methods are not needed by elogind.
+ * LIBSYSTEMD_214 {
+ * global:
+ * sd_pid_notify;
+ * sd_pid_notifyf;
+ * } LIBSYSTEMD_213;
+ */
LIBSYSTEMD_216 {
global:
sd_machine_get_ifindices;
-} LIBSYSTEMD_214;
+} LIBSYSTEMD_213;
LIBSYSTEMD_217 {
global:
@@ -187,7 +190,7 @@ global:
/* sd_bus_get_address; */
/* sd_bus_set_bus_client; */
/* sd_bus_is_bus_client; */
- sd_bus_set_server;
+ /* sd_bus_set_server; */
/* sd_bus_is_server; */
/* sd_bus_set_anonymous; */
/* sd_bus_is_anonymous; */
@@ -197,7 +200,7 @@ global:
/* sd_bus_is_monitor; */
/* sd_bus_set_description; */
/* sd_bus_get_description; */
- sd_bus_negotiate_creds;
+ /* sd_bus_negotiate_creds; */
/* sd_bus_negotiate_timestamp; */
/* sd_bus_negotiate_fds; */
sd_bus_can_send;
@@ -206,7 +209,7 @@ global:
/* sd_bus_get_allow_interactive_authorization; */
sd_bus_start;
sd_bus_close;
- sd_bus_try_close;
+ /* sd_bus_try_close; */
sd_bus_ref;
sd_bus_unref;
/* sd_bus_is_open; */
@@ -215,10 +218,10 @@ global:
/* sd_bus_get_tid; */
sd_bus_get_owner_creds;
sd_bus_send;
- sd_bus_send_to;
+ /* sd_bus_send_to; */
sd_bus_call;
sd_bus_call_async;
- sd_bus_get_fd;
+ /* sd_bus_get_fd; */
sd_bus_get_events;
sd_bus_get_timeout;
sd_bus_process;
@@ -232,7 +235,7 @@ global:
sd_bus_attach_event;
sd_bus_detach_event;
sd_bus_get_event;
- sd_bus_add_filter;
+ /* sd_bus_add_filter; */
sd_bus_add_match;
sd_bus_add_object;
sd_bus_add_fallback;
@@ -285,17 +288,17 @@ global:
/* sd_bus_message_is_empty; */
/* sd_bus_message_has_signature; */
/* sd_bus_message_set_expect_reply; */
- sd_bus_message_set_auto_start;
+ /* sd_bus_message_set_auto_start; */
/* sd_bus_message_set_allow_interactive_authorization; */
sd_bus_message_set_destination;
/* sd_bus_message_set_priority; */
sd_bus_message_append;
sd_bus_message_append_basic;
- sd_bus_message_append_array;
- sd_bus_message_append_array_space;
+ /* sd_bus_message_append_array; */
+ /* sd_bus_message_append_array_space; */
/* sd_bus_message_append_array_iovec; */
/* sd_bus_message_append_array_memfd; */
- sd_bus_message_append_string_space;
+ /* sd_bus_message_append_string_space; */
/* sd_bus_message_append_string_iovec; */
/* sd_bus_message_append_string_memfd; */
sd_bus_message_append_strv;
@@ -416,8 +419,8 @@ global:
sd_event_add_io;
sd_event_add_time;
sd_event_add_signal;
- sd_event_add_child;
- sd_event_add_defer;
+ /* sd_event_add_child; */
+ /* sd_event_add_defer; */
sd_event_add_post;
sd_event_add_exit;
sd_event_prepare;
@@ -429,8 +432,8 @@ global:
/* sd_event_now; */
/* sd_event_get_fd; */
sd_event_get_state;
- sd_event_get_tid;
- sd_event_get_exit_code;
+ /* sd_event_get_tid; */
+ /* sd_event_get_exit_code; */
sd_event_set_watchdog;
/* sd_event_get_watchdog; */
/* sd_event_source_ref; */
@@ -473,3 +476,14 @@ global:
sd_pid_get_cgroup;
sd_peer_get_cgroup;
} LIBSYSTEMD_222;
+
+/*
+ * These methods are not needed by elogind.
+ * LIBSYSTEMD_227 {
+ * global:
+ * sd_bus_default_flush_close;
+ * sd_bus_path_decode_many;
+ * sd_bus_path_encode_many;
+ * sd_listen_fds_with_names;
+ * } LIBSYSTEMD_226;
+*/
diff --git a/src/libelogind/sd-bus/Makefile b/src/libelogind/sd-bus/Makefile
new file mode 120000
index 000000000..94aaae2c4
--- /dev/null
+++ b/src/libelogind/sd-bus/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/src/libelogind/sd-bus/bus-container.c b/src/libelogind/sd-bus/bus-container.c
index 5c607f49b..435ec92d6 100644
--- a/src/libelogind/sd-bus/bus-container.c
+++ b/src/libelogind/sd-bus/bus-container.c
@@ -217,15 +217,8 @@ int bus_container_connect_kernel(sd_bus *b) {
_exit(EXIT_FAILURE);
}
- cmsg = CMSG_FIRSTHDR(&mh);
- cmsg->cmsg_level = SOL_SOCKET;
- cmsg->cmsg_type = SCM_RIGHTS;
- cmsg->cmsg_len = CMSG_LEN(sizeof(int));
- memcpy(CMSG_DATA(cmsg), &fd, sizeof(int));
-
- mh.msg_controllen = cmsg->cmsg_len;
-
- if (sendmsg(pair[1], &mh, MSG_NOSIGNAL) < 0)
+ r = send_one_fd(pair[1], fd, 0);
+ if (r < 0)
_exit(EXIT_FAILURE);
_exit(EXIT_SUCCESS);
diff --git a/src/libelogind/sd-bus/bus-creds.c b/src/libelogind/sd-bus/bus-creds.c
index 4fccae503..ed82df253 100644
--- a/src/libelogind/sd-bus/bus-creds.c
+++ b/src/libelogind/sd-bus/bus-creds.c
@@ -109,8 +109,7 @@ _public_ sd_bus_creds *sd_bus_creds_unref(sd_bus_creds *c) {
c->supplementary_gids = mfree(c->supplementary_gids);
- strv_free(c->well_known_names);
- c->well_known_names = NULL;
+ c->well_known_names = strv_free(c->well_known_names);
bus_creds_done(c);
@@ -1047,9 +1046,8 @@ int bus_creds_add_more(sd_bus_creds *c, uint64_t mask, pid_t pid, pid_t tid) {
if (r != -EPERM && r != -EACCES)
return r;
} else {
- if (c->cmdline_size == 0) {
+ if (c->cmdline_size == 0)
c->cmdline = mfree(c->cmdline);
- }
c->mask |= SD_BUS_CREDS_CMDLINE;
}
diff --git a/src/libelogind/sd-bus/bus-internal.h b/src/libelogind/sd-bus/bus-internal.h
index e0d7c9ee7..b4ec380cd 100644
--- a/src/libelogind/sd-bus/bus-internal.h
+++ b/src/libelogind/sd-bus/bus-internal.h
@@ -396,6 +396,6 @@ int bus_maybe_reply_error(sd_bus_message *m, int r, sd_bus_error *error);
#define bus_assert_return(expr, r, error) \
do { \
- if (!assert_log(expr)) \
+ if (!assert_log(expr, #expr)) \
return sd_bus_error_set_errno(error, r); \
} while (false)
diff --git a/src/libelogind/sd-bus/bus-introspect.c b/src/libelogind/sd-bus/bus-introspect.c
index 14f40385b..c3aaa9b6d 100644
--- a/src/libelogind/sd-bus/bus-introspect.c
+++ b/src/libelogind/sd-bus/bus-introspect.c
@@ -204,8 +204,7 @@ int introspect_finish(struct introspect *i, sd_bus *bus, sd_bus_message *m, sd_b
void introspect_free(struct introspect *i) {
assert(i);
- if (i->f)
- fclose(i->f);
+ safe_fclose(i->f);
free(i->introspection);
zero(*i);
diff --git a/src/libelogind/sd-bus/bus-message.c b/src/libelogind/sd-bus/bus-message.c
index 36b8ebea0..7b1216989 100644
--- a/src/libelogind/sd-bus/bus-message.c
+++ b/src/libelogind/sd-bus/bus-message.c
@@ -1148,7 +1148,6 @@ _public_ int sd_bus_message_set_expect_reply(sd_bus_message *m, int b) {
return 0;
}
-#endif // 0
_public_ int sd_bus_message_set_auto_start(sd_bus_message *m, int b) {
assert_return(m, -EINVAL);
@@ -1162,8 +1161,6 @@ _public_ int sd_bus_message_set_auto_start(sd_bus_message *m, int b) {
return 0;
}
-/// UNNEEDED by elogind
-#if 0
_public_ int sd_bus_message_set_allow_interactive_authorization(sd_bus_message *m, int b) {
assert_return(m, -EINVAL);
assert_return(!m->sealed, -EPERM);
@@ -1670,6 +1667,8 @@ _public_ int sd_bus_message_append_basic(sd_bus_message *m, char type, const voi
return message_append_basic(m, type, p, NULL);
}
+/// UNNEEDED by elogind
+#if 0
_public_ int sd_bus_message_append_string_space(
sd_bus_message *m,
size_t size,
@@ -1727,8 +1726,6 @@ _public_ int sd_bus_message_append_string_space(
return 0;
}
-/// UNNEEDED by elogind
-#if 0
_public_ int sd_bus_message_append_string_iovec(
sd_bus_message *m,
const struct iovec *iov,
@@ -2587,6 +2584,8 @@ _public_ int sd_bus_message_append(sd_bus_message *m, const char *types, ...) {
return r;
}
+/// UNNEEDED by elogind
+#if 0
_public_ int sd_bus_message_append_array_space(
sd_bus_message *m,
char type,
@@ -2654,8 +2653,6 @@ _public_ int sd_bus_message_append_array(
return 0;
}
-/// UNNEEDED by elogind
-#if 0
_public_ int sd_bus_message_append_array_iovec(
sd_bus_message *m,
char type,
diff --git a/src/libelogind/sd-bus/bus-objects.c b/src/libelogind/sd-bus/bus-objects.c
index 05a00f217..fdfd005a3 100644
--- a/src/libelogind/sd-bus/bus-objects.c
+++ b/src/libelogind/sd-bus/bus-objects.c
@@ -1578,25 +1578,14 @@ _public_ int sd_bus_add_fallback(
return bus_add_object(bus, slot, true, prefix, callback, userdata);
}
-static unsigned long vtable_member_hash_func(const void *a, const uint8_t hash_key[HASH_KEY_SIZE]) {
+static void vtable_member_hash_func(const void *a, struct siphash *state) {
const struct vtable_member *m = a;
- uint8_t hash_key2[HASH_KEY_SIZE];
- unsigned long ret;
assert(m);
- ret = string_hash_func(m->path, hash_key);
-
- /* Use a slightly different hash key for the interface */
- memcpy(hash_key2, hash_key, HASH_KEY_SIZE);
- hash_key2[0]++;
- ret ^= string_hash_func(m->interface, hash_key2);
-
- /* And an even different one for the member */
- hash_key2[0]++;
- ret ^= string_hash_func(m->member, hash_key2);
-
- return ret;
+ string_hash_func(m->path, state);
+ string_hash_func(m->interface, state);
+ string_hash_func(m->member, state);
}
static int vtable_member_compare_func(const void *a, const void *b) {
diff --git a/src/libelogind/sd-bus/bus-socket.c b/src/libelogind/sd-bus/bus-socket.c
index 735a775cb..d0b1e3d7d 100644
--- a/src/libelogind/sd-bus/bus-socket.c
+++ b/src/libelogind/sd-bus/bus-socket.c
@@ -985,7 +985,7 @@ int bus_socket_read_message(sd_bus *bus) {
return -EIO;
}
- f = realloc(bus->fds, sizeof(int) + (bus->n_fds + n));
+ f = realloc(bus->fds, sizeof(int) * (bus->n_fds + n));
if (!f) {
close_many((int*) CMSG_DATA(cmsg), n);
return -ENOMEM;
diff --git a/src/libelogind/sd-bus/sd-bus.c b/src/libelogind/sd-bus/sd-bus.c
index 6acc9f386..4340a2197 100644
--- a/src/libelogind/sd-bus/sd-bus.c
+++ b/src/libelogind/sd-bus/sd-bus.c
@@ -69,6 +69,10 @@ static int bus_poll(sd_bus *bus, bool need_more, uint64_t timeout_usec);
static int attach_io_events(sd_bus *b);
static void detach_io_events(sd_bus *b);
+static thread_local sd_bus *default_system_bus = NULL;
+// UNNEEDED static thread_local sd_bus *default_user_bus = NULL;
+static thread_local sd_bus *default_starter_bus = NULL;
+
static void bus_close_fds(sd_bus *b) {
assert(b);
@@ -299,7 +303,6 @@ _public_ int sd_bus_negotiate_timestamp(sd_bus *bus, int b) {
return 0;
}
-#endif // 0
_public_ int sd_bus_negotiate_creds(sd_bus *bus, int b, uint64_t mask) {
uint64_t new_flags;
@@ -340,8 +343,6 @@ _public_ int sd_bus_set_server(sd_bus *bus, int b, sd_id128_t server_id) {
return 0;
}
-/// UNNEEDED by elogind
-#if 0
_public_ int sd_bus_set_anonymous(sd_bus *bus, int b) {
assert_return(bus, -EINVAL);
assert_return(bus->state == BUS_UNSET, -EPERM);
@@ -1032,7 +1033,6 @@ static int bus_start_address(sd_bus *b) {
if (b->exec_path)
r = bus_socket_exec(b);
-
else if ((b->nspid > 0 || b->machine) && b->kernel) {
r = bus_container_connect_kernel(b);
if (r < 0 && !IN_SET(r, -ENOENT, -ESOCKTNOSUPPORT))
@@ -1054,7 +1054,6 @@ static int bus_start_address(sd_bus *b) {
r = bus_socket_connect(b);
else
skipped = true;
-
} else
skipped = true;
@@ -1845,6 +1844,8 @@ _public_ int sd_bus_send(sd_bus *bus, sd_bus_message *m, uint64_t *cookie) {
return bus_send_internal(bus, m, cookie, false);
}
+/// UNNEEDED by elogind
+#if 0
_public_ int sd_bus_send_to(sd_bus *bus, sd_bus_message *m, const char *destination, uint64_t *cookie) {
int r;
@@ -1870,6 +1871,7 @@ _public_ int sd_bus_send_to(sd_bus *bus, sd_bus_message *m, const char *destinat
return sd_bus_send(bus, m, cookie);
}
+#endif // 0
static usec_t calc_elapse(uint64_t usec) {
if (usec == (uint64_t) -1)
@@ -2154,6 +2156,8 @@ fail:
return sd_bus_error_set_errno(error, r);
}
+/// UNNEEDED by elogind
+#if 0
_public_ int sd_bus_get_fd(sd_bus *bus) {
assert_return(bus, -EINVAL);
@@ -2162,6 +2166,7 @@ _public_ int sd_bus_get_fd(sd_bus *bus) {
return bus->input_fd;
}
+#endif // 0
_public_ int sd_bus_get_events(sd_bus *bus) {
int flags = 0;
@@ -2959,6 +2964,8 @@ _public_ int sd_bus_flush(sd_bus *bus) {
}
}
+/// UNNEEDED by elogind
+#if 0
_public_ int sd_bus_add_filter(
sd_bus *bus,
sd_bus_slot **slot,
@@ -2985,6 +2992,7 @@ _public_ int sd_bus_add_filter(
return 0;
}
+#endif // 0
_public_ int sd_bus_add_match(
sd_bus *bus,
@@ -3388,16 +3396,13 @@ static int bus_default(int (*bus_open)(sd_bus **), sd_bus **default_bus, sd_bus
}
_public_ int sd_bus_default_system(sd_bus **ret) {
- static thread_local sd_bus *default_system_bus = NULL;
-
return bus_default(sd_bus_open_system, &default_system_bus, ret);
}
+
_public_ int sd_bus_default_user(sd_bus **ret) {
/// elogind does not support user buses
#if 0
- static thread_local sd_bus *default_user_bus = NULL;
-
return bus_default(sd_bus_open_user, &default_user_bus, ret);
#else
return sd_bus_default_system(ret);
@@ -3430,13 +3435,13 @@ _public_ int sd_bus_default(sd_bus **ret) {
e = secure_getenv("DBUS_STARTER_ADDRESS");
if (e) {
- static thread_local sd_bus *default_starter_bus = NULL;
return bus_default(sd_bus_open, &default_starter_bus, ret);
}
/* Finally, if nothing is set use the cached connection for
* the right scope */
+
/// elogind does not support systemd units
#if 0
if (cg_pid_get_owner_uid(0, NULL) >= 0)
@@ -3505,7 +3510,171 @@ _public_ int sd_bus_path_decode(const char *path, const char *prefix, char **ext
*external_id = ret;
return 1;
}
-#endif // 0
+
+_public_ int sd_bus_path_encode_many(char **out, const char *path_template, ...) {
+ _cleanup_strv_free_ char **labels = NULL;
+ char *path, *path_pos, **label_pos;
+ const char *sep, *template_pos;
+ size_t path_length;
+ va_list list;
+ int r;
+
+ assert_return(out, -EINVAL);
+ assert_return(path_template, -EINVAL);
+
+ path_length = strlen(path_template);
+
+ va_start(list, path_template);
+ for (sep = strchr(path_template, '%'); sep; sep = strchr(sep + 1, '%')) {
+ const char *arg;
+ char *label;
+
+ arg = va_arg(list, const char *);
+ if (!arg) {
+ va_end(list);
+ return -EINVAL;
+ }
+
+ label = bus_label_escape(arg);
+ if (!label) {
+ va_end(list);
+ return -ENOMEM;
+ }
+
+ r = strv_consume(&labels, label);
+ if (r < 0) {
+ va_end(list);
+ return r;
+ }
+
+ /* add label length, but account for the format character */
+ path_length += strlen(label) - 1;
+ }
+ va_end(list);
+
+ path = malloc(path_length + 1);
+ if (!path)
+ return -ENOMEM;
+
+ path_pos = path;
+ label_pos = labels;
+
+ for (template_pos = path_template; *template_pos; ) {
+ sep = strchrnul(template_pos, '%');
+ path_pos = mempcpy(path_pos, template_pos, sep - template_pos);
+ if (!*sep)
+ break;
+
+ path_pos = stpcpy(path_pos, *label_pos++);
+ template_pos = sep + 1;
+ }
+
+ *path_pos = 0;
+ *out = path;
+ return 0;
+}
+
+_public_ int sd_bus_path_decode_many(const char *path, const char *path_template, ...) {
+ _cleanup_strv_free_ char **labels = NULL;
+ const char *template_pos, *path_pos;
+ char **label_pos;
+ va_list list;
+ int r;
+
+ /*
+ * This decodes an object-path based on a template argument. The
+ * template consists of a verbatim path, optionally including special
+ * directives:
+ *
+ * - Each occurrence of '%' in the template matches an arbitrary
+ * substring of a label in the given path. At most one such
+ * directive is allowed per label. For each such directive, the
+ * caller must provide an output parameter (char **) via va_arg. If
+ * NULL is passed, the given label is verified, but not returned.
+ * For each matched label, the *decoded* label is stored in the
+ * passed output argument, and the caller is responsible to free
+ * it. Note that the output arguments are only modified if the
+ * actualy path matched the template. Otherwise, they're left
+ * untouched.
+ *
+ * This function returns <0 on error, 0 if the path does not match the
+ * template, 1 if it matched.
+ */
+
+ assert_return(path, -EINVAL);
+ assert_return(path_template, -EINVAL);
+
+ path_pos = path;
+
+ for (template_pos = path_template; *template_pos; ) {
+ const char *sep;
+ size_t length;
+ char *label;
+
+ /* verify everything until the next '%' matches verbatim */
+ sep = strchrnul(template_pos, '%');
+ length = sep - template_pos;
+ if (strncmp(path_pos, template_pos, length))
+ return 0;
+
+ path_pos += length;
+ template_pos += length;
+
+ if (!*template_pos)
+ break;
+
+ /* We found the next '%' character. Everything up until here
+ * matched. We now skip ahead to the end of this label and make
+ * sure it matches the tail of the label in the path. Then we
+ * decode the string in-between and save it for later use. */
+
+ ++template_pos; /* skip over '%' */
+
+ sep = strchrnul(template_pos, '/');
+ length = sep - template_pos; /* length of suffix to match verbatim */
+
+ /* verify the suffixes match */
+ sep = strchrnul(path_pos, '/');
+ if (sep - path_pos < (ssize_t)length ||
+ strncmp(sep - length, template_pos, length))
+ return 0;
+
+ template_pos += length; /* skip over matched label */
+ length = sep - path_pos - length; /* length of sub-label to decode */
+
+ /* store unescaped label for later use */
+ label = bus_label_unescape_n(path_pos, length);
+ if (!label)
+ return -ENOMEM;
+
+ r = strv_consume(&labels, label);
+ if (r < 0)
+ return r;
+
+ path_pos = sep; /* skip decoded label and suffix */
+ }
+
+ /* end of template must match end of path */
+ if (*path_pos)
+ return 0;
+
+ /* copy the labels over to the caller */
+ va_start(list, path_template);
+ for (label_pos = labels; label_pos && *label_pos; ++label_pos) {
+ char **arg;
+
+ arg = va_arg(list, char **);
+ if (arg)
+ *arg = *label_pos;
+ else
+ free(*label_pos);
+ }
+ va_end(list);
+
+ free(labels);
+ labels = NULL;
+ return 1;
+}
_public_ int sd_bus_try_close(sd_bus *bus) {
int r;
@@ -3533,8 +3702,6 @@ _public_ int sd_bus_try_close(sd_bus *bus) {
return 0;
}
-/// UNNEEDED by elogind
-#if 0
_public_ int sd_bus_get_description(sd_bus *bus, const char **description) {
assert_return(bus, -EINVAL);
assert_return(description, -EINVAL);
@@ -3663,4 +3830,21 @@ _public_ int sd_bus_is_monitor(sd_bus *bus) {
return !!(bus->hello_flags & KDBUS_HELLO_MONITOR);
}
+
+static void flush_close(sd_bus *bus) {
+ if (!bus)
+ return;
+
+ /* Flushes and closes the specified bus. We take a ref before,
+ * to ensure the flushing does not cause the bus to be
+ * unreferenced. */
+
+ sd_bus_flush_close_unref(sd_bus_ref(bus));
+}
+
+_public_ void sd_bus_default_flush_close(void) {
+ flush_close(default_starter_bus);
+ flush_close(default_user_bus);
+ flush_close(default_system_bus);
+}
#endif // 0
diff --git a/src/libelogind/sd-daemon/sd-daemon.c b/src/libelogind/sd-daemon/sd-daemon.c
index af3dab7e4..b26ecf26d 100644
--- a/src/libelogind/sd-daemon/sd-daemon.c
+++ b/src/libelogind/sd-daemon/sd-daemon.c
@@ -19,27 +19,39 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <netinet/in.h>
-#include <stdlib.h>
#include <errno.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stddef.h>
#include <limits.h>
//#include <mqueue.h>
+#include <netinet/in.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/un.h>
+#include <unistd.h>
-#include "util.h"
#include "path-util.h"
#include "socket-util.h"
+//#include "strv.h"
+#include "util.h"
+
#include "sd-daemon.h"
/// UNNEEDED by elogind
#if 0
+static void unsetenv_all(bool unset_environment) {
+
+ if (!unset_environment)
+ return;
+
+ unsetenv("LISTEN_PID");
+ unsetenv("LISTEN_FDS");
+ unsetenv("LISTEN_FDNAMES");
+}
+
_public_ int sd_listen_fds(int unset_environment) {
const char *e;
unsigned n;
@@ -81,14 +93,51 @@ _public_ int sd_listen_fds(int unset_environment) {
r = (int) n;
finish:
- if (unset_environment) {
- unsetenv("LISTEN_PID");
- unsetenv("LISTEN_FDS");
+ unsetenv_all(unset_environment);
+ return r;
}
+_public_ int sd_listen_fds_with_names(int unset_environment, char ***names) {
+ _cleanup_strv_free_ char **l = NULL;
+ bool have_names;
+ int n_names = 0, n_fds;
+ const char *e;
+ int r;
+
+ if (!names)
+ return sd_listen_fds(unset_environment);
+
+ e = getenv("LISTEN_FDNAMES");
+ if (e) {
+ n_names = strv_split_extract(&l, e, ":", EXTRACT_DONT_COALESCE_SEPARATORS);
+ if (n_names < 0) {
+ unsetenv_all(unset_environment);
+ return n_names;
+ }
+
+ have_names = true;
+ } else
+ have_names = false;
+
+ n_fds = sd_listen_fds(unset_environment);
+ if (n_fds <= 0)
+ return n_fds;
+
+ if (have_names) {
+ if (n_names != n_fds)
+ return -EINVAL;
+ } else {
+ r = strv_extend_n(&l, "unknown", n_fds);
+ if (r < 0)
return r;
}
+ *names = l;
+ l = NULL;
+
+ return n_fds;
+}
+
_public_ int sd_is_fifo(int fd, const char *path) {
struct stat st_fd;
@@ -315,10 +364,15 @@ _public_ int sd_is_socket_unix(int fd, int type, int listening, const char *path
_public_ int sd_is_mq(int fd, const char *path) {
struct mq_attr attr;
- assert_return(fd >= 0, -EBADF);
+ /* Check that the fd is valid */
+ assert_return(fcntl(fd, F_GETFD) >= 0, -errno);
- if (mq_getattr(fd, &attr) < 0)
+ if (mq_getattr(fd, &attr) < 0) {
+ if (errno == EBADF)
+ /* A non-mq fd (or an invalid one, but we ruled that out above) */
+ return 0;
return -errno;
+ }
if (path) {
char fpath[PATH_MAX];
@@ -401,8 +455,9 @@ _public_ int sd_pid_notify_with_fds(pid_t pid, int unset_environment, const char
have_pid = pid != 0 && pid != getpid();
if (n_fds > 0 || have_pid) {
- msghdr.msg_controllen = CMSG_SPACE(sizeof(int) * n_fds) +
- CMSG_SPACE(sizeof(struct ucred) * have_pid);
+ /* CMSG_SPACE(0) may return value different then zero, which results in miscalculated controllen. */
+ msghdr.msg_controllen = (n_fds ? CMSG_SPACE(sizeof(int) * n_fds) : 0) +
+ CMSG_SPACE(sizeof(struct ucred)) * have_pid;
msghdr.msg_control = alloca(msghdr.msg_controllen);
cmsg = CMSG_FIRSTHDR(&msghdr);
@@ -458,9 +513,12 @@ finish:
return r;
}
+/// UNNEEDED by elogind
+#if 0
_public_ int sd_pid_notify(pid_t pid, int unset_environment, const char *state) {
return sd_pid_notify_with_fds(pid, unset_environment, state, NULL, 0);
}
+#endif // 0
_public_ int sd_notify(int unset_environment, const char *state) {
return sd_pid_notify_with_fds(0, unset_environment, state, NULL, 0);
@@ -505,16 +563,11 @@ _public_ int sd_notifyf(int unset_environment, const char *format, ...) {
}
_public_ int sd_booted(void) {
- struct stat st;
-
/* We test whether the runtime unit file directory has been
* created. This takes place in mount-setup.c, so is
* guaranteed to happen very early during boot. */
- if (lstat("/run/systemd/system/", &st) < 0)
- return 0;
-
- return !!S_ISDIR(st.st_mode);
+ return laccess("/run/systemd/system/", F_OK) >= 0;
}
#endif // 0
diff --git a/src/libelogind/sd-event/Makefile b/src/libelogind/sd-event/Makefile
new file mode 120000
index 000000000..94aaae2c4
--- /dev/null
+++ b/src/libelogind/sd-event/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/src/libelogind/sd-event/sd-event.c b/src/libelogind/sd-event/sd-event.c
index 062f19b56..f6d0d1054 100644
--- a/src/libelogind/sd-event/sd-event.c
+++ b/src/libelogind/sd-event/sd-event.c
@@ -242,12 +242,6 @@ static int pending_prioq_compare(const void *a, const void *b) {
if (x->pending_iteration > y->pending_iteration)
return 1;
- /* Stability for the rest */
- if (x < y)
- return -1;
- if (x > y)
- return 1;
-
return 0;
}
@@ -257,6 +251,12 @@ static int prepare_prioq_compare(const void *a, const void *b) {
assert(x->prepare);
assert(y->prepare);
+ /* Enabled ones first */
+ if (x->enabled != SD_EVENT_OFF && y->enabled == SD_EVENT_OFF)
+ return -1;
+ if (x->enabled == SD_EVENT_OFF && y->enabled != SD_EVENT_OFF)
+ return 1;
+
/* Move most recently prepared ones last, so that we can stop
* preparing as soon as we hit one that has already been
* prepared in the current iteration */
@@ -265,24 +265,12 @@ static int prepare_prioq_compare(const void *a, const void *b) {
if (x->prepare_iteration > y->prepare_iteration)
return 1;
- /* Enabled ones first */
- if (x->enabled != SD_EVENT_OFF && y->enabled == SD_EVENT_OFF)
- return -1;
- if (x->enabled == SD_EVENT_OFF && y->enabled != SD_EVENT_OFF)
- return 1;
-
/* Lower priority values first */
if (x->priority < y->priority)
return -1;
if (x->priority > y->priority)
return 1;
- /* Stability for the rest */
- if (x < y)
- return -1;
- if (x > y)
- return 1;
-
return 0;
}
@@ -310,12 +298,6 @@ static int earliest_time_prioq_compare(const void *a, const void *b) {
if (x->time.next > y->time.next)
return 1;
- /* Stability for the rest */
- if (x < y)
- return -1;
- if (x > y)
- return 1;
-
return 0;
}
@@ -343,12 +325,6 @@ static int latest_time_prioq_compare(const void *a, const void *b) {
if (x->time.next + x->time.accuracy > y->time.next + y->time.accuracy)
return 1;
- /* Stability for the rest */
- if (x < y)
- return -1;
- if (x > y)
- return 1;
-
return 0;
}
@@ -370,12 +346,6 @@ static int exit_prioq_compare(const void *a, const void *b) {
if (x->priority > y->priority)
return 1;
- /* Stability for the rest */
- if (x < y)
- return -1;
- if (x > y)
- return 1;
-
return 0;
}
@@ -1195,6 +1165,8 @@ _public_ int sd_event_add_signal(
return 0;
}
+/// UNNEEDED by elogind
+#if 0
_public_ int sd_event_add_child(
sd_event *e,
sd_event_source **ret,
@@ -1287,6 +1259,7 @@ _public_ int sd_event_add_defer(
return 0;
}
+#endif // 0
_public_ int sd_event_add_post(
sd_event *e,
@@ -2729,6 +2702,8 @@ _public_ int sd_event_get_state(sd_event *e) {
return e->state;
}
+/// UNNEEDED by elogind
+#if 0
_public_ int sd_event_get_exit_code(sd_event *e, int *code) {
assert_return(e, -EINVAL);
assert_return(code, -EINVAL);
@@ -2740,6 +2715,7 @@ _public_ int sd_event_get_exit_code(sd_event *e, int *code) {
*code = e->exit_code;
return 0;
}
+#endif // 0
_public_ int sd_event_exit(sd_event *e, int code) {
assert_return(e, -EINVAL);
@@ -2813,6 +2789,8 @@ _public_ int sd_event_default(sd_event **ret) {
return 1;
}
+/// UNNEEDED by elogind
+#if 0
_public_ int sd_event_get_tid(sd_event *e, pid_t *tid) {
assert_return(e, -EINVAL);
assert_return(tid, -EINVAL);
@@ -2825,6 +2803,7 @@ _public_ int sd_event_get_tid(sd_event *e, pid_t *tid) {
return -ENXIO;
}
+#endif // 0
_public_ int sd_event_set_watchdog(sd_event *e, int b) {
int r;
diff --git a/src/libelogind/sd-id128/sd-id128.c b/src/libelogind/sd-id128/sd-id128.c
index 46f2181ea..eb539ad31 100644
--- a/src/libelogind/sd-id128/sd-id128.c
+++ b/src/libelogind/sd-id128/sd-id128.c
@@ -28,7 +28,7 @@
#include "sd-id128.h"
#include "random-util.h"
-_public_ char *sd_id128_to_string(sd_id128_t id, char s[33]) {
+_public_ char *sd_id128_to_string(sd_id128_t id, char s[SD_ID128_STRING_MAX]) {
unsigned n;
assert_return(s, NULL);
diff --git a/src/libelogind/sd-login/sd-login.c b/src/libelogind/sd-login/sd-login.c
index 03d9cdbcb..6c81c18d4 100644
--- a/src/libelogind/sd-login/sd-login.c
+++ b/src/libelogind/sd-login/sd-login.c
@@ -381,7 +381,7 @@ static int file_of_seat(const char *seat, char **_p) {
if (!filename_is_valid(seat))
return -EINVAL;
- p = strappend("/run/systemd/seats/", seat);
+ p = strappend("/run/systemd/seats/", seat);
} else {
_cleanup_free_ char *buf = NULL;
@@ -445,10 +445,10 @@ static int uid_get_array(uid_t uid, const char *variable, char ***array) {
r = parse_env_file(p, NEWLINE, variable, &s, NULL);
if (r == -ENOENT || (r >= 0 && isempty(s))) {
- if (array)
- *array = NULL;
- return 0;
- }
+ if (array)
+ *array = NULL;
+ return 0;
+ }
if (r < 0)
return r;
diff --git a/src/login/.gitignore b/src/login/.gitignore
index 5c0b2ac68..bc9ac41a2 100644
--- a/src/login/.gitignore
+++ b/src/login/.gitignore
@@ -2,3 +2,4 @@
/org.freedesktop.login1.policy
/71-seat.rules
/73-seat-late.rules
+/elogind-user
diff --git a/src/login/70-power-switch.rules b/src/login/70-power-switch.rules
index 36d2a3eb4..e2855b50f 100644
--- a/src/login/70-power-switch.rules
+++ b/src/login/70-power-switch.rules
@@ -13,6 +13,6 @@ SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="twl4030_pwrbutton", TAG+="po
SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="tps65217_pwr_but", TAG+="power-switch"
SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="* WMI hotkeys", TAG+="power-switch"
SUBSYSTEM=="input", KERNEL=="event*", \
- SUBSYSTEMS=="platform", DRIVERS=="gpio-keys", ATTRS{keys}=="116", TAG+="power-switch"
+ SUBSYSTEMS=="platform", DRIVERS=="gpio-keys", ATTRS{keys}=="*,116|116,*|116|*,116,*", TAG+="power-switch"
LABEL="power_switch_end"
diff --git a/src/login/elogind-user b/src/login/elogind-user.m4
index 8112d7464..7933508f2 100644
--- a/src/login/elogind-user
+++ b/src/login/elogind-user.m4
@@ -3,4 +3,9 @@
# Used by systemd --user instances.
account include system-auth
+
+m4_ifdef(`HAVE_SELINUX',
+session required pam_selinux.so close
+session required pam_selinux.so nottys open
+)m4_dnl
session include system-auth
diff --git a/src/login/inhibit.c b/src/login/inhibit.c
index 89e529d01..bfee1ca06 100644
--- a/src/login/inhibit.c
+++ b/src/login/inhibit.c
@@ -179,9 +179,7 @@ static int parse_argv(int argc, char *argv[]) {
return 0;
case ARG_VERSION:
- puts(PACKAGE_STRING);
- puts(SYSTEMD_FEATURES);
- return 0;
+ return version();
case ARG_WHAT:
arg_what = optarg;
diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index babfa349c..ce0adc45c 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -37,8 +37,8 @@
#include "strv.h"
#include "unit-name.h"
#include "sysfs-show.h"
-// #include "logs-show.h"
-#include "cgroup-show.h"
+//#include "logs-show.h"
+//#include "cgroup-show.h"
#include "cgroup-util.h"
#include "spawn-polkit-agent.h"
#include "verbs.h"
@@ -712,19 +712,165 @@ static int print_seat_status_info(sd_bus *bus, const char *path, bool *new_line)
return 0;
}
+static int print_property(const char *name, sd_bus_message *m, const char *contents) {
+ int r;
+
+ assert(name);
+ assert(m);
+ assert(contents);
+
+ if (arg_property && !strv_find(arg_property, name))
+ /* skip what we didn't read */
+ return sd_bus_message_skip(m, contents);
+
+ switch (contents[0]) {
+
+ case SD_BUS_TYPE_STRUCT_BEGIN:
+
+ if (contents[1] == SD_BUS_TYPE_STRING && STR_IN_SET(name, "Display", "Seat", "ActiveSession")) {
+ const char *s;
+
+ r = sd_bus_message_read(m, "(so)", &s, NULL);
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ if (arg_all || !isempty(s))
+ printf("%s=%s\n", name, s);
+
+ return 0;
+
+ } else if (contents[1] == SD_BUS_TYPE_UINT32 && streq(name, "User")) {
+ uint32_t uid;
+
+ r = sd_bus_message_read(m, "(uo)", &uid, NULL);
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ if (!uid_is_valid(uid)) {
+ log_error("Invalid user ID: " UID_FMT, uid);
+ return -EINVAL;
+ }
+
+ printf("%s=" UID_FMT "\n", name, uid);
+
+ return 0;
+ }
+
+ break;
+
+ case SD_BUS_TYPE_ARRAY:
+
+ if (contents[1] == SD_BUS_TYPE_STRUCT_BEGIN && streq(name, "Sessions")) {
+ const char *s;
+ bool space = false;
+
+ r = sd_bus_message_enter_container(m, SD_BUS_TYPE_ARRAY, "(so)");
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ printf("%s=", name);
+
+ while ((r = sd_bus_message_read(m, "(so)", &s, NULL)) > 0) {
+ printf("%s%s", space ? " " : "", s);
+ space = true;
+ }
+
+ printf("\n");
+
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ r = sd_bus_message_exit_container(m);
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ return 0;
+ }
+
+ break;
+ }
+
+ r = bus_print_property(name, m, arg_all);
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ if (r == 0) {
+ r = sd_bus_message_skip(m, contents);
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ if (arg_all)
+ printf("%s=[unprintable]\n", name);
+ }
+
+ return 0;
+}
+
static int show_properties(sd_bus *bus, const char *path, bool *new_line) {
+ _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
+ _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
int r;
+ assert(bus);
+ assert(path);
+ assert(new_line);
+
+ r = sd_bus_call_method(
+ bus,
+ "org.freedesktop.login1",
+ path,
+ "org.freedesktop.DBus.Properties",
+ "GetAll",
+ &error,
+ &reply,
+ "s", "");
+ if (r < 0)
+ return log_error_errno(r, "Failed to get properties: %s", bus_error_message(&error, r));
+
+ r = sd_bus_message_enter_container(reply, SD_BUS_TYPE_ARRAY, "{sv}");
+ if (r < 0)
+ return bus_log_parse_error(r);
+
if (*new_line)
printf("\n");
*new_line = true;
- r = bus_print_all_properties(bus, "org.freedesktop.login1", path, arg_property, arg_all);
+ while ((r = sd_bus_message_enter_container(reply, SD_BUS_TYPE_DICT_ENTRY, "sv")) > 0) {
+ const char *name, *contents;
+
+ r = sd_bus_message_read(reply, "s", &name);
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ r = sd_bus_message_peek_type(reply, NULL, &contents);
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ r = sd_bus_message_enter_container(reply, SD_BUS_TYPE_VARIANT, contents);
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ r = print_property(name, reply, contents);
+ if (r < 0)
+ return r;
+
+ r = sd_bus_message_exit_container(reply);
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ r = sd_bus_message_exit_container(reply);
+ if (r < 0)
+ return bus_log_parse_error(r);
+ }
if (r < 0)
- log_error_errno(r, "Could not get properties: %m");
+ return bus_log_parse_error(r);
- return r;
+ r = sd_bus_message_exit_container(reply);
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ return 0;
}
static int show_session(int argc, char *argv[], void *userdata) {
@@ -1557,9 +1703,7 @@ static int parse_argv(int argc, char *argv[]) {
return 0;
case ARG_VERSION:
- puts(PACKAGE_STRING);
- puts(SYSTEMD_FEATURES);
- return 0;
+ return version();
case 'p': {
r = strv_extend(&arg_property, optarg);
@@ -1700,7 +1844,7 @@ int main(int argc, char *argv[]) {
if (r <= 0)
goto finish;
- r = bus_open_transport(arg_transport, arg_host, false, &bus);
+ r = bus_connect_transport(arg_transport, arg_host, false, &bus);
if (r < 0) {
log_error_errno(r, "Failed to create bus connection: %m");
goto finish;
diff --git a/src/login/logind-action.c b/src/login/logind-action.c
index 5406cd45b..9b2ec6e24 100644
--- a/src/login/logind-action.c
+++ b/src/login/logind-action.c
@@ -154,7 +154,6 @@ int manager_handle_action(
offending->uid, strna(u),
offending->pid, strna(comm));
- warn_melody();
return -EPERM;
}
diff --git a/src/login/logind-action.h b/src/login/logind-action.h
index 99b06bff8..6b63b92d3 100644
--- a/src/login/logind-action.h
+++ b/src/login/logind-action.h
@@ -22,7 +22,7 @@
***/
typedef enum HandleAction {
- HANDLE_IGNORE,
+ HANDLE_IGNORE = 0,
HANDLE_POWEROFF,
HANDLE_REBOOT,
HANDLE_HALT,
diff --git a/src/login/logind-button.c b/src/login/logind-button.c
index 210b889c4..f40e35a8c 100644
--- a/src/login/logind-button.c
+++ b/src/login/logind-button.c
@@ -66,12 +66,11 @@ void button_free(Button *b) {
sd_event_source_unref(b->io_event_source);
sd_event_source_unref(b->check_event_source);
- if (b->fd >= 0) {
+ if (b->fd >= 0)
/* If the device has been unplugged close() returns
* ENODEV, let's ignore this, hence we don't use
* safe_close() */
(void) close(b->fd);
- }
free(b->name);
free(b->seat);
@@ -239,10 +238,7 @@ int button_open(Button *b) {
assert(b);
- if (b->fd >= 0) {
- close(b->fd);
- b->fd = -1;
- }
+ b->fd = safe_close(b->fd);
p = strjoina("/dev/input/", b->name);
@@ -251,8 +247,7 @@ int button_open(Button *b) {
return log_warning_errno(errno, "Failed to open %s: %m", b->name);
if (ioctl(b->fd, EVIOCGNAME(sizeof(name)), name) < 0) {
- log_error_errno(errno, "Failed to get input name: %m");
- r = -errno;
+ r = log_error_errno(errno, "Failed to get input name: %m");
goto fail;
}
@@ -267,8 +262,7 @@ int button_open(Button *b) {
return 0;
fail:
- close(b->fd);
- b->fd = -1;
+ b->fd = safe_close(b->fd);
return r;
}
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index e59795eed..0c1f90dea 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -1528,7 +1528,7 @@ int manager_dispatch_delayed(Manager *manager, bool timeout) {
assert(manager);
- if (manager->action_what == 0)
+ if ( (0 == manager->action_what) || (HANDLE_IGNORE == manager->pending_action) )
return 0;
if (manager_is_inhibited(manager, manager->action_what, INHIBIT_DELAY, NULL, false, false, 0, &offending)) {
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 016886805..ca1ea5868 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -530,7 +530,7 @@ static int session_start_scope(Session *s) {
if (!scope)
return log_oom();
- r = manager_start_scope(s->manager, scope, s->leader, s->user->slice, description, "logind.service", "systemd-user-sessions.service", &error, &job);
+ r = manager_start_scope(s->manager, scope, s->leader, s->user->slice, description, "systemd-logind.service", "systemd-user-sessions.service", &error, &job);
if (r < 0) {
log_error("Failed to start session scope %s: %s %s",
scope, bus_error_message(&error, r), error.name);
@@ -538,6 +538,7 @@ static int session_start_scope(Session *s) {
return r;
} else {
s->scope = scope;
+
free(s->scope_job);
s->scope_job = job;
}
@@ -1109,22 +1110,25 @@ int session_prepare_vt(Session *s) {
r = fchown(vt, s->user->uid, -1);
if (r < 0) {
- r = -errno;
- log_error_errno(errno, "Cannot change owner of /dev/tty%u: %m", s->vtnr);
+ r = log_error_errno(errno,
+ "Cannot change owner of /dev/tty%u: %m",
+ s->vtnr);
goto error;
}
r = ioctl(vt, KDSKBMODE, K_OFF);
if (r < 0) {
- r = -errno;
- log_error_errno(errno, "Cannot set K_OFF on /dev/tty%u: %m", s->vtnr);
+ r = log_error_errno(errno,
+ "Cannot set K_OFF on /dev/tty%u: %m",
+ s->vtnr);
goto error;
}
r = ioctl(vt, KDSETMODE, KD_GRAPHICS);
if (r < 0) {
- r = -errno;
- log_error_errno(errno, "Cannot set KD_GRAPHICS on /dev/tty%u: %m", s->vtnr);
+ r = log_error_errno(errno,
+ "Cannot set KD_GRAPHICS on /dev/tty%u: %m",
+ s->vtnr);
goto error;
}
@@ -1136,8 +1140,9 @@ int session_prepare_vt(Session *s) {
mode.acqsig = SIGRTMIN + 1;
r = ioctl(vt, VT_SETMODE, &mode);
if (r < 0) {
- r = -errno;
- log_error_errno(errno, "Cannot set VT_PROCESS on /dev/tty%u: %m", s->vtnr);
+ r = log_error_errno(errno,
+ "Cannot set VT_PROCESS on /dev/tty%u: %m",
+ s->vtnr);
goto error;
}
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index 63adc8210..0f7f31aa8 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -925,26 +925,26 @@ int config_parse_tmpfs_size(
errno = 0;
ul = strtoul(rvalue, &f, 10);
if (errno != 0 || f != e) {
- log_syntax(unit, LOG_ERR, filename, line, errno ? errno : EINVAL, "Failed to parse percentage value, ignoring: %s", rvalue);
+ log_syntax(unit, LOG_ERR, filename, line, errno, "Failed to parse percentage value, ignoring: %s", rvalue);
return 0;
}
if (ul <= 0 || ul >= 100) {
- log_syntax(unit, LOG_ERR, filename, line, errno ? errno : EINVAL, "Percentage value out of range, ignoring: %s", rvalue);
+ log_syntax(unit, LOG_ERR, filename, line, 0, "Percentage value out of range, ignoring: %s", rvalue);
return 0;
}
*sz = PAGE_ALIGN((size_t) ((physical_memory() * (uint64_t) ul) / (uint64_t) 100));
} else {
- off_t o;
+ uint64_t k;
- r = parse_size(rvalue, 1024, &o);
- if (r < 0 || (off_t) (size_t) o != o) {
- log_syntax(unit, LOG_ERR, filename, line, r < 0 ? -r : ERANGE, "Failed to parse size value, ignoring: %s", rvalue);
+ r = parse_size(rvalue, 1024, &k);
+ if (r < 0 || (uint64_t) (size_t) k != k) {
+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse size value, ignoring: %s", rvalue);
return 0;
}
- *sz = PAGE_ALIGN((size_t) o);
+ *sz = PAGE_ALIGN((size_t) k);
}
return 0;
diff --git a/src/login/logind.c b/src/login/logind.c
index 9e637c741..2e4342b0a 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -218,7 +218,7 @@ static void manager_free(Manager *m) {
/* Avoid the creation of new processes forked by the
* kernel; at this point, we will not listen to the
* signals anyway */
- if (detect_container(NULL) <= 0)
+ if (detect_container() <= 0)
(void) cg_uninstall_release_agent(SYSTEMD_CGROUP_CONTROLLER);
manager_shutdown_cgroup(m, true);
diff --git a/src/login/pam_elogind.c b/src/login/pam_elogind.c
index 7ccaec56f..f66f1ce84 100644
--- a/src/login/pam_elogind.c
+++ b/src/login/pam_elogind.c
@@ -257,7 +257,7 @@ _public_ PAM_EXTERN int pam_sm_open_session(
}
/* Make sure we don't enter a loop by talking to
- * logind when it is actually waiting for the
+ * systemd-logind when it is actually waiting for the
* background to finish start-up. If the service is
* "systemd-user" we simply set XDG_RUNTIME_DIR and
* leave. */
diff --git a/src/login/sysfs-show.c b/src/login/sysfs-show.c
index 9a9fb7622..f38f06baf 100644
--- a/src/login/sysfs-show.c
+++ b/src/login/sysfs-show.c
@@ -114,7 +114,7 @@ static int show_sysfs_one(
"%s%s:%s%s%s%s",
is_master ? "[MASTER] " : "",
subsystem, sysname,
- name ? " \"" : "", name ? name : "", name ? "\"" : "") < 0)
+ name ? " \"" : "", strempty(name), name ? "\"" : "") < 0)
return -ENOMEM;
free(k);
diff --git a/src/shared/Makefile b/src/shared/Makefile
new file mode 120000
index 000000000..d0b0e8e00
--- /dev/null
+++ b/src/shared/Makefile
@@ -0,0 +1 @@
+../Makefile \ No newline at end of file
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index dc8727c8f..cd05a82d3 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -577,14 +577,14 @@ int bus_check_peercred(sd_bus *c) {
return 1;
}
-int bus_open_system_systemd(sd_bus **_bus) {
+int bus_connect_system_systemd(sd_bus **_bus) {
_cleanup_bus_unref_ sd_bus *bus = NULL;
int r;
assert(_bus);
if (geteuid() != 0)
- return sd_bus_open_system(_bus);
+ return sd_bus_default_system(_bus);
/* If we are root and kdbus is not available, then let's talk
* directly to the system instance, instead of going via the
@@ -619,7 +619,7 @@ int bus_open_system_systemd(sd_bus **_bus) {
r = sd_bus_start(bus);
if (r < 0)
- return sd_bus_open_system(_bus);
+ return sd_bus_default_system(_bus);
r = bus_check_peercred(bus);
if (r < 0)
@@ -631,7 +631,7 @@ int bus_open_system_systemd(sd_bus **_bus) {
return 0;
}
-int bus_open_user_systemd(sd_bus **_bus) {
+int bus_connect_user_systemd(sd_bus **_bus) {
_cleanup_bus_unref_ sd_bus *bus = NULL;
_cleanup_free_ char *ee = NULL;
const char *e;
@@ -661,7 +661,7 @@ int bus_open_user_systemd(sd_bus **_bus) {
e = secure_getenv("XDG_RUNTIME_DIR");
if (!e)
- return sd_bus_open_user(_bus);
+ return sd_bus_default_user(_bus);
ee = bus_address_escape(e);
if (!ee)
@@ -677,7 +677,7 @@ int bus_open_user_systemd(sd_bus **_bus) {
r = sd_bus_start(bus);
if (r < 0)
- return sd_bus_open_user(_bus);
+ return sd_bus_default_user(_bus);
r = bus_check_peercred(bus);
if (r < 0)
@@ -1216,7 +1216,7 @@ int bus_map_all_properties(
return bus_message_map_all_properties(m, map, userdata);
}
-int bus_open_transport(BusTransport transport, const char *host, bool user, sd_bus **bus) {
+int bus_connect_transport(BusTransport transport, const char *host, bool user, sd_bus **bus) {
int r;
assert(transport >= 0);
@@ -1256,7 +1256,7 @@ int bus_open_transport(BusTransport transport, const char *host, bool user, sd_b
/// UNNEEDED by elogind
#if 0
-int bus_open_transport_systemd(BusTransport transport, const char *host, bool user, sd_bus **bus) {
+int bus_connect_transport_systemd(BusTransport transport, const char *host, bool user, sd_bus **bus) {
int r;
assert(transport >= 0);
@@ -1270,9 +1270,9 @@ int bus_open_transport_systemd(BusTransport transport, const char *host, bool us
case BUS_TRANSPORT_LOCAL:
if (user)
- r = bus_open_user_systemd(bus);
+ r = bus_connect_user_systemd(bus);
else
- r = bus_open_system_systemd(bus);
+ r = bus_connect_system_systemd(bus);
break;
@@ -1438,9 +1438,10 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
return bus_log_create_error(r);
if (STR_IN_SET(field,
- "CPUAccounting", "MemoryAccounting", "BlockIOAccounting",
+ "CPUAccounting", "MemoryAccounting", "BlockIOAccounting", "TasksAccounting",
"SendSIGHUP", "SendSIGKILL", "WakeSystem", "DefaultDependencies",
- "IgnoreSIGPIPE", "TTYVHangup", "TTYReset", "RemainAfterExit")) {
+ "IgnoreSIGPIPE", "TTYVHangup", "TTYReset", "RemainAfterExit",
+ "PrivateTmp", "PrivateDevices", "PrivateNetwork", "NoNewPrivileges")) {
r = parse_boolean(eq);
if (r < 0) {
@@ -1451,20 +1452,50 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
r = sd_bus_message_append(m, "v", "b", r);
} else if (streq(field, "MemoryLimit")) {
- off_t bytes;
+ uint64_t bytes;
+ if (isempty(eq) || streq(eq, "infinity"))
+ bytes = (uint64_t) -1;
+ else {
r = parse_size(eq, 1024, &bytes);
if (r < 0) {
log_error("Failed to parse bytes specification %s", assignment);
return -EINVAL;
}
+ }
+
+ r = sd_bus_message_append(m, "v", "t", bytes);
+
+ } else if (streq(field, "TasksMax")) {
+ uint64_t n;
+
+ if (isempty(eq) || streq(eq, "infinity"))
+ n = (uint64_t) -1;
+ else {
+ r = safe_atou64(eq, &n);
+ if (r < 0) {
+ log_error("Failed to parse maximum tasks specification %s", assignment);
+ return -EINVAL;
+ }
+ }
+
+ r = sd_bus_message_append(m, "v", "t", n);
+
+ } else if (STR_IN_SET(field, "CPUShares", "StartupCPUShares")) {
+ uint64_t u;
+
+ r = cg_cpu_shares_parse(eq, &u);
+ if (r < 0) {
+ log_error("Failed to parse %s value %s.", field, eq);
+ return -EINVAL;
+ }
- r = sd_bus_message_append(m, "v", "t", (uint64_t) bytes);
+ r = sd_bus_message_append(m, "v", "t", u);
- } else if (STR_IN_SET(field, "CPUShares", "BlockIOWeight")) {
+ } else if (STR_IN_SET(field, "BlockIOWeight", "StartupBlockIOWeight")) {
uint64_t u;
- r = safe_atou64(eq, &u);
+ r = cg_cpu_shares_parse(eq, &u);
if (r < 0) {
log_error("Failed to parse %s value %s.", field, eq);
return -EINVAL;
@@ -1476,7 +1507,8 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
"User", "Group", "DevicePolicy", "KillMode",
"UtmpIdentifier", "UtmpMode", "PAMName", "TTYPath",
"StandardInput", "StandardOutput", "StandardError",
- "Description", "Slice", "Type"))
+ "Description", "Slice", "Type", "WorkingDirectory",
+ "RootDirectory"))
r = sd_bus_message_append(m, "v", "s", eq);
else if (streq(field, "DeviceAllow")) {
@@ -1509,7 +1541,7 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
r = sd_bus_message_append(m, "v", "a(st)", 0);
else {
const char *path, *bandwidth, *e;
- off_t bytes;
+ uint64_t bytes;
e = strchr(eq, ' ');
if (e) {
@@ -1531,7 +1563,7 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
return -EINVAL;
}
- r = sd_bus_message_append(m, "v", "a(st)", 1, path, (uint64_t) bytes);
+ r = sd_bus_message_append(m, "v", "a(st)", 1, path, bytes);
}
} else if (streq(field, "BlockIODeviceWeight")) {
@@ -1905,7 +1937,6 @@ int bus_wait_for_jobs(BusWaitForJobs *d, bool quiet) {
}
d->name = mfree(d->name);
-
d->result = mfree(d->result);
}
diff --git a/src/shared/bus-util.h b/src/shared/bus-util.h
index 0cd3a2316..db735d9c9 100644
--- a/src/shared/bus-util.h
+++ b/src/shared/bus-util.h
@@ -72,8 +72,8 @@ void bus_verify_polkit_async_registry_free(Hashmap *registry);
// UNNEEDED int bus_open_system_systemd(sd_bus **_bus);
// UNNEEDED int bus_open_user_systemd(sd_bus **_bus);
-int bus_open_transport(BusTransport transport, const char *host, bool user, sd_bus **bus);
-// UNNEEDED int bus_open_transport_systemd(BusTransport transport, const char *host, bool user, sd_bus **bus);
+int bus_connect_transport(BusTransport transport, const char *host, bool user, sd_bus **bus);
+// UNNEEDED bus_connect_transport_systemd(BusTransport transport, const char *host, bool user, sd_bus **bus);
int bus_print_property(const char *name, sd_bus_message *property, bool all);
int bus_print_all_properties(sd_bus *bus, const char *dest, const char *path, char **filter, bool all);
diff --git a/src/shared/cgroup-show.c b/src/shared/cgroup-show.c
deleted file mode 100644
index 4b038452f..000000000
--- a/src/shared/cgroup-show.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- 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/>.
-***/
-
-#include <stdio.h>
-#include <string.h>
-#include <dirent.h>
-#include <errno.h>
-
-#include "util.h"
-#include "formats-util.h"
-#include "process-util.h"
-#include "macro.h"
-#include "path-util.h"
-#include "cgroup-util.h"
-#include "cgroup-show.h"
-#include "terminal-util.h"
-
-static int compare(const void *a, const void *b) {
- const pid_t *p = a, *q = b;
-
- if (*p < *q)
- return -1;
- if (*p > *q)
- return 1;
- return 0;
-}
-
-static void show_pid_array(pid_t pids[], unsigned n_pids, const char *prefix, unsigned n_columns, bool extra, bool more, bool kernel_threads, OutputFlags flags) {
- unsigned i, j, pid_width;
-
- if (n_pids == 0)
- return;
-
- qsort(pids, n_pids, sizeof(pid_t), compare);
-
- /* Filter duplicates */
- for (j = 0, i = 1; i < n_pids; i++) {
- if (pids[i] == pids[j])
- continue;
- pids[++j] = pids[i];
- }
- n_pids = j + 1;
- pid_width = DECIMAL_STR_WIDTH(pids[j]);
-
- if (flags & OUTPUT_FULL_WIDTH)
- n_columns = 0;
- else {
- if (n_columns > pid_width+2)
- n_columns -= pid_width+2;
- else
- n_columns = 20;
- }
- for (i = 0; i < n_pids; i++) {
- _cleanup_free_ char *t = NULL;
-
- get_process_cmdline(pids[i], n_columns, true, &t);
-
- if (extra)
- printf("%s%s ", prefix, draw_special_char(DRAW_TRIANGULAR_BULLET));
- else
- printf("%s%s", prefix, draw_special_char(((more || i < n_pids-1) ? DRAW_TREE_BRANCH : DRAW_TREE_RIGHT)));
-
- printf("%*"PID_PRI" %s\n", pid_width, pids[i], strna(t));
- }
-}
-
-
-static int show_cgroup_one_by_path(const char *path, const char *prefix, unsigned n_columns, bool more, bool kernel_threads, OutputFlags flags) {
- char *fn;
- _cleanup_fclose_ FILE *f = NULL;
- size_t n = 0, n_allocated = 0;
- _cleanup_free_ pid_t *pids = NULL;
- _cleanup_free_ char *p = NULL;
- pid_t pid;
- int r;
-
- r = cg_mangle_path(path, &p);
- if (r < 0)
- return r;
-
- fn = strjoina(p, "/cgroup.procs");
- f = fopen(fn, "re");
- if (!f)
- return -errno;
-
- while ((r = cg_read_pid(f, &pid)) > 0) {
-
- if (!kernel_threads && is_kernel_thread(pid) > 0)
- continue;
-
- if (!GREEDY_REALLOC(pids, n_allocated, n + 1))
- return -ENOMEM;
-
- assert(n < n_allocated);
- pids[n++] = pid;
- }
-
- if (r < 0)
- return r;
-
- show_pid_array(pids, n, prefix, n_columns, false, more, kernel_threads, flags);
-
- return 0;
-}
-
-int show_cgroup_by_path(const char *path, const char *prefix, unsigned n_columns, bool kernel_threads, OutputFlags flags) {
- _cleanup_free_ char *fn = NULL, *p1 = NULL, *last = NULL, *p2 = NULL;
- _cleanup_closedir_ DIR *d = NULL;
- char *gn = NULL;
- bool shown_pids = false;
- int r;
-
- assert(path);
-
- if (n_columns <= 0)
- n_columns = columns();
-
- if (!prefix)
- prefix = "";
-
- r = cg_mangle_path(path, &fn);
- if (r < 0)
- return r;
-
- d = opendir(fn);
- if (!d)
- return -errno;
-
- while ((r = cg_read_subgroup(d, &gn)) > 0) {
- _cleanup_free_ char *k = NULL;
-
- k = strjoin(fn, "/", gn, NULL);
- free(gn);
- if (!k)
- return -ENOMEM;
-
- if (!(flags & OUTPUT_SHOW_ALL) && cg_is_empty_recursive(NULL, k) > 0)
- continue;
-
- if (!shown_pids) {
- show_cgroup_one_by_path(path, prefix, n_columns, true, kernel_threads, flags);
- shown_pids = true;
- }
-
- if (last) {
- printf("%s%s%s\n", prefix, draw_special_char(DRAW_TREE_BRANCH), cg_unescape(basename(last)));
-
- if (!p1) {
- p1 = strappend(prefix, draw_special_char(DRAW_TREE_VERTICAL));
- if (!p1)
- return -ENOMEM;
- }
-
- show_cgroup_by_path(last, p1, n_columns-2, kernel_threads, flags);
- free(last);
- }
-
- last = k;
- k = NULL;
- }
-
- if (r < 0)
- return r;
-
- if (!shown_pids)
- show_cgroup_one_by_path(path, prefix, n_columns, !!last, kernel_threads, flags);
-
- if (last) {
- printf("%s%s%s\n", prefix, draw_special_char(DRAW_TREE_RIGHT), cg_unescape(basename(last)));
-
- if (!p2) {
- p2 = strappend(prefix, " ");
- if (!p2)
- return -ENOMEM;
- }
-
- show_cgroup_by_path(last, p2, n_columns-2, kernel_threads, flags);
- }
-
- return 0;
-}
-
-int show_cgroup(const char *controller, const char *path, const char *prefix, unsigned n_columns, bool kernel_threads, OutputFlags flags) {
- _cleanup_free_ char *p = NULL;
- int r;
-
- assert(path);
-
- r = cg_get_path(controller, path, NULL, &p);
- if (r < 0)
- return r;
-
- return show_cgroup_by_path(p, prefix, n_columns, kernel_threads, flags);
-}
-
-static int show_extra_pids(const char *controller, const char *path, const char *prefix, unsigned n_columns, const pid_t pids[], unsigned n_pids, OutputFlags flags) {
- _cleanup_free_ pid_t *copy = NULL;
- unsigned i, j;
- int r;
-
- assert(path);
-
- if (n_pids <= 0)
- return 0;
-
- if (n_columns <= 0)
- n_columns = columns();
-
- prefix = strempty(prefix);
-
- copy = new(pid_t, n_pids);
- if (!copy)
- return -ENOMEM;
-
- for (i = 0, j = 0; i < n_pids; i++) {
- _cleanup_free_ char *k = NULL;
-
- r = cg_pid_get_path(controller, pids[i], &k);
- if (r < 0)
- return r;
-
- if (path_startswith(k, path))
- continue;
-
- copy[j++] = pids[i];
- }
-
- show_pid_array(copy, j, prefix, n_columns, true, false, false, flags);
-
- return 0;
-}
-
-int show_cgroup_and_extra(const char *controller, const char *path, const char *prefix, unsigned n_columns, bool kernel_threads, const pid_t extra_pids[], unsigned n_extra_pids, OutputFlags flags) {
- int r;
-
- assert(path);
-
- r = show_cgroup(controller, path, prefix, n_columns, kernel_threads, flags);
- if (r < 0)
- return r;
-
- return show_extra_pids(controller, path, prefix, n_columns, extra_pids, n_extra_pids, flags);
-}
-
-/// UNNEEDED by elogind
-#if 0
-int show_cgroup_and_extra_by_spec(const char *spec, const char *prefix, unsigned n_columns, bool kernel_threads, const pid_t extra_pids[], unsigned n_extra_pids, OutputFlags flags) {
- _cleanup_free_ char *controller = NULL, *path = NULL;
- int r;
-
- assert(spec);
-
- r = cg_split_spec(spec, &controller, &path);
- if (r < 0)
- return r;
-
- return show_cgroup_and_extra(controller, path, prefix, n_columns, kernel_threads, extra_pids, n_extra_pids, flags);
-}
-#endif // 0
diff --git a/src/shared/cgroup-show.h b/src/shared/cgroup-show.h
deleted file mode 100644
index 7c9c3f652..000000000
--- a/src/shared/cgroup-show.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*-*- 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/>.
-***/
-
-#include <stdbool.h>
-#include <sys/types.h>
-// #include "logs-show.h"
-#include "output-mode.h"
-
-int show_cgroup_by_path(const char *path, const char *prefix, unsigned columns, bool kernel_threads, OutputFlags flags);
-int show_cgroup(const char *controller, const char *path, const char *prefix, unsigned columns, bool kernel_threads, OutputFlags flags);
-
-// UNNEEDED int show_cgroup_and_extra_by_spec(const char *spec, const char *prefix, unsigned n_columns, bool kernel_threads, const pid_t extra_pids[], unsigned n_extra_pids, OutputFlags flags);
-int show_cgroup_and_extra(const char *controller, const char *path, const char *prefix, unsigned n_columns, bool kernel_threads, const pid_t extra_pids[], unsigned n_extra_pids, OutputFlags flags);
diff --git a/src/shared/clean-ipc.c b/src/shared/clean-ipc.c
index 95d6c4219..85d35a567 100644
--- a/src/shared/clean-ipc.c
+++ b/src/shared/clean-ipc.c
@@ -78,8 +78,9 @@ static int clean_sysvipc_shm(uid_t delete_uid) {
if (errno == EIDRM || errno == EINVAL)
continue;
- log_warning_errno(errno, "Failed to remove SysV shared memory segment %i: %m", shmid);
- ret = -errno;
+ ret = log_warning_errno(errno,
+ "Failed to remove SysV shared memory segment %i: %m",
+ shmid);
}
}
@@ -130,8 +131,9 @@ static int clean_sysvipc_sem(uid_t delete_uid) {
if (errno == EIDRM || errno == EINVAL)
continue;
- log_warning_errno(errno, "Failed to remove SysV semaphores object %i: %m", semid);
- ret = -errno;
+ ret = log_warning_errno(errno,
+ "Failed to remove SysV semaphores object %i: %m",
+ semid);
}
}
@@ -183,8 +185,9 @@ static int clean_sysvipc_msg(uid_t delete_uid) {
if (errno == EIDRM || errno == EINVAL)
continue;
- log_warning_errno(errno, "Failed to remove SysV message queue %i: %m", msgid);
- ret = -errno;
+ ret = log_warning_errno(errno,
+ "Failed to remove SysV message queue %i: %m",
+ msgid);
}
}
@@ -304,8 +307,9 @@ static int clean_posix_mq(uid_t uid) {
if (errno == ENOENT)
continue;
- log_warning_errno(errno, "Failed to stat() MQ segment %s: %m", de->d_name);
- ret = -errno;
+ ret = log_warning_errno(errno,
+ "Failed to stat() MQ segment %s: %m",
+ de->d_name);
continue;
}
@@ -319,8 +323,9 @@ static int clean_posix_mq(uid_t uid) {
if (errno == ENOENT)
continue;
- log_warning_errno(errno, "Failed to unlink POSIX message queue %s: %m", fn);
- ret = -errno;
+ ret = log_warning_errno(errno,
+ "Failed to unlink POSIX message queue %s: %m",
+ fn);
}
}
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index b803c57e7..941666212 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -147,8 +147,7 @@ static int next_assignment(const char *unit,
/* Warn about unknown non-extension fields. */
if (!relaxed && !startswith(lvalue, "X-"))
- log_syntax(unit, LOG_WARNING, filename, line, EINVAL,
- "Unknown lvalue '%s' in section '%s'", lvalue, section);
+ log_syntax(unit, LOG_WARNING, filename, line, 0, "Unknown lvalue '%s' in section '%s'", lvalue, section);
return 0;
}
@@ -196,8 +195,7 @@ static int parse_line(const char* unit,
* Support for them should be eventually removed. */
if (!allow_include) {
- log_syntax(unit, LOG_ERR, filename, line, EBADMSG,
- ".include not allowed here. Ignoring.");
+ log_syntax(unit, LOG_ERR, filename, line, 0, ".include not allowed here. Ignoring.");
return 0;
}
@@ -216,8 +214,7 @@ static int parse_line(const char* unit,
assert(k > 0);
if (l[k-1] != ']') {
- log_syntax(unit, LOG_ERR, filename, line, EBADMSG,
- "Invalid section header '%s'", l);
+ log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid section header '%s'", l);
return -EBADMSG;
}
@@ -228,12 +225,10 @@ static int parse_line(const char* unit,
if (sections && !nulstr_contains(sections, n)) {
if (!relaxed && !startswith(n, "X-"))
- log_syntax(unit, LOG_WARNING, filename, line, EINVAL,
- "Unknown section '%s'. Ignoring.", n);
+ log_syntax(unit, LOG_WARNING, filename, line, 0, "Unknown section '%s'. Ignoring.", n);
free(n);
- free(*section);
- *section = NULL;
+ *section = mfree(*section);
*section_line = 0;
*section_ignored = true;
} else {
@@ -249,16 +244,15 @@ static int parse_line(const char* unit,
if (sections && !*section) {
if (!relaxed && !*section_ignored)
- log_syntax(unit, LOG_WARNING, filename, line, EINVAL,
- "Assignment outside of section. Ignoring.");
+ log_syntax(unit, LOG_WARNING, filename, line, 0, "Assignment outside of section. Ignoring.");
return 0;
}
e = strchr(l, '=');
if (!e) {
- log_syntax(unit, LOG_WARNING, filename, line, EINVAL, "Missing '='.");
- return -EBADMSG;
+ log_syntax(unit, LOG_WARNING, filename, line, 0, "Missing '='.");
+ return -EINVAL;
}
*e = 0;
@@ -421,7 +415,8 @@ int config_parse_many(const char *conf_file,
}
#define DEFINE_PARSER(type, vartype, conv_func) \
- int config_parse_##type(const char *unit, \
+ int config_parse_##type( \
+ const char *unit, \
const char *filename, \
unsigned line, \
const char *section, \
@@ -442,21 +437,23 @@ int config_parse_many(const char *conf_file,
\
r = conv_func(rvalue, i); \
if (r < 0) \
- log_syntax(unit, LOG_ERR, filename, line, -r, \
+ log_syntax(unit, LOG_ERR, filename, line, r, \
"Failed to parse %s value, ignoring: %s", \
#type, rvalue); \
\
return 0; \
- }
-
-DEFINE_PARSER(int, int, safe_atoi)
-DEFINE_PARSER(long, long, safe_atoli)
-DEFINE_PARSER(uint32, uint32_t, safe_atou32)
-DEFINE_PARSER(uint64, uint64_t, safe_atou64)
-DEFINE_PARSER(unsigned, unsigned, safe_atou)
-DEFINE_PARSER(double, double, safe_atod)
-// UNNEEDED DEFINE_PARSER(nsec, nsec_t, parse_nsec)
-DEFINE_PARSER(sec, usec_t, parse_sec)
+ } \
+ struct __useless_struct_to_allow_trailing_semicolon__
+
+DEFINE_PARSER(int, int, safe_atoi);
+DEFINE_PARSER(long, long, safe_atoli);
+DEFINE_PARSER(uint32, uint32_t, safe_atou32);
+DEFINE_PARSER(uint64, uint64_t, safe_atou64);
+DEFINE_PARSER(unsigned, unsigned, safe_atou);
+DEFINE_PARSER(double, double, safe_atod);
+// UNNEEDED DEFINE_PARSER(nsec, nsec_t, parse_nsec);
+DEFINE_PARSER(sec, usec_t, parse_sec);
+DEFINE_PARSER(mode, mode_t, parse_mode);
int config_parse_iec_size(const char* unit,
const char *filename,
@@ -470,7 +467,7 @@ int config_parse_iec_size(const char* unit,
void *userdata) {
size_t *sz = data;
- off_t o;
+ uint64_t v;
int r;
assert(filename);
@@ -478,13 +475,13 @@ int config_parse_iec_size(const char* unit,
assert(rvalue);
assert(data);
- r = parse_size(rvalue, 1024, &o);
- if (r < 0 || (off_t) (size_t) o != o) {
- log_syntax(unit, LOG_ERR, filename, line, r < 0 ? -r : ERANGE, "Failed to parse size value, ignoring: %s", rvalue);
+ r = parse_size(rvalue, 1024, &v);
+ if (r < 0 || (uint64_t) (size_t) v != v) {
+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse size value, ignoring: %s", rvalue);
return 0;
}
- *sz = (size_t) o;
+ *sz = (size_t) v;
return 0;
}
@@ -502,7 +499,7 @@ int config_parse_si_size(const char* unit,
void *userdata) {
size_t *sz = data;
- off_t o;
+ uint64_t v;
int r;
assert(filename);
@@ -510,17 +507,17 @@ int config_parse_si_size(const char* unit,
assert(rvalue);
assert(data);
- r = parse_size(rvalue, 1000, &o);
- if (r < 0 || (off_t) (size_t) o != o) {
- log_syntax(unit, LOG_ERR, filename, line, r < 0 ? -r : ERANGE, "Failed to parse size value, ignoring: %s", rvalue);
+ r = parse_size(rvalue, 1000, &v);
+ if (r < 0 || (uint64_t) (size_t) v != v) {
+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse size value, ignoring: %s", rvalue);
return 0;
}
- *sz = (size_t) o;
+ *sz = (size_t) v;
return 0;
}
-int config_parse_iec_off(const char* unit,
+int config_parse_iec_uint64(const char* unit,
const char *filename,
unsigned line,
const char *section,
@@ -531,7 +528,7 @@ int config_parse_iec_off(const char* unit,
void *data,
void *userdata) {
- off_t *bytes = data;
+ uint64_t *bytes = data;
int r;
assert(filename);
@@ -539,11 +536,9 @@ int config_parse_iec_off(const char* unit,
assert(rvalue);
assert(data);
- assert_cc(sizeof(off_t) == sizeof(uint64_t));
-
r = parse_size(rvalue, 1024, bytes);
if (r < 0)
- log_syntax(unit, LOG_ERR, filename, line, -r, "Failed to parse size value, ignoring: %s", rvalue);
+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse size value, ignoring: %s", rvalue);
return 0;
}
@@ -570,8 +565,7 @@ int config_parse_bool(const char* unit,
k = parse_boolean(rvalue);
if (k < 0) {
- log_syntax(unit, LOG_ERR, filename, line, -k,
- "Failed to parse boolean value, ignoring: %s", rvalue);
+ log_syntax(unit, LOG_ERR, filename, line, k, "Failed to parse boolean value, ignoring: %s", rvalue);
return 0;
}
@@ -635,7 +629,7 @@ int config_parse_string(
assert(data);
if (!utf8_is_valid(rvalue)) {
- log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue);
+ log_syntax_invalid_utf8(unit, LOG_ERR, filename, line, rvalue);
return 0;
}
@@ -673,12 +667,12 @@ int config_parse_path(
assert(data);
if (!utf8_is_valid(rvalue)) {
- log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue);
+ log_syntax_invalid_utf8(unit, LOG_ERR, filename, line, rvalue);
return 0;
}
if (!path_is_absolute(rvalue)) {
- log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Not an absolute path, ignoring: %s", rvalue);
+ log_syntax(unit, LOG_ERR, filename, line, 0, "Not an absolute path, ignoring: %s", rvalue);
return 0;
}
@@ -739,7 +733,7 @@ int config_parse_strv(const char *unit,
return log_oom();
if (!utf8_is_valid(n)) {
- log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue);
+ log_syntax_invalid_utf8(unit, LOG_ERR, filename, line, rvalue);
free(n);
continue;
}
@@ -749,39 +743,13 @@ int config_parse_strv(const char *unit,
return log_oom();
}
if (!isempty(state))
- log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "Trailing garbage, ignoring.");
-
- return 0;
-}
-
-int config_parse_mode(
- const char *unit,
- const char *filename,
- unsigned line,
- const char *section,
- unsigned section_line,
- const char *lvalue,
- int ltype,
- const char *rvalue,
- void *data,
- void *userdata) {
-
- mode_t *m = data;
-
- assert(filename);
- assert(lvalue);
- assert(rvalue);
- assert(data);
-
- if (parse_mode(rvalue, m) < 0) {
- log_syntax(unit, LOG_ERR, filename, line, errno, "Failed to parse mode value, ignoring: %s", rvalue);
- return 0;
- }
+ log_syntax(unit, LOG_ERR, filename, line, 0, "Trailing garbage, ignoring.");
return 0;
}
+/// UNNEEDED by elogind
+#if 0
int config_parse_log_facility(
const char *unit,
const char *filename,
@@ -804,7 +772,7 @@ int config_parse_log_facility(
x = log_facility_unshifted_from_string(rvalue);
if (x < 0) {
- log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Failed to parse log facility, ignoring: %s", rvalue);
+ log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse log facility, ignoring: %s", rvalue);
return 0;
}
@@ -812,6 +780,7 @@ int config_parse_log_facility(
return 0;
}
+#endif // 0
int config_parse_log_level(
const char *unit,
@@ -835,7 +804,7 @@ int config_parse_log_level(
x = log_level_from_string(rvalue);
if (x < 0) {
- log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Failed to parse log level, ignoring: %s", rvalue);
+ log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse log level, ignoring: %s", rvalue);
return 0;
}
@@ -864,7 +833,7 @@ int config_parse_signal(
r = signal_from_string_try_harder(rvalue);
if (r <= 0) {
- log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Failed to parse signal name, ignoring: %s", rvalue);
+ log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse signal name, ignoring: %s", rvalue);
return 0;
}
@@ -895,7 +864,7 @@ int config_parse_personality(
p = personality_from_string(rvalue);
if (p == PERSONALITY_INVALID) {
- log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Failed to parse personality, ignoring: %s", rvalue);
+ log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse personality, ignoring: %s", rvalue);
return 0;
}
diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h
index 9e594c86e..f2dde26ba 100644
--- a/src/shared/conf-parser.h
+++ b/src/shared/conf-parser.h
@@ -118,18 +118,11 @@ int config_parse_strv(const char *unit, const char *filename, unsigned line, con
int config_parse_sec(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
// UNNEEDED int config_parse_nsec(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_mode(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_log_facility(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
+// UNNEEDED int config_parse_log_facility(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_log_level(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_signal(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
// UNNEEDED int config_parse_personality(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-#define log_invalid_utf8(unit, level, config_file, config_line, error, rvalue) \
- do { \
- _cleanup_free_ char *_p = utf8_escape_invalid(rvalue); \
- log_syntax(unit, level, config_file, config_line, error, \
- "String is not UTF-8 clean, ignoring assignment: %s", strna(_p)); \
- } while(false)
-
#define DEFINE_CONFIG_PARSE_ENUM(function,name,type,msg) \
int function(const char *unit, \
const char *filename, \
diff --git a/src/shared/pager.c b/src/shared/pager.c
index f1f3dc7e7..bc2d0372c 100644
--- a/src/shared/pager.c
+++ b/src/shared/pager.c
@@ -38,7 +38,7 @@ static pid_t pager_pid = 0;
noreturn static void pager_fallback(void) {
int r;
- r = copy_bytes(STDIN_FILENO, STDOUT_FILENO, (off_t) -1, false);
+ r = copy_bytes(STDIN_FILENO, STDOUT_FILENO, (uint64_t) -1, false);
if (r < 0) {
log_error_errno(r, "Internal pager failed: %m");
_exit(EXIT_FAILURE);
@@ -48,24 +48,27 @@ noreturn static void pager_fallback(void) {
}
int pager_open(bool jump_to_end) {
- int fd[2];
+ _cleanup_close_pair_ int fd[2] = { -1, -1 };
const char *pager;
pid_t parent_pid;
- int r;
if (pager_pid > 0)
return 1;
- if ((pager = getenv("SYSTEMD_PAGER")) || (pager = getenv("PAGER")))
- if (!*pager || streq(pager, "cat"))
+ if (!on_tty())
return 0;
- if (!on_tty())
+ pager = getenv("SYSTEMD_PAGER");
+ if (!pager)
+ pager = getenv("PAGER");
+
+ /* If the pager is explicitly turned off, honour it */
+ if (pager && (pager[0] == 0 || streq(pager, "cat")))
return 0;
/* Determine and cache number of columns before we spawn the
* pager so that we get the value from the actual tty */
- columns();
+ (void) columns();
if (pipe(fd) < 0)
return log_error_errno(errno, "Failed to create pager pipe: %m");
@@ -73,12 +76,8 @@ int pager_open(bool jump_to_end) {
parent_pid = getpid();
pager_pid = fork();
- if (pager_pid < 0) {
- r = -errno;
- log_error_errno(errno, "Failed to fork pager: %m");
- safe_close_pair(fd);
- return r;
- }
+ if (pager_pid < 0)
+ return log_error_errno(errno, "Failed to fork pager: %m");
/* In the child start the pager */
if (pager_pid == 0) {
@@ -87,7 +86,7 @@ int pager_open(bool jump_to_end) {
(void) reset_all_signal_handlers();
(void) reset_signal_mask();
- dup2(fd[0], STDIN_FILENO);
+ (void) dup2(fd[0], STDIN_FILENO);
safe_close_pair(fd);
/* Initialize a good set of less options */
@@ -142,7 +141,6 @@ int pager_open(bool jump_to_end) {
if (dup2(fd[1], STDERR_FILENO) < 0)
return log_error_errno(errno, "Failed to duplicate pager pipe: %m");
- safe_close_pair(fd);
return 1;
}
@@ -152,17 +150,10 @@ void pager_close(void) {
return;
/* Inform pager that we are done */
- fclose(stdout);
-#if defined(__GLIBC__)
- stdout = NULL;
-#endif // in musl-libc this is a const
-
- fclose(stderr);
-#if defined(__GLIBC__)
- stderr = NULL;
-#endif // in musl-libc this is a const
+ stdout = safe_fclose(stdout);
+ stderr = safe_fclose(stderr);
- kill(pager_pid, SIGCONT);
+ (void) kill(pager_pid, SIGCONT);
(void) wait_for_terminate(pager_pid, NULL);
pager_pid = 0;
}
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index 1064fd5cb..3dedbd1f6 100644
--- a/src/shared/sleep-config.c
+++ b/src/shared/sleep-config.c
@@ -226,7 +226,7 @@ static bool enough_memory_for_hibernation(void) {
if (r < 0)
return false;
- r = get_status_field("/proc/meminfo", "\nActive(anon):", &active);
+ r = get_proc_field("/proc/meminfo", "Active(anon)", WHITESPACE, &active);
if (r < 0) {
log_error_errno(r, "Failed to retrieve Active(anon) from /proc/meminfo: %m");
return false;
diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h
index a9a6b4eb7..b2f2b6ace 100644
--- a/src/systemd/sd-bus.h
+++ b/src/systemd/sd-bus.h
@@ -131,7 +131,7 @@ int sd_bus_set_fd(sd_bus *bus, int input_fd, int output_fd);
// UNNEEDED int sd_bus_get_address(sd_bus *bus, const char **address);
// UNNEEDED int sd_bus_set_bus_client(sd_bus *bus, int b);
// UNNEEDED int sd_bus_is_bus_client(sd_bus *bus);
-int sd_bus_set_server(sd_bus *bus, int b, sd_id128_t bus_id);
+// UNNEEDED int sd_bus_set_server(sd_bus *bus, int b, sd_id128_t bus_id);
// UNNEEDED int sd_bus_is_server(sd_bus *bus);
// UNNEEDED int sd_bus_set_anonymous(sd_bus *bus, int b);
// UNNEEDED int sd_bus_is_anonymous(sd_bus *bus);
@@ -141,7 +141,7 @@ int sd_bus_set_server(sd_bus *bus, int b, sd_id128_t bus_id);
// UNNEEDED int sd_bus_is_monitor(sd_bus *bus);
// UNNEEDED int sd_bus_set_description(sd_bus *bus, const char *description);
// UNNEEDED int sd_bus_get_description(sd_bus *bus, const char **description);
-int sd_bus_negotiate_creds(sd_bus *bus, int b, uint64_t creds_mask);
+// UNNEEDED int sd_bus_negotiate_creds(sd_bus *bus, int b, uint64_t creds_mask);
// UNNEEDED int sd_bus_negotiate_timestamp(sd_bus *bus, int b);
// UNNEEDED int sd_bus_negotiate_fds(sd_bus *bus, int b);
int sd_bus_can_send(sd_bus *bus, char type);
@@ -151,14 +151,14 @@ int sd_bus_set_allow_interactive_authorization(sd_bus *bus, int b);
int sd_bus_start(sd_bus *ret);
-int sd_bus_try_close(sd_bus *bus);
+// UNNEEDED int sd_bus_try_close(sd_bus *bus);
void sd_bus_close(sd_bus *bus);
sd_bus *sd_bus_ref(sd_bus *bus);
sd_bus *sd_bus_unref(sd_bus *bus);
sd_bus *sd_bus_flush_close_unref(sd_bus *bus);
-// UNNEEDED int sd_bus_is_open(sd_bus *bus);
+// UNNEEDED void sd_bus_default_flush_close(void);
// UNNEEDED int sd_bus_get_bus_id(sd_bus *bus, sd_id128_t *id);
// UNNEEDED int sd_bus_get_scope(sd_bus *bus, const char **scope);
@@ -166,11 +166,11 @@ sd_bus *sd_bus_flush_close_unref(sd_bus *bus);
int sd_bus_get_owner_creds(sd_bus *bus, uint64_t creds_mask, sd_bus_creds **ret);
int sd_bus_send(sd_bus *bus, sd_bus_message *m, uint64_t *cookie);
-int sd_bus_send_to(sd_bus *bus, sd_bus_message *m, const char *destination, uint64_t *cookie);
+// UNNEEDED int sd_bus_send_to(sd_bus *bus, sd_bus_message *m, const char *destination, uint64_t *cookie);
int sd_bus_call(sd_bus *bus, sd_bus_message *m, uint64_t usec, sd_bus_error *ret_error, sd_bus_message **reply);
int sd_bus_call_async(sd_bus *bus, sd_bus_slot **slot, sd_bus_message *m, sd_bus_message_handler_t callback, void *userdata, uint64_t usec);
-int sd_bus_get_fd(sd_bus *bus);
+// UNNEEDED int sd_bus_get_fd(sd_bus *bus);
int sd_bus_get_events(sd_bus *bus);
int sd_bus_get_timeout(sd_bus *bus, uint64_t *timeout_usec);
int sd_bus_process(sd_bus *bus, sd_bus_message **r);
@@ -187,7 +187,7 @@ int sd_bus_attach_event(sd_bus *bus, sd_event *e, int priority);
int sd_bus_detach_event(sd_bus *bus);
sd_event *sd_bus_get_event(sd_bus *bus);
-int sd_bus_add_filter(sd_bus *bus, sd_bus_slot **slot, sd_bus_message_handler_t callback, void *userdata);
+// UNNEEDED int sd_bus_add_filter(sd_bus *bus, sd_bus_slot **slot, sd_bus_message_handler_t callback, void *userdata);
int sd_bus_add_match(sd_bus *bus, sd_bus_slot **slot, const char *match, sd_bus_message_handler_t callback, void *userdata);
int sd_bus_add_object(sd_bus *bus, sd_bus_slot **slot, const char *path, sd_bus_message_handler_t callback, void *userdata);
int sd_bus_add_fallback(sd_bus *bus, sd_bus_slot **slot, const char *prefix, sd_bus_message_handler_t callback, void *userdata);
@@ -256,7 +256,7 @@ int sd_bus_message_is_method_error(sd_bus_message *m, const char *name);
// UNNEEDED int sd_bus_message_has_signature(sd_bus_message *m, const char *signature);
// UNNEEDED int sd_bus_message_set_expect_reply(sd_bus_message *m, int b);
-int sd_bus_message_set_auto_start(sd_bus_message *m, int b);
+// UNNEEDED int sd_bus_message_set_auto_start(sd_bus_message *m, int b);
// UNNEEDED int sd_bus_message_set_allow_interactive_authorization(sd_bus_message *m, int b);
int sd_bus_message_set_destination(sd_bus_message *m, const char *destination);
@@ -264,11 +264,11 @@ int sd_bus_message_set_destination(sd_bus_message *m, const char *destination);
int sd_bus_message_append(sd_bus_message *m, const char *types, ...);
int sd_bus_message_append_basic(sd_bus_message *m, char type, const void *p);
-int sd_bus_message_append_array(sd_bus_message *m, char type, const void *ptr, size_t size);
-int sd_bus_message_append_array_space(sd_bus_message *m, char type, size_t size, void **ptr);
+// UNNEEDED int sd_bus_message_append_array(sd_bus_message *m, char type, const void *ptr, size_t size);
+// UNNEEDED int sd_bus_message_append_array_space(sd_bus_message *m, char type, size_t size, void **ptr);
// UNNEEDED int sd_bus_message_append_array_iovec(sd_bus_message *m, char type, const struct iovec *iov, unsigned n);
// UNNEEDED int sd_bus_message_append_array_memfd(sd_bus_message *m, char type, int memfd, uint64_t offset, uint64_t size);
-int sd_bus_message_append_string_space(sd_bus_message *m, size_t size, char **s);
+// UNNEEDED int sd_bus_message_append_string_space(sd_bus_message *m, size_t size, char **s);
// UNNEEDED int sd_bus_message_append_string_iovec(sd_bus_message *m, const struct iovec *iov, unsigned n);
// UNNEEDED int sd_bus_message_append_string_memfd(sd_bus_message *m, int memfd, uint64_t offset, uint64_t size);
int sd_bus_message_append_strv(sd_bus_message *m, char **l);
@@ -418,7 +418,9 @@ int sd_bus_error_add_map(const sd_bus_error_map *map);
/* Label escaping */
// UNNEEDED int sd_bus_path_encode(const char *prefix, const char *external_id, char **ret_path);
+// UNNEEDED int sd_bus_path_encode_many(char **out, const char *path_template, ...);
// UNNEEDED int sd_bus_path_decode(const char *path, const char *prefix, char **ret_external_id);
+// UNNEEDED int sd_bus_path_decode_many(const char *path, const char *path_template, ...);
/* Tracking peers */
diff --git a/src/systemd/sd-daemon.h b/src/systemd/sd-daemon.h
index 67cc66fcb..2d573fde9 100644
--- a/src/systemd/sd-daemon.h
+++ b/src/systemd/sd-daemon.h
@@ -76,6 +76,8 @@ _SD_BEGIN_DECLARATIONS;
*/
// UNNEEDED int sd_listen_fds(int unset_environment);
+// UNNEEDED int sd_listen_fds_with_names(int unset_environment, char ***names);
+
/*
Helper call for identifying a passed file descriptor. Returns 1 if
the file descriptor is a FIFO in the file system stored under the
@@ -240,7 +242,7 @@ int sd_notify(int unset_environment, const char *state);
Similar to sd_notify(), but send the message on behalf of another
process, if the appropriate permissions are available.
*/
-int sd_pid_notify(pid_t pid, int unset_environment, const char *state);
+// UNNEEDED int sd_pid_notify(pid_t pid, int unset_environment, const char *state);
/*
Similar to sd_notifyf(), but send the message on behalf of another
diff --git a/src/systemd/sd-event.h b/src/systemd/sd-event.h
index 3cf7661fd..1adb26ee4 100644
--- a/src/systemd/sd-event.h
+++ b/src/systemd/sd-event.h
@@ -81,8 +81,8 @@ sd_event* sd_event_unref(sd_event *e);
int sd_event_add_io(sd_event *e, sd_event_source **s, int fd, uint32_t events, sd_event_io_handler_t callback, void *userdata);
int sd_event_add_time(sd_event *e, sd_event_source **s, clockid_t clock, uint64_t usec, uint64_t accuracy, sd_event_time_handler_t callback, void *userdata);
int sd_event_add_signal(sd_event *e, sd_event_source **s, int sig, sd_event_signal_handler_t callback, void *userdata);
-int sd_event_add_child(sd_event *e, sd_event_source **s, pid_t pid, int options, sd_event_child_handler_t callback, void *userdata);
-int sd_event_add_defer(sd_event *e, sd_event_source **s, sd_event_handler_t callback, void *userdata);
+// UNNEEDED int sd_event_add_child(sd_event *e, sd_event_source **s, pid_t pid, int options, sd_event_child_handler_t callback, void *userdata);
+// UNNEEDED int sd_event_add_defer(sd_event *e, sd_event_source **s, sd_event_handler_t callback, void *userdata);
int sd_event_add_post(sd_event *e, sd_event_source **s, sd_event_handler_t callback, void *userdata);
int sd_event_add_exit(sd_event *e, sd_event_source **s, sd_event_handler_t callback, void *userdata);
@@ -97,8 +97,8 @@ int sd_event_exit(sd_event *e, int code);
// UNNEEDED int sd_event_get_fd(sd_event *e);
int sd_event_get_state(sd_event *e);
-int sd_event_get_tid(sd_event *e, pid_t *tid);
-int sd_event_get_exit_code(sd_event *e, int *code);
+// UNNEEDED int sd_event_get_tid(sd_event *e, pid_t *tid);
+// UNNEEDED int sd_event_get_exit_code(sd_event *e, int *code);
int sd_event_set_watchdog(sd_event *e, int b);
// UNNEEDED int sd_event_get_watchdog(sd_event *e);
diff --git a/tools/make-directive-index.py b/tools/make-directive-index.py
index 183eca3bb..5abcac84d 100755
--- a/tools/make-directive-index.py
+++ b/tools/make-directive-index.py
@@ -51,20 +51,20 @@ TEMPLATE = '''\
</refnamediv>
<refsect1>
- <title>PAM configuration directives</title>
+ <title>Environment variables</title>
- <para>Directives for configuring PAM behaviour.</para>
+ <para>Environment variables understood by the elogind
+ manager and other programs.</para>
- <variablelist id='pam-directives' />
+ <variablelist id='environment-variables' />
</refsect1>
<refsect1>
- <title>elogind manager directives</title>
+ <title>PAM configuration directives</title>
- <para>Directives for configuring the behaviour of the
- elogind process.</para>
+ <para>Directives for configuring PAM behaviour.</para>
- <variablelist id='elogind-directives' />
+ <variablelist id='pam-directives' />
</refsect1>
<refsect1>