1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-28 11:55:23 +03:00
Commit Graph

21526 Commits

Author SHA1 Message Date
Tom Gundersen
9317cbecf8 Merge pull request #844 from poettering/clock-boottime2
tree-wide: convert bootchart and lldp code to use clock_boottime_or_m…
2015-08-03 17:58:54 +02:00
Tom Gundersen
6934f402cd Merge pull request #843 from poettering/clock-boottime
sd-event: make sure sd_event_now() cannot fail
2015-08-03 17:57:26 +02:00
Lennart Poettering
27ec691bfd tree-wide: convert bootchart and lldp code to use clock_boottime_or_monotonic()
We should avoid using CLOCK_BOOTTIME directly unless we actually can
sensible distuingish it from CLOCK_MONOTONIC. CLOCK_BOOTTIME is only
fully feature on very recent Linux kernels, hence we should stick to a
fallback logic, which is already available in the
clock_boottime_or_monotonic() call.
2015-08-03 17:40:46 +02:00
Lennart Poettering
5ef9b2203e Merge pull request #840 from systemd-mailing-devs/1438566907-9544-1-git-send-email-wangkefeng.wang@huawei.com
logind: add standard gpio power button support
2015-08-03 17:34:54 +02:00
Lennart Poettering
38a03f06a7 sd-event: make sure sd_event_now() cannot fail
Previously, if the event loop never ran before sd_event_now() would
fail. With this change it will instead fall back to invoking now(). This
way, the function cannot fail anymore, except for programming error when
invoking it with wrong parameters.

This takes into account the fact that many callers did not handle the
error condition correctly, and if the callers did, then they kept simply
invoking now() as fall back on their own. Hence let's shorten the code
using this call, and make things more robust, and let's just fall back
to now() internally.

Whether now() is used or the cache timestamp may still be detected via
the return value of sd_event_now(). If > 0 is returned, then the fall
back to now() was used, if == 0 is returned, then the cached value was
returned.

This patch also simplifies many of the invocations of sd_event_now():
the manual fall back to now() can be removed. Also, in cases where the
call is invoked withing void functions we can now protect the invocation
via assert_se(), acknowledging the fact that the call cannot fail
anymore except for programming errors with the parameters.

This change is inspired by #841.
2015-08-03 17:34:49 +02:00
Daniel Mack
4d2bee0620 Merge pull request #841 from teg/resolved-exponential-resend
resolved: exponential backoff of packet resend
2015-08-03 16:32:40 +02:00
Tom Gundersen
3b31df8301 resolved: transaction - increase number of retry attempts
With the exponential backoff, we can perform more requests in the same amount of time,
so bump this a bit.

In case of large RTT this may be necessary in order not to regress, and in case
of large packet-loss it will make us more robust. The latter is particularly
relevant once we start probing for features (and hence may see packet-loss
until we settle on the right feature level).
2015-08-03 14:25:49 +02:00
Tom Gundersen
9df3ba6c6c resolved: transaction - exponentially increase retry timeouts
Rather than fixing this to 5s for unicast DNS and 1s for LLMNR, start
at a tenth of those values and increase exponentially until the old
values are reached. For LLMNR the recommended timeout for IEEE802
networks (which basically means all of the ones we care about) is 100ms,
so that should be uncontroversial. For unicast DNS I have found no
recommended value. However, it seems vastly more likely that hitting a
500ms timeout is casued by a packet loss, rather than the RTT genuinely
being greater than 500ms, so taking this as a startnig value seems
reasonable to me.

In the common case this greatly reduces the latency due to normal packet
loss. Moreover, once we get support for probing for features, this means
that we can send more packets before degrading the feature level whilst
still allowing us to settle on the correct feature level in a reasonable
timeframe.

The timeouts are tracked per server (or per scope for the multicast
protocols), and once a server (or scope) receives a successfull package
the timeout is reset. We also track the largest RTT for the given
server/scope, and always start our timouts at twice the largest
observed RTT.
2015-08-03 14:06:58 +02:00
Tom Gundersen
240b589b14 resolved: cache - use clock_boottime_or_monotonic()
We cannot rely on CLOCK_BOOTTIME being supported by the kernel, so fallack
to CLOCK_MONOTONIC if the former is not supported.
2015-08-03 13:42:44 +02:00
Daniel Mack
b04d9f2871 Merge pull request #837 from ssahani/dhcp
networkd: fix neworkd crash
2015-08-03 09:55:41 +02:00
Kefeng Wang
405e116f57 logind: add standard gpio power button support
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==""
2015-08-03 04:04:27 +02:00
Daniel Mack
8e675fc615 Merge pull request #836 from mbiebl/man-fix-typo-systemd-fsck
man: fix typo in systemd-fsck@
2015-08-02 22:54:13 +02:00
Michael Biebl
349ca6e68b man: fix typo in systemd-fsck@ 2015-08-02 22:22:44 +02:00
David Herrmann
13fd31ccc6 Merge pull request #834 from namhyung/sdbus-cleanup-v2
sd-bus: Small cleanups (v2)
2015-08-02 19:32:21 +02:00
Namhyung Kim
ba243e5155 sd-bus: cleanup bus_reset_parsed_address()
Both strv_free() and mfree() return NULL pointer after free.
2015-08-02 23:12:08 +09:00
Namhyung Kim
253f96e53e sd-bus: use mfree() in bus_reset_queues()
Recently mfree() was introduced to reduce work of tedious free + reset
pointers.  Use it in bus_reset_queues() too.
2015-08-02 23:12:08 +09:00
Namhyung Kim
0fd8d506f4 sd-bus: cleanup bus_close_fds()
The safe_close() already checks the fd and returns -1.
2015-08-02 23:12:08 +09:00
Susant Sahani
49f6e11e89 networkd: fix neworkd crash
fix issue #827

