Commit Graph

176 Commits

Author SHA1 Message Date
Lennart Poettering aec8de63b1 core: no need to list properties for PropertiesChanged messages anymore
Since the vtable includes this information anyway, let's just use that
2013-12-22 03:50:52 +01:00
Lennart Poettering e120204729 core,logind,networkd: check for udev device initialization via enumeration matches
Instead of checking each device after we got it, check wuth an
enumeration filter instead, to make it more efficient.
2013-12-18 18:21:28 +01:00
Kay Sievers 48b9cfcb7c comment out udev's is_initialized call until the problem is sorted out 2013-12-18 05:07:16 +01:00
Lennart Poettering bf5332d2bf core,logind,networkd: don't pick up devices from udev before they finished udev initialization
Managers shouldn't pick up the devices the manage before udev finished
initialization, hence check explicitly for that.
2013-12-18 03:37:26 +01:00
Lennart Poettering ecad10fe4a Revert "systemd: add a start job for all units in SYSTEMD_[USER_]WANTS="
This reverts commit e775289d56.

We really should let the dependency logic add jobs for dependencies here
rather than manually adding in jobs, overtaping the real problem.
2013-12-10 18:53:56 +00:00
Zbigniew Jędrzejewski-Szmek e775289d56 systemd: add a start job for all units in SYSTEMD_[USER_]WANTS= 2013-12-05 17:25:08 -05:00
Lennart Poettering 9670d583d3 swap: always track the current real device node of all swap devices, even when not active
This way, we can avoid executing two /bin/swapon jobs to be dispatched
for the same swap device if it is configured for two different paths.

Previously we were just tracking the device nodes of active swap
devices, which would not allow us to recognize the identity of two swap
devices before they are active.

https://bugs.freedesktop.org/show_bug.cgi?id=69835
2013-11-25 22:10:22 +01:00
Lennart Poettering c5ab2e02dc device: fix typo 2013-11-25 17:59:41 +01:00
Lennart Poettering f1421cc67d device: modernizations 2013-11-25 17:40:53 +01:00
Lennart Poettering 718db96199 core: convert PID 1 to libsystemd-bus
This patch converts PID 1 to libsystemd-bus and thus drops the
dependency on libdbus. The only remaining code using libdbus is a test
case that validates our bus marshalling against libdbus' marshalling,
and this dependency can be turned off.

This patch also adds a couple of things to libsystem-bus, that are
necessary to make the port work:

- Synthesizing of "Disconnected" messages when bus connections are
  severed.

- Support for attaching multiple vtables for the same interface on the
  same path.

This patch also fixes the SetDefaultTarget() and GetDefaultTarget() bus
calls which used an inappropriate signature.

As a side effect we will now generate PropertiesChanged messages which
carry property contents, rather than just invalidation information.
2013-11-20 20:52:36 +01:00
Oleksii Shevchuk 1f19a534ea Configurable Timeouts/Restarts default values
https://bugs.freedesktop.org/show_bug.cgi?id=71132

Patch adds DefaultTimeoutStartSec, DefaultTimeoutStopSec, DefaultRestartSec
configuration options to manager configuration file.
2013-11-05 19:57:22 +01:00
Lennart Poettering 71fda00f32 list: make our list macros a bit easier to use by not requring type spec on each invocation
We can determine the list entry type via the typeof() gcc construct, and
so we should to make the macros much shorter to use.
2013-10-14 06:11:19 +02:00
Zbigniew Jędrzejewski-Szmek b47d419c25 Modernization
Fixes minor leak in error path in device.c.
2013-10-13 17:56:54 -04:00
MUNEDA Takahiro d9abd1493d core: escape unit name from udev
This patch escapes a unit name which was derived from udev.

Please imagine following udev rule.

  ACTION=="online|offline", TAG+="systemd", ENV{SYSTEMD_WANTS}="muneda@%p.service"
  ACTION=="online|offline", TAG+="systemd", ENV{SYSTEMD_WANTS}="muneda@%r.service"
  ACTION=="online|offline", TAG+="systemd", ENV{SYSTEMD_WANTS}="muneda@%S.service"

When unit name is derived from udev via
udev_device_get_property_value(), the name may contains '/' if
ENV{SYSTEMD_WANTS} has the udev options $devpath(%p), $root(%r), or
$sys(%S).  However, '/' is a invalid char for unit name so processing
of this rule fails as Invalid argument with following message.

Apr 22 13:21:37 localhost systemd[1]: Failed to load device unit: Invalid argument
Apr 22 13:21:37 localhost systemd[1]: Failed to process udev device event: Invalid argument

This patch escapes those invalid chars in a unit name.
Tested with 202, and confirmed to apply cleanly on top of commit 195f8e36.

