Commit graph

838 commits

Author SHA1 Message Date
Daniel Mack 94d56326a1 src/core/selinux-access: #include <sys/socket.h>
Fixes the following build errors on Fedora 20:

  CC       src/core/libsystemd_core_la-selinux-access.lo
src/core/selinux-access.c: In function 'get_audit_data':
src/core/selinux-access.c:245:22: error: storage size of 'ucred' isn't known
         struct ucred ucred;
                      ^
src/core/selinux-access.c:259:9: warning: implicit declaration of function 'getsockopt' [-Wimplicit-function-declaration]
         r = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len);
         ^
src/core/selinux-access.c:259:28: error: 'SOL_SOCKET' undeclared (first use in this function)
         r = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len);
                            ^
src/core/selinux-access.c:259:28: note: each undeclared identifier is reported only once for each function it appears in
src/core/selinux-access.c:259:40: error: 'SO_PEERCRED' undeclared (first use in this function)
         r = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len);
                                        ^
src/core/selinux-access.c:245:22: warning: unused variable 'ucred' [-Wunused-variable]
         struct ucred ucred;
                      ^
make[2]: *** [src/core/libsystemd_core_la-selinux-access.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
2013-11-21 20:33:23 +01:00
Lennart Poettering fa0fed4975 bus: fix seriliazation of activation errors 2013-11-21 02:14:05 +01:00
Lennart Poettering df2d202e6e bus: let's simplify things by getting rid of unnecessary bus parameters 2013-11-21 02:07:35 +01:00
Lennart Poettering 2e41a51ea4 socket: fix segfault 2013-11-21 00:06:11 +01:00
Lennart Poettering 54b434b1b5 valgrind: make running PID 1 in valgrind useful
Since valgrind only generates useful output on exit() (rather than
exec()) we need to explicitly exit when valgrind is detected.
2013-11-20 22:12:47 +01:00
Lennart Poettering 3772995afa manager: don't do plymouth in a container
Given that plymouth listens on an abstract namespace socket and if
CLONE_NEWNET is not used the abstract namespace is shared with the host
we might actually end up send plymouth data to the host.
2013-11-20 20:58:17 +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
Lennart Poettering 16ed0233a5 install: use const where we can 2013-11-20 19:36:13 +01:00
Karel Zak 4561be3a64 Remove duplicate includes 2013-11-18 20:28:55 -05:00
Shawn Landden 05d3a17623 use #pragma once instead of foo*foo define guards 2013-11-18 20:28:54 -05:00
Shawn Landden f0511bd7e3 core/socket: fix SO_REUSEPORT 2013-11-17 17:41:35 -05:00
Shawn Landden e55001ebba core/socket: use _cleanup_free_ 2013-11-17 17:41:35 -05:00
Olivier Brunel 9cd861842c Fix RemainAfterExit services keeping a hold on console
When a service exits succesfully and has RemainAfterExit set, its hold
on the console (in m->n_on_console) wasn't released since the unit state
didn't change.
2013-11-16 12:08:11 -05:00
Zbigniew Jędrzejewski-Szmek e48614c4b2 core: some more _cleanup_free_ 2013-11-15 22:53:14 -05:00
Tom Gundersen 81eca919f7 loopback-setup: move to rtnl
This should be equivalent to the old behavior.
2013-11-14 15:11:15 +01:00
Olivier Brunel 5b1869eaa2 Fix possible lack of status messages on shutdown/reboot
Since 31a7eb86 the output on console can be disabled to avoid colliding with
gettys. However, it could also lead to a lack of messages during
shutdown/reboot.
2013-11-13 23:22:31 -05:00
Olivier Brunel 2f38577f30 Only disable output on console during boot if needed
If there are no more jobs on console, no need/we shouldn't disable output.
2013-11-13 23:22:31 -05:00
Thomas Hindoe Paaboel Andersen c2e0d600ed analyze: plot the time spent setting up security modules 2013-11-10 23:21:15 +01:00
Zbigniew Jędrzejewski-Szmek a94042fa9b systemd: fix memory leak in cgroup code
If the unit already was in the hashmap, path would be leaked.
2013-11-09 19:02:53 -05:00
Lennart Poettering 477def8097 shutdown: unify handling of reboot() syscall a bit 2013-11-08 19:32:45 +01:00
Lennart Poettering 9588bc3209 Remove dead code and unexport some calls
"make check-api-unused" informs us about code that is not used anymore
or that is exported but only used internally. Fix these all over the
place.
2013-11-08 18:12:45 +01:00
Lukas Nykryn 3f41e1e595 manager: configurable StartLimit default values
https://bugzilla.redhat.com/show_bug.cgi?id=821723
2013-11-08 17:00:01 +01:00
Kay Sievers 8be28fb1e0 core: fix require $XDG_RUNTIME_DIR
$ sudo dracut -f
  Trying to run as user instance, but $XDG_RUNTIME_DIR is not set.
  /usr/lib/dracut/modules.d/98systemd/module-setup.sh: line 10:
    ((: >= 198 : syntax error: operand expected (error token is ">= 198 ")
2013-11-07 14:14:22 +01:00
Zbigniew Jędrzejewski-Szmek 86198b2788 udevadm-settle: add missing brace 2013-11-07 01:34:19 -05:00
Mantas Mikulėnas 3f6da75bce core: require $XDG_RUNTIME_DIR to be set for user instances
It seems that some places use /run otherwise, which isn't going to work.
2013-11-07 01:27:15 -05:00
WaLyong Cho 37185ec80a Support additional argument in reboot
reboot syscall can be performed with an additional argument. In some
systems this functionality can be useful to modify the mode of the
next boot performed by the bootloader.
2013-11-07 01:23:54 -05:00
Lennart Poettering 175a3d25d0 active: rework make_socket_fd() to be based on socket_address_listen()
Among other things this makes sure we set SO_REUSEADDR which is
immensely useful.
2013-11-06 23:03:12 +01:00
Lennart Poettering 84f6181c2a clients: various simplifications 2013-11-06 17:32:51 +01:00
David Strauss f366954523 Comment spelling fixes. 2013-11-06 20:03:18 +10:00
Lennart Poettering 74df0fca09 util: unify reading of /proc/cmdline
Instead of individually checking for containers in each user do this
once in a new call proc_cmdline() that read the file only if we are not
in a container.
2013-11-06 03:15:16 +01:00
Lennart Poettering 41f85451d3 shutdown: trim the cgroup tree on loop iteration
This way we leave the cgroup empty before exiting in a container which
makes sure the container manager will get cgroup notification event

https://bugs.freedesktop.org/show_bug.cgi?id=68370
https://bugzilla.redhat.com/show_bug.cgi?id=988883
2013-11-06 02:31:22 +01:00
Lennart Poettering 15c60e99a9 cgroup: run PID 1 in the root cgroup
This way cleaning up the cgroup tree on shutdown is a lot easier since
we are in the root dir. Also PID 1 was previously artificially placed in
system.slice, even though our rule actually was not to have processes in
slices. The root slice otoh is magic anyway, so having PID 1 in there
sounds less surprising.

Of course, this means that PID is scheduled against the three top-level
slices.
2013-11-06 02:12:21 +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
Kay Sievers 98e6c5e62f detect_virtualization() returns NULL; pass empty string to dbus 2013-11-02 00:02:56 +01:00
Lennart Poettering 250a918dc4 strv: introduce new strv_from_stdarg_alloca() macro to generate a string array from stdarg function parameters
This allows us to turn lists of strings passed in easily into string
arrays without having to allocate memory.
2013-10-29 19:53:43 +01:00
Zbigniew Jędrzejewski-Szmek d8c9d3a468 systemd: use unit name in PrivateTmp directories
Unit name is used whole in the directory name, so that the unit name
can be easily extracted from it, e.g. "/tmp/systemd-abcd.service-DEDBIF1".

https://bugzilla.redhat.com/show_bug.cgi?id=957439
2013-10-22 22:54:09 -04:00
Kay Sievers 7759ecb21e silent a few more gcc warnings 2013-10-21 18:40:33 +02:00
Kay Sievers df28bc0836 build-sys: use -Og instead of -O0 to catch warnings
$ touch src/core/dbus.c; make CFLAGS=-O0
  make --no-print-directory all-recursive
  Making all in .
    CC       src/core/libsystemd_core_la-dbus.lo
    CCLD     libsystemd-core.la

  $ touch src/core/dbus.c; make CFLAGS=-Og
  make --no-print-directory all-recursive
  Making all in .
    CC       src/core/libsystemd_core_la-dbus.lo
  src/core/dbus.c: In function 'init_registered_system_bus':
  src/core/dbus.c:798:18: warning: 'id' may be used uninitialized in this function [-Wmaybe-uninitialized]
           dbus_free(id);
                    ^
    CCLD     libsystemd-core.la

-Og Optimize debugging experience. -Og enables optimizations that do
not interfere with debugging. It should be the optimization level of
choice for the standard edit-compile-debug cycle, offering a
reasonable level of optimization while maintaining fast compilation
and a good debugging experience.
2013-10-21 15:46:00 +02:00
Kay Sievers bd4b5df2cb bus: initialize variable, now that we might skip debug logging 2013-10-21 00:56:47 +02:00
Kay Sievers ca2871d9b0 bus: remove static introspection file export 2013-10-21 00:41:26 +02:00
Tom Gundersen accdd018ed mount/service: drop FsckPassNo support
We now treat passno as boleans in the generators, and don't need this any more. fsck itself
is able to sequentialize checks on the same local media, so in the common case the ordering
is redundant.

It is still possible to force an order by using .d fragments, in case that is desired.
2013-10-19 12:23:17 +02:00
Lennart Poettering 44b601bc79 macro: clean up usage of gcc attributes
Always use our own macros, and name all our own macros the same style.
2013-10-16 06:14:59 +02: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
Mantas Mikulėnas a0a6408e31 manager: connect to private bus even if $DBUS_SESSION_BUS_ADDRESS is not set
Because that's exactly the kind of situation where the private bus is
necessary.
2013-10-13 23:01:23 -04:00
Zbigniew Jędrzejewski-Szmek 1ca208fb4f Introduce udev object cleanup functions 2013-10-13 17:56:55 -04:00
Zbigniew Jędrzejewski-Szmek f6d2d42147 Make sure that we don't dereference NULL
The code was actually safe, because b should
never be null, because if rvalue is empty, a different
branch is taken. But we *do* check for NULL in the
loop above, so it's better to also check here for symmetry.
2013-10-13 17:56:55 -04:00
Zbigniew Jędrzejewski-Szmek 51d122af23 Introduce _cleanup_fdset_free_ 2013-10-13 17:56:54 -04:00
Zbigniew Jędrzejewski-Szmek 6891529fe1 drop-ins: check return value
If the function failed, nothing serious would happen
because unlink would probably return EFAULT, but this
would obscure the real error and is a bit sloppy.
2013-10-13 17:56:54 -04:00
Zbigniew Jędrzejewski-Szmek b47d419c25 Modernization
Fixes minor leak in error path in device.c.
2013-10-13 17:56:54 -04:00
Zbigniew Jędrzejewski-Szmek 7ff7394d9e Never call qsort on potentially NULL arrays
This extends 62678ded 'efi: never call qsort on potentially
NULL arrays' to all other places where qsort is used and it
is not obvious that the count is non-zero.
2013-10-13 17:56:54 -04:00