Commit graph

12149 commits

Author SHA1 Message Date
Sebastian Ott dd8b2bf433 udev: path_id - fix by-path link generation for scm devices
Set some_transport = true to prevent scm devices from being ignored.

Suggested-by: Harald Hoyer <harald@redhat.com>
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
2013-09-17 13:53:58 -05:00
David Herrmann bf7825ae69 logind: extract has_vts() from can_multi_session()
We currently use seat_can_multi_session() to test for two things:
 * whether the seat can handle session-switching
 * whether the seat has VTs

As both are currently logically equivalent, we didn't care. However, we
want to allow session-switching on seats without VTs, so split this helper
into:
 * seat_can_multi_session(): whether session-switching is supported
 * seat_has_vts(): whether the seat has VTs

Note that only one seat on a system can have VTs. There is only one set of
them. We automatically assign them to seat0 as usual.

With this patch in place, we can easily add new session-switching/tracking
methods without breaking any VT code as it is now protected by has_vts(),
no longer by can_multi_session().
2013-09-17 13:49:24 -05:00
David Herrmann 9209d5121d logind: fix session_activate(vtnr = 0)
VT numbers start with 1. If a session has vtnr == 0, we must not assume it
is running on a VT.
Note that this could trigger the assert() below as CreateSession() sets
vtnr to 0, not <0.
2013-09-17 13:48:41 -05:00
David Herrmann 20e1bd9d1b logind: fix seat_can_tty() to check for VTs
A seat provides text-logins if it has VTs. This is always limited to seat0
so the seat_is_seat0() check is correct. However, if VTs are disabled, no
seat provides text-logins so we also need to check for the console-fd.

This was previously:
  return seat_is_vtconsole();
It looked right, but was functionally equivalent to seat_is_seat0(). The
rename of this helper made it more obvious that it is missing the VT test.
2013-09-17 13:48:23 -05:00
David Herrmann 92432fcc7f logind: rename vtconsole to seat0
The seat->vtconsole member always points to the default seat seat0. Even
if VTs are disabled, it's used as default seat. Therefore, rename it to
seat0 to correctly state what it is.

This also changes the seat files in /run from IS_VTCONSOLE to IS_SEAT0. It
wasn't used by any code, yet, so this seems fine.

While we are at it, we also remove every "if (s->vtconsole)" as this
pointer is always valid!
2013-09-17 13:47:19 -05:00
Lennart Poettering 3331234adc nspawn: update unit file
ControlGroup= is obsolete, so let's drop it from the default nspawn unit
file.
2013-09-17 11:59:47 -05:00
Lennart Poettering e58ae41037 update TODO 2013-09-17 11:59:41 -05:00
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
David Herrmann ae5e06bda2 logind: add session controllers
A session usually has only a single compositor or other application that
controls graphics and input devices on it. To avoid multiple applications
from hijacking each other's devices or even using the devices in parallel,
we add session controllers.

A session controller is an application that manages a session. Specific
API calls may be limited to controllers to avoid others from getting
unprivileged access to restricted resources. A session becomes a
controller by calling the RequestControl() dbus API call. It can drop it
via ReleaseControl().

logind tracks bus-names to release the controller once an application
closes the bus. We use the new bus-name tracking to do that. Note that
during ReleaseControl() we need to check whether some other session also
tracks the name before we remove it from the bus-name tracking list.

Currently, we only allow one controller at a time. However, the public API
does not enforce this restriction. So if it makes sense, we can allow
multiple controllers in parallel later. Or we can add a "scope" parameter,
which allows a different controller for graphics-devices, sound-devices
and whatever you want.
Note that currently you get -EBUSY if there is already a controller. You
can force the RequestControl() call (root-only) to drop the current
controller and recover the session during an emergency. To recover a seat,
this is not needed, though. You can simply create a new session or
force-activate it.

To become a session controller, a dbus caller must either be root or the
same user as the user of the session. This allows us to run a session
compositor as user and we no longer need any CAP_SYS_ADMIN.
2013-09-17 11:33:18 -05:00
David Herrmann e8b212fe56 logind: add infrastructure to watch busnames
If we want to track bus-names to allow exclusive resource-access, we need
a way to get notified when a bus-name is gone. We make logind watch for
NameOwnerChanged dbus events and check whether the name is currently
watched. If it is, we remove it from the watch-list (notification for
other objects can be added in follow-up patches).
2013-09-17 11:30:44 -05:00
David Herrmann 718d006a63 logind: listen actively for session devices
Session compositors need access to fbdev, DRM and evdev devices if they
control a session. To make logind pass them to sessions, we need to
listen for them actively.

