summaryrefslogtreecommitdiff
path: root/src/login/logind.c
Commit message (Collapse)AuthorAgeFilesLines
* logind: rename function to avoid confusionDavid Tardon2023-04-271-5/+5
|
* logind: hook up memory pressure + SIGRTMIN+18Lennart Poettering2023-03-011-1/+10
|
* logind: implement Type=notify-reload protocol properlyLennart Poettering2023-01-101-0/+6
| | | | | | So close already. Let's add the two missing notifications too. Fixes: #18484
* tree-wide: use -EBADF for fd initializationZbigniew Jędrzejewski-Szmek2022-12-191-3/+3
| | | | | | | | | | | | | | | | -1 was used everywhere, but -EBADF or -EBADFD started being used in various places. Let's make things consistent in the new style. Note that there are two candidates: EBADF 9 Bad file descriptor EBADFD 77 File descriptor in bad state Since we're initializating the fd, we're just assigning a value that means "no fd yet", so it's just a bad file descriptor, and the first errno fits better. If instead we had a valid file descriptor that became invalid because of some operation or state change, the other errno would fit better. In some places, initialization is dropped if unnecessary.
* logind: Properly unescape names of lingering usersMichal Koutný2022-11-261-2/+8
| | | | | | | | | | | | Filenames to store user linger requests are created with C-escaping. When we enumerate the files to acquire ligering users, we use the filenames verbatim. In the case C-escaping is not an identity map (such as "DOMAIN\User"), we won't be able to start user instances of such mangled users. Unescape filenames when we treat them as usernames again. Fixes: #25448
* Rename def.h to constants.hZbigniew Jędrzejewski-Szmek2022-11-081-1/+1
| | | | | | The name "def.h" originates from before the rule of "no needless abbreviations" was established. Let's rename the file to clarify that it contains a collection of various semi-related constants.
* tree-wide: set description for device managerYu Watanabe2022-10-191-4/+4
|
* tree-wide: use ASSERT_PTR moreDavid Tardon2022-09-131-13/+6
|
* tree-wide: Use correct format specifiersJan Janssen2022-08-301-1/+1
| | | | gcc will complain about all these with -Wformat-signedness.
* login: use helper functions for fd storeYu Watanabe2022-08-161-10/+4
|
* Revert "logind: don't start user@UID.service instance for background sessions"Michal Sekletar2022-07-141-1/+4
| | | | This reverts commit e73bf3425c0b5a6339388a3a459ce2bac497308b.
* logind: don't start user@UID.service instance for background sessionsMichal Sekletar2022-07-071-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | We have had background session class for a long time (since commit e2acb67baa), but so far the only difference in handling of background sessions was logging, i.e. we log some messages with LOG_DEBUG for such sessions. Previously there were complains [1] about excessive logging for each time cron session is started. We used to advise user to enable lingering for users if they want to avoid these log messages. However, on servers with a lot of users the extra processes that result from lingering just adds too much overhead. Hence I think that our current handling of background sessions is not ideal and we should make better use of this attribute. This commit introduces a change in default behavior of logind. Logind is now not going to start user instance of systemd when background session is created and that should address excessive logging problem for cron where background class is used by default. When the same user actually logs in normally then user instance will be started as previously. Also note that PAM_TTY variable is now always set to some value for PAM sessions started via PAMName= option. Otherwise we would categorize such sessions as "background" and user manager won't be started. [1] https://bugzilla.redhat.com/show_bug.cgi?id=1825942
* logind: remember our idle state and use it to detect idle level transitionsMichal Sekletar2022-06-301-4/+19
| | | | Fixes #16391
* logind: rework wall message about pending shutdown/halt/reboot/…Zbigniew Jędrzejewski-Szmek2022-06-011-1/+1
| | | | | | | | Those messages simply *feel* dated: "The system is going for suspend NOW!". Let's say "The system will suspend|power off|hibernate|… now!" instead. The exclamation mark is enough to show the urgency. Also, the "the" seemed out of place. We're not talking about a specific reboot.
* list: declare iterator of LIST_FOREACH() in the loopYu Watanabe2022-03-191-6/+4
|
* logind: load scheduled shutdown on restartLudwig Nussel2022-02-281-0/+2
| | | | | Make sure logind doesn't forget about a scheduled shutdown, even if it gets restarted eg due to a package update.
* logind: refactorLudwig Nussel2022-01-251-1/+0
| | | | | | | Avoid hardcoded strings and string compares related to shutdown actions. Instead put everything into a common structure. Reuse existing HandleAction as index since it's already exposed as property for the button handlers.
* logind: enable wall messages by defaultLudwig Nussel2022-01-251-0/+1
| | | | | | | | | | | Something calling directly into the dbus interface to request a shutdown may not bother turning wall messages on explicitly. This has the convenient side effect that no separate polkit auth is required to turn on wall messages. Was annoying as having a wall message is the default behavior of the commandline tools. Now it's the other way around ie eg systemctl reboot --no-wall requires auth to explicitly turn off the wall message.
* Define FOREACH_DIRENT through FOREACH_DIRENT_ALLZbigniew Jędrzejewski-Szmek2021-12-151-5/+0
| | | | As in the previous commit, 'de' is used as the iterator variable name.
* shared: clean up mkdir.h/label.h situationLennart Poettering2021-11-161-0/+1
| | | | | | | | | | Previously the mkdir_label() family of calls was implemented in src/shared/mkdir-label.c but its functions partly declared ins src/shared/label.h and partly in src/basic/mkdir.h (!!). That's weird (and wrong). Let's clean this up, and add a proper mkdir-label.h matching the .c file.
* tree-wide: warn when sd_notify fails with READY=1 or FDSTOREREMOVE=1Zbigniew Jędrzejewski-Szmek2021-11-031-4/+6
| | | | | | | | Most sd_notify() calls are like log_info() — the result is only informative and if they fail, it's best ignore this. But if a call with READY=1 fails, the unit may enter a failed state, so we should warn about this. Similarly for FSTOREREMOVE=1: the manager may be left with a stale fd, at least wasting resources.
* tree-wide: mark set-but-not-used variables as unused to make LLVM happyFrantisek Sumsal2021-09-151-1/+1
| | | | | | | | | | | | | | LLVM 13 introduced `-Wunused-but-set-variable` diagnostic flag, which trips over some intentionally set-but-not-used variables or variables attached to cleanup handlers with side effects (`_cleanup_umask_`, `_cleanup_(notify_on_cleanup)`, `_cleanup_(restore_sigsetp)`, etc.): ``` ../src/basic/process-util.c:1257:46: error: variable 'saved_ssp' set but not used [-Werror,-Wunused-but-set-variable] _cleanup_(restore_sigsetp) sigset_t *saved_ssp = NULL; ^ 1 error generated. ```
* logind: allow binding different operation to reboot key long pressesYegor Alexeyev2021-07-081-0/+2
|
* dirent-util: use readdir_ensure_type() in readdir_no_dot() and FOREACH_DIRENT()Yu Watanabe2021-06-241-1/+0
|
* logind: tweak log messageZbigniew Jędrzejewski-Szmek2021-04-191-1/+1
| | | | https://github.com/systemd/systemd/pull/19317#pullrequestreview-637765222
* partition, random-seed, logind: fix log messages with %mZbigniew Jędrzejewski-Szmek2021-04-141-2/+2
| | | | | We would print "...: Success", which is not too terrible, but not pretty either.
* tree-wide: use UINT64_MAX or friendsYu Watanabe2021-03-051-1/+1
|
* signal-util: make -1 termination of ignore_signals() argument list unnecessaryLennart Poettering2021-02-251-1/+1
| | | | | | | | | | Clean up ignore_signals() + default_signals() + sigaction_many() a bit: make it unnecessary to explicitly terminate the signal list with -1. Merge all three calls into a single function that is just called with slightly different parameters. And eliminate an unnecessary extra iteration in its inner for() loop. No change in behaviour.
* sd-device: add sd_device_get_action() + sd_device_get_seqnum() + ↵Lennart Poettering2021-02-181-1/+1
| | | | | | | | | | | | | | | | sd_device_new_from_stat_rdev() To make sd-device properly usable for all programs we need to provide an API for the "action" field of an event, it's one of the most relevant ones, and it was so far missing. This also adds sd_device_get_seqnum(), which isn't that interesting, except for generating pretty debug output, which we use it ourselves for. This also makes device_new_from_stat_rdev() public, as it is truly useful, as we can see in our own uses of it, and I think is fairly generic to show up in the public APIs.
* tree-wide: enable colorized logging for daemons when run in consoleYu Watanabe2021-02-011-1/+1
| | | | It may be useful when debugging daemons.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* logind: minor indentation adjustmentsZbigniew Jędrzejewski-Szmek2020-10-191-7/+6
|
* logind: use notify_start/notify_on_cleanupZbigniew Jędrzejewski-Szmek2020-10-191-13/+4
| | | | Logging about the pid is dropped, pid1 does that better.
* logind: clarify what the second argument of session_stop() means when calling itLennart Poettering2020-09-111-2/+2
|
* tree-wide: define iterator inside of the macroZbigniew Jędrzejewski-Szmek2020-09-081-6/+5
|
* shared: actually move all BusLocator related calls to bus-locator.cLennart Poettering2020-06-301-1/+1
|
* logind: also cache LoaderEntryOneShot EFI variableLennart Poettering2020-06-261-0/+1
| | | | | | | | | With this we are now caching all EFI variables that we expose as property in logind. Thus a client invoking GetAllProperties() should only trgger a single read of each variable, but never repeated ones. Obsoletes: #16190 Fixes: #14828
* Make failures of mac_selinux_init() fatalChristian Göttsche2020-06-231-1/+1
|
* login: filenames in /run/systemd/users are uidsJan Palus2020-06-121-1/+10
| | | | Fixes: #16146
* efi: cache LoaderEntries EFI variableLennart Poettering2020-05-291-0/+2
| | | | | | Based-on: https://github.com/systemd/systemd/issues/14828#issuecomment-634202054
* login: switch to BusLocator-oriented helpersVito Caputo2020-05-071-33/+5
| | | | Mechanical substitution reducing some verbosity
* importd,logind: add --bus-introspect= optionZbigniew Jędrzejewski-Szmek2020-05-051-0/+2
|
* logind: convert to the new schemeZbigniew Jędrzejewski-Szmek2020-05-051-28/+4
|
* logind,importd,hostnamed,localed,timedated,machined,resolved: add option ↵Zbigniew Jędrzejewski-Szmek2020-05-031-5/+7
| | | | | | | | parsing stubs --help and --version are implemented in the usual style. help() prints full path, since the program is not expected to be in $PATH.
* tree-wide: implement new log control API dbus interface in all our daemonsLennart Poettering2020-04-211-0/+5
|
* shared: split out polkit stuff from bus-util.c → bus-polkit.cLennart Poettering2020-01-221-1/+1
| | | | | | It's enough, complex stuff to warrant its own source file. No other changes, just splitting out.
* tree-wide: drop string.h when string-util.h or friends are includedYu Watanabe2019-11-041-1/+0
|
* Handle d_type == DT_UNKNOWN correctlyMichael Olbrich2019-09-301-0/+1
| | | | | | | | | | | | | As documented in the man-page, readdir() may return a directory entry with d_type == DT_UNKNOWN. This must be handled for regular filesystems. dirent_ensure_type() is available to set d_type if necessary. Use it in some more places. Without this systemd will fail to boot correctly with nfsroot and some other filesystems. Closes #13609
* logind: at start-up automatically clean up orphaned inhibitorsLennart Poettering2019-07-231-2/+9
|
* logind: drop redundant session_id_valid() checkLennart Poettering2019-07-231-6/+0
| | | | | session_new() checks that as first step anyway, no need to do this beforehand.