chiark / gitweb /
elogind.git
5 years agotest-fileio: Remove dead check
Thomas Hindoe Paaboel Andersen [Tue, 30 Sep 2014 21:37:10 +0000 (23:37 +0200)]
test-fileio: Remove dead check

t cannot be null here

5 years agotest-date: don't fail test if log_max_level is higher than LOG_INFO
Thomas Hindoe Paaboel Andersen [Tue, 30 Sep 2014 21:30:30 +0000 (23:30 +0200)]
test-date: don't fail test if log_max_level is higher than LOG_INFO

5 years agotest-path-util: fix a mem leak and avoid confusing coverity
Thomas Hindoe Paaboel Andersen [Tue, 30 Sep 2014 20:18:18 +0000 (22:18 +0200)]
test-path-util: fix a mem leak and avoid confusing coverity

Found with coverity. Fixes CID#1237754 and #1237790

5 years agovconsole: silence coverity
Thomas Hindoe Paaboel Andersen [Tue, 30 Sep 2014 19:14:58 +0000 (21:14 +0200)]
vconsole: silence coverity

Let's silence coverity here too. There is not much to do if the
ioctls to copy the fonts and character maps should fail.

5 years agoshared: util - use nicer idiom to silence Coverity
Tom Gundersen [Tue, 30 Sep 2014 09:37:28 +0000 (11:37 +0200)]
shared: util - use nicer idiom to silence Coverity

Suggested by Zbigniew.

5 years agocore: execute - don't leak strv
Tom Gundersen [Tue, 30 Sep 2014 09:34:01 +0000 (11:34 +0200)]
core: execute - don't leak strv

5 years agoudev/hwdb: New Entry for Dell XPS12 9Q33 keyboard
Stefan Brüns [Tue, 30 Sep 2014 02:32:10 +0000 (22:32 -0400)]
udev/hwdb: New Entry for Dell XPS12 9Q33 keyboard

https://bugs.freedesktop.org/show_bug.cgi?id=84437

5 years agoutil: silence coverity
Tom Gundersen [Mon, 29 Sep 2014 12:30:15 +0000 (14:30 +0200)]
util: silence coverity

Make it clear in the code that ignoring a failed safe_ato?() is intentional.

5 years agonspawn: log when tearing down of loop device fails
Tom Gundersen [Mon, 29 Sep 2014 11:20:54 +0000 (13:20 +0200)]
nspawn: log when tearing down of loop device fails

5 years agoDo not format USEC_INFINITY as NULL
Zbigniew Jędrzejewski-Szmek [Mon, 29 Sep 2014 12:31:14 +0000 (07:31 -0500)]
Do not format USEC_INFINITY as NULL

systemctl would print 'CPUQuotaPerSecUSec=(null)' for no limit. This
does not look right.

Since USEC_INFINITY is one of the valid values, format_timespan()
could return NULL, and we should wrap every use of it in strna() or
similar. But most callers didn't do that, and it seems more robust to
return a string ("infinity") that makes sense most of the time, even
if in some places the result will not be grammatically correct.

5 years agocore/dbus: simplify handling of CPUQuotaPerSecUSec
Zbigniew Jędrzejewski-Szmek [Mon, 29 Sep 2014 03:42:33 +0000 (23:42 -0400)]
core/dbus: simplify handling of CPUQuotaPerSecUSec

No functional change intended.

5 years agocore/swap: advertise Discard over dbus
Zbigniew Jędrzejewski-Szmek [Mon, 29 Sep 2014 02:13:07 +0000 (22:13 -0400)]
core/swap: advertise Discard over dbus

5 years agocore/swap: follow the configured unit by default
Zbigniew Jędrzejewski-Szmek [Sun, 28 Sep 2014 14:37:52 +0000 (10:37 -0400)]
core/swap: follow the configured unit by default

Phenomenon: parameters configured in /etc/fstab for swap units are
ignored. E.g. pri= settings have no effect when systemd starts swap
units. What is even more confusing, .swap units for the name used in
/etc/fstab initially show proper values for Priority=, but after
starting them, they are re-initalized from /proc/swaps and show the -1
value from /proc/swaps.

Change swap units to follow the original configured unit. This way
proper settings are used when starting the swap.

5 years agofstab-generator: properly deal with discard as non-last option
Zbigniew Jędrzejewski-Szmek [Sun, 28 Sep 2014 02:02:04 +0000 (22:02 -0400)]
fstab-generator: properly deal with discard as non-last option

Previous code would only return correct results when discard
was the last option.

