summaryrefslogtreecommitdiff
path: root/src/login
Commit message (Collapse)AuthorAge
* Classify processes from sessions into cgroupsSven Eden2017-03-14
| | | | | | | Create a private cgroup tree associated with no controllers, and use it to map PIDs to sessions. Since we use our own path structure, remove internal cgroup-related helpers that interpret the cgroup path structure to pull out users, slices, and scopes.
* Stop sessions on ReleaseSessionSven Eden2017-03-14
|
* Uninstall the cgroup release agent when the manager is shut down.Sven Eden2017-03-14
|
* Remove src/basic/special.h, as all defines in there are systemd-only.Sven Eden2017-03-14
|
* Add poweroff, suspend etc. loginctl commandsSven Eden2017-03-14
| | | | | | | * src/login/loginctl.c: Add poweroff, reboot, suspend, hibernate, and hybrid-sleep commands. Normally these are handled by systemctl but since elogind is targeted at the no-systemd use case, we incorporate them here.
* 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.
* Create /run/systemd as neededSven Eden2017-03-14
| | | | | | | * src/login/logind.c (main): Also create /run/systemd at startup. * Create /run/systemd/machines, so that the login monitor works. * Fail if any of the needed directories could not be created. * But do not fail if any of the needed directories exist.
* Fix logind startupSven Eden2017-03-14
| | | | | | | | | | | * src/login/logind.c (manager_connect_bus): - Notice instead of error if we can't subscribe to updates from systemd. Perhaps we should remove this entirely. But leaving it optional means, that a system managed by systemd can use elogind substituting systemd-login. - Warn instead of error if we can't add receiver matches from systemd events. On a system not run by systemd, such events wouldn't occur anyway.
* Fix man page building to be less systemd and more elogind.Sven Eden2017-03-14
|
* Remove unused and invalid udev definitionsSven Eden2017-03-14
| | | | | | | | | These definitions were not valid when compiling against eudev. As a nice consequence, our own copies of any udev includes are no longer needed and could be removed for good. Add label.h include to logind.c, as "udev.h" is no longer available which would have done so otherwise.
* 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 v226: loginctl.c: Fix call to (changed) cg_is_empty_recursive().Sven Eden2017-03-14
|
* Prep v226: Apply missing fixes and changes to src/loginSven Eden2017-03-14
|
* logind: make scope of wall message handling smallerLennart Poettering2017-03-14
|
* login: fix NULL-deref on wall_messageDavid Herrmann2017-03-14
| | | | | | | | | | | | | | | We treat an empty wall-message equal to a NULL wall-message since: commit 5744f59a3ee883ef3a78214bd5236157acdc35ba Author: Lennart Poettering <lennart@poettering.net> Date: Fri Sep 4 10:34:47 2015 +0200 logind: treat an empty wall message like a NULL one Fix the shutdown scheduler to not deref a NULL pointer, but properly check for an empty wall-message. Fixes: #1120
* logind: when parsing a boolean via sd-bus the type must be "int"Lennart Poettering2017-03-14
| | | | And not bool.
* logind: treat an empty wall message like a NULL oneLennart Poettering2017-03-14
|
* logind: Listen to WMI hotkeys to catch SW_DOCK state/eventsMartin Pitt2017-03-14
| | | | | | | | | | On Dell and HP laptops the dock state/events (SW_DOCK) come from the "{Dell,HP} WMI hotkeys" input devices. Tag them as power-switch so that login actually considers them. Use a general match in case this affects other vendors, too. Thanks to Andreas Schultz for debugging this! https://launchpad.net/bugs/1450009
* login: support user-bus on dbus1David Herrmann2017-03-14
| | | | | | | | | | | | | | | | | | | | | | dbus-1.10 was just released, including systemd units to run `dbus-daemon --session` as systemd user unit. This allows using a user-bus with dbus1, just like we do per default with kdbus. All the dbus libraries have already been fixed long ago to use the user-bus as default. Hence, there's no need to set DBUS_SESSION_BUS_ADDRESS= if we use the user-bus. However, gdm and friends continue to spawn a session bus if this variable is not set (instead of checking for the existence of the user-bus). Hence, we force the user-bus, if it is available, in pam_elogind. Once gdm and friends are fixed, we can continue to drop this again. However, that might take a while. With this in place, all that is needed to make the user-bus work is: `systemctl --global enable dbus.socket` If dbus.socket is not enabled, the legacy session-bus is still used. Based on a patch by: Jan Alexander Steffens <jan.steffens@gmail.com>
* Prep v225: Applying various fixes and changes to src/login that got lost ↵Sven Eden2017-03-14
| | | | during git am transfer.
* logind: get a fresh file descriptor to clean up a VTOwen W. Taylor2017-03-14
| | | | | | | | | | | | When the controlling process exits, any existing file descriptors for that FD will be marked as hung-up and ioctls on them will file with EIO. To work around this, open a new file descriptor for the VT we want to clean up. Thanks to Ray Strode for help in sorting out the problem and coming up with a fix! https://github.com/systemd/systemd/issues/989
* logind: use open_terminal() instead of open()Owen W. Taylor2017-03-14
| | | | | | | | | | | The open_terminal() function adds retries in case a terminal is in the process of being closed when we open it, and should generally be used to open a terminal. We especially need it for code that a subsequent commit adds that reopens the terminal at session shut-down time; such races would be more likely in that case. Found by Ray Strode.
* logind: actually fail on OOMThomas Hindoe Paaboel Andersen2017-03-14
| | | | | | | | | | | | | | | Since dacd6cee76a08331b8c8616c5f30f70ee49aa2f9 the two OOM's are ignored as the value of r will be overwritten and we only log in the fail section anyway. This patch jumps to fail on OOM. Note that this is different behavior compared to both the current code and previous to dacd6cee76a08331b8c8616c5f30f70ee49aa2f9. Before that commit we would log that saving the inhibit data failed, but still write the file, though without the WHO/WHY section. CID# 1313545
* logind: add standard gpio power button supportKefeng Wang2017-03-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many boards like hisilicon D02 board use standard gpio key to power down system. A description of gpio-key in dts shown below, gpio_keys { compatible = "gpio-keys"; #address-cells = <1>; #size-cells = <0>; pwrbutton { label = "Power Button"; gpios = <&porta 8 1>; linux,code = <116>; // KEY_POWER, used by SC System Power Down }; }; -bash-4.3# udevadm info -a /dev/input/event3 Udevadm info starts with the device specified by the devpath and then walks up the chain of parent devices. It prints for every device found, all possible attributes in the udev rules key format. A rule to match, can be composed by the attributes of the device and the attributes from one single parent device. looking at device '/devices/platform/gpio_keys/input/input3/event3': KERNEL=="event3" SUBSYSTEM=="input" DRIVER=="" looking at parent device '/devices/platform/gpio_keys/input/input3': KERNELS=="input3" SUBSYSTEMS=="input" DRIVERS=="" ATTRS{name}=="gpio_keys" ATTRS{phys}=="gpio-keys/input0" ATTRS{uniq}=="" ATTRS{properties}=="0" looking at parent device '/devices/platform/gpio_keys': KERNELS=="gpio_keys" SUBSYSTEMS=="platform" DRIVERS=="gpio-keys" ATTRS{keys}=="116" ATTRS{switches}=="" ATTRS{driver_override}=="(null)" ATTRS{disabled_keys}=="" ATTRS{disabled_switches}=="" looking at parent device '/devices/platform': KERNELS=="platform" SUBSYSTEMS=="" DRIVERS==""
* Prep v222: Update build system:Sven Eden2017-03-14
| | | | | | | | - The content of the man pages directory has been overhauled - Makefile-man.am was regenerated - Makefile.am and configure.ac needed a few addtitions and fixes - Some masked functions had to be unmasked - Now superfluous files have been removed
* Prep v221: Some more cleanup and a few fixesSven Eden2017-03-14
| | | | | | | | | The files - src/core/org.freedesktop.systemd.policy.in.in and - src/core/systemd.pc.in have been deleted as they are not needed. The other changes are some minor fixes.
* Prep v221: Update and clean up build system to sync with upstreamSven Eden2017-03-14
| | | | | | | | | | | | | | This commit replays the moving around of source files that have been done between systemd-219 and systemd-221. Further the Makefile.am is synchronized with the upstream version and then "re-cleaned". A lot of functions, that are not used anywhere in elogind have been coated into #if 0/#endif directives to further shorten the list of dependencies. All unneeded files have been removed.
* Prep v220: Apply "Fixes to user and session saving"Sven Eden2017-03-14
|
* Prep v220: elogind does not need to register with systemd1.*Sven Eden2017-03-14
|
* Prep v220: Update src/login/org.freedesktop.login1.conf to the most recent ↵Sven Eden2017-03-14
| | | | version.
* 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.
* Classify processes from sessions into cgroupsAndy Wingo2017-03-14
| | | | | | | Create a private cgroup tree associated with no controllers, and use it to map PIDs to sessions. Since we use our own path structure, remove internal cgroup-related helpers that interpret the cgroup path structure to pull out users, slices, and scopes.
* Stop sessions on ReleaseSessionAndy Wingo2017-03-14
|
* Fix the login monitorAndy Wingo2017-03-14
| | | | | | * src/login/logind.c (main): Create /run/systemd/machines, so that the login monitor works. * configure.ac: v219.10.
* 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 :)
* Actually working with pamAndy Wingo2017-03-14
| | | | | | | | | | * src/login/logind-user.c (user_start): Don't start slices and systemd-user services. * src/login/logind-dbus.c (method_create_session): Send a reply directly instead of waiting on systemd that isn't there. * configure.ac: Bump version.
* Create /run/systemd as neededAndy Wingo2017-03-14
| | | | | * src/login/logind.c (main): Also create /run/systemd at startup. * configure.ac: Bump to 219.3.
* logind: release VT-positions when closing sessionsDavid Herrmann2017-03-14
| | | | | | | | | Make sure we release VT-positions when a session is closed. Otherwise, lingering sessions will occupy VTs and prevent next logins from succeeding. Note that we already release session-devices when closing a session, so there cannot be anyone using the VT anymore.
* logind: fix write_string_file() falloutDaniel Mack2017-03-14
| | | | | | | | WRITE_STRING_FILE_ATOMIC is only valid if WRITE_STRING_FILE_CREATE is also given. IOW, an atomic file write operation is only possible when creating a file is also being asked for. This is a regression from the recent write_string_file() rework.
* logind: never select closing sessions for a VTDavid Herrmann2017-03-14
| | | | | | | If a session is in closing state (and already got rid of its VT), then never re-select it for that VT. There is no reason why we should grant something to a session that is already going away *AND* already got rid of exactly that.
* logind: prefer new sessions over older ones on VT switchesDavid Herrmann2017-03-14
| | | | | | | | | | | | | | | | | | Our seat->positions[] array keeps track of the 'preferred' session on a VT. The only situation this is used, is to select the session to activate when a VT is activated. In the normal case, there's only one session per VT so the selection is trivial. Older greeters, however, implement take-overs when they start sessions on the same VT that the greeter ran on. We recently limited such take-overs to VTs where a greeter is running on, to force people to never share VTs in new code that is written. For legacy reasons, we need to be compatible to old greeters, though. Hence, we allow those greeters to implement take-over. In such take-overs, however, we should really make sure that the new sessions gets preferred over the old one under all circumstances. Hence, make sure we override the previous preferred session with a new session.
* logind: bring bus policy up-to-dateLennart Poettering2017-03-14
| | | | | | | | | | | | | A while back we opened up all of logind's bus calls to unprivileged users, via PK. However, the dbus1 policy wasn't updated accordingly. With this change, the dbus1 policy is opened up for all bus calls that should be available to unprivileged clients. (also rearranges some calls in the vtable, to make more sense, and be in line with the order in the bus policy file) Fixes #471.