However, we avoid creating new seats for non master-of-seat devices. Only
once a seat is created, we start remembering all other session devices. If
the last master-device is removed (even if there are other non-master
devices still available), we destroy the seat. This is the current
behavior, but we need to explicitly implement it now as there may be
non-master devices in the seat->devices list.

Unlike master devices, we don't care whether our list of non-master
devices is complete. We don't export this list but use it only as cache if
sessions request these devices. Hence, if a session requests a device that
is not in the list, we will simply look it up. However, once a session
requested a device, we must be notified of "remove" udev events. So we
must link the devices somehow into the device-list.

Regarding the implementation, we now sort the device list by the "master"
flag. This guarantees that master devices are at the front and non-master
devices at the tail of the list. Thus, we can easily test whether a seat
has a master device attached.
2013-09-17 11:15:29 -05:00
Lennart Poettering 1731e34a4e tmpfiles: support simple specifier expansion for specified paths 2013-09-17 11:02:54 -05:00
Zbigniew Jędrzejewski-Szmek f485606bf8 Make tmpdir removal asynchronous
https://bugs.freedesktop.org/show_bug.cgi?id=68232
2013-09-17 10:26:30 -05:00
Zbigniew Jędrzejewski-Szmek 43638332c4 man: add a list of environment variables 2013-09-17 10:26:30 -05:00
Lennart Poettering 19f6d71077 specifier: rework specifier calls to return proper error message
Previously the specifier calls could only indicate OOM by returning
NULL. With this change they will return negative errno-style error codes
like everything else.
2013-09-17 10:06:50 -05:00
Lennart Poettering 0aafd43d23 update TODO 2013-09-17 10:06:50 -05:00
Dave Reisner 328b5bc96e Add YouCompleteMe configuration 2013-09-16 19:10:03 -04:00
David Strauss d2e2c03d87 TODO spelling fix. 2013-09-16 17:40:00 -05:00
Martin Pitt 6e1452d6f0 keymap: Add Samsung Series 5 [Ultra]
Also consolidate the wlan key into the "all Samsung" rule to avoid repetition.

Thanks to Mauro Carvalho Chehab!

https://bugzilla.redhat.com/show_bug.cgi?id=989103
2013-09-16 14:25:44 -05:00
Zbigniew Jędrzejewski-Szmek 35375afec5 login: fix login_is_valid test 2013-09-16 11:10:55 -05:00
Dave Reisner 3cf0f8f7e0 udev-rules: avoid erroring on trailing whitespace
https://bugs.archlinux.org/task/36950
2013-09-16 11:46:05 -04:00
David Herrmann d8c8508bad build: check for build/link flags harder
Use AC_LINK_IFELSE instead of AC_COMPILE_IFELSE to test for flags that
might succeed during compilation but not during linking. An example is gcc
compiled with libssp support but gnu-ld without it. In this case
-fstack-protector works fine during compilation but fails during linking
as several internal helpers are missing.
2013-09-16 09:59:16 -05:00
Zbigniew Jędrzejewski-Szmek 4b549144d8 Verify validity of session name when received from outside
Only ASCII letters and digits are allowed.
2013-09-16 09:58:37 -05:00
Zbigniew Jędrzejewski-Szmek 1244d8d640 transaction.c: do not point users to logs when unit not found
The logs are unlikely to contain any useful information in this case.

Also, change "walked on cycle path" to "found dependency on", which
is less technical and indicates the direction. With the old message,
I was never sure if prior units depended on later ones, or vice versa.

https://bugzilla.redhat.com/show_bug.cgi?id=996133
https://bugzilla.redhat.com/show_bug.cgi?id=997082
2013-09-16 09:47:28 -05:00
Zbigniew Jędrzejewski-Szmek c32fc72f37 Remove duplicate entries from syscall list
ARM syscall list includes SYS_OABI_SYSCALL_BASE and SYS_SYSCALL_BASE
which were obsuring real syscall names.
2013-09-16 09:47:28 -05:00
Zbigniew Jędrzejewski-Szmek 442e00839e Assume that /proc/meminfo can be missing
Travis tests are failing, probably because /proc/meminfo is not available
in the test environment. The same might be true in some virtualized systems,
so just treat missing /proc/meminfo as a sign that hibernation is not
possible.
2013-09-16 09:47:28 -05:00
Gao feng 112a7f4696 cgroup: add missing equals for BlockIOWeight 2013-09-16 09:19:00 -04:00
Tom Gundersen 4e82fe5213 swap: create .wants symlink to 'auto' swap devices
As we load unit files lazily, we need to make sure something pulls in swap
units that should be started automatically, otherwise the default dependencies
will never be applied.

