platform/upstream/systemd.git
6 years agoexec-util: use fflush_and_check() where appropriate
Lennart Poettering [Wed, 17 Oct 2018 18:14:51 +0000 (20:14 +0200)]
exec-util: use fflush_and_check() where appropriate

6 years agosulogin-shell: Use force if SYSTEMD_SULOGIN_FORCE set
Andreas Henriksson [Sun, 14 Oct 2018 12:53:09 +0000 (14:53 +0200)]
sulogin-shell: Use force if SYSTEMD_SULOGIN_FORCE set

When the root account is locked sulogin will either inform you of
this and not allow you in or if --force is used it will hand
you passwordless root (if using a recent enough version of util-linux).

Not being allowed a shell is ofcourse inconvenient, but at the same
time handing out passwordless root unconditionally is probably not
a good idea everywhere.

This patch thus allows to control which behaviour you want by
setting the SYSTEMD_SULOGIN_FORCE environment variable to true
or false to control the behaviour, eg. via adding this to
'systemctl edit rescue.service' (or emergency.service):

[Service]
Environment=SYSTEMD_SULOGIN_FORCE=1

Distributions who used locked root accounts and want the passwordless
behaviour could thus simply drop in the override file in
/etc/systemd/system/rescue.service.d/override.conf

Fixes: #7115
Addresses: https://bugs.debian.org/802211

6 years agoudev: make sd_device_get_devname() failure non-fatal
Yu Watanabe [Tue, 16 Oct 2018 19:04:35 +0000 (04:04 +0900)]
udev: make sd_device_get_devname() failure non-fatal

As it is just for logging.

Follow-up for eb276e98419af59d4a587f2dd37e0b923e4c6fd2.

6 years agoMerge pull request #10244 from poettering/nofile-bump
Lennart Poettering [Wed, 17 Oct 2018 15:59:36 +0000 (17:59 +0200)]
Merge pull request #10244 from poettering/nofile-bump

bump RLIMIT_NOFILE

6 years agomeson: simplify definition of MEMORY_ACCOUNTING_DEFAULT
Zbigniew Jędrzejewski-Szmek [Wed, 17 Oct 2018 12:36:09 +0000 (14:36 +0200)]
meson: simplify definition of MEMORY_ACCOUNTING_DEFAULT

Let's just use the simplest form, it doesn't really matter how the define
looks after preprocessing.

6 years agomeson: define @HIGH_RLIMIT_NOFILE@ and use it everywhere
Zbigniew Jędrzejewski-Szmek [Wed, 17 Oct 2018 08:21:48 +0000 (10:21 +0200)]
meson: define @HIGH_RLIMIT_NOFILE@ and use it everywhere

6 years agomain: introduce a define HIGH_RLIMIT_MEMLOCK similar to HIGH_RLIMIT_NOFILE
Lennart Poettering [Thu, 11 Oct 2018 16:31:11 +0000 (18:31 +0200)]
main: introduce a define HIGH_RLIMIT_MEMLOCK similar to HIGH_RLIMIT_NOFILE

6 years agomain: bump fs.nr_open + fs.max-file to their largest possible values
Lennart Poettering [Thu, 11 Oct 2018 16:23:26 +0000 (18:23 +0200)]
main: bump fs.nr_open + fs.max-file to their largest possible values

After discussions with kernel folks, a system with memcg really
shouldn't need extra hard limits on file descriptors anymore, as they
are properly accounted for by memcg anyway. Hence, let's bump these
values to their maximums.

This also adds a build time option to turn thiss off, to cover those
users who do not want to use memcg.

6 years agoMerge pull request #10429 from yuwata/drop-udev-list
Lennart Poettering [Wed, 17 Oct 2018 09:58:02 +0000 (11:58 +0200)]
Merge pull request #10429 from yuwata/drop-udev-list

udev: replace udev_list by Hashmap

6 years agoudev: use Hashmap for storing global properties
Yu Watanabe [Tue, 16 Oct 2018 21:47:16 +0000 (06:47 +0900)]
udev: use Hashmap for storing global properties

