1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-15 07:24:00 +03:00
Commit Graph

17382 Commits

Author SHA1 Message Date
Gustavo Sverzut Barbieri
10893a5cfa journal: build fix when LZ4 is enabled but XZ is not 2014-09-25 18:19:03 -04:00
Zbigniew Jędrzejewski-Szmek
dd87b1840c 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.
2014-09-25 18:19:03 -04:00
Jonathan Liu
22259a00fd 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.]
2014-09-25 18:19:03 -04:00
Tom Gundersen
79d80fc146 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.
2014-09-25 19:10:11 +02:00
Tom Gundersen
3d1b90bd7f delta: warn if diff failed
Found by Coverity. Fixes CID #1237541.
2014-09-25 18:16:04 +02:00
Daniel Buch
d6bc8348d5 readahead: wipe out readahead 2014-09-25 16:39:18 +02:00
Tom Gundersen
4a3bb59960 bus-proxy: drop one wrong assert() 2014-09-25 16:21:36 +02:00
Tom Gundersen
4a690c4726 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.
2014-09-25 16:17:58 +02:00
Tom Gundersen
94a2c2f64a bus-proxyd: add some asserts
Both as documentation, and to make Coverity happy.

Fixes CID #1241495 and #1241496.
2014-09-25 15:59:24 +02:00
Michal Sekletar
a34286684e localectl: print warning when there are options given on kernel cmdline 2014-09-25 09:19:56 +02:00
Michal Sekletar
a5f6c30da3 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.
2014-09-25 09:19:56 +02:00
Daniel Mack
078ef7b85a 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.
2014-09-24 17:07:14 +02:00
Thomas Hindoe Paaboel Andersen
04c553e322 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
2014-09-23 21:39:36 +02:00
David Herrmann
158c1e3e0c 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.
2014-09-23 20:05:45 +02:00
David Herrmann
a908d21355 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.
2014-09-23 20:05:45 +02:00
David Herrmann
c5e6bfc6bc 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.
2014-09-23 20:05:45 +02:00
David Herrmann
b4170aed36 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.
2014-09-23 20:05:44 +02:00
David Herrmann
ce540a24d5 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.
2014-09-23 20:05:44 +02:00
Daniel Mack
590889ac53 sd-bus: sync kdbus.h 2014-09-23 17:37:44 +02:00
Daniel Mack
619d7a039f sd-bus: sync kdbus.h (API break)
Just a rename of two struct members to make the header file c++ compatible.
2014-09-23 16:16:04 +02:00
Zbigniew Jędrzejewski-Szmek
e78af5ffe5 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.
2014-09-23 09:24:15 -04:00
Zbigniew Jędrzejewski-Szmek
493d521d9f Fix warning about unused variable with !SELINUX
src/shared/label.c:255:15: warning: unused variable 'l' [-Wunused-variable]
         char *l = NULL;
               ^
2014-09-23 09:22:40 -04:00
Zbigniew Jędrzejewski-Szmek
0508a4dfb8 terminal: fix spelling mistake 2014-09-23 09:22:33 -04:00
Zbigniew Jędrzejewski-Szmek
58d4aabedd logind: add support for Triton2 Power Button
https://bugs.freedesktop.org/show_bug.cgi?id=84201
2014-09-22 22:15:43 -04:00
Daniel Mack
f8c2425287 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.
2014-09-22 18:22:53 +02:00
Emil Renner Berthing
8507eb20b6 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)
2014-09-22 18:20:21 +02:00
David Herrmann
c17091b797 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.
2014-09-22 18:14:44 +02:00
David Herrmann
ed3a9f6a30 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.
2014-09-22 18:14:44 +02:00
David Herrmann
f2a15d86cc 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.
2014-09-22 18:14:44 +02:00
David Herrmann
5d301b8aec 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.
2014-09-22 18:14:44 +02:00
Zbigniew Jędrzejewski-Szmek
ffb6c43e79 exit-status.c: bring EXIT_BUS_ENDPOINT label in line with others 2014-09-22 09:15:49 -04:00
Zbigniew Jędrzejewski-Szmek
9c77924c29 man: fix typo and add link 2014-09-22 09:13:38 -04:00
David Herrmann
c72d5456e2 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.
2014-09-22 14:27:02 +02:00
David Herrmann
7f3d3ba1a6 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.
2014-09-22 14:27:02 +02:00
David Herrmann
95d78c7e7c 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.
2014-09-22 14:27:02 +02:00
David Herrmann
eee846339d test-util: make valgrind happy
Properly free all temporary resources to make valgrind not complain about
lost records.
2014-09-22 14:27:02 +02:00
David Herrmann
f6e3ee1493 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.
2014-09-22 14:27:02 +02:00
David Herrmann
89febb631a 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.
2014-09-22 14:27:02 +02:00
David Herrmann
6022343476 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.
2014-09-22 14:27:02 +02:00
David Herrmann
4c4e4128f3 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.
2014-09-22 14:27:02 +02:00
Daniel Mack
20725d929f bus-policy: add test utility
Add some test files and routines for dbus policy checking.
2014-09-20 18:47:45 +02:00
Daniel Mack
38349552d8 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.
2014-09-20 18:47:45 +02:00
Daniel Mack
ed91202f1c bus-policy: print numeric [gu]id in dump_items() 2014-09-20 18:47:45 +02:00
Daniel Mack
e42bb8d4ed bus-policy: do not exit() from policy_dump()
This function is quite useful for debugging. Exiting from it seems
unnecessary.
2014-09-20 18:47:45 +02:00
Daniel Mack
080edb3484 bus-policy: implement dump_items() with LIST_FOREACH
Instead of making the function call itself recursively.
2014-09-20 18:47:45 +02:00
Daniel Mack
9eacea6b51 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.
2014-09-20 18:47:45 +02:00
Daniel Mack
c3502b59ec bus_policy: set i->[ug]id_valid 2014-09-20 18:47:45 +02:00
Daniel Mack
e7eb49db07 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.
2014-09-20 18:47:45 +02:00
Daniel Mack
303174638a bus-policy: story mandatory items in right list 2014-09-20 18:47:45 +02:00
Tom Gundersen
9158d03e40 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.
2014-09-20 18:12:53 +02:00