This partially reinstates code removed in
commit 64347fc2b9.

Also don't order swap devices after swap.target when they are 'nofail'.
2013-09-16 01:11:52 +02:00
Kay Sievers a5c724b25b README: add SCSI BSG option 2013-09-15 07:29:25 +02:00
Zbigniew Jędrzejewski-Szmek 69ab808815 Advertise hibernation only if there's enough free swap
Condition that is checked is taken from upower:
  active(anon) < free swap * 0.98

This is really stupid, because the kernel knows the situation better,
e.g. there could be two swap files, and then hibernation would be
impossible despite passing this check, or the kernel could start
supporting compressed swap and/or compressed hibernation images, and
then this this check would be too stringent. Nevertheless, until
we have something better, this should at least return a true negative
if there's no swap.

Logging of capabilities in the journal is changed to not strip leading
zeros. I consider this more readable anyway.

http://cgit.freedesktop.org/upower/tree/src/up-daemon.c#n613
https://bugzilla.redhat.com/show_bug.cgi?id=1007059
2013-09-13 19:41:52 -04:00
Zbigniew Jędrzejewski-Szmek e39ff1f48d keymap: remove some commented out lines 2013-09-13 19:29:52 -04:00
Tom Gundersen ecd1e54ca6 man: document luks.options kernel commandline
This should have been part of commit 7ab064a6d
2013-09-13 21:04:59 +02:00
Lukas Nykryn 6faa3dcbb8 libudev: fix move_later comparison
At the beginning move_later is set to -1, but it is set to different
value only if expression !move_later is true.
2013-09-13 15:36:08 +02:00
Tom Gundersen 90060fa660 swap: fix reverse dependencies
Make sure swap.target correctly requires/wants the swap units.

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=69291.

Reported-by: Hussam Al-Tayeb
2013-09-13 14:48:29 +02:00
Lukas Nykryn 81c68af03f core/cgroup: first print then free 2013-09-13 14:40:58 +02:00
Lennart Poettering df5f6971e6 update TODO 2013-09-13 14:32:14 +02:00
Lukas Nykryn 2dba165c63 random-seed: we should return errno of failed loop_write 2013-09-13 14:32:14 +02:00
Gao feng 6a94f2e938 cgroup: fix incorrectly setting memory cgroup
If the memory_limit of unit is -1, we should write "-1"
to the file memory.limit_in_bytes. not the (unit64_t) -1.

otherwise the memory.limit_in_bytes will be set to zero.
2013-09-13 14:32:14 +02:00
Gao feng 84121bc2ee cgroup: correct the log information
it should be memory.soft_limit_in_bytes.
2013-09-13 14:32:14 +02:00
Gao feng 15b4a7548f cgroup: add the missing setting of variable's value
set the value of variable "r" to the return value
of cg_set_attribute.
2013-09-13 14:32:14 +02:00
David Mackey a5e41bdb72 automount: rename repeat_unmont to repeat_unmount
Trivial cleanup of repeat_unmount() spelling.
2013-09-13 14:32:08 +02:00
Tom Gundersen 7ab064a6d6 cryptsetup-generator: allow specifying options in /proc/cmdline
The main usecase for this is to make it possible to use cryptsetup in
the initrd without it having to include a host-specific /etc/crypttab.

Tested-by: Thomas Bächler <thomas@archlinux.org>
2013-09-13 11:52:14 +02:00
Tom Gundersen 8c11d3c1b5 cryptsetup-generator: don't create tmp+swap units 2013-09-13 11:52:14 +02:00
Lennart Poettering 719e4e368b update TODO 2013-09-13 04:13:47 +02:00
Kay Sievers f3a165b05d NEWS: update 2013-09-13 02:24:57 +02:00
Lennart Poettering 4f0be680b5 build-sys: prepare 207 2013-09-13 02:12:16 +02:00
Zbigniew Jędrzejewski-Szmek 64eed40c07 bash-completion: add systemd-run 2013-09-12 19:36:27 -04:00
Kay Sievers 6e869e18c0 shut up gcc complaining about freeing a const variable 2013-09-12 23:37:23 +02:00
Jan Engelhardt 7964042405 man: wording and grammar updates
This is a recurring submission and includes corrections to various
issue spotted. I guess I can just skip over reporting ubiquitous
comma placement fixes…

Highligts in this particular commit:
- the "unsigned" type qualifier is completed to form a full type
  "unsigned int"
- alphabetic -> lexicographic (that way we automatically define how
  numbers get sorted)
2013-09-12 22:09:57 +02:00
Lennart Poettering 982e44dbc3 update TODO 2013-09-12 18:52:41 +02:00