hostname should be init to NULL.
2015-08-02 00:16:02 +05:30
Daniel Mack
f429182e62 Merge pull request #822 from hobbitalastair/master
hwdb: add resolution information for Dell Vostro 1510 touchpad
2015-08-01 13:39:20 +02:00
Alastair Hughes
8d51633304 hwdb: add resolution information for Dell Vostro 1510 touchpad
Dell Vostro 1510, AlpsPS/2 ALPS GlidePoint touchpad.

Relevant issue: #763
2015-08-01 20:03:51 +12:00
Lennart Poettering
58d5d500d8 Merge pull request #813 from dvdhrm/bus-client
busctl: make sure --address connects as bus-client
2015-07-31 20:24:47 +02:00
David Herrmann
36fd918260 Merge pull request #812 from zonque/test
Add some more tests
2015-07-31 20:23:19 +02:00
Daniel Mack
6f7897f9d2 Merge pull request #814 from dvdhrm/mfree
tree-wide: introduce mfree()
2015-07-31 20:17:33 +02:00
Daniel Mack
97d09a6283 Merge pull request #815 from poettering/coding-style-for
CODING_STYLE: say that "for (;;)" is better than "while (1)"
2015-07-31 20:07:11 +02:00
David Herrmann
8d87d4a989 busctl: make sure --address connects as bus-client
There is really no reason to use `busctl` to connect to legacy private
bus endpoints. Fix this and make sure `busctl --address=unix:path=/foo`
works!
2015-07-31 20:00:21 +02:00
Lennart Poettering
cad6982291 CODING_STYLE: say that "for (;;)" is better than "while (1)" 2015-07-31 20:00:07 +02:00
Daniel Mack
e76398868a test-socket-util: add test for in_addr_is_null() 2015-07-31 19:58:29 +02:00
Daniel Mack
ff9265d089 test-util: add more tests
Add tests for safe_ato[iu]16() and some more unbase32hexmem() torture.
2015-07-31 19:58:29 +02:00
Daniel Mack
da8ba7219a test: add test for static lists
Test af-list and arphdr-list.
2015-07-31 19:58:27 +02:00
David Herrmann
97b11eedff tree-wide: introduce mfree()
Pretty trivial helper which wraps free() but returns NULL, so we can
simplify this:
        free(foobar);
        foobar = NULL;
to this:
        foobar = mfree(foobar);
2015-07-31 19:56:38 +02:00
Daniel Mack
c474a4ecfa Merge pull request #811 from namhyung/busctl-misc-v2
busctl: Misc cleanups and a fix (v2)
2015-07-31 19:40:57 +02:00
Daniel Mack
6ba32d1c2f Merge pull request #810 from mamikk/bitmap-fixes-v2
Bitmap fixes v2
2015-07-31 19:21:51 +02:00
Namhyung Kim
cbfa6a4131 busctl: fix assertion failure on --size option
Using --size option triggers an assert failure below because
parse_size() requires the second argument, base, being either 1000 or
1024.  As it's for a packet size, it'd be better using IEC binary
suffix (base 1024) IMHO.

  $ busctl --size 2048
  Assertion 'base == 1000 || base == 1024' failed at src/basic/util.c:2222,
  function parse_size(). Aborting.
  Aborted (core dumped)
2015-08-01 02:20:47 +09:00
Namhyung Kim
d28ebe27f2 busctl: add missing description of --size option
The size option was to specify maximum captured patch length but was
missing its description in the command line help.  Add it.
2015-08-01 02:20:37 +09:00
Namhyung Kim
c030a850ba busctl: add and use strcmp_ptr()
In member_compare_func(), it compares interface, type and name of
members.  But as it can contain NULL pointer, it needs to check them
before calling strcmp().  So make it as a separate strcmp_ptr
function (named after streq_ptr) so that it can be used by others.

Also let streq_ptr() to use it in order to make the code simpler.
2015-08-01 02:16:24 +09:00
Marcel Holtmann
3d5ff087ce hwdb: Update database of Bluetooth company identifiers 2015-07-31 19:12:24 +02:00
Martin Mikkelsen
951c3eefac bitmap: make bitmap_clear free the bitmap array
Given two bitmaps and the following code:

  Bitmap *a = bitmap_new(), *b = bitmap_new();
  bitmap_set(a, 1);
  bitmap_clear(a);
  bitmap_set(a, 0);
  bitmap_set(b, 0);

