Systemd/src
David Herrmann ab60f2ffb1 logind: make Session.Activate() lazy
Currently, Activate() calls chvt(), which does an ioctl(VT_ACTIVATE) and
immediately calls seat_set_active(). However, VTs are allowed to prevent
being deactivated. Therefore, logind cannot be sure the VT_ACTIVATE call
was actually successful.

Furthermore, compositors often need to clean up their devices before they
acknowledge the VT switch. The immediate call to seat_set_active() may
modify underlying ACLs, though. Thus, some compositors may fail cleaning
up their stuff. Moreover, the compositor being switched to (if listening
to logind instead of VTs) will not be able to activate its devices if the
old VT still has them active.

We could simply add an VT_WAITACTIVE call, which blocks until the given VT
is active. However, this can block forever if the compositor hangs.

So to fix this, we make Activate() lazy. That is, it only schedules a
session-switch but does not wait for it to complete. The caller can no
longer rely on it being immediate. Instead, a caller is required to wait
for the PropertiesChanged signal and read the "Active" field.

We could make Activate() wait asynchronously for the session-switch to
complete and then send the return-message afterwards. However, this would
add a lot of state-tracking with no real gain:
 1) Sessions normally don't care whether Activate() was actually
    successful as they currently _must_ wait for the VT activation to do
    anything for real.
 2) Error messages for failed session switches can be printed by logind
    instead of the session issuing Activate().
 3) Sessions that require synchronous Activate() calls can simply issue
    the call and then wait for "Active" properties to change. This also
    allows them to implement their own timeout.

This change prepares for multi-session on seats without VTs. Forced VT
switches are always bad as compositors cannot perform any cleanup. This
isn't strictly required, but may lead to loss of information and ambiguous
error messages.
So for multi-session on seats without VTs, we must wait for the current
session to clean-up before finalizing the session-switch. This requires
Activate() to be lazy as we cannot block here.

