summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* logind: change user-runtime-dir to query runtime dir size from logind via ↵Lennart Poettering2018-10-29
| | | | | | | | | | | | | | | | | | 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. (cherry picked from commit 07ee5adb356b9fde500c8a5226f24a314789832b)
* logind: optionally watch utmp for login dataLennart Poettering2018-10-29
| | | | | | | | 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 (cherry picked from commit 3d0ef5c7e00155bc74f6f71c34cad518a4ff56ba)
* logind: add hashtable for finding session by leader PIDLennart Poettering2018-10-29
| | | | | | | This is useful later on, when we quickly want to find the session for a leader PID. (cherry picked from commit 238794b15082e6f61d0ce2943d39205289fff7f0)
* logind: optionally, keep the user@.service instance for eached logged in ↵Lennart Poettering2018-10-29
| | | | | | | | | | | | 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 (cherry picked from commit 9afe9efb9340588db553950727a2a9672dc3db24)
* logind: minor session time handling tweaksLennart Poettering2018-10-29
| | | | (cherry picked from commit 061c6607a9f2e39a76ee74048f19b5de16c8fac3)
* logind: rework how we manage the slice and user-runtime-dir@.service unit ↵Lennart Poettering2018-10-29
| | | | | | | | | | | | | | | | | | | | | | for each user Instead of managing it explicitly, let's simplify things and rely on regular Wants=/Requires= dependencies to pull in these units from user@.service and the session scope, and StopWhenUneeded= to stop these auxiliary units again. This way, they can be pulled in easily by unrelated units too. This simplifies things quite a bit: for each session we now only need to manage the session scope, and for each user the user@.service, the other units are not something we need to manage anymore. This patch also makes sure that if user@.service of a user is masked we will continue to work, and user-runtime-dir@.service will still be correctly pulled in, as it is now a dependency of the scope unit. Fixes: #9461 Replaces: #5546 (cherry picked from commit 25a1ab4ed48b72e974f77a68dcbe3521014787bb)
* login: use free_and_replace() and TAKE_PTR()Yu Watanabe2018-10-29
| | | | (cherry picked from commit fb2367edd943d37f418725c90498a940016e80bd)
* logind: don't clobber bus error structure if we don't failLennart Poettering2018-10-29
| | | | (cherry picked from commit ea3a7cf6c34163834893f1f4c7af44c8245776ac)
* logind: propagate session stop errorsLennart Poettering2018-10-29
| | | | | | | | | | Let's propagate errors from stopping sessions via seat_stop(). This is similar to how we propagate such errors in user_stop() for all sessions associated with a user. Note that we propagate these errors, but we don't abort the function. (cherry picked from commit e6958b7ea33813b085966ac25817a957c0dad7f9)
* logind: introduce little helper that checks whether a session is readyLennart Poettering2018-10-29
| | | | (cherry picked from commit b1951bc83ffbbb92ba4de7b9cba845421c2f35b1)
* logind: use TAKE_PTR() where we canLennart Poettering2018-10-29
| | | | (cherry picked from commit 1b88ed3b7db37241323348f640f9adb61c0df47a)
* logind: prefer strjoin() over asprintf()Lennart Poettering2018-10-29
| | | | (cherry picked from commit d5ddc930150633f9ce38ed4a6dc9accfd7ceaaac)
* logind: don't rely on downgrade-to-boolLennart Poettering2018-10-29
| | | | (cherry picked from commit 709d058756da7139181355b63cfad2288eefddfe)
* logind: voidify a few callsLennart Poettering2018-10-29
| | | | (cherry picked from commit 75bbdf478c73d78bbe5bdee6f468c2e84a1844c6)
* logind: make better use of logging functionsLennart Poettering2018-10-29
| | | | (cherry picked from commit e555d12635007da7263d0a43ed7307e70a07720d)
* logind: never elect a session that is stopping as displayLennart Poettering2018-10-29
| | | | (cherry picked from commit 04857cd801022d9f9933efb484c6253572f09870)
* logind: make unit/job active checking more debuggableLennart Poettering2018-10-29
| | | | | | Let's log the error messages if we get any at debug level. (cherry picked from commit bd26aee1f6bea13fe25b3feb2a5e9cd1be522e7e)
* man: add missing spaceLennart Poettering2018-10-29
| | | | (cherry picked from commit 74fb9617a8d1958d89b4b829a6fe544ac30bb81c)
* sd-bus: add new API call sd_bus_error_move()Lennart Poettering2018-10-29
| | | | | | | | | This new call move an sd_bus_error into another one. (cherry picked from commit 190128e407eb24a445554c0e1f956a1d51f97338) In the backport, the new function is made non-public, declared in bus-error.h not sd-bus.h.
* logind: fix bad error propagationLennart Poettering2018-10-29
| | | | (cherry picked from commit cce08496e7353e3e9903b42695aba3f9d259b90a)
* logind: correct bad clean-up pathLennart Poettering2018-10-29
| | | | (cherry picked from commit d88ffeeeefda4c3447223fd36f8e30f23c931e48)
* logind: save/restore User object's "stopping" field during restartsLennart Poettering2018-10-29
| | | | | | | Whether we are stopping or not is highly relevant, hence don't forget it across restarts. (cherry picked from commit d865bc024bf28c17120d7322a81e9a99997a59f6)
* logind: improve logging in manager_connect_console()Lennart Poettering2018-10-29
| | | | | | | | | | | | | | | | | let's make sure we log about every failure Also, complain about systems where /dev/tty0 exists but /sys/class/tty/tty0/active does not. Such systems (usually container environments) are pretty broken as they mount something that is not a VC to /dev/tty0 and they really shouldn't. Systems should either have a VC or not, but not badly fake one by mounting things wildly. This just adds a warning message, as before we'll simply turn off VC handling in this case. (cherry picked from commit 0b6d55cae9b8adc507fbea95d1b2874729a77386)
* logind: initialize Manager object with structure initialization tooLennart Poettering2018-10-29
| | | | (cherry picked from commit b25ba6cf673036e46cbaec77d3c7859ed83d3ca8)
* logind: turn of stdio locking when writing session files tooLennart Poettering2018-10-29
| | | | | | | This just copies what we already do for user and seat files to session files. (cherry picked from commit 44176400138e18d9087e0864ca97041416a90d47)
* logind: fix serialization/deserialization of user's "display session"Lennart Poettering2018-10-29
| | | | | | | | | | | Previously this was serialized as part of the user object. This didn't work however, as we load users first, and sessions seconds and hence referencing a session from the user load logic cannot work. Fix this by storing an IS_DISPLAY property along with each session, and make the session with this set display session when it is loaded. (cherry picked from commit 1c8280fd47b6561d35b15b3b6d49bdeacf891bfd)
* logind: rework Seat/Session/User object allocation and freeing a bitLennart Poettering2018-10-29
| | | | | | | | | | | | | | Let's update things a bit to follow current practices: - User structure initialization rather than zero-initialized allocation - Always propagate proper errors from allocation functions - Use _cleanup_ for freeing objects when allocation fails half-way - Make destructors return NULL (cherry picked from commit 8c29a4570993105fecc12288596d2ee77c7f82b8)
* format-table: don't use unsigned when there's no point in itLennart Poettering2018-10-29
| | | | | | CID 1394372 (cherry picked from commit ee7b9f1dfc4653cc8ce26d57cbed249d7f9cea4b)
* login: avoid leak of name returned by uid_to_name()David Tardon2018-10-29
| | | | (cherry picked from commit e99742ef3e9d847da04e71fec0eb426063b25068)
* be consistent about sun_path lengthDavid Tardon2018-10-29
| | | | | | | Most places use the whole buffer for name, without leaving extra space for the trailing NUL. (cherry picked from commit f369f47c264dd56f630e91697006efd647542feb)
* meson: fix '-Dstatic-libsystemd=true' or '-Dstatic-libudev=true'Yu Watanabe2018-10-29
| | | | | | Follow-up for a5d8835c78112206bbf0812dd4cb471f803bfe88. (cherry picked from commit be44b572f3543e589e381f8a0a04ade71c4c2e03)
* test: add test for 'thread safety' of libudevYu Watanabe2018-10-29
| | | | | | This adds a test for 715a970548d03fed18dc66c411c8b42ff21029cf. (cherry picked from commit cb3e926a5da4f73b48f71b541febe646bc1008d7)
* test: add tests for $SYSTEMD_MEMPOOL=Yu Watanabe2018-10-29
| | | | | | | This adds tests for b4f607433cac749b617e15b3d5d122322ed2bc71 and 205c085bc36c2c61a09dc40621d8561b135d9b57 (#9792). (cherry picked from commit 3ffd12bfbe9f91b392d80fbf6a8b2def2a13bf6d)
* mempool: only enable mempool use when linked to libsystemd-shared.soZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | | | | | | | Mempool use is enabled or disabled based on the mempool_use_allowed symbol that is linked in. Should fix assert crashes in external programs caused by #9792. Replaces #10286. v2: - use two different source files instead of a gcc constructor (cherry picked from commit a5d8835c78112206bbf0812dd4cb471f803bfe88)
* meson: update bug referenceZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | | https://github.com/mesonbuild/meson/issues/1644 was resolved in 0.42: https://github.com/mesonbuild/meson/pull/2191/commits/be4428005dff8b17af5696c8f05567de9af1a8c5, but still no-go. (cherry picked from commit 6939fb9eb4c76de630b71f6b2ad98686d7fbd1bf)
* meson: remove old commentZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | | The linked page is gone, and I can't quite remember what the warning was about. Something about recursive copying... Everything seems to work. (cherry picked from commit c42c98192484f48342c2c032ea3d00022bd20e92)
* meson: drop workaroundZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | It was added way back, and seems to work fine now without it. (cherry picked from commit 5dbf13fa6c2d5311a9fc236a0a95c1babcc11937)
* meson: include more build settings in status outputLennart Poettering2018-10-29
| | | | (cherry picked from commit 19d8c9c9b7b3507eb2fdcf668a85456a4ae0dbeb)
* Move use_pool() to mempool.c and rename to mempool_enabled()Zbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | The only user is in hashmap.c, but it's a mempool thing. (cherry picked from commit 7c48ea02800782651b7da373c6165abb052f1382)
* hashmap: add an explicit assert() for detecting when objects migrated ↵Lennart Poettering2018-10-29
| | | | | | | | | | | | | between threads When clients don't follow protocol and use the same object from different threads, then we previously would silently corrupt memory. With this assert we'll fail with an assert(). This doesn't fix anything but certainly makes mis-uses easier to detect and debug. Triggered by https://bugzilla.redhat.com/show_bug.cgi?id=1609349 (cherry picked from commit 205c085bc36c2c61a09dc40621d8561b135d9b57)
* hashmap: add an environment variable to turn off the memory pool used by ↵Lennart Poettering2018-10-29
| | | | | | | | hashmaps Triggered by https://bugzilla.redhat.com/show_bug.cgi?id=1609349 (cherry picked from commit b4f607433cac749b617e15b3d5d122322ed2bc71)
* terminal-util: extra safety checks when parsing $COLUMNS or $LINES (#10314)Lennart Poettering2018-10-29
| | | | | | | | Let's make sure the integers we parse out are not larger than USHRT_MAX. This is a good idea as the kernel's TIOCSWINSZ ioctl for sizing terminals can't take larger values, and we shouldn't risk an overflow. (cherry picked from commit d09a71356e3ed78be7cef3cd7d9919dc77508b41)
* shared/sleep-config: add switches to kill specific sleep modesZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | | | | | | | | /etc/systemd/sleep.conf gains four new switches: AllowSuspend=, AllowHibernation=, AllowSuspendThenHibernate=, AllowHybridSleep=. Disabling specific modes was already possible by masking suspend.target, hibernate.target, suspend-then-hibernate.target, or hybrid-sleep.target. But this is not convenient for distributions, which want to set some defaults based on what they want to support. Having those available as configuration makes it easy to put a config file in /usr/lib/systemd/sleep.conf.d/ that overrides the defaults and gives instructions how to undo that override. (cherry picked from commit e8f1d00d695f491654d50e57c82623288d3bcbeb)
* shared/sleep-config: forbid hibernation if resume= is not configuredZbigniew Jędrzejewski-Szmek2018-10-29
| | | | (cherry picked from commit 5fdf2d51c244288ac41443d1bd81365fab7b7b81)
* basic/proc-cmdline: allow parsing of cmdline from a stringZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | | | | | Comes with tests. Also add direct test for $SYSTEMD_PROC_CMDLINE. In test-proc-cmdline, "true" was masquerading as PROC_CMDLINE_STRIP_RD_PREFIX, fix that. Also, reorder functions to match call order. (cherry picked from commit 9a135c084ae6d06734ec3380f0eafdecd7c216f8)
* Add $SYSTEMD_IN_INITRD=yes|no override for debuggingZbigniew Jędrzejewski-Szmek2018-10-29
| | | | (cherry picked from commit 0307ea49c70b1ed4f3af3c80566c8c098dc080bb)
* logind: ensure seat0 CanGraphical state is writtenRay Strode2018-10-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For non-`seat0` seats, attaching a graphics card to a seat can lead to it getting created. This is because the graphics device is a "master device" which means that device is a seat-defining device. `seat0` may get created, even before the graphics driver is loaded, though. This is because the graphics driver is loaded asynchronously at startup, and `seat0` is the primary seat of system, associated with the system VTs. When a graphics card is attached to a seat the `CanGraphical` property on that seat will flip to `true`. For seats that haven't been created yet (non-`seat0` seats), this leads to `seat_start` getting called which ultimately causes the seat to get serialized to `/run/systemd/seats`. For `seat0`, which is already created, `seat_start` will return immediately, which means the updated `CanGraphical` state will never get written to `/run/systemd/seats`. The end result is that clients querying `sd_seat_can_graphical` won't get the correct answer for `seat0` in cases where the graphics device takes a long time to load until some other peice of seat state is updated. This commit fixes the problem by calling `seat_save` explicitly for already running seats at the time a graphics device is attached. (cherry picked from commit ad1bf59c67e8d05629a4db00bbbe4d4c1c37fe46)
* * hack around deficiencies in prctl() PR_SET_MM_*Frank Schaefer2018-10-29
| | | | (cherry picked from commit 14ee72b7d8de34a6b02767b865c3c49ceef2ed84)
* fileio: fix error propagation in link_tmpfile()Lennart Poettering2018-10-29
| | | | (cherry picked from commit eaa680c09e5701a62e8ac819211e5969eda84f2d)
* basic/hexdecoct: check for overflowZbigniew Jędrzejewski-Szmek2018-10-29
| | | | | | | | | LGTM was complaining: > Multiplication result may overflow 'int' before it is converted to 'long'. Fix this by changing all types to ssize_t and add a check for overflow while at it. (cherry picked from commit 3d6c1844744f631995af72867d5f293430d8015b)