summaryrefslogtreecommitdiff
path: root/src/login/logind-action.c
Commit message (Collapse)AuthorAgeFilesLines
* logind: rework wall message about pending shutdown/halt/reboot/…Zbigniew Jędrzejewski-Szmek2022-06-011-0/+16
| | | | | | | | 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.
* logind: use consistent casing in messageZbigniew Jędrzejewski-Szmek2022-05-311-1/+1
| | | | | The other strings use "sentence capitalization". Let's do the same here.
* logind: align tablesZbigniew Jędrzejewski-Szmek2022-05-311-18/+18
|
* logind: rename "log_message" to "log_verb"Zbigniew Jędrzejewski-Szmek2022-05-111-4/+4
| | | | | This field is used to log SHUTDOWN=. Calling it "something-message" is confusing.
* logind: rename manager_item_for_handle() → handle_action_lookup()Lennart Poettering2022-03-091-7/+8
| | | | | | | | | | | | The function has nothing to do with any Manager object, hence drop that from the name. And it actually looks something up by handle *action* not by *handle*, hence the old name was a bit misnomer. Let's call it handle_action_lookup(), as it queries handle action metainfo for a handle action. Also, let's make sure it behaves more like our usual functions that lookup some fixed data from some enum value/int: let's return NULL if we don't find it.
* logind: minor whitespace fixLennart Poettering2022-03-091-7/+7
|
* logind: rename ActionTableItem → HandleActionDataLennart Poettering2022-03-091-2/+2
| | | | | | | | It stores meta-info about various HandleActions, hence let's name it after that. The fact that it can be seen as stored inside some form of a table is an implementation detail of logind-action.c, and should not leak into other modules, hence let's focus on what it is, not how it is stored.
* logind: more verbose struct initializationLudwig Nussel2022-02-141-94/+90
|
* logind: style fixesLudwig Nussel2022-02-141-7/+0
|
* logind: add handle enum to structLudwig Nussel2022-02-141-6/+9
| | | | | Avoid pointer arithmetic at the expense of repeating the enum value in the struct.
* logind: refactorLudwig Nussel2022-01-251-24/+111
| | | | | | | 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.
* units: added factory-reset.targetYegor Alexeyev2021-08-101-0/+3
|
* sleep: use SleepOperation enum everywhere and drop sleep_settings()Lennart Poettering2021-05-221-5/+5
| | | | | | | | | Instead of comparing strings everywhere, let's use the new enum. This allows us to drop sleep_settings(), since the operation enum can be directly used as index into the config settings. Some minor other refactoring is done, but mostly just shifting thing around a bit, no actual change in behaviour.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* logind: print what action is ignoredZbigniew Jędrzejewski-Szmek2020-10-101-1/+3
| | | | | | | | | | My logs have lines like this: Oct 10 09:38:38 krowka systemd-logind[1889]: External (2) displays connected. Oct 10 09:38:38 krowka systemd-logind[1889]: Refusing operation, as it is turned off. Without some hint *what* operation is ignored, this is not very informative. (I remember this came up before, but I don't remember why we didn't change this log line back then...)
* Revert "logind: remove unused check"Yu Watanabe2019-08-041-2/+6
| | | | | | This reverts commit f2330acda408a34451d5e15380fcdd225a672473. Fixes #13255.
* logind: log operation details when starting actionsZbigniew Jędrzejewski-Szmek2019-06-241-25/+24
| | | | | | | | | For some reason, systemd-logind is trying to handle idle action in one of my containers: Jun 07 10:28:08 rawhide systemd-logind[42]: System idle. Taking action. Jun 07 10:28:08 rawhide systemd-logind[42]: Requested operation not supported, ignoring. But we didn't log what exactly was being done. Let's put the name of the action in messages.
* logind: remove unused checkZbigniew Jędrzejewski-Szmek2019-06-241-6/+2
| | | | | | All callers pass either a fixed action, or HANDLE_IGNORE is explicitly filtered out. Let's remove this case here, because we cannot properly log what opreation we are ignoring.
* logind: split out dbus header files into their ownLennart Poettering2019-05-241-0/+2
| | | | | | | | | Previously, logind's logind-session.h would define prototypes for logind-session.c and logind-session-dbus.c. Split that out, so that there's a separate logind-session-dbus.h for that. Similar for seats and users as well as the manager itself. This changes no code, just rearranges where protoypes are located.
* login: do not use cast to bool for enumYu Watanabe2019-01-081-1/+1
|
* logind: voidify more thingsLennart Poettering2018-11-161-1/+1
|
* logind: when we need to execute a sleep operation we don't support, fall ↵Lennart Poettering2018-11-161-0/+8
| | | | | | | | | | back to suspend If suspend-then-hibernate, hybrid-sleep or plain hibernation is supposed to be execute due to a key press/lid switch but is not supported, automatically fall back to plain suspend (and log about it). Fixes: #10558
* tree-wide: shorten error logging a bitYu Watanabe2018-08-071-4/+2
| | | | Continuation of 4027f96aa08c73f109aa46b89842ca0e25c9c0e9.
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-3/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* Merge pull request #8700 from keszybz/hibernationLennart Poettering2018-04-111-14/+23
|\ | | | | Various improvements related to hibernation
| * logind: refuse operations if the target unit is masked or unavailableZbigniew Jędrzejewski-Szmek2018-04-101-14/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If hibernate.target is masked, and systemctl hibernate is invoked, havoc ensues. logind starts the hibernation operation, but then doesn't go through with it; gnome-shell segfaults. Let's be nice to the user and refuse doing anything in that case. $ sudo systemctl mask hibernate.target $ busctl call org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager CanHibernate s "no" $ sudo systemctl hibernate Failed to hibernate system via logind: Access denied Failed to start hibernate.target: Unit hibernate.target is masked. https://bugzilla.redhat.com/show_bug.cgi?id=1468003#c4
* | tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
|/ | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* Rename suspend-to-hibernate to suspend-then-hibernateMario Limonciello2018-03-281-6/+6
| | | | | Per some discussion with Gnome folks, they would prefer this name as it's more descriptive of what's happening.
* Introduce suspend-to-hibernate (#8274)Mario Limonciello2018-03-081-3/+10
| | | | | | | | | | | | | | Suspend to Hibernate is a new sleep method that invokes suspend for a predefined period of time before automatically waking up and hibernating the system. It's similar to HybridSleep however there isn't a performance impact on every suspend cycle. It's intended to use with systems that may have a higher power drain in their supported suspend states to prevent battery and data loss over an extended suspend cycle. Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* Rename formats-util.h to format-util.hZbigniew Jędrzejewski-Szmek2016-11-071-1/+1
| | | | | | We don't have plural in the name of any other -util files and this inconsistency trips me up every time I try to type this file name from memory. "formats-util" is even hard to pronounce.
* Revert "logind: really handle *KeyIgnoreInhibited options in logind.conf"Mantas Mikulėnas2016-08-081-1/+1
| | | | | | | | | | This reverts commit 8121f4d209eca85dcb11830800483cdfafbef9b7. The special 'key handling' inhibitors should always work regardless of any *IgnoreInhibited settings – otherwise they're nearly useless. Reverts: #3470 Fixes: #3897
* logind: minor cleanup and use IN_SET() in manager_handle_action()Franck Bui2016-06-081-1/+1
|
* logind: really handle *KeyIgnoreInhibited options in logind.confFranck Bui2016-06-081-1/+1
|
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easyLennart Poettering2015-11-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GLIB has recently started to officially support the gcc cleanup attribute in its public API, hence let's do the same for our APIs. With this patch we'll define an xyz_unrefp() call for each public xyz_unref() call, to make it easy to use inside a __attribute__((cleanup())) expression. Then, all code is ported over to make use of this. The new calls are also documented in the man pages, with examples how to use them (well, I only added docs where the _unref() call itself already had docs, and the examples, only cover sd_bus_unrefp() and sd_event_unrefp()). This also renames sd_lldp_free() to sd_lldp_unref(), since that's how we tend to call our destructors these days. Note that this defines no public macro that wraps gcc's attribute and makes it easier to use. While I think it's our duty in the library to make our stuff easy to use, I figure it's not our duty to make gcc's own features easy to use on its own. Most likely, client code which wants to make use of this should define its own: #define _cleanup_(function) __attribute__((cleanup(function))) Or similar, to make the gcc feature easier to use. Making this logic public has the benefit that we can remove three header files whose only purpose was to define these functions internally. See #2008.
* util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: move string table stuff into its own string-table.[ch]Lennart Poettering2015-10-271-5/+6
|
* util-lib: split out user/group/uid/gid calls into user-util.[ch]Lennart Poettering2015-10-261-0/+1
|
* logind: remove warn_melody() logicLennart Poettering2015-10-011-1/+0
| | | | | | | | | | The internal speaker is usually not available on modern latops that support suspend, and even if it is available in the hardware, most distributions turned support for it off in the kernel. And even if it is enabled, it's probably still a bad idea to make use of it for the suspend-failures. If anything a proper sound should be played. Long story short, let's remove support of this anachronism.
* shared: add terminal-util.[ch]Ronny Chevalier2015-04-111-0/+1
|
* shared: add process-util.[ch]Ronny Chevalier2015-04-101-0/+1
|
* shared: add formats-util.hRonny Chevalier2015-04-101-0/+1
|
* tree-wide: there is no ENOTSUP on linuxDavid Herrmann2015-03-131-1/+1
| | | | Replace ENOTSUP by EOPNOTSUPP as this is what linux actually uses.
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-231-1/+0
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* logind: add HandleLidSwitchDocked= option to logind.conf + documentationBen Wolsieffer2014-08-261-18/+0
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=82485
* logind: allow suspending if there are no displaysMantas Mikulėnas2014-05-161-5/+3
| | | | | | | | | | | With proprietary graphics drivers, there won't be any 'drm' devices in sysfs, so logind will never suspend the system upon closing the lid, even if only one (internal) display is connected. This has been reported by multiple users so far. IMHO, it's better to suspend the system in this case for safety reasons, to avoid having nvidia blob users' laptops overheat, for the same reason that sleep inhibitors are overridden (LidSwitchIgnoreInhibited=yes).
* Remove unnecessary casts in printfsZbigniew Jędrzejewski-Szmek2014-05-151-6/+6
| | | | No functional change expected :)
* logind: Do not fail display count if a device has no parentMantas Mikulėnas2014-03-111-1/+3
| | | | | | | udev_device_get_parent() may return NULL when the device doesn't have a parent, as is the case with (for example) /sys/devices/virtual/drm/ttm. Also, log an actual error message instead of "-12 displays connected".