1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-08 11:27:32 +03:00
Commit Graph

34 Commits

Author SHA1 Message Date
Lennart Poettering
74ca738f6a util: introduce safe_fclose() and port everything over to it
Adds a coccinelle script to port things over automatically.
2015-09-09 15:26:11 +02:00
David Herrmann
057171efc1 Revert "sd-bus: do not connect to dbus-1 socket when kdbus is available"
This reverts commit d4d00020d6. The idea of
the commit is broken and needs to be reworked. We really cannot reduce
the bus-addresses to a single address. We always will have systemd with
native clients and legacy clients at the same time, so we also need both
addresses at the same time.
2015-08-27 16:32:22 +02:00
Kay Sievers
d4d00020d6 sd-bus: do not connect to dbus-1 socket when kdbus is available
We should not fall back to dbus-1 and connect to the proxy when kdbus
returns an error that indicates that kdbus is running but just does not
accept new connections because of quota limits or something similar.

Using is_kdbus_available() in libsystemd/ requires it to move from
shared/ to libsystemd/.

Based on a patch from David Herrmann:
  https://github.com/systemd/systemd/pull/886
2015-08-11 20:49:36 +02:00
David Herrmann
d79acc3093 bus: don't switch to kdbus if not requested
Whenever systemd is re-executed, it tries to create a system bus via
kdbus. If the system did not have kdbus loaded during bootup, but the
module is loaded later on manually, this will cause two system buses
running (kdbus and dbus-daemon in parallel).

This patch makes sure we never try to create kdbus buses if it wasn't
explicitly requested on the command-line.
2015-05-06 18:21:51 +02:00
Lennart Poettering
7410616cd9 core: rework unit name validation and manipulation logic
A variety of changes:

- Make sure all our calls distuingish OOM from other errors if OOM is
  not the only error possible.

- Be much stricter when parsing escaped paths, do not accept trailing or
  leading escaped slashes.

- Change unit validation to take a bit mask for allowing plain names,
  instance names or template names or an combination thereof.

- Refuse manipulating invalid unit name
2015-05-05 15:06:42 -07:00
Lennart Poettering
63c372cb9d util: rework strappenda(), and rename it strjoina()
After all it is now much more like strjoin() than strappend(). At the
same time, add support for NULL sentinels, even if they are normally not
necessary.
2015-02-03 02:05:59 +01:00
David Herrmann
34a317e1cc dbus1-generator: fix array sentinal
Add a {} sentinal entry so the config-iterator can properly iterate all
array elements. Fixes a segfault in the dbus1-generator.
2015-01-08 16:13:39 +01:00
Michal Schmidt
4a62c710b6 treewide: another round of simplifications
Using the same scripts as in f647962d64 "treewide: yet more log_*_errno
+ return simplifications".
2014-11-28 19:57:32 +01:00
Michal Schmidt
56f64d9576 treewide: use log_*_errno whenever %m is in the format string
If the format string contains %m, clearly errno must have a meaningful
value, so we might as well use log_*_errno to have ERRNO= logged.

Using:
find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/'

Plus some whitespace, linewrap, and indent adjustments.
2014-11-28 19:49:27 +01:00
Michal Schmidt
23bbb0de4e treewide: more log_*_errno + return simplifications 2014-11-28 18:24:30 +01:00
Lennart Poettering
e3afaf6b8e sd-bus: rename default bus address constants, they aren't "paths" but "addresses" 2014-11-28 16:17:33 +01:00
Michal Schmidt
da927ba997 treewide: no need to negate errno for log_*_errno()
It corrrectly handles both positive and negative errno values.
2014-11-28 13:29:21 +01:00
Michal Schmidt
0a1beeb642 treewide: auto-convert the simple cases to log_*_errno()
As a followup to 086891e5c1 "log: add an "error" parameter to all
low-level logging calls and intrdouce log_error_errno() as log calls
that take error numbers", use sed to convert the simple cases to use
the new macros:

find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/'

Multi-line log_*() invocations are not covered.
And we also should add log_unit_*_errno().
2014-11-28 12:04:41 +01:00
Daniel Mack
63cc4c3138 sd-bus: sync with kdbus upstream (ABI break)
kdbus has seen a larger update than expected lately, most notably with
kdbusfs, a file system to expose the kdbus control files:

 * Each time a file system of this type is mounted, a new kdbus
   domain is created.

 * The layout inside each mount point is the same as before, except
   that domains are not hierarchically nested anymore.

 * Domains are therefore also unnamed now.

 * Unmounting a kdbusfs will automatically also detroy the
   associated domain.

 * Hence, the action of creating a kdbus domain is now as
   privileged as mounting a filesystem.

 * This way, we can get around creating dev nodes for everything,
   which is last but not least something that is not limited by
   20-bit minor numbers.

