Commit graph

32 commits

Author SHA1 Message Date
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
Lennart Poettering b5dae4c7f7 sd-bus: add suppot for renegotiating message credential attach flags 2014-11-26 02:20:55 +01:00
Lennart Poettering 2e9efd22ce busctl: if no parameter is specified for "busctl status" show credentials of bus owner 2014-11-25 14:28:34 +01:00
Lennart Poettering 40ed1a4574 busctl: add new --augment-creds= switch for controlling whether shown credential data shall be augment with data from /proc 2014-11-25 14:28:34 +01:00
Lennart Poettering 1d58a1fe13 busctl: improve readability a bit 2014-11-25 14:28:34 +01:00
Lennart Poettering a44b10818a busctl: add --timeout= option to specify method call timeout 2014-11-21 20:31:50 +01:00
Lennart Poettering 3805157836 busctl: add options to control message header flags when invoking methods 2014-11-21 20:13:26 +01:00
Lennart Poettering 1fc5560911 busctl: show property values in "introspect" output, add "set-property" command, and support both a terse and a verbose output format 2014-11-21 00:32:02 +01:00
Lennart Poettering b18ec7e29f busctl: when --address is specified do not assume we connect to a full bus 2014-11-21 00:32:02 +01:00
Lennart Poettering 79f34de9fb busctl: use canned error message on parse failure 2014-11-21 00:32:02 +01:00
Lennart Poettering 73fc23c064 busctl: pass error output to stdout (rather than stderr) when generate tree for all objects
This is a ton more useful when some services fail, since we continue
crawling then and output everything to a pager.
2014-11-20 00:01:05 +01:00
Lennart Poettering d0b2babf52 busctl: improve output of service creds 2014-11-20 00:01:05 +01:00
Lennart Poettering 0171da06ef busctl: add new "introspect" verb for introspecting objects 2014-11-20 00:01:05 +01:00
Lennart Poettering a1ad376761 busctl: split out introspection parser from tree logic so that we can reuse it for a future "busctl introspect" command 2014-11-20 00:01:05 +01:00
Lennart Poettering d55192add7 busctl: introduce busctl "get-property" command for reading and dumping object properties 2014-11-14 17:52:40 +01:00
Lennart Poettering 56c8b52d4d busctl: various tweaks to "busctl tree" output 2014-11-14 13:18:51 +01:00
Lennart Poettering 781fa93815 busctl: add new "call" command to invoke methods on a service 2014-11-14 13:18:51 +01:00
Lennart Poettering d9130355ee busctl: add "tree" command to explore object trees 2014-11-10 19:25:29 +01:00
Lennart Poettering 455971c149 sd-bus: rename "connection name" to "description" for the sd-bus API too
kdbus recently renamed this concept, and so should we in what we expose
in userspace.
2014-11-04 16:13:49 +01:00
Lennart Poettering 1f70b0876a busctl: add new "capture" verb to record bus messages in libpcap compatible files, for dissection with wireshark 2014-10-30 01:13:54 +01:00
Daniel Mack 056f95d0a7 sd-bus: rename sd_bus_get_owner_uid(), sd_bus_get_owner_machine_id() and sd_bus_get_peer_creds()
Clean up the function namespace by renaming the following:

  sd_bus_get_owner_uid()        → sd_bus_get_name_creds_uid()
  sd_bus_get_owner_machine_id() → sd_bus_get_name_machine_id()
  sd_bus_get_peer_creds()       → sd_bus_get_owner_creds()
2014-10-22 19:45:07 +02:00
Michal Schmidt d5099efc47 hashmap: introduce hash_ops to make struct Hashmap smaller
It is redundant to store 'hash' and 'compare' function pointers in
struct Hashmap separately. The functions always comprise a pair.
Store a single pointer to struct hash_ops instead.

systemd keeps hundreds of hashmaps, so this saves a little bit of
memory.
2014-09-15 16:08:50 +02:00
Lennart Poettering 249968612f bus: always explicitly close bus from main programs
Since b5eca3a205 we don't attempt to GC
busses anymore when unsent messages remain that keep their reference,
when they otherwise are not referenced anymore. This means that if we
explicitly want connections to go away, we need to close them.

With this change we will no do so explicitly wherver we connect to the
bus from a main program (and thus know when the bus connection should go
away), or when we create a private bus connection, that really should go
away after our use.

This fixes connection leaks in the NSS and PAM modules.
2014-08-04 16:25:24 +02:00
Zbigniew Jędrzejewski-Szmek 601185b43d Unify parse_argv style
getopt is usually good at printing out a nice error message when
commandline options are invalid. It distinguishes between an unknown
option and a known option with a missing arg. It is better to let it
do its job and not use opterr=0 unless we actually want to suppress
messages. So remove opterr=0 in the few places where it wasn't really
useful.

When an error in options is encountered, we should not print a lengthy
help() and overwhelm the user, when we know precisely what is wrong
with the commandline. In addition, since help() prints to stdout, it
should not be used except when requested with -h or --help.

Also, simplify things here and there.
2014-08-03 21:46:07 -04:00
Lennart Poettering 19befb2d5f sd-bus: introduce sd_bus_slot objects encapsulating callbacks or vtables attached to a bus connection
This makes callback behaviour more like sd-event or sd-resolve, and
creates proper object for unregistering callbacks.

Taking the refernce to the slot is optional. If not taken life time of
the slot will be bound to the underlying bus object (or in the case of
an async call until the reply has been recieved).
2014-05-15 01:15:30 +02:00
Lennart Poettering d0ce77344b busctl: when monitoring the bus, enable all credentials 2014-03-19 16:25:11 +01:00
Lennart Poettering 0936559234 sd-bus: add proper monitoring API 2014-03-19 04:17:00 +01:00
Lennart Poettering 151b9b9662 api: in constructor function calls, always put the returned object pointer first (or second)
Previously the returned object of constructor functions where sometimes
returned as last, sometimes as first and sometimes as second parameter.
Let's clean this up a bit. Here are the new rules:

1. The object the new object is derived from is put first, if there is any

2. The object we are creating will be returned in the next arguments

3. This is followed by any additional arguments

Rationale:

For functions that operate on an object we always put that object first.
Constructors should probably not be too different in this regard. Also,
if the additional parameters might want to use varargs which suggests to
put them last.

Note that this new scheme only applies to constructor functions, not to
all other functions. We do give a lot of freedom for those.

Note that this commit only changes the order of the new functions we
added, for old ones we accept the wrong order and leave it like that.
2014-02-20 00:03:10 +01:00
Thomas Hindoe Paaboel Andersen 17d47d8d2d busctl: add --no-legend and use in bash completion 2014-02-19 17:35:35 +01:00
Lennart Poettering 14008e4e9c busctl: include connection name in busctl output 2014-01-22 18:51:49 +01:00
Tom Gundersen 607553f930 libsystemd: split up into subdirs
We still only produce on .so, but let's keep the sources separate to make things a bit
less messy.
2014-01-21 14:41:35 +01:00
Renamed from src/libsystemd/busctl.c (Browse further)