Thanks,
Takahiro
2013-05-06 23:10:44 +02:00
Zbigniew Jędrzejewski-Szmek 44a6b1b680 Add __attribute__((const, pure, format)) in various places
I'm assuming that it's fine if a _const_ or _pure_ function
calls assert. It is assumed that the assert won't trigger,
and even if it does, it can only trigger on the first call
with a given set of parameters, and we don't care if the
compiler moves the order of calls.
2013-05-02 22:52:09 -04:00
Harald Hoyer 003ac9d031 core/device.c: fix possible segfault
https://bugs.freedesktop.org/show_bug.cgi?id=63189

better fail than segfault

systemd[1]: Failed to load device unit: Invalid argument
systemd[1]: Failed to process udev device event: Invalid argument
2013-04-17 09:05:37 +02:00
Zbigniew Jędrzejewski-Szmek b92bea5d2a Use initalization instead of explicit zeroing
Before, we would initialize many fields twice: first
by filling the structure with zeros, and then a second
time with the real values. We can let the compiler do
the job for us, avoiding one copy.

A downside of this patch is that text gets slightly
bigger. This is because all zero() calls are effectively
inlined:

$ size build/.libs/systemd
         text    data     bss     dec     hex filename
before 897737  107300    2560 1007597   f5fed build/.libs/systemd
after  897873  107300    2560 1007733   f6075 build/.libs/systemd

… actually less than 1‰.

A few asserts that the parameter is not null had to be removed. I
don't think this changes much, because first, it is quite unlikely
for the assert to fail, and second, an immediate SEGV is almost as
good as an assert.
2013-04-05 19:50:57 -04:00
Zbigniew Jędrzejewski-Szmek 66870f90de systemd: use unit logging macros 2013-01-06 13:52:48 -05:00
Eelco Dolstra 22349cee29 Properly handle device aliases used as dependencies
If a device unit has aliases defined in udev rules, and there are
other units that depend on that alias, as in

  BindTo=sys-subsystem-net-devices-eth0.device

then systemd will fail the start the alias, and any dependent units
will time out.  See

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

This is because unit_add_name() in device_add_escaped_name() will
return EEXIST.

The solution taken here is to call device_update_unit() on the alias
name.  Thus if a unit with the alias name already exists, we reuse it;
otherwise a new unit is created.  Creating multiple units for a single
device is perhaps suboptimal, but it's consistent with the treatment
of udev symlinks in device_process_new_device().
2012-10-17 09:54:53 -04:00
Kay Sievers 07845c142b udev: support multiple entries for ENV{SYSTEMD_ALIAS} and ENV{SYSTEM_WANTS} 2012-10-09 00:16:50 +02:00
Lennart Poettering bcbe497e5a unit: get rid of UnitVTable.suffix, which is now unused 2012-07-10 17:16:50 +02:00
Lennart Poettering b0193f1c1f systemctl: automatically turn paths and unescaped unit names into proper unit names
This makes sure that

  systemctl status /home

is implicitly translated to:

  systemctl status /home.mount

Similar, /dev/foobar becomes dev-foobar.device.

Also, all characters that cannot be part of a unit name are implicitly
escaped.
2012-06-22 13:08:48 +02:00
Michal Schmidt c69182961b unit: unit type dependent status messages
Instead of generic "Starting..." and "Started" messages for all unit use
type-dependent messages. For example, mounts will announce "Mounting..."
and "Mounted".

Add status messages to units of types that used to be entirely silent
(automounts, sockets, targets, devices). For unit types whose jobs are
instantaneous, report only the job completion, not the starting event.
Socket units with non-instantaneous jobs are rare (Exec*= is not used
often in socket units), so I chose not to print the starting messages
for them either.

This will hopefully give people better understanding of the boot.
2012-05-14 14:29:53 +02:00
Kay Sievers 9eb977db5b util: split-out path-util.[ch] 2012-05-08 02:33:10 +02:00
Lennart Poettering 5430f7f2bc relicense to LGPLv2.1 (with exceptions)
We finally got the OK from all contributors with non-trivial commits to
relicense systemd from GPL2+ to LGPL2.1+.

Some udev bits continue to be GPL2+ for now, but we are looking into
relicensing them too, to allow free copy/paste of all code within
systemd.

The bits that used to be MIT continue to be MIT.

The big benefit of the relicensing is that closed source code may now
link against libsystemd-login.so and friends.
2012-04-12 00:24:39 +02:00
Kay Sievers b30e2f4c18 move libsystemd_core.la sources into core/ 2012-04-11 16:03:51 +02:00
Renamed from src/device.c (Browse further)