The kdbus specific bits in nspawn have all been dropped now, as nspawn
can rely on the container OS to set up its own kdbus domain, simply by
mounting a new instance.

A new set of mounts has been added to mount things *after* the kernel
modules have been loaded. For now, only kdbus is in this set, which is
invoked with mount_setup_late().
2014-11-13 20:41:52 +01:00
Lennart Poettering
0975b63fb3 dbus1-generator: properly free the FILE*
Also, rework the code to make use of fflush_and_check().

Issue discovered by Simon Danner.
2014-08-22 12:44:17 +02:00
Dave Reisner
8085f163c5 util: allow strappenda to take any number of args
This makes strappenda3 redundant, so we remove its usage and
definition. Add a few tests along the way for sanity.
2014-08-13 20:41:41 -04:00
Zbigniew Jędrzejewski-Szmek
36f822c4bd Let config_parse open file where applicable
Special care is needed so that we get an error message if the
file failed to parse, but not when it is missing. To avoid duplicating
the same error check in every caller, add an additional 'warn' boolean
to tell config_parse whether a message should be issued.
This makes things both shorter and more robust wrt. to error reporting.
2014-07-16 18:47:20 -04:00
Zbigniew Jędrzejewski-Szmek
e9f3d2d508 Constify ConfigTableItem tables 2014-07-15 22:34:40 -04:00
Zbigniew Jędrzejewski-Szmek
de0671ee7f Remove unnecessary casts in printfs
No functional change expected :)
2014-05-15 15:29:58 +02:00
Kay Sievers
d5ce683c07 units: remove "AllowUser=root own", the bus owner can always own names 2014-03-08 19:38:06 +01:00
Daniel Mack
a9beb58d8d dbus1-generator: set AllowWorld=own for now 2014-03-07 19:19:01 +01:00
Lennart Poettering
c3834f9b88 generators: add Documentation= fields that point to the generator man pages 2014-03-06 18:48:22 +01:00
Kay Sievers
62cfb98add dbus1-generator: use XDG_RUNTIME_DIR instead of /run/user/%lu/ 2014-01-26 18:09:24 +01:00
Kay Sievers
7a821bfec1 dbus1-generator: add missing "path=" and "unix:*" to DBUS environment variables
This works around the goa daemon crash:
  Jan 25 20:54:24 lon goa[1363]: goa-daemon version 3.10.2 starting [main.c:117, main()]
  Jan 25 20:54:24 lon systemd[424]: Starting Legacy D-Bus Protocol Compatibility Daemon (PID 1363/UID 2702)...
  Jan 25 20:54:24 lon systemd[424]: Started Legacy D-Bus Protocol Compatibility Daemon (PID 1363/UID 2702).
  Jan 25 20:54:24 lon kernel: goa-daemon[1363]: segfault at 20 ip 00007f46914b26d5 sp 00007fff1ae6d9a0 error 4 in libtelepathy-glib.so.0.80.1[7f469144f000+228000]
  Jan 25 20:54:24 lon systemd-coredump[1368]: Process 1363 (goa-daemon) dumped core.
  Jan 25 20:54:32 lon goa[1375]: goa-daemon version 3.10.2 starting [main.c:117, main()]
2014-01-25 21:08:36 +01:00
Zbigniew Jędrzejewski-Szmek
737dedebb8 dbus1-generator: fix copy-pasto 2014-01-07 22:19:01 -05:00
Kay Sievers
ac12cf5b7f dbus1-generator: always pull proxy socket into sockets.target
dbus.socket does that for --system, we need to explicitly pull it
in for --user.
2014-01-07 07:09:08 +08:00
Zbigniew Jędrzejewski-Szmek
f78e6385dc Use enums to make it obvious what boolean params mean
Suggested-by: Russ Allbery <rra@debian.org>
2013-12-26 15:49:54 -05:00
Lennart Poettering
010b2b8d7a bus: also mask dbus.service in generator if kdbus is found 2013-12-16 21:06:57 +01:00
Lennart Poettering
1c5f57c5a7 bus: fix symlink to bus proxy socket 2013-12-16 21:06:57 +01:00
Lennart Poettering
7c9a6f9063 bus: install systemd-bus-proxyd unit files for compatibility with dbus1 2013-12-13 20:49:57 +01:00
Lennart Poettering
c71ecee578 dbus1: make gcc shut up 2013-12-03 02:08:35 +01:00
Lennart Poettering
5c817d31d9 dbus1: hook busnames.target into normal boot if kdbus is enabled 2013-12-03 01:41:02 +01:00
Lennart Poettering
4c3a127cb6 bus: skip unit file generation for systemd itself 2013-12-03 01:24:39 +01:00
Lennart Poettering
674eb68520 bus: add generator that turns old dbus1 activation files into .busname + .service units 2013-12-03 01:13:48 +01:00