Note that we can always implement a timeout which allows us to guarantee
the session switch to happen. Nevertheless, this calls for a lazy
Activate().
2013-09-17 11:33:18 -05:00
..
ac-power unit: add ConditionACPower= 2012-12-31 21:24:26 +01:00
activate replace tabs with spaces in various files 2013-07-02 23:06:22 -04:00
analyze systemctl: move set-log-level to systemd-analyze 2013-07-26 16:59:55 +02:00
ask-password util: rename parse_usec() to parse_sec() sinds the default unit is seconds 2013-04-03 20:12:57 +02:00
backlight backlight: instead of syspath use sysname for identifying backlight devices 2013-08-14 02:55:57 +02:00
binfmt fileio: in envfiles, do not skip lines following empty lines 2013-04-13 20:24:39 -04:00
boot bootctl: fix help text 2013-03-29 15:47:43 +01:00
bootchart bootchart: remove +x permissions on .c file 2013-08-14 21:47:38 -04:00
cgls logind: add infrastructure to keep track of machines, and move to slices 2013-06-20 03:49:59 +02:00
cgroups-agent cgroups-agent: remove ancient fallback code; turn connection error into warning 2013-07-04 20:54:40 +02:00
cgtop cgtop: fixup the online help 2013-09-04 15:02:06 +02:00
core Make tmpdir removal asynchronous 2013-09-17 10:26:30 -05:00
cryptsetup cryptsetup-generator: allow specifying options in /proc/cmdline 2013-09-13 11:52:14 +02:00
delta systemd-delta: Only print colors when on a tty 2013-08-04 08:33:02 -04:00
detect-virt build-sys: drop all distribution specfic checks 2013-01-04 23:26:21 +01:00
efi-boot-generator Standarize on one spelling of symlink error message 2013-04-24 00:25:04 -04:00
fsck Do no isolate in case of emergency or severe problems 2013-04-01 23:43:48 -04:00
fstab-generator swap: create .wants symlink to 'auto' swap devices 2013-09-16 01:11:52 +02:00
getty-generator getty-generator: Enable getty on all active serial consoles. 2013-09-12 08:34:30 -04:00
gpt-auto-generator Rename F_TYPE_CMP() to F_TYPE_EQUAL() 2013-08-20 21:18:43 -04:00
gudev licence: remove references to old FSF address 2012-12-17 11:41:31 +01:00
hostname Allow tabs in environment files 2013-09-11 21:58:22 -04:00
initctl journald: be a bit more verbose when vacuuming 2013-09-10 08:27:30 -04:00
journal journald: Log error when failed to get machine-id on start 2013-09-12 18:19:16 +02:00
kernel-install kernel-install/90-loaderentry.install: do not fail for missing initrd 2013-07-11 13:43:35 +02:00
libsystemd-bus remove hasprefix(), use startswith() 2013-08-22 00:52:14 -04:00
libsystemd-daemon Include <fcntl.h> instead of <sys/fcntl.h> 2013-04-13 21:02:03 -04:00
libsystemd-id128 id128: when taking user input for a 128bit ID, validate syntax 2013-04-30 08:36:01 -03:00
libudev libudev: fix move_later comparison 2013-09-13 15:36:08 +02:00
locale Add /usr/share/keymaps to localectl supported locations. 2013-08-01 00:09:58 +02:00
login logind: make Session.Activate() lazy 2013-09-17 11:33:18 -05:00
machine logind: update the session state file before we send out the CreateSession() reply 2013-07-26 19:03:54 +02:00
machine-id-setup build-sys: drop all distribution specfic checks 2013-01-04 23:26:21 +01:00
modules-load move _cleanup_ attribute in front of the type 2013-04-18 09:11:22 +02:00
notify core: add new "scope" unit type for making a unit of pre-existing processes 2013-07-01 00:18:00 +02:00
nspawn nspawn: trivial simplification 2013-08-23 12:48:14 -04:00
nss-myhostname build-sys: add makefile stub link to nss-myhostname/ 2013-04-30 08:36:02 -03:00
python-systemd systemd-python: check for oom, give nicer error messages 2013-08-15 12:59:36 -04:00
quotacheck quota: use QUOTACHECK path correctly as tested in configure.ac 2013-05-06 21:15:38 +02:00
random-seed random-seed: we should return errno of failed loop_write 2013-09-13 14:32:14 +02:00
rc-local-generator Standarize on one spelling of symlink error message 2013-04-24 00:25:04 -04:00
readahead Rename F_TYPE_CMP() to F_TYPE_EQUAL() 2013-08-20 21:18:43 -04:00
remount-fs Use initalization instead of explicit zeroing 2013-04-05 19:50:57 -04:00
reply-password Use initalization instead of explicit zeroing 2013-04-05 19:50:57 -04:00
run Fix two compiler warnings 2013-09-09 17:35:52 -04:00
shared specifier: rework specifier calls to return proper error message 2013-09-17 10:06:50 -05:00
shutdownd Add __attribute__((const, pure, format)) in various places 2013-05-02 22:52:09 -04:00
sleep systemd-sleep: add support for freeze and standby 2013-05-06 22:51:57 +02:00
stdio-bridge bus: add APIs for negotiating what is attached to messages 2013-05-17 04:26:27 +02:00
sysctl sysctl: allow overwriting of values specified in "later" files 2013-08-15 18:43:31 +02:00
system-update-generator Standarize on one spelling of symlink error message 2013-04-24 00:25:04 -04:00
systemctl shut up gcc complaining about freeing a const variable 2013-09-12 23:37:23 +02:00
systemd sd-login: add a public accessor for the VT number 2013-09-11 19:08:20 +02:00
test tmpfiles: support simple specifier expansion for specified paths 2013-09-17 11:02:54 -05:00
timedate man: improve grammar and word formatting in numerous man pages 2013-07-02 23:06:22 -04:00
tmpfiles tmpfiles: support simple specifier expansion for specified paths 2013-09-17 11:02:54 -05:00
tty-ask-password-agent conf-parser: restrict .include usage 2013-04-25 00:05:14 -03:00
udev udev-rules: avoid erroring on trailing whitespace 2013-09-16 11:46:05 -04:00
update-utmp utmp: turn systemd-update-utmp-shutdown.service into a normal runtime service 2013-05-16 00:19:03 +02:00
vconsole move _cleanup_ attribute in front of the type 2013-04-18 09:11:22 +02:00
.gitignore Add test coverage and generate report with lcov 2013-07-13 21:56:33 -04:00
Makefile relicense to LGPLv2.1 (with exceptions) 2012-04-12 00:24:39 +02:00