6 years agoudev: use Hashmap for storing PROGRAM or BUILTIN
Yu Watanabe [Tue, 16 Oct 2018 21:11:33 +0000 (06:11 +0900)]
udev: use Hashmap for storing PROGRAM or BUILTIN

6 years agoudev: use Hashmap for storing SECLABEL
Yu Watanabe [Tue, 16 Oct 2018 20:37:34 +0000 (05:37 +0900)]
udev: use Hashmap for storing SECLABEL

6 years agoMerge pull request #10419 from yuwata/fix-prioq
Lennart Poettering [Tue, 16 Oct 2018 17:56:04 +0000 (19:56 +0200)]
Merge pull request #10419 from yuwata/fix-prioq

Fix segfault in prioq_remove() with empty Prioq object

6 years agotree-wide: use CMP() macro where applicable
Yu Watanabe [Tue, 16 Oct 2018 15:55:30 +0000 (00:55 +0900)]
tree-wide: use CMP() macro where applicable

Follow-up for 6dd91b368298e3b3b264a5f2cb5647b2c5cb692b.

6 years agohwdb: add Aiptek Hyperpen 12000U (#10424)
Ervin Peters [Tue, 16 Oct 2018 17:39:52 +0000 (19:39 +0200)]
hwdb: add Aiptek Hyperpen 12000U (#10424)

Closes #9834.

6 years agoMerge pull request #10412 from poettering/sockaddr-sun-path
Yu Watanabe [Tue, 16 Oct 2018 16:25:58 +0000 (01:25 +0900)]
Merge pull request #10412 from poettering/sockaddr-sun-path

various fixes related to struct sockaddr_un handling

6 years agoMerge pull request #10422 from poettering/network-xml-route-fix
Yu Watanabe [Tue, 16 Oct 2018 16:20:12 +0000 (01:20 +0900)]
Merge pull request #10422 from poettering/network-xml-route-fix

man: systemd.network man page fix

6 years agotest: add one more test for prioq_remove()
Yu Watanabe [Tue, 16 Oct 2018 16:18:05 +0000 (01:18 +0900)]
test: add one more test for prioq_remove()

This adds a testcase for e6e637a11a6c62eff31d36f5fc4b49c2a10c7ea8.

6 years agoprioq: use structrued initializer
Yu Watanabe [Tue, 16 Oct 2018 15:47:50 +0000 (00:47 +0900)]
prioq: use structrued initializer

6 years agoprioq: fix index range check
Yu Watanabe [Tue, 16 Oct 2018 15:38:52 +0000 (00:38 +0900)]
prioq: fix index range check

6 years agoprioq: add one more assertion
Yu Watanabe [Tue, 16 Oct 2018 14:35:22 +0000 (23:35 +0900)]
prioq: add one more assertion

6 years agotree-wide: CMP()ify all the things
Lennart Poettering [Tue, 16 Oct 2018 13:57:40 +0000 (15:57 +0200)]
tree-wide: CMP()ify all the things

Let's employ coccinelle to fix everything up automatically for us.

6 years agoSet theme jekyll-theme-primer
Michael Biebl [Tue, 16 Oct 2018 15:11:46 +0000 (17:11 +0200)]
Set theme jekyll-theme-primer

This theme uses anchorjs to provide mouse-over anchor links.

Closes: #10418

6 years agoman: fix spurious uppercasing
Lennart Poettering [Tue, 16 Oct 2018 15:19:23 +0000 (17:19 +0200)]
man: fix spurious uppercasing

6 years agoman: an attempt to reword the [Route] Type= man page
Lennart Poettering [Tue, 16 Oct 2018 15:18:30 +0000 (17:18 +0200)]
man: an attempt to reword the [Route] Type= man page

A follow-up for #10388.

6 years agonetworkd: type support for "throw" in [Route] section
Hui Yiqun [Sat, 13 Oct 2018 06:01:47 +0000 (14:01 +0800)]
networkd: type support for "throw" in [Route] section

6 years agomkosi: make kmsg work in our mkosi builds at least
Lennart Poettering [Thu, 11 Oct 2018 16:22:38 +0000 (18:22 +0200)]
mkosi: make kmsg work in our mkosi builds at least

6 years agoNEWS: explain the RLIMIT_NOFILE bump
Lennart Poettering [Tue, 2 Oct 2018 07:21:45 +0000 (09:21 +0200)]
NEWS: explain the RLIMIT_NOFILE bump

6 years agorlimit-util: don't call setrlimit() needlessly if it wouldn't change anything
Lennart Poettering [Tue, 2 Oct 2018 06:41:03 +0000 (08:41 +0200)]
rlimit-util: don't call setrlimit() needlessly if it wouldn't change anything

Just a tiny tweak to avoid generating an error if there's no need to.

6 years agocore: bump RLIMIT_NOFILE soft+hard limit for systemd itself in all cases
Lennart Poettering [Mon, 1 Oct 2018 16:11:52 +0000 (18:11 +0200)]
core: bump RLIMIT_NOFILE soft+hard limit for systemd itself in all cases

Previously we'd do this for PID 1 only. Let's do this when running in
user mode too, because we know we can handle it.

6 years agounits: bump the RLIMIT_NOFILE soft limit for all services that access the journal
Lennart Poettering [Mon, 1 Oct 2018 16:08:27 +0000 (18:08 +0200)]
units: bump the RLIMIT_NOFILE soft limit for all services that access the journal

This updates the unit files of all our serviecs that deal with journal
stuff to use a higher RLIMIT_NOFILE soft limit by default. The new value
is the same as used for the new HIGH_RLIMIT_NOFILE we just added.

With this we ensure all code that access the journal has higher
RLIMIT_NOFILE. The code that runs as daemon via the unit files, the code
that is run from the user's command line via C code internal to the
relevant tools. In some cases this means we'll redundantly bump the
limits as there are tools run both from the command line and as service.

6 years agocore: raise the RLIMIT_NOFILE hard limit for all services by default
Lennart Poettering [Mon, 1 Oct 2018 15:56:52 +0000 (17:56 +0200)]
core: raise the RLIMIT_NOFILE hard limit for all services by default

Following the discussions with the kernel folks, let's substantially
increase the hard limit (but not the soft limit) of RLIMIT_NOFILE to
256K for all services we start.

Note that PID 1 itself bumps the limit even further, to the max the
kernel allows. We can deal with that after all.

6 years agotree-wide: uniformly bump RLIMIT_NOFILE in all our tools that access the journal
Lennart Poettering [Mon, 1 Oct 2018 15:44:46 +0000 (17:44 +0200)]
tree-wide: uniformly bump RLIMIT_NOFILE in all our tools that access the journal

This makes use of rlimit_nofile_bump() in all tools that access the
journal. In some cases this replaces older code to achieve this, and
others we add it in where it was missing.

6 years agocore: add a new call for bumping RLIMIT_NOFILE to "high" values
Lennart Poettering [Mon, 1 Oct 2018 15:38:48 +0000 (17:38 +0200)]
core: add a new call for bumping RLIMIT_NOFILE to "high" values

Following discussions with some kernel folks at All Systems Go! it
appears that file descriptors are not really as expensive as they used
to be (both memory and performance-wise) and it should thus be OK to allow
programs (including unprivileged ones) to have more of them without ill
effects.

Unfortunately we can't just raise the RLIMIT_NOFILE soft limit
globally for all processes, as select() and friends can't handle fds
>= 1024, and thus unexpecting programs might fail if they accidently get
an fd outside of that range. We can however raise the hard limit, so
that programs that need a lot of fds can opt-in into getting fds beyond
the 1024 boundary, simply by bumping the soft limit to the now higher
hard limit.

This is useful for all our client code that accesses the journal, as the
journal merging logic might need a lot of fds. Let's add a unified
function for bumping the limit in a robust way.

6 years agodef: add a "high" limit for RLIMIT_NOFILE
Lennart Poettering [Mon, 1 Oct 2018 15:37:01 +0000 (17:37 +0200)]
def: add a "high" limit for RLIMIT_NOFILE

This simply adds a new constant we can use for bumping RLIMIT_NOFILE to
a "high" value. It default to 256K for now, which is pretty high, but
smaller than the kernel built-in limit of 1M.

Previously, some tools that needed a higher RLIMIT_NOFILE bumped it to
16K. This new define goes substantially higher than this, following the
discussion with the kernel folks.

6 years agoupdate TODO
Lennart Poettering [Mon, 1 Oct 2018 13:47:50 +0000 (15:47 +0200)]
update TODO

6 years agosiphash24: add helper for calculating the hash value for a string
Lennart Poettering [Tue, 16 Oct 2018 11:56:14 +0000 (13:56 +0200)]
siphash24: add helper for calculating the hash value for a string

Let's shorten some code.

6 years agoMerge pull request #10416 from poettering/udev-coverity
Lennart Poettering [Tue, 16 Oct 2018 14:26:44 +0000 (16:26 +0200)]
Merge pull request #10416 from poettering/udev-coverity

three simple coverity fixes

6 years agoutil: fix segfault in prioq_remove() with empty Prioq object
Yu Watanabe [Tue, 16 Oct 2018 13:27:30 +0000 (22:27 +0900)]
util: fix segfault in prioq_remove() with empty Prioq object

6 years agoutil,test: introduce cleanup function prioq_freep()
Yu Watanabe [Tue, 16 Oct 2018 13:17:04 +0000 (22:17 +0900)]
util,test: introduce cleanup function prioq_freep()

This also simplifies test-prioq.c.

6 years agotest: use CMP() macro at one more place
Yu Watanabe [Tue, 16 Oct 2018 12:56:46 +0000 (21:56 +0900)]
test: use CMP() macro at one more place

6 years agoudev: (void)ify calls to kill() where we knowingly ignore the return values
Lennart Poettering [Tue, 16 Oct 2018 11:49:28 +0000 (13:49 +0200)]
udev: (void)ify calls to kill() where we knowingly ignore the return values

CID 1368231
CID 1368229

6 years agoudev: don't use devname before we acquired it
Lennart Poettering [Tue, 16 Oct 2018 11:48:25 +0000 (13:48 +0200)]
udev: don't use devname before we acquired it

CID 1396107

6 years agocore: log about unit_watch_pid() failing
Lennart Poettering [Tue, 16 Oct 2018 11:47:23 +0000 (13:47 +0200)]
core: log about unit_watch_pid() failing

CID 1237509

6 years agoMerge pull request #10327 from yuwata/test-sd-device-enumerator-subsystem
Lennart Poettering [Tue, 16 Oct 2018 10:48:01 +0000 (12:48 +0200)]
Merge pull request #10327 from yuwata/test-sd-device-enumerator-subsystem

sd-device-enumerator: dedup enumerated devices and add test for subsystem filtering

6 years agoSet theme jekyll-theme-cayman
Lennart Poettering [Tue, 16 Oct 2018 09:32:09 +0000 (11:32 +0200)]
Set theme jekyll-theme-cayman

6 years agocatalog: fix name of variable
Zbigniew Jędrzejewski-Szmek [Mon, 15 Oct 2018 20:41:49 +0000 (22:41 +0200)]
catalog: fix name of variable

All the messages would (literally) say "The start-up result is RESULT."
because @RESULT@ was not defined.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1639482
and the first part of #8005.

Fixup for 646cc98dc81c4d0edbc1b57e7bca0f474b47e270.

6 years agorules: Add ID_REVISION environment var for NVMe devices
Harry Mallon [Mon, 15 Oct 2018 16:10:44 +0000 (17:10 +0100)]
rules: Add ID_REVISION environment var for NVMe devices

6 years agoMerge pull request #9824 from poettering/login-unit-fixes
Zbigniew Jędrzejewski-Szmek [Tue, 16 Oct 2018 07:34:27 +0000 (09:34 +0200)]
Merge pull request #9824 from poettering/login-unit-fixes

many logind improvements

6 years agoMerge pull request #10391 from poettering/systemctl-exit-code-fixes
Zbigniew Jędrzejewski-Szmek [Tue, 16 Oct 2018 06:42:34 +0000 (08:42 +0200)]
Merge pull request #10391 from poettering/systemctl-exit-code-fixes

systemctl exit code fixes

6 years agonspawn: TAKE_FD() is your friend
Lennart Poettering [Mon, 15 Oct 2018 17:45:37 +0000 (19:45 +0200)]
nspawn: TAKE_FD() is your friend

6 years agotree-wide: use sockaddr_un_unlink() at two more places where appropriate
Lennart Poettering [Mon, 15 Oct 2018 17:40:18 +0000 (19:40 +0200)]
tree-wide: use sockaddr_un_unlink() at two more places where appropriate

6 years agoudev: use safe_close() where we can
Lennart Poettering [Mon, 15 Oct 2018 17:23:09 +0000 (19:23 +0200)]
udev: use safe_close() where we can

6 years agotree-wide: add a single version of "static const int one = 1"
Lennart Poettering [Mon, 15 Oct 2018 17:21:37 +0000 (19:21 +0200)]
tree-wide: add a single version of "static const int one = 1"

All over the place we define local variables for the various sockopts
that take a bool-like "int" value. Sometimes they are const, sometimes
static, sometimes both, sometimes neither.

Let's clean this up, introduce a common const variable "const_int_one"
(as well as one matching "const_int_zero") and use it everywhere, all
acorss the codebase.

6 years agosocket-util: tighten socket_address_verify() checks a bit
Lennart Poettering [Mon, 15 Oct 2018 16:54:12 +0000 (18:54 +0200)]
socket-util: tighten socket_address_verify() checks a bit

6 years agosocket-util: tweak commenting in socket_address_get_path()
Lennart Poettering [Mon, 15 Oct 2018 16:27:33 +0000 (18:27 +0200)]
socket-util: tweak commenting in socket_address_get_path()

Let's make clear explicitly that there's always a NUL byte following the
path, and how.

6 years agosocket-util: include trailing NUL byte in SOCKADDR_UN_LEN() count for fs sockets
Lennart Poettering [Mon, 15 Oct 2018 16:26:31 +0000 (18:26 +0200)]
socket-util: include trailing NUL byte in SOCKADDR_UN_LEN() count for fs sockets

This is what unix(7) recommends, hence do so.

6 years agosd-bus: rework how we initialize struct sockaddr_un
Lennart Poettering [Mon, 15 Oct 2018 16:22:04 +0000 (18:22 +0200)]
sd-bus: rework how we initialize struct sockaddr_un

Let's use structured initialization, but more importantly, let's
increase salen by 1, if we reference AF_UNIX sockets in the file system,
so that they also contain the trailing NUL byte. This is what unix(7)
suggests to do, hence follow it.

6 years agosd-bus: make parsing of AF_UNIX socket addresses more strict
Lennart Poettering [Mon, 15 Oct 2018 16:17:57 +0000 (18:17 +0200)]
sd-bus: make parsing of AF_UNIX socket addresses more strict

Insist on NUL termination, just to be safe rather than sorry. The kernel
doesn't require it, but it's really annoying if people rely on this,
hence refuse this early.

6 years agotree-wide: port various users over to sockaddr_un_set_path()
Lennart Poettering [Mon, 15 Oct 2018 11:58:31 +0000 (13:58 +0200)]
tree-wide: port various users over to sockaddr_un_set_path()

CID 1396140
CID 1396141

6 years agosocket-util: add sockaddr_un_set_path() helper
Lennart Poettering [Mon, 15 Oct 2018 16:02:30 +0000 (18:02 +0200)]
socket-util: add sockaddr_un_set_path() helper

Properly initializing sun_path from foreign data is not easy, given the
size constraints, and NUL confusion. Let's add a helper function for
this.

6 years agotree-wide: use structured initialization for sockaddr_un
Lennart Poettering [Mon, 15 Oct 2018 11:59:07 +0000 (13:59 +0200)]
tree-wide: use structured initialization for sockaddr_un

6 years agocore: be more specific in error message
Lennart Poettering [Mon, 15 Oct 2018 11:58:00 +0000 (13:58 +0200)]
core: be more specific in error message

6 years agostrxcpyx: minor coding style updates
Lennart Poettering [Mon, 15 Oct 2018 11:57:07 +0000 (13:57 +0200)]
strxcpyx: minor coding style updates

6 years agosocket-address: document socket address parsing size restrictions in a comment
Lennart Poettering [Mon, 15 Oct 2018 11:55:48 +0000 (13:55 +0200)]
socket-address: document socket address parsing size restrictions in a comment

6 years agosocket-util: use structured initialization
Lennart Poettering [Mon, 15 Oct 2018 11:55:00 +0000 (13:55 +0200)]
socket-util: use structured initialization

6 years agotree-wide: make use of TAKE_FD() at two more places
Lennart Poettering [Mon, 15 Oct 2018 10:09:17 +0000 (12:09 +0200)]
tree-wide: make use of TAKE_FD() at two more places

6 years agotree-wide: use sockaddr_un_unlink() whereever appropriate
Lennart Poettering [Mon, 15 Oct 2018 10:08:30 +0000 (12:08 +0200)]
tree-wide: use sockaddr_un_unlink() whereever appropriate

Let's port everything over.

6 years agosocket-util: add new sockaddr_un_unlink() helper
Lennart Poettering [Mon, 15 Oct 2018 10:06:07 +0000 (12:06 +0200)]
socket-util: add new sockaddr_un_unlink() helper

The helper is supposed to properly handle cases where .sun_path does not
contain a NUL byte, and thus copies out the path suffix a NUL as
necessary.

This also reworks the more specific socket_address_unlink() to be a
wrapper around the more generic sockaddr_un_unlink()

6 years agoalloc-util: add alloca() counterparts for memdup() and memdup_suffix0()
Lennart Poettering [Mon, 15 Oct 2018 10:05:54 +0000 (12:05 +0200)]
alloc-util: add alloca() counterparts for memdup() and memdup_suffix0()

6 years agoMerge pull request #10373 from poettering/systemd-io
Zbigniew Jędrzejewski-Szmek [Mon, 15 Oct 2018 13:39:05 +0000 (15:39 +0200)]
Merge pull request #10373 from poettering/systemd-io

adopt systemd.io urls

6 years agoMerge pull request #10392 from poettering/manager-no-inotify-fail
Yu Watanabe [Sun, 14 Oct 2018 22:15:12 +0000 (07:15 +0900)]
Merge pull request #10392 from poettering/manager-no-inotify-fail

make sure /etc/localtime issues don't cause systemd to fail boot

6 years agoman/systemd.nspawn: fix reference to --timezone argument (#10403)
Ben Boeckel [Sun, 14 Oct 2018 21:16:43 +0000 (17:16 -0400)]
man/systemd.nspawn: fix reference to --timezone argument (#10403)

6 years agoMerge pull request #10394 from yuwata/fixes-found-by-clang
Lennart Poettering [Sun, 14 Oct 2018 18:11:19 +0000 (20:11 +0200)]
Merge pull request #10394 from yuwata/fixes-found-by-clang

Fix warnings reported by clang

6 years agoudev: use readlink_malloc() or its friend
Yu Watanabe [Sat, 13 Oct 2018 14:28:02 +0000 (23:28 +0900)]
udev: use readlink_malloc() or its friend

Follow-up for a2554acec652fc65c8ed0c6c1fede9ba8c3693b1 and
70068602713e8f441c5ddc2618f007f24488e422.

6 years agoMerge pull request #10381 from poettering/coverity-fixes
Yu Watanabe [Sun, 14 Oct 2018 09:58:36 +0000 (18:58 +0900)]
Merge pull request #10381 from poettering/coverity-fixes

fixes for various recent coverity issues

6 years agotest: use fabsl instead of fabs as json_variant_real() returns 'long double'
Yu Watanabe [Sat, 13 Oct 2018 14:59:16 +0000 (23:59 +0900)]
test: use fabsl instead of fabs as json_variant_real() returns 'long double'

6 years agobusctl: drop unused variable
Yu Watanabe [Sat, 13 Oct 2018 14:56:07 +0000 (23:56 +0900)]
busctl: drop unused variable

6 years agocore: set _unused_ attribute to 'reloading'
Yu Watanabe [Sat, 13 Oct 2018 14:50:04 +0000 (23:50 +0900)]
core: set _unused_ attribute to 'reloading'

Follow-up for 4df7d537c8203557d330b68ba7833515ddd4e985.

6 years agocore: ensure it's not fatal if we cannot watch /etc/localtime
Lennart Poettering [Sat, 13 Oct 2018 13:12:41 +0000 (15:12 +0200)]
core: ensure it's not fatal if we cannot watch /etc/localtime

See: #9602

6 years agocore: add debug logging if we cant watch /etc/localtime itself
Lennart Poettering [Sat, 13 Oct 2018 13:12:16 +0000 (15:12 +0200)]
core: add debug logging if we cant watch /etc/localtime itself

6 years agotest: make test-sd-device stricter
Yu Watanabe [Tue, 9 Oct 2018 13:53:13 +0000 (22:53 +0900)]
test: make test-sd-device stricter

6 years agosd-device: dedup enumerated devices
Yu Watanabe [Tue, 9 Oct 2018 13:52:33 +0000 (22:52 +0900)]
sd-device: dedup enumerated devices

6 years agotest: add test for subsystem filtering of sd_device_enumerator
Yu Watanabe [Tue, 9 Oct 2018 09:44:41 +0000 (18:44 +0900)]
test: add test for subsystem filtering of sd_device_enumerator

6 years agohashmap: introduce hashmap_first_key_and_value() and friends
Yu Watanabe [Sat, 13 Oct 2018 07:30:49 +0000 (16:30 +0900)]
hashmap: introduce hashmap_first_key_and_value() and friends

6 years agosystemctl: clean up start_unit_one() error handling
Lennart Poettering [Sat, 13 Oct 2018 12:38:46 +0000 (14:38 +0200)]
systemctl: clean up start_unit_one() error handling

Let's split exit code handling in two: "r" is only used for errno-style
errors, and "ret" is used for exit() codes. Then, let's use EXIT_SUCCESS
for checking whether the latter is already used.

This way it should always be clear what kind of error we are processing,
and when we propaate one into the other.

Moreover this allows us to drop "q" form all inner loops, avoiding
confusion when to use "q" and when "r" to store received errors.

Fixes: #9704

6 years agosystemctl: add missing OOM check
Lennart Poettering [Sat, 13 Oct 2018 12:34:56 +0000 (14:34 +0200)]
systemctl: add missing OOM check

6 years agologind: validate /run/user/1000 before we set it
Lennart Poettering [Tue, 9 Oct 2018 20:23:41 +0000 (22:23 +0200)]
logind: validate /run/user/1000 before we set it

Let's be safe than sorry, in particular as logind doesn't set it up
anymore, but user-runtime-dir@.service does, and logind doesn't really
track success of that.

6 years agocore: fix unfortunate typo in unit_is_unneeded()
Lennart Poettering [Tue, 9 Oct 2018 20:23:14 +0000 (22:23 +0200)]
core: fix unfortunate typo in unit_is_unneeded()

Follow-up for a3c1168ac293f16d9343d248795bb4c246aaff4a.

6 years agocore: make destructive transaction error a bit more useful
Lennart Poettering [Tue, 9 Oct 2018 20:22:52 +0000 (22:22 +0200)]
core: make destructive transaction error a bit more useful

6 years agoupdate TODO
Lennart Poettering [Tue, 7 Aug 2018 09:01:46 +0000 (11:01 +0200)]
update TODO

6 years agoman: also use "yes"/"no" rather than "true"/"false" in man pages
Lennart Poettering [Tue, 25 Sep 2018 10:40:35 +0000 (12:40 +0200)]
man: also use "yes"/"no" rather than "true"/"false" in man pages

We usually use yes/no in all our unit files, do the same in the man
pages.

Triggered by:

https://github.com/systemd/systemd/pull/9824#issuecomment-420729987

6 years agounits: use =yes rather than =true everywhere
Lennart Poettering [Wed, 12 Sep 2018 17:04:24 +0000 (19:04 +0200)]
units: use =yes rather than =true everywhere

So far we always used "yes" instead of "true" in all our unit files,
except for one outlier. Let's do this here too. No change in behaviour
whatsoever, except that it looks prettier ;-)

6 years agologind: automatically GC lingering users for who now user@.service (nor slice, not...
Lennart Poettering [Wed, 8 Aug 2018 14:04:40 +0000 (16:04 +0200)]
logind: automatically GC lingering users for who now user@.service (nor slice, not runtime dir service) is running anymore

This heavily borrows from @intelfx' PR #5546, but watches all three
units that are associated with a user now: the slice, the user@.service
and user-runtime-dir@.service.

The logic and reasoning behind it is the same though: there's no value
in keeping lingering users around if all their three services are gone.

Replaces: #5546
Fixes: #4162

6 years agologind: improve error propagation of user_check_linger_file()
Lennart Poettering [Wed, 8 Aug 2018 14:03:11 +0000 (16:03 +0200)]
logind: improve error propagation of user_check_linger_file()

Let's make this a bit prettier, and propagate unexpected access() errors
correctly.

(The callers of this function will suppress them, but it's nicer of they
do that, rather than us doing that twice in both the callers and the
callees)

6 years agologind: add a RequiresMountsFor= dependency from the session scope unit to the home...
Lennart Poettering [Wed, 8 Aug 2018 13:27:49 +0000 (15:27 +0200)]
logind: add a RequiresMountsFor= dependency from the session scope unit to the home directory of the user

This is useful so that during shutdown scope units are always terminated
before the mounts necessary for the home directory.

(Ideally we'd also add a similar dependency from the user@.service
instance to the home directory, but this isn't as easy as that service
is defined statically and not dynamically, and hence not easy to modify
dynamically, in particular when it comes to deps)

6 years agologind: change user-runtime-dir to query runtime dir size from logind via the bus
Lennart Poettering [Wed, 8 Aug 2018 12:50:57 +0000 (14:50 +0200)]
logind: change user-runtime-dir to query runtime dir size from logind via the bus

I think this is a slightly cleaner approach than parsing the
configuration file at multiple places, as this way there's only a single
reload cycle for logind.conf, and that's systemd-logind.service's
runtime.

This means that logind and dbus become a requirement of
user-runtime-dir, but given that XDG_RUNTIME_DIR is not set anyway
without logind and dbus around this isn't really any limitation.

This also simplifies linking a bit as this means user-runtime-dir
doesn't have to link against any code of logind itself.

6 years agologind: optionally watch utmp for login data
Lennart Poettering [Tue, 7 Aug 2018 11:49:34 +0000 (13:49 +0200)]
logind: optionally watch utmp for login data

This allows us to determine the TTY an ssh session is for, which is
useful to to proper idle detection for ssh sessions.

Fixes: #9622

6 years agologind: add hashtable for finding session by leader PID
Lennart Poettering [Tue, 7 Aug 2018 10:08:24 +0000 (12:08 +0200)]
logind: add hashtable for finding session by leader PID

This is useful later on, when we quickly want to find the session for a
leader PID.

6 years agologind: optionally, keep the user@.service instance for eached logged in user around...
Lennart Poettering [Tue, 7 Aug 2018 09:02:00 +0000 (11:02 +0200)]
logind: optionally, keep the user@.service instance for eached logged in user around for a while

This should speed up rapid logout/login cycles a bit.

By default this timeout is now set to 10s.

Fixes: #8410
Replaces: #4434