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

12898 Commits

Author SHA1 Message Date
Lennart Poettering
ebcf1f97de bus: rework message handlers to always take an error argument
Message handler callbacks can be simplified drastically if the
dispatcher automatically replies to method calls if errors are returned.

Thus: add an sd_bus_error argument to all message handlers. When we
dispatch a message handler and it returns negative or a set sd_bus_error
we send this as message error back to the client. This means errors
returned by handlers by default are given back to clients instead of
rippling all the way up to the event loop, which is desirable to make
things robust.

As a side-effect we can now easily turn the SELinux checks into normal
function calls, since the method call dispatcher will generate the right
error replies automatically now.

Also, make sure we always pass the error structure to all property and
method handlers as last argument to follow the usual style of passing
variables for return values as last argument.
2013-11-21 21:12:36 +01:00
Lennart Poettering
0ccad099d4 hostnamed: modernizations 2013-11-21 21:12:36 +01:00
Lennart Poettering
9d5a3757c3 manager: always sort environment block, it's prettier 2013-11-21 21:12:36 +01:00
Lennart Poettering
51b4ea6f48 bus: the :no-sender hack is now unnecessary, since the new library doesn't require this anymore 2013-11-21 21:12:36 +01:00
Tom Gundersen
5a3eb5a77d networkd: make sure Network and Link can always be freed
Also, don't fail a link just because we can't find its MAC address.
2013-11-21 21:04:04 +01:00
Tom Gundersen
602cc437e8 networkd: avoid segfault 2013-11-21 20:48:06 +01:00
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
Kay Sievers
29db78811d bus: update kdbus.h 2013-11-21 20:16:56 +01:00
Václav Pavlín
fa7abba232 man: suggest using hash= atribut for swap in example
(#883941)
2013-11-21 15:34:01 +01:00
Tom Gundersen
002f5de9a9 networkd: don't filter on udev tags
This removed the requirement for devices to be tagged with
'systemd-networkd' before they will be visible to networkd.

Still, as by default we don't ship any .network files, network
devices will simply be tracked, but not touched, unless the
admin configures things explicitly.
2013-11-21 15:33:02 +01:00
Tom Gundersen
0b9e3f2cfd efi-boot-generator: don't mount /boot eagerly 2013-11-21 12:36:05 +01:00
Lennart Poettering
fa0fed4975 bus: fix seriliazation of activation errors 2013-11-21 02:14:05 +01:00
Lennart Poettering
14c24659cd bus: rename SD_BUS_ERROR_MAKE to SD_BUS_ERROR_MAKE_CONST to indicate it only works for const strings 2013-11-21 02:11:06 +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
28383ba189 bus: add API calls to escape string components of objects paths 2013-11-21 01:03:26 +01:00
Lennart Poettering
850516e012 sd-event: try to move timer wakeups to the same spot within each minute 2013-11-21 00:46:13 +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
420c7379fb nspawn: add new --drop-capability= switch 2013-11-20 22:10:42 +01:00
Lennart Poettering
1b5995b039 event: make sure to possibly disarm the timerfds before we reenter epoll_wait 2013-11-20 20:58:17 +01:00
Lennart Poettering
c57b5ca301 event: don't disarm invalid timerfd 2013-11-20 20:58:17 +01:00
Lennart Poettering
86befb4098 bus: make sure an additional ref to a busevent source doesn't cause the event source to be triggered again 2013-11-20 20:58:17 +01:00
Lennart Poettering
2576a19ed2 event: whenever a time source changes pending state reshuffle elapsation prioqs 2013-11-20 20:58:17 +01:00
Lennart Poettering
503f39c35e event: when we change the io events to watch we need to figure out if a an event is pending again 2013-11-20 20:58:17 +01:00
Lennart Poettering
a99badf5ed sd-event: fix comparison functions 2013-11-20 20:58:17 +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
b51f299ae1 busctl: when no match is specified, add default match 2013-11-20 20:58:16 +01:00
Lennart Poettering
f8cfb5f5f3 bus: add color and indentation to bus_message_dump() 2013-11-20 20:58:16 +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
3febea3a0b hashmap: be a bit more conservative with pre-allocating hash tables and items 2013-11-20 19:37:02 +01:00
Lennart Poettering
e8372f7e3e install: when determining where default.target points to, accept a file instead of a symlink, too 2013-11-20 19:37:02 +01:00
Lennart Poettering
a454d241ef test: exit early if we would conflict with running user systemd 2013-11-20 19:37:02 +01:00
Lennart Poettering
911121a7c8 bus: add sd_bus_send_to() API call 2013-11-20 19:37:02 +01:00
Lennart Poettering
aea93debfa bus: bump serial number counter when sending already sealed messages 2013-11-20 19:36:14 +01:00
Lennart Poettering
80c1974018 bus: sd_bus_error_setxyz calls should always return the error as errno style negative int 2013-11-20 19:36:14 +01:00
Lennart Poettering
725d7e6ceb libudev: always return NULL in _unref() APIs
Returning anything else but NULL would suggest the caller's reference
might still be valid, but it isn't, because the caller just invoked
_unref() after all.

This turns the return value into a typesafe shortcut that allows
unreffing and resetting a reference in one line. In contrast to
solutions for this which take a pointer to a pointer to accomplish the
same this solution is just syntactic sugar the developer can make use of
but doesn't have to, and this is particularly useful when immediately
unreffing objects returned by function calls.
2013-11-20 19:36:14 +01:00
Lennart Poettering
994e023433 libudev: always return valid negative error codes on API functions 2013-11-20 19:36:14 +01:00
Lennart Poettering
135168183e calendar: support 'yearly' and 'annually' names the same way as cron 2013-11-20 19:36:14 +01:00
Lennart Poettering
8e64fd110d hwclock: modernizations 2013-11-20 19:36:14 +01:00
Lennart Poettering
d3cfcae9db macro: add _unlikely_() to assert_return()
As the name indicates assert_return() is really just for assertions,
i.e. where it's a programming error if the assertion does not hold.
Hence it is safe to add _unlikely_() decorators for the expression to
check.
2013-11-20 19:36:14 +01:00
Lennart Poettering
780dbeef9f macro: change assert_cc() so that it can appear outside of functions 2013-11-20 19:36:14 +01:00
Lennart Poettering
fd1b903adb include: make direct includion of _sd-common.h harder 2013-11-20 19:36:14 +01:00
Lennart Poettering
16ed0233a5 install: use const where we can 2013-11-20 19:36:13 +01:00
Tom Gundersen
91ffff9621 conf-parser: don't leak section names
If we encounter an unknown section, we must free the previous section before
clearing the pointer.
2013-11-20 17:54:09 +01:00
David Herrmann
0cc1125ae1 event: clear pending-state when re-arming timers
If a timer fires and is marked pending, but an application re-arms it
before it is dispatched, we now clear the pending state.

This fixes a bug where an application arms a timer, which fires and is
marked pending. But before it is dispatched, the application loses
interest in it and disables it. Now if the timer is re-armed and
re-enabled later, it will be immediately dispatched as it is still marked
pending.

This behavior is unexpected, so avoid it by clearing pending state when
re-arming timers. Note that applications have no way to clear pending
state themselves, so there's no current workaround.
2013-11-20 16:19:58 +01:00
David Herrmann
6c1508b871 bus: fix error-path in bus_map_all_properties()
We shouldn't return positive integers on errors. Fix the typo by removing
the negation.
2013-11-20 16:19:58 +01:00
Thomas Hindoe Paaboel Andersen
d7726e578a bus/rtnl: silence clang warnings 2013-11-20 12:42:43 +01:00
Tom Gundersen
0617ffabe8 networkd: make sure Links and Networks are freed 2013-11-19 14:39:19 +01:00
Jose Ignacio Naranjo
bc9cdba5dd keymap: Add Toshiba Satellite U940
Signed-off-by: Martin Pitt <martinpitt@gnome.org>
2013-11-19 08:15:50 +01:00
Zbigniew Jędrzejewski-Szmek
0732ef7acf localed: match converted keymaps before legacy
Before, X11 keymap fr-pc105-oss would be converted to fr,
even though fr-oss exists. Now, if
/usr/lib/kbd/keymaps/xkb/<layout>[-<variant>].map[.gz] exists,
<layout>[-<variant>] will be used as the console keymap,
falling back to the legacy mappings otherwise.

% sudo localectl set-x11-keymap pl pc105
% localectl
   System Locale: LANG=en_US.UTF-8
       VC Keymap: pl                      (was pl2 before)
      X11 Layout: pl
       X11 Model: pc105
% sudo localectl set-x11-keymap fr pc105 oss
% localectl
   System Locale: LANG=en_US.UTF-8
       VC Keymap: fr-oss                  (was fr before)
      X11 Layout: fr
       X11 Model: pc105
     X11 Variant: oss
% sudo localectl set-x11-keymap fr pc105
% localectl
   System Locale: LANG=en_US.UTF-8
       VC Keymap: fr
      X11 Layout: fr
       X11 Model: pc105
% sudo localectl set-x11-keymap gb
% localectl
   System Locale: LANG=en_US.UTF-8
       VC Keymap: gb                     (was uk before)
      X11 Layout: gb
2013-11-18 20:35:52 -05:00