summaryrefslogtreecommitdiff
path: root/src/login/logind.h
Commit message (Collapse)AuthorAge
* Prep v239: Add support for the new 'suspend-then-hibernate' method.Sven Eden2018-08-24
|
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-08-24
| | | | | | | | | | | 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-08-24
| | | | | | | | | | | | | | | | 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.
* logind: let's change the type of the runtime directory size to uint64_tLennart Poettering2018-08-24
| | | | | | | Externally it's an uint64_t anyway, and internally we most just initialize it to physical_memory() which returns uint64_t, hence there's exactly zero value in using it as size_t internally. Hence, let's fix that, and use uint64_t everywhere.
* tree-wide: port over all code to the new CONFIG_PARSER_PROTOTYPE() macroLennart Poettering2018-08-24
| | | | | | | | | | | This makes most header files easier to look at. Also Emacs gets really slow when browsing through large sections of overly long prototypes, which is much improved by this macro. We should probably not do something similar with too many other cases, as macros like this might help readability for some, but make it worse for others. But I think given the complexity of this specific prototype and how often we use it, it's worth doing.
* logind: remove manager_start_slice()Zbigniew Jędrzejewski-Szmek2018-08-24
| | | | It is now unused.
* Use a dash-truncated drop-in for user-%j.slice configurationZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | | | | | | | | | | This removes the UserTasksMax= setting in logind.conf. Instead, the generic TasksMax= setting on the slice should be used. Instead of a transient unit we use a drop-in to tweak the default definition of a .slice. It's better to use the normal unit mechanisms instead of creating units on the fly. This will also make it easier to start user@.service independently of logind, or set additional settings like MemoryMax= for user slices. The setting in logind is removed, because otherwise we would have two sources of "truth": the slice on disk and the logind config. Instead of trying to coordinate those two sources of configuration (and maintainer overrides to both), let's just convert to the new one fully. Right now now automatic transition mechanism is provided. logind will emit a hint when it encounters the setting, but otherwise it will be ignored. Fixes #2556.
* logind: move two functions to logind_core utility libZbigniew Jędrzejewski-Szmek2018-08-24
| | | | In preparation to reusing them later in other places...
* logind: enable limiting of user session scopes using pam context objects (#8397)Jan Synacek2018-08-24
|
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | 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.
* Suspend on lid close based on power status. (#8016)Simon Fowler2018-05-30
| | | | | | | | This change adds support for controlling the suspend-on-lid-close behaviour based on the power status as well as whether the machine is docked or has an external monitor. For backwards compatibility the new configuration file variable is ignored completely by default, and must be set explicitly before being considered in any decisions.
* Prep v236 : Add missing SPDX-License-Identifier (5/9) src/loginSven Eden2018-03-26
|
* v235: Added missing updatesSven Eden2017-11-19
|
* logind: VT_GETSTATE "cannot return state for more than 16 VTs" (#6625)Alan Jenkins2017-09-25
| | | | | `vt_is_busy(16)` would always return FALSE. So we could have started autovt@16.service even when VT 16 was already being used for something.
* build-sys: add check for gperf lookup function signature (#5055)Mike Gilbert2017-07-17
| | | | | | | gperf-3.1 generates lookup functions that take a size_t length parameter instead of unsigned int. Test for this at configure time. Fixes: https://github.com/elogind/elogind/issues/5039
* Prep v231: Move elogind specific code in login/logind.c to login/elogind.cSven Eden2017-06-16
|
* logind: change TasksMax= value for user logins to 33%Lennart Poettering2017-06-16
| | | | | | | | | | | | | | | | | | | | Let's change from a fixed value of 12288 tasks per user to a relative value of 33%, which with the kernel's default of 32768 translates to 10813. This is a slight decrease of the limit, for no other reason than "33%" sounding like a nice round number that is close enough to 12288 (which would translate to 37.5%). (Well, it also has the nice effect of still leaving a bit of room in the PID space if there are 3 cooperating evil users that try to consume all PIDs... Also, I like my bikesheds blue). Since the new value is taken relative, and machined's TasksMax= setting defaults to 16384, 33% inside of containers is usually equivalent to 5406, which should still be ample space. To summarize: | on the host | in the container old default | 12288 | 12288 new default | 10813 | 5406
* Prep v230: Add utmp support to make wall message to work properly.Sven Eden2017-06-16
|
* Prep v230: Apply missing upstream fixes and updates (6/8) src/login.Sven Eden2017-06-16
|
* logind: enforce a limit on inhibitors we hand outLennart Poettering2017-06-16
| | | | | | | | For similar reasons as the recent addition of a limit on sessions. Note that we don't enforce a limit on inhibitors per-user currently, but there's an implicit one, since each inhibitor takes up one fd, and fds are limited via RLIMIT_NOFILE, and the limit on the number of processes per user.
* logind: enforce a limit on current user sessionsLennart Poettering2017-06-16
| | | | | | | | | | | We really should put limits on all resources we manage, hence add one to the number of concurrent sessions, too. This was previously unbounded, hence set a relatively high limit of 8K by default. Note that most PAM setups will actually invoke pam_elogind prefixed with "-", so that the return code of pam_elogind is ignored, and the login attempt succeeds anyway. On systems like this the session will be created but is not tracked by elogind.
* Prep v229: Consolidate system sleep functions.Sven Eden2017-05-22
| | | | | | Move sleep relevant functions from shared/sleep-config.* and login/logind-action.* into login/logind-sleep.* - they aren't used outside of elogind anyway.
* tree-wide: remove Emacs lines from all filesDaniel Mack2017-05-17
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* Prep v228: Condense elogind source masks (5/5)Sven Eden2017-04-26
|
* Prep v228: Substitute declaration masks (4/4)Sven Eden2017-04-26
|
* Prep v228: Removed utmp bits. elogind does not support utmp-wtmp.Sven Eden2017-04-26
|
* Prep v228: Add remaining updates from upstream (3/3)Sven Eden2017-04-26
| | | | | Apply remaining fixes and the performed move of utility functions into their own foo-util.[hc] files on the rest of elogind.
* Major cleanup of all leftovers after rebasing on master.Sven Eden2017-03-14
| | | | | | | | The patching of elogind in several steps with only partly rebasing on a common commit with upstream, left the tree in a state, that was unmergeable with master. By rebasing on master and manually cleaning up all commits, this merge is now possible. However, this process left some orphans, that are cleanup now.
* Cleaned up more unneeded functions and types in:Sven Eden2017-03-14
| | | | | | | | | | | | | | | | | | | | - src/basic/ioprio.h - removed - src/basic/ring.h - removed - src/basic/capability.[hc] - cleaned - src/basic/cgroup-util.[hc] - cleaned - src/basic/hostname-util.[hc] - cleaned - src/basic/path-util.[hc] - cleaned - src/basic/socket-util.h - cleaned - src/basic/strv.[hc] - cleaned - src/basic/time-util.[hc] - cleaned - src/basic/unit-name.[hc] - cleaned - src/basic/util.[hc] - cleaned - src/libelogind/sd-bus/bus-introspect.c - cleaned - src/login/loginctl.c - cleaned - src/login/logind-dbus.c - cleaned - src/login/logind.h - cleaned - src/shared/conf-parser.[hc] - cleaned
* Incorporate sleep.conf into logind.confSven Eden2017-03-14
| | | | | | | | | | | | | | | | | * src/login/logind-action.c (shutdown_or_sleep, do_sleep): Take modes from the manager instead of parsing them ourselves. * src/login/logind-dbus.c (execute_shutdown_or_sleep): Adapt to shutdown_or_sleep prototype change. * src/login/logind-gperf.gperf: Add config items from sleep.conf. * src/login/logind.c (manager_new): Wire up defaults for new config items. (manager_free): Free new config items. (manager_parse_config_file): Arrange to parse a single elogind/logind.conf file, not grovelling all over the filesystem. Take the file from the ELOGIND_CONF_FILE environment variable if present.
* Handle suspend, shutdown, reboot, etc within elogindSven Eden2017-03-14
| | | | | | | | | | | | | | | | | Since we are catching the keys, we might as well just do suspend/reboot/etc handling here. * configure.ac: Get paths of halt and reboot. * Makefile.am (systemsleepdir, systemshutdowndir): New variables. Look in them for hooks to run. * src/login/logind-action.c: Inline the salient bits from systemd's sleep/sleep.c here. * src/login/logind-dbus.c (execute_shutdown_or_sleep): Call our own shutdown_or_sleep helper instead of invoking a systemd method. * src/login/logind-action.h: Declare shutdown_or_sleep.
* Remove support for auto-spawning VTsSven Eden2017-03-14
| | | | | Auto-spawning VTs requires systemd in practice. If you're using systemd you can just use its logind :)
* Remove dependency of systemd units, services and slices for new sessions.Sven Eden2017-03-14
| | | | | | | | | | | | | | | | | | | | * elogind does not support systemd services and units. But at least the units are needed to support the systemd cgroup slice/scope system. * Remove systemd subscription to scope, service and slice jobs. These can not be supported in any way, as they depend on systemd running the machine. * The functions session_start_scope(), user_start_service() and user_start_slice() no longer try to call systemd via dbus for assistance. This way they generate their proper scope, service and slice names, and store them in the Managers HashMaps for session and user units. This should enable us to reverse track pids to users and such stuff, as that is what systemd-logind does, not knowing whether any unit *really* has been started or not. However, this will not work out of the box until we find a way to integrate cg_create_everywhere() into elogind without becoming dependent of systemd unit, service and job knowledge again.
* [Patch 3/3] Add cgroups initialization and handlingSven Eden2017-03-14
| | | | | Let elogind setup cgroups support on its manager initialization and free the cgroups subsystem when the manager is destroyed.
* Fix lookup_errno by adding a gperf length parameter detection.Sven Eden2017-03-14
| | | | | | | | | build-sys: add check for gperf lookup function signature (#5055) gperf-3.1 generates lookup functions that take a size_t length parameter instead of unsigned int. Test for this at configure time. Fixes: https://github.com/systemd/systemd/issues/5039
* Prep 4xx6: Fix logind_gperf_lookup declarationSven Eden2017-03-14
|
* Prep v225: Applying various fixes and changes to src/login that got lost ↵Sven Eden2017-03-14
| | | | during git am transfer.
* Prep v220: Use new cgroups functionsSven Eden2017-03-14
| | | | | Prep v220: Update logind and loginctl to upstream version. Prep v220: src/shared/rm-rf.c does not need to be able to handle btrfs subvolumes for elogind.
* Handle suspend/hibernate/hybrid-suspend/shutdown/reboot directlyAndy Wingo2017-03-14
| | | | | | | | | | | | | | * configure.ac: Get paths of halt and reboot. * Makefile.am (systemsleepdir, systemshutdowndir): New variables. Look in them for hooks to run. * src/login/logind-action.c: Inline the salient bits from systemd's system-sleep.c here. * src/login/logind-dbus.c (execute_shutdown_or_sleep): Call our own shutdown_or_sleep helper instead of invoking a systemd method. * src/login/logind.h: Declare shutdown_or_sleep.
* Beginnings of handling suspend/etc within logindAndy Wingo2017-03-14
| | | | | Since we are catching the keys, we might as well just do suspend/reboot/etc handling here.
* Remove systemd subscription and user/session unitsAndy Wingo2017-03-14
| | | | | | This removes attempts by logind to listen to systemd messages over the bus, and to start and/or manage units associated with sessions and users.
* Remove support for auto-spawning VTsAndy Wingo2017-03-14
| | | | | Auto-spawning VTs requires systemd in practice. If you're using systemd you can just use its logind :)
* logind: rework display counting when detecting whether the system is dockedLennart Poettering2017-03-14
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we'd just count connected displays, and if there was 2 or more we assumed a "docked" state. With this change we now: - Only count external displays, ignore internal ones (which we detect by checking the connector name against a whitelist of known external plug types) - We ignore connectors which are explicitly disabled - We then compare the count with >= 1 rather than >= 2 as before This new logic has the benefit that systems that disconnect the internal display when the lid is closed are better supported. Also, explicitly disabled ports do not confuse the algorithm anymore. This new algorithm has been suggested here: http://lists.freedesktop.org/archives/intel-gfx/2015-June/068821.html This also makes two functions static, that are not used outside of their .c files.
* logind: fix delayed execution regressionDaniel Mack2017-03-14
| | | | | | | | | | | | | | | Commit c0f32805 ("logind: use sd_event timer source for inhibitor logic") reworked the main loop logic of logind so that it uses a real timeout callback handler to execute delayed functions. What the old code did, however, was to call those functions on every iteration in the main loop, not only when the timeout expired. Restore that behavior by bringing back manager_dispatch_delayed(), and call it from manager_run(). The internal event source callback manager_inhibit_timeout_handler() was turned into a wrapper of manager_dispatch_delayed() now.
* sd-bus: drop bus parameter from message callback prototypeLennart Poettering2017-03-14
| | | | | | This should simplify the prototype a bit. The bus parameter is redundant in most cases, and in the few where it matters it can be derived from the message via sd_bus_message_get_bus().
* logind: add support for /run/nologin and /run/systemd/shutdown/scheduledDaniel Mack2017-03-14
| | | | | | Port over more code from shutdownd and teach logind to write /run/nologin at least 5 minutes before the system is going down, and /run/systemd/shutdown/scheduled when a shutdown is scheduled.
* logind: add code for UTMP wall messagesDaniel Mack2017-03-14
| | | | | | | | | | | | | | Add a timer to print UTMP wall messages so that it repeatedly informs users about a scheduled shutdown: * every 1 minute with less than 10 minutes to go * every 15 minutes with less than 60 minutes to go * every 30 minutes with less than 180 minutes (3 hours) to go * every 60 minutes if more than that to go This functionality only active if the .EnableWallMessages DBus property is set to true. Also, a custom string can be added to the wall message, set through the WallMessagePrefix property.
* logind: add .ScheduleShutdown and .CancelScheduledShutdown methodsDaniel Mack2017-03-14
| | | | | | | | | | | | | | | | | | | Add a method called ScheduleShutdown in org.freedesktop.login1.Manager which adds a timer to shut down the system at a later point in time. The first argument holds the type of the schedule that is about to happen, and must be one of 'reboot', 'halt' or 'poweroff'. The second argument specifies the absolute time, based on CLOCK_REALTIME in nanoseconds, at which the the operation should be executed. To cancel a previously scheduled shutdown, the CancelScheduledShutdown() can be called, which returns a bool, indicating whether a scheduled timeout was cancelled. Also add a new property called ScheduledShutdown which returns the equivalent to what was passed in via ScheduleShutdown, as '(st)' type.
* logind: make local functions staticDaniel Mack2017-03-14
| | | | | make manager_gc(), manager_startup(), manager_new(), manager_free() and manager_run() static, and kill their forward declarations.
* logind: use sd_event timer source for inhibitor logicDaniel Mack2017-03-14
| | | | | | | | Instead of open-coding the delayed action and inhibit timeout logic, switch over to a real sd_event_source based implementation. This is not only easier to read but also allows us to add more timers in the future.