These two bitmaps should now have the same bits set and they should be
equal but bitmap_equal() will return false in this case because while
bitmap_clear() resets the number of elements in the array it does not
clear the array and bitmap_set() expects the array to be cleared.
GREEDY_REALLOC0 looks at the allocated size and not the actual size so
it does not clear any memory.

Fix this by freeing the allocated memory and resetting the whole Bitmap
to an initial state in bitmap_clear().

This also adds test code for this issue.
2015-07-31 19:08:26 +02:00
Martin Mikkelsen
d5fa819958 bitmap: fix bitmap_equal on bitmaps with unset bits
Given two bitmaps and the following code:

Bitmap *a = bitmap_new(), *b = bitmap_new();
bitmap_set(a, 0);
bitmap_unset(a, 0);

These two bitmaps should now have the same bits set and they should be
equal but bitmap_equal() will return false in this case because the
bitmaps array in a is larger because of the bit which was previously
set.

Fix this by comparing only the bits which exists in both bitmaps and
then check that the rest of the bits (if any) is all zero.

This also adds test code for this issue.
2015-07-31 18:57:13 +02:00
David Herrmann
b2a0ac5e5b bus-proxy: allow empty arguments to UpdateActivationEnvironment()
There is no reason to prevent empty argument lists on
UpdateActivationEnvironment(). Make sure we don't fail, but still skip
the call to pid1.
2015-07-31 18:56:38 +02:00
David Herrmann
10fa421cd2 NEWS: update
Add new functionality and behavior changes to NEWS for the imminent bugfix
release 224.
2015-07-31 18:21:19 +02:00
David Herrmann
11811e856b build: bump version to 224
Prepare for bug-fix release and bump versions.
2015-07-31 18:13:57 +02:00
Kay Sievers
1e40e358ee hwdb: update 2015-07-31 18:08:55 +02:00
Lennart Poettering
aba8a9d1d2 Merge pull request #806 from dvdhrm/proxy-cookie
bus-proxy: fix cookie namespacing
2015-07-31 17:56:02 +02:00
David Herrmann
10189fd6be logind: release VT-positions when closing sessions
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.
2015-07-31 16:52:29 +02:00
David Herrmann
970ad53dd6 bus-proxy: fix cookie namespacing
If we generate messages from within bus-proxyd, we really must make sure
that we do not clutter the cookie-namespace of our client. The client has
full control over it, so we cannot steal cookies from it. However, we can
re-use the cookie the client used for our request. As long as we only
send a single message, we're fine.
2015-07-31 16:42:38 +02:00
Kay Sievers
b506d3141b timesyncd: remove RLIMIT_NPROC
NSS plugins might create additional threads. Remove the limit, we cannot
really make any assumptions here.
2015-07-31 15:33:49 +02:00
Kay Sievers
4b6ac4326a Merge pull request #803 from mixi/master
build-sys: use 'test -f' instead of AC_CHECK_FILE
2015-07-31 15:25:53 +02:00
Daniel Mack
e87cedf350 Merge pull request #804 from dvdhrm/proxy-directed2
bus-proxy: make NameAcquired/Lost directed (v2)
2015-07-31 15:04:21 +02:00
Daniel Mack
832089af55 Merge pull request #805 from dvdhrm/proxy-activation
bus-proxy: make StartServiceByName synchronous
2015-07-31 15:03:49 +02:00
David Herrmann
11f254be0c bus-proxy: make StartServiceByName synchronous
The StartServiceByName() call was provided by dbus-daemon to activate a
service without sending a message. On receiption, dbus-daemon schedules
an activation request (different modes are supported) and sends back the
reply once activation is done.

With kdbus, we marked StartServiceByName() as deprecated. There is no
real reason to start services explicitly. Instead, applications should
just *use* the service and rely on it being activated implicitly.
However, we provide compatibility with dbus-daemon and implement
StartServiceByName() on the proxy via a call to
org.freedesktop.DBus.Peer.Ping() on the destination. This will activate
the peer implicitly as part of the no-op Ping() method call (regardless
whether the peer actually implements that call).

Now, the problem is, StartServiceByName() was synchronous on dbus-daemon
but isn't on bus-proxy. Hence, on return, there is no guarantee that
ListNames includes the activated name. As this is required by some
applications, we need to make this synchronous.

This patch makes the proxy track the Ping() method call and send the
reply of StartServiceByName() only once Ping() returned. We do not look
at possible errors of Ping(), as there is no strict requirement for the
peer to implement org.freedesktop.DBus.Peer. Furthermore, any interesting
error should have already been caught by sd_bus_send() before.

Note:
        This race was triggered by gdbus. The gdbus-proxy implementation
        relies on a name to be available after StartServiceByName()
        returns. This is highly fragile and should be dropped by gdbus.
        Even if the call is synchronous, there is no reason whatsoever to
        assume the service did not exit-on-idle before ListNames()
        returns.
        However, this race is much less likely than the startup race, so
        we try to be compatible to dbus-daemon now.
2015-07-31 13:56:39 +02:00