While at it, avoid incorrect behaviour for (invalid) 'pri' option
not followed by '=...', and also do not return -1 as the error code.

5 years agoswap: introduce Discard property
Jan Synacek [Wed, 24 Sep 2014 12:29:05 +0000 (14:29 +0200)]
swap: introduce Discard property

Process possible "discard" values from /etc/fstab.

5 years agojournal-remote: fix handling of non-blocking sources
Zbigniew Jędrzejewski-Szmek [Sun, 28 Sep 2014 00:00:00 +0000 (20:00 -0400)]
journal-remote: fix handling of non-blocking sources

In the conversion to sd-event loop, handling of normal files got
broken. We do not want to perform non-blocking reads on them, but
simply do read() in a loop. Install a statically-enabled "source"
to do that.

5 years agojournalctl: do not output --reboot-- markers when running non-interactively
Zbigniew Jędrzejewski-Szmek [Fri, 26 Sep 2014 14:49:55 +0000 (10:49 -0400)]
journalctl: do not output --reboot-- markers when running non-interactively

They are not legal in the export format.

5 years agobus: use 2M as maximum message size in benchmark
David Herrmann [Mon, 29 Sep 2014 13:44:44 +0000 (15:44 +0200)]
bus: use 2M as maximum message size in benchmark

The kdbus limit is 2M and we removed the bus-owner override. Therefore,
use at most 2M as message size.

5 years agoterminal: add helper to retrieve the seat of a session
David Herrmann [Mon, 29 Sep 2014 13:36:20 +0000 (15:36 +0200)]
terminal: add helper to retrieve the seat of a session

Allow sysview users to retrieve the seat that a session is assigned to.

5 years agobus: sync kdbus.h (ABI break!)
David Herrmann [Mon, 29 Sep 2014 13:35:51 +0000 (15:35 +0200)]
bus: sync kdbus.h (ABI break!)

5 years agoterminal: add sysview_seat_switch_to()
David Herrmann [Mon, 29 Sep 2014 12:59:01 +0000 (14:59 +0200)]
terminal: add sysview_seat_switch_to()

Add helper to perform session switches on a specific seat whenever we
retrieve a VT-switch keyboard event.

5 years agosd-bus: clean up string length calculation
Daniel Mack [Sun, 28 Sep 2014 19:19:22 +0000 (21:19 +0200)]
sd-bus: clean up string length calculation

Move the +1 calculus onto the definition of the variable, just to make
the code a little easier to read. No functional change.

5 years agobootchart: Do not try to access data for non-existing CPU's
Philippe De Swert [Sun, 28 Sep 2014 15:12:51 +0000 (18:12 +0300)]
bootchart: Do not try to access data for non-existing CPU's

Cpu's are assigned normally, so starting at 0, so the MAX_CPU index will
always be one smaller than the actual number.

Found with Coverity.

5 years agotest-bus-policy: silence coverity
Thomas Hindoe Paaboel Andersen [Sun, 28 Sep 2014 16:46:15 +0000 (18:46 +0200)]
test-bus-policy: silence coverity

Check if strjoin worked and also use _cleanup_free_ since we are
here.

Found with Coverity. Fixes CID#1241962

5 years agobootchart: check return of strftime
Thomas Hindoe Paaboel Andersen [Sat, 27 Sep 2014 20:25:07 +0000 (22:25 +0200)]
bootchart: check return of strftime

Found by coverity. Fixes: CID#996314 and #996312

5 years agobootchart: parse userinput with safe_atoi
Thomas Hindoe Paaboel Andersen [Fri, 26 Sep 2014 19:41:02 +0000 (21:41 +0200)]
bootchart: parse userinput with safe_atoi

Found by coverity. Fixes: CID#996409

5 years agologind: add support for TPS65217 Power Button
Koen Kooi [Sat, 27 Sep 2014 07:55:44 +0000 (09:55 +0200)]
logind: add support for TPS65217 Power Button

This PMIC is found on TI AM335x based boards like the beaglebone and
beaglebone black.

root@beaglebone-white:~# udevadm info -a /dev/input/event0

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/ocp.3/44e0b000.i2c/i2c-0/0-0024/input/input0/event0':
    KERNEL=="event0"
    SUBSYSTEM=="input"
    DRIVER==""

  looking at parent device
