Commit graph

364 commits

Author SHA1 Message Date
Lennart Poettering f00c31213a bus: also add error parameter to object find and enumerator callbacks
Just in order to bring things inline with the method and property
callbacks.
2013-11-22 01:42:15 +01:00
Lennart Poettering 969987ea93 bus: restore selinux access control to PID 1 for properties 2013-11-21 23:36:51 +01:00
Lennart Poettering 21586b77de bus: properly serialize unit file change list 2013-11-21 21:12:36 +01:00
Lennart Poettering 86b8d28971 logind,machined,run: properly invoke StartTransientUnit() bus call 2013-11-21 21:12:36 +01:00
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 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
Kay Sievers 29db78811d bus: update kdbus.h 2013-11-21 20:16:56 +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 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 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 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
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
Kay Sievers f21326e604 bus: TIMESTAMP is optional kdbus metadata now, NAMES are always added 2013-11-18 01:30:57 +01:00
Kay Sievers 16be43684f bus: CREDS and NAMES are optional kdbus metadata now 2013-11-17 22:35:58 +01:00
Tom Gundersen 0927756b8d bus: typo
Fix a couple of 'void' that should have been 'sd_bus'.
2013-11-14 22:19:48 +01:00
Zbigniew Jędrzejewski-Szmek f1e0c18340 build-sys: add a link test for exported symbols
I know that this is a pretty big net to catch some small fish,
but we *do* regularly forget to properly export symbols that
were supposed to be exported.

This time sd_bus_get_current and some renamed symbols are caught.
2013-11-12 18:58:34 -05:00
Kay Sievers d311601f5b bus: test-bus-objects - add missing header 2013-11-12 15:49:36 +01:00
Lennart Poettering 3db0e46b0d bus: add missing dump.[ch] 2013-11-12 12:11:24 +01:00
Lennart Poettering 2b5c5383e4 bus: beautify bus_message_dump() output a bit 2013-11-12 00:12:44 +01:00
Lennart Poettering 7b0b392f7b busctl: show machine name of all registered names 2013-11-12 00:12:44 +01:00
Lennart Poettering 8d162091c0 bus: set no_auto_start flag for GetMachineId calls, so that we don't auto-start if we want to know the machine of a bus service 2013-11-12 00:12:44 +01:00
Lennart Poettering a8a07f892c bus: detect blocking message calls to our own connection and return ELOOP early 2013-11-12 00:12:44 +01:00
Lennart Poettering 1fee9de509 bus: add api to control auto start message flag 2013-11-12 00:12:44 +01:00
Lennart Poettering 76b543756e bus: introduce concept of a default bus for each thread and make use of it everywhere
We want to emphasize bus connections as per-thread communication
primitives, hence introduce a concept of a per-thread default bus, and
make use of it everywhere.
2013-11-12 00:12:43 +01:00
Lennart Poettering afc6adb5ec bus: introduce concept of a "default" event loop per-thread and make use of it everywhere
Try to emphasize a bit that there should be a mapping between event
loops and threads, hence introduce a logic that there's one "default"
event loop for each thread, that can be queried via
"sd_event_default()".
2013-11-12 00:12:43 +01:00
Lennart Poettering d5e4ec5b1e test: fix minor memory leak in test-event 2013-11-12 00:12:43 +01:00
Lennart Poettering c49b30a235 bus: rename sd_bus_send_with_reply_and_block() to sd_bus_call()
The call is one of the most important ones we expose, where we place
major emphasis on. We should make sure to give it a short, memorable
name.
2013-11-12 00:12:43 +01:00
Lennart Poettering 938bcbab12 bus: add APIs for adding iovecs to messages as string or arrays 2013-11-11 16:26:12 +01:00
Lennart Poettering 60411ac750 bus: we really need to get rid of the :no-sender hack
This is where a hack from PID 1 spilled into the client side. We need
to get rid of this as soon as PID 1 is converted to libsystemd-bus.
2013-11-10 23:54:55 +01:00
Lennart Poettering 369c583b3f bus: actually export sd_utf8_is_valid() and sd_ascii_is_valid() 2013-11-10 23:54:55 +01:00
Lennart Poettering f959af205a bus: use ENXIO as error condition when trying to exit a container when we are not in any
So far we used ENXIO whenever the user tried to read something from a
function that didn't carry the right type, and hence use the same error
here to indicate that what the user expected and what was in the message
didn't match up.
2013-11-10 23:54:55 +01:00
Zbigniew Jędrzejewski-Szmek 2bba9a57e7 bus: fix build with old glibc 2013-11-09 20:31:12 -05:00
Zbigniew Jędrzejewski-Szmek 0a9776c230 systemctl: make sure daemon-reload returns success
Also change sd_bus_message_exit_container to return -ENOENT
when not in a container, to make it easier to distinguish different
errors.
2013-11-09 19:41:00 -05:00
Kay Sievers dbb642afae bus: let magic ":no-sender" pass the validation 2013-11-09 00:58:11 +01:00
Lennart Poettering 7a4a210539 bus: allow queuing more local msgs
When issuing a synchronous "systemctl daemon-reload" requests this will
send out a tonload of UnitRemoved+UnitNew signals, that we will queue
locally. When we wait for the message reply, we should be able to queue
those, hence bump the limits on locally queuing messages.
2013-11-08 18:23:47 +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