'/devices/ocp.3/44e0b000.i2c/i2c-0/0-0024/input/input0':
    KERNELS=="input0"
    SUBSYSTEMS=="input"
    DRIVERS==""
    ATTRS{name}=="tps65217_pwr_but"
    ATTRS{phys}==""
    ATTRS{uniq}==""
    ATTRS{properties}=="0"

  looking at parent device '/devices/ocp.3/44e0b000.i2c/i2c-0/0-0024':
    KERNELS=="0-0024"
    SUBSYSTEMS=="i2c"
    DRIVERS=="tps65217"
    ATTRS{name}=="tps65217"

  looking at parent device '/devices/ocp.3/44e0b000.i2c/i2c-0':
    KERNELS=="i2c-0"
    SUBSYSTEMS=="i2c"
    DRIVERS==""
    ATTRS{name}=="OMAP I2C adapter"

  looking at parent device '/devices/ocp.3/44e0b000.i2c':
    KERNELS=="44e0b000.i2c"
    SUBSYSTEMS=="platform"
    DRIVERS=="omap_i2c"

  looking at parent device '/devices/ocp.3':
    KERNELS=="ocp.3"
    SUBSYSTEMS=="platform"
    DRIVERS==""

5 years agocatalog: add Polish translation
Piotr Drąg [Sat, 27 Sep 2014 21:30:15 +0000 (23:30 +0200)]
catalog: add Polish translation

5 years agoshell-completion(zsh): journalctl's -b changes
Eric Cook [Sat, 27 Sep 2014 12:48:09 +0000 (08:48 -0400)]
shell-completion(zsh): journalctl's -b changes

removed pointless index sort of bootids.
use `compadd -a' to add each array, instead of expanding possibly hundreds of words needlessly.
optional completion of -b

5 years agoshutdownd: clean up initialization of struct
Thomas Hindoe Paaboel Andersen [Fri, 26 Sep 2014 22:25:09 +0000 (00:25 +0200)]
shutdownd: clean up initialization of struct

No functional change. We just don't assign the value twice.

Found by coverity. Fixes: CID#1237616 and #1237617

5 years agotest-bus-policy: load policy files from TEST_DIR
Daniel Mack [Fri, 26 Sep 2014 15:50:24 +0000 (17:50 +0200)]
test-bus-policy: load policy files from TEST_DIR

'make distcheck' calls test-bus-policy outside of the source tree, so it
must consider the TEST_DIR variable to access its files.

5 years agosystemd-tmpfiles: Fix IGNORE_DIRECTORY_PATH age handling
Richard Weinberger [Tue, 9 Sep 2014 09:09:37 +0000 (11:09 +0200)]
systemd-tmpfiles: Fix IGNORE_DIRECTORY_PATH age handling

If one has a config like:
d /tmp 1777 root root -
X /tmp/important_mount

All files below /tmp/important_mount will be deleted as the
/tmp/important_mount item will spuriously inherit a max age of 0
from /tmp.
/tmp has a max age of 0 but age_set is (of course) false.

This affects also the PrivateTmp feature of systemd.
All tmp files of such services will be deleted unconditionally
and can cause service failures and data loss.

Fix this by checking ->age_set in the IGNORE_DIRECTORY_PATH logic.

5 years agomake utmp/wtmp support configurable
Emil Renner Berthing [Wed, 24 Sep 2014 15:25:00 +0000 (17:25 +0200)]
make utmp/wtmp support configurable

This adds --disable-utmp option to configure. If it is used, all
utmp-related functionality, including querying runlevel support,
is removed.

5 years agoRevert "only build and install systemd-bus-proxyd if --enable-kdbus"
Zbigniew Jędrzejewski-Szmek [Thu, 25 Sep 2014 23:02:42 +0000 (19:02 -0400)]
Revert "only build and install systemd-bus-proxyd if --enable-kdbus"

This reverts commit ef99aec4d25087dec995b3f00b6957dcee6b13e9.

systemd-stdio-bridge is used on non-kdbus systems.

5 years agodo not install factory/etc/pam.d if --disable-pam
Gustavo Sverzut Barbieri [Thu, 25 Sep 2014 21:12:03 +0000 (18:12 -0300)]
do not install factory/etc/pam.d if --disable-pam

5 years agobuild-sys: do not distribute make-man-rules.py
Zbigniew Jędrzejewski-Szmek [Thu, 25 Sep 2014 21:39:56 +0000 (17:39 -0400)]
build-sys: do not distribute make-man-rules.py

It was added to EXTRA_DIST in 3c3e5f4276a893791110b03984735654372aa33a,
but this script only makes sense for developers.

5 years agoonly build and install systemd-bus-proxyd if --enable-kdbus
Gustavo Sverzut Barbieri [Thu, 25 Sep 2014 21:13:19 +0000 (18:13 -0300)]
only build and install systemd-bus-proxyd if --enable-kdbus

5 years agoman: use <constant> markup for errno value
Zbigniew Jędrzejewski-Szmek [Thu, 25 Sep 2014 21:27:46 +0000 (17:27 -0400)]
man: use <constant> markup for errno value

We were inconsistent, but marking them up as constants makes more
sense then as variables.

5 years agoman: document sd_event_add_{defer,post,exit}
Zbigniew Jędrzejewski-Szmek [Thu, 25 Sep 2014 21:27:40 +0000 (17:27 -0400)]
man: document sd_event_add_{defer,post,exit}

5 years agoman: add sd_event_add_child(3)
Zbigniew Jędrzejewski-Szmek [Thu, 25 Sep 2014 21:27:33 +0000 (17:27 -0400)]
man: add sd_event_add_child(3)

5 years agoman: add sd_event_add_signal(3)
Zbigniew Jędrzejewski-Szmek [Thu, 25 Sep 2014 21:27:27 +0000 (17:27 -0400)]
man: add sd_event_add_signal(3)

5 years agobuild-sys: add sd_session_get_desktop to Makefile-man.am
Zbigniew Jędrzejewski-Szmek [Thu, 25 Sep 2014 21:27:21 +0000 (17:27 -0400)]
build-sys: add sd_session_get_desktop to Makefile-man.am

Fixup for c72d5456e2d.

5 years agoman/sd_event_new: tweaks
Zbigniew Jędrzejewski-Szmek [Thu, 25 Sep 2014 21:27:17 +0000 (17:27 -0400)]
man/sd_event_new: tweaks

5 years agojournal: build fix when LZ4 is enabled but XZ is not
Gustavo Sverzut Barbieri [Thu, 25 Sep 2014 21:08:02 +0000 (18:08 -0300)]
journal: build fix when LZ4 is enabled but XZ is not

5 years agojournal-remote: fix counting of events written
Zbigniew Jędrzejewski-Szmek [Thu, 25 Sep 2014 21:26:40 +0000 (17:26 -0400)]
journal-remote: fix counting of events written

After recent changes the number was always reported as 0, because
the accounting was done server_destroy(), called after the message was
already printed. But even before this change, the counts were wrong
because seqnum start at 0 only for newly created journal files, so when
appending to existing files, the calculated count was wrong anyway.

Also do some variable renaming for consistency and disable some low-level
debug messages.

5 years agojournal-remote: initialize writer hashmap before use
Jonathan Liu [Wed, 24 Sep 2014 13:59:06 +0000 (23:59 +1000)]
journal-remote: initialize writer hashmap before use

https://bugs.freedesktop.org/show_bug.cgi?id=83682

[zj: move the initalization even earlier, before any sockets are
     looked at.]

5 years agonspawn: check some more return values
Tom Gundersen [Thu, 25 Sep 2014 16:49:56 +0000 (18:49 +0200)]
nspawn: check some more return values

Most of these failures would anyway get caught later on, but now the error messages are a bit more
specific.

5 years agodelta: warn if diff failed
Tom Gundersen [Thu, 25 Sep 2014 16:16:04 +0000 (18:16 +0200)]
delta: warn if diff failed

Found by Coverity. Fixes CID #1237541.

5 years agoreadahead: wipe out readahead
Daniel Buch [Tue, 26 Aug 2014 19:17:22 +0000 (21:17 +0200)]
readahead: wipe out readahead

5 years agobus-proxy: drop one wrong assert()
Tom Gundersen [Thu, 25 Sep 2014 14:21:36 +0000 (16:21 +0200)]
bus-proxy: drop one wrong assert()

5 years agoshared: path-util - try to make PATH_FORECH_PREFIX look less wrong
Tom Gundersen [Thu, 25 Sep 2014 14:12:41 +0000 (16:12 +0200)]
shared: path-util - try to make PATH_FORECH_PREFIX look less wrong

We replace the idiom "X && !(*foo = 0)" with "X && ((*foo = 0), true)".

This is not a functional change, but should hopefully make it less
likely that people and static analyzers believe there is a typo here
(i.e., to make it clear that the intention was not "X && *foo != 0").

Thanks to David Herrmann for the suggestion.

5 years agobus-proxyd: add some asserts
Tom Gundersen [Thu, 25 Sep 2014 13:49:43 +0000 (15:49 +0200)]
bus-proxyd: add some asserts

Both as documentation, and to make Coverity happy.

Fixes CID #1241495 and #1241496.

5 years agolocalectl: print warning when there are options given on kernel cmdline
Michal Sekletar [Wed, 24 Sep 2014 11:17:43 +0000 (13:17 +0200)]
localectl: print warning when there are options given on kernel cmdline

5 years agofileio: make parse_env_file() return number of parsed items
Michal Sekletar [Mon, 22 Sep 2014 07:38:38 +0000 (09:38 +0200)]
fileio: make parse_env_file() return number of parsed items

This commit introduces possibility to call parse_env_file_internal() and hand
over extra argument where we will accumulate how many items were successfully
parsed and pushed by callback. We make use of this in parse_env_file() and
return number of parsed items on success instead of always returning zero.

As a side-effect this commit should fix bug that locale settings in
/etc/locale.conf are not overriden by options passed via kernel command line.

5 years agobus-policy: split API for bus-proxyd
Daniel Mack [Wed, 24 Sep 2014 15:02:08 +0000 (17:02 +0200)]
bus-policy: split API for bus-proxyd

Instead of operating on an sd_bus_message object, expose an API that has 4
functions:

  policy_check_own()
  policy_check_hello()
  policy_check_recv()
  policy_check_send()

This also allows dropping extra code to parse message contents - the bus
proxy already has dedicated code paths for that, and we can hook into
those later.

Tests amended accordingly.

5 years agobus: remove unused check
Thomas Hindoe Paaboel Andersen [Tue, 23 Sep 2014 19:34:21 +0000 (21:34 +0200)]
bus: remove unused check

strerror_r does not return null here and even if it did we would have
problems already at the preceding strlen call.

Found by coverity. Fixes: CID#1237770

5 years agoterminal: provide display dimensions to API users
David Herrmann [Tue, 23 Sep 2014 11:52:50 +0000 (13:52 +0200)]
terminal: provide display dimensions to API users

Allow users to query the display dimensions of a grdev_display. This is
required to properly resize the objects to be rendered.

5 years agoterminal: verify kernel-returned DRM events are not truncated
David Herrmann [Tue, 23 Sep 2014 11:51:42 +0000 (13:51 +0200)]
terminal: verify kernel-returned DRM events are not truncated

Make sure the kernel always returns events properly. This is guaranteed
right now, otherwise, we do something really wrong. But lets be sure and
verify the received values properly. This also silences some coverity
warnings.

5 years agoterminal: verify grdev tiles are correctly linked
David Herrmann [Tue, 23 Sep 2014 11:40:18 +0000 (13:40 +0200)]
terminal: verify grdev tiles are correctly linked

We used to set "pipe->tile = tile" inside of the leaf allocation. We no
longer do that. Verify that "out" is non-NULL, otherwise we'd leak memory.

This is currently always given, but make sure to add an assert(), so
coverity does not complain.

5 years agoterminal: fix tile-offset calculation
David Herrmann [Tue, 23 Sep 2014 11:38:09 +0000 (13:38 +0200)]
terminal: fix tile-offset calculation

Binary operators with two pointers as arguments always operate on
object-size, not bytes. That is, "int *a, *b", (a - b) calculates the
number of integers between b and a, not the number of bytes.

Fix our cache-offset calculation to not use sizeof() with full-ptr
arithmetic.

5 years agoSilence some "unchecked return-value" warnings
David Herrmann [Tue, 23 Sep 2014 11:33:53 +0000 (13:33 +0200)]
Silence some "unchecked return-value" warnings

This adds some log-messages to ioctl() calls where we don't really care
for the return value. It isn't strictly necessary to look for those, but
lets be sure and print warnings. This silences gcc and coverity, and also
makes sure we get reports in case something goes wrong and we didn't
expect it to fail that way.

5 years agosd-bus: sync kdbus.h
Daniel Mack [Tue, 23 Sep 2014 15:37:44 +0000 (17:37 +0200)]
sd-bus: sync kdbus.h

5 years agosd-bus: sync kdbus.h (API break)
Daniel Mack [Tue, 23 Sep 2014 14:13:54 +0000 (16:13 +0200)]
sd-bus: sync kdbus.h (API break)

Just a rename of two struct members to make the header file c++ compatible.

5 years agolocaled: rename write_data_x11 to x11_write_data
Zbigniew Jędrzejewski-Szmek [Thu, 4 Sep 2014 16:30:46 +0000 (12:30 -0400)]
localed: rename write_data_x11 to x11_write_data

Other functions in this file follow this pattern,
we have vconsole_write_data and locale_write_data.

5 years agoFix warning about unused variable with !SELINUX
Zbigniew Jędrzejewski-Szmek [Tue, 23 Sep 2014 13:22:40 +0000 (09:22 -0400)]
Fix warning about unused variable with !SELINUX

src/shared/label.c:255:15: warning: unused variable 'l' [-Wunused-variable]
         char *l = NULL;
               ^

5 years agoterminal: fix spelling mistake
Zbigniew Jędrzejewski-Szmek [Tue, 23 Sep 2014 13:22:33 +0000 (09:22 -0400)]
terminal: fix spelling mistake

5 years agologind: add support for Triton2 Power Button
Zbigniew Jędrzejewski-Szmek [Tue, 23 Sep 2014 02:14:39 +0000 (22:14 -0400)]
logind: add support for Triton2 Power Button

https://bugs.freedesktop.org/show_bug.cgi?id=84201

5 years agosd-bus: sync kdbus.h (API+ABI break)
Daniel Mack [Mon, 22 Sep 2014 16:20:14 +0000 (18:20 +0200)]
sd-bus: sync kdbus.h (API+ABI break)

The kdbus logic name registry logic was changed to transport the actual
name to acquire, release or report in a kdbus item.

This brings the name API a little more in line with other calls, and allows
for later augmentation.

Follow that change on the systemd side.

5 years agoutil: avoid non-portable __WORDSIZE
Emil Renner Berthing [Fri, 19 Sep 2014 18:26:53 +0000 (20:26 +0200)]
util: avoid non-portable __WORDSIZE

Lets not unnecessarily rely on __WORDSIZE, which is not clearly specified
by any spec. Use explicit size comparisons if we're not interested in the
WORDSIZE, anyway.

(David: adjust commit message to explain why we do this)

5 years agoterminal: signal object removal during sysview_context_stop()
David Herrmann [Mon, 22 Sep 2014 16:05:19 +0000 (18:05 +0200)]
terminal: signal object removal during sysview_context_stop()

Now that we no longer propagate callback return values, we can safely call
into user-callbacks during sysview_context_stop(). This way, users can
rely on all objects to be removed via callbacks (except if they failed
during object creation). This avoids duplicating any object hashtables on
the users' side and reduces memory consumption.

5 years agoterminal: handle callback errors in sysview instead of propagating them
David Herrmann [Mon, 22 Sep 2014 15:55:31 +0000 (17:55 +0200)]
terminal: handle callback errors in sysview instead of propagating them

We cannot sanely propagate error codes if we call into user-callbacks
multiple times for multiple objects. There is no way to merge those errors
or somehow propagate them.

However, we can just act similar to sd-event and print a log-message while
discarding the values. This way, we allow error-returns, but can properly
continue working on our objects.

5 years agoterminal: allow user-context to be retrieved/stored
David Herrmann [Mon, 22 Sep 2014 15:37:21 +0000 (17:37 +0200)]
terminal: allow user-context to be retrieved/stored

Add "userdata" storage to a bunch of external objects, namely displays and
sessions. Furthermore, add some property retrieval helpers.

This is required if we want external API users to not duplicate our own
object hashtables, but retrieve context from the objects themselves.

5 years agoterminal: make evdev logind-matches per session
David Herrmann [Mon, 22 Sep 2014 15:34:13 +0000 (17:34 +0200)]
terminal: make evdev logind-matches per session

Instead of adding matches per device, we now add logind matches per
session. This reduces the number of matches considerably and saves
resources.

5 years agoexit-status.c: bring EXIT_BUS_ENDPOINT label in line with others
Zbigniew Jędrzejewski-Szmek [Mon, 22 Sep 2014 13:15:49 +0000 (09:15 -0400)]
exit-status.c: bring EXIT_BUS_ENDPOINT label in line with others

5 years agoman: fix typo and add link
Zbigniew Jędrzejewski-Szmek [Mon, 22 Sep 2014 13:13:38 +0000 (09:13 -0400)]
man: fix typo and add link

5 years agologin: add public sd_session_get_desktop() API
David Herrmann [Sat, 20 Sep 2014 16:42:29 +0000 (18:42 +0200)]
login: add public sd_session_get_desktop() API

The desktop brand is stored as DESKTOP variable for sessions. It can be
set arbitrarily by the session owner and identifies the desktop
environment that is running on that session.

5 years agobus: align kdbus ioctl parameters to 8byte
David Herrmann [Mon, 22 Sep 2014 10:49:47 +0000 (12:49 +0200)]
bus: align kdbus ioctl parameters to 8byte

All kdbus ioctl arguments must be 8byte aligned. Make sure we use
alloca_align() and _alignas_(8) in all situations where gcc doesn't
guarantee 8-byte alignment.

Note that objects on the stack are always 8byte aligned as we put
_alignas_(8) into the structure definition in kdbus.h.

5 years agoutil: add alloca_align()
David Herrmann [Mon, 22 Sep 2014 10:05:16 +0000 (12:05 +0200)]
util: add alloca_align()

The alloca_align() helper is the alloca() equivalent of posix_memalign().
As there is no such function provided by glibc, we simply account for
additional memory and return a pointer offset into the allocated memory to
grant the alignment.

Furthermore, alloca0_align() is added, which simply clears the allocated
memory.

5 years agotest-util: make valgrind happy
David Herrmann [Mon, 22 Sep 2014 09:27:22 +0000 (11:27 +0200)]
test-util: make valgrind happy

Properly free all temporary resources to make valgrind not complain about
lost records.

5 years agoterminal: raise sysview DEVICE_CHANGE events per attachment
David Herrmann [Sat, 20 Sep 2014 15:47:56 +0000 (17:47 +0200)]
terminal: raise sysview DEVICE_CHANGE events per attachment

Instead of raising DEVICE_CHANGE only per device, we now raise it per
device-session attachment. This is what we want for all sysview users,
anyway, as sessions are meant to be independent of each other. Lets avoid
any external session iterators and just do that in sysview itself.

5 years agoterminal: forward evdev RESYNC events to linked devices
David Herrmann [Sat, 20 Sep 2014 10:39:59 +0000 (12:39 +0200)]
terminal: forward evdev RESYNC events to linked devices

Whenever we resync an evdev device (or disable it), we should send RESYNC
events to the linked upper layers. This allows to disable key-repeat and
assume some events got dropped.

5 years agoterminal: always call _enable/_disable on evdev devices
David Herrmann [Sat, 20 Sep 2014 10:34:43 +0000 (12:34 +0200)]
terminal: always call _enable/_disable on evdev devices

The current pause/resume logic kinda intertwines the resume/pause and
enable/disable functions. Lets avoid that non-obvious behavior and always
make resume call into enable, and pause call into disable, if appropriate.

5 years agoterminal: print RESYNC state in evcat
David Herrmann [Sat, 20 Sep 2014 10:33:18 +0000 (12:33 +0200)]
terminal: print RESYNC state in evcat

Whenever a key-event is part of a RESYNC, we should print that verbosely
as those events are out-of-order.

5 years agobus-policy: add test utility
Daniel Mack [Fri, 19 Sep 2014 12:50:53 +0000 (14:50 +0200)]
bus-policy: add test utility

Add some test files and routines for dbus policy checking.

5 years agobus-policy: add policy check function
Daniel Mack [Fri, 19 Sep 2014 12:38:52 +0000 (14:38 +0200)]
bus-policy: add policy check function

Add policy_check() to actually check whether an incoming message is allowed
by the policy. The code is not yet used from the proxy daemon, though.

5 years agobus-policy: print numeric [gu]id in dump_items()
Daniel Mack [Sat, 20 Sep 2014 16:09:00 +0000 (18:09 +0200)]
bus-policy: print numeric [gu]id in dump_items()

5 years agobus-policy: do not exit() from policy_dump()
Daniel Mack [Sat, 20 Sep 2014 13:59:40 +0000 (15:59 +0200)]
bus-policy: do not exit() from policy_dump()

This function is quite useful for debugging. Exiting from it seems
unnecessary.

5 years agobus-policy: implement dump_items() with LIST_FOREACH
Daniel Mack [Fri, 19 Sep 2014 12:05:18 +0000 (14:05 +0200)]
bus-policy: implement dump_items() with LIST_FOREACH

Instead of making the function call itself recursively.

5 years agobus-policy: resolve [ug]id of POLICY_ITEM_{USER,GROUP}
Daniel Mack [Sat, 20 Sep 2014 02:34:30 +0000 (04:34 +0200)]
bus-policy: resolve [ug]id of POLICY_ITEM_{USER,GROUP}

Do the lookup during parsing already, and set i->uid, or i->gid to the
numerical values.

5 years agobus_policy: set i->[ug]id_valid
Daniel Mack [Sat, 20 Sep 2014 14:34:31 +0000 (16:34 +0200)]
bus_policy: set i->[ug]id_valid

5 years agobus-policy: append items rather than prepending them
Daniel Mack [Fri, 19 Sep 2014 20:05:01 +0000 (22:05 +0200)]
bus-policy: append items rather than prepending them

In the D-Bus policy, the order of items matters, so make sure to store them
in the same order as they are parsed by the sax parser.

5 years agobus-policy: story mandatory items in right list
Daniel Mack [Fri, 19 Sep 2014 15:50:41 +0000 (17:50 +0200)]
bus-policy: story mandatory items in right list

5 years agotest: udev - restrict nemuric uid's to existing ones
Tom Gundersen [Sat, 20 Sep 2014 16:12:53 +0000 (18:12 +0200)]
test: udev - restrict nemuric uid's to existing ones

We now verify the existence of uid's before applying them to devicenodes, so change the
test accordingly. We assume that both uid/gid 1 and 2 exist on the test system.

5 years agoterminal: fix mode sync for connectors
David Herrmann [Sat, 20 Sep 2014 09:43:32 +0000 (11:43 +0200)]
terminal: fix mode sync for connectors

The GETXY ioctls of DRM are usually called twice by libdrm: Once to
retrieve the number of objects, a second time with suitably sized buffers
to actually retrieve all objects. In grdrm, we avoid these excessive calls
and instead just call ioctls with cached buffers and resize them if they
were too small.

However, connectors need to read the mode list via EDID, which is horribly
slow. As the kernel still cannot do that asynchronously (seriously, we
need to fix this!), it has a hack to only do it if count_modes==0. This is
fine with libdrm, as it calls every ioctl twice, anyway. However, we fail
horribly with this as we usually never pass 0.

Fix this by calling into GETCONNECTOR ioctls twice in case we received an
hotplug event. Only in those cases, we need to re-read modes, so this
should be totally fine.

5 years agoterminal: restructure some logging calls in grdrm
David Herrmann [Sat, 20 Sep 2014 09:41:34 +0000 (11:41 +0200)]
terminal: restructure some logging calls in grdrm

Multiple issues here:
 1) Don't print excessive card dumps on each resync. Disable it and make
    developers add it themselves.
 2) Ignore EINVAL on page-flips. Some cards don't support page-flips, so
    we'd print it on each frame. Maybe, at some point, the kernel will add
    support to retrieve capabilities for that. Until then, simply ignore
    it.
 3) Replace the now dropped card-dump with a short message about resyncing
    the card.

5 years agoterminal: grdev: schedule virtual frame events if hw doesn't support it
David Herrmann [Sat, 20 Sep 2014 09:12:44 +0000 (11:12 +0200)]
terminal: grdev: schedule virtual frame events if hw doesn't support it

Whenever we cannot use hardware frame events, we now schedule a virtual
frame event to make sure applications don't have to do this. Usually,
applications render only on data changes, but we can further reduce
render-time by also limiting rendering to vsyncs.

5 years agoterminal: grdev: raise frame event after DISPLAY_ADD/CHANGE
David Herrmann [Sat, 20 Sep 2014 09:11:07 +0000 (11:11 +0200)]
terminal: grdev: raise frame event after DISPLAY_ADD/CHANGE

Whenever a display is added or changed, we suppressed any frame events.
Make sure to raise them manually so we can avoid rendering when handling
anything but FRAME events.

5 years agoterminal: split grdrm_crtc_commit() apart
David Herrmann [Sat, 20 Sep 2014 09:10:04 +0000 (11:10 +0200)]
terminal: split grdrm_crtc_commit() apart

This helper is quite huge, split it apart to make it easier to follow.

5 years agoterminal: grdev: refresh device state on hotplug events
David Herrmann [Sat, 20 Sep 2014 07:50:10 +0000 (09:50 +0200)]
terminal: grdev: refresh device state on hotplug events

Whenever we get udev hotplug events, re-read the device state so we
properly detect any changed in the display setups.

5 years agoterminal: grdev: treat udev-devices without devnum as hotplug
David Herrmann [Sat, 20 Sep 2014 07:48:22 +0000 (09:48 +0200)]
terminal: grdev: treat udev-devices without devnum as hotplug

If we get udev-device events via sysview, but they lack devnum
annotations, we know it cannot be a DRM card. Look through it's parents
and treat it as hotplug event in case we find such a card.

This will treat any new/removed connectors as sub-devices of the real
card, instead of as devices on its own.