summaryrefslogtreecommitdiff
path: root/src/busctl
Commit message (Collapse)AuthorAgeFilesLines
* busctl: set a description for the bus connectionLennart Poettering2023-05-161-0/+2
| | | | | | | Unlike most other bus connections in our codebase this one is created manually and every setting set invididually. It hence does not have a description by default (as all automatic connections have). Set one explicitly.
* busctl: add --xml-interface to the help messageMasatake YAMATO2023-04-111-0/+1
| | | | Signed-off-by: Masatake YAMATO <yamato@redhat.com>
* busctl: also assume --full if not writing to terminalZbigniew Jędrzejewski-Szmek2023-03-281-3/+6
| | | | If people grep the output, it probably shouldn't be ellipsized.
* busctl: use size_t for set sizeZbigniew Jędrzejewski-Szmek2023-03-281-9/+9
| | | | Also reduce the scope of variables.
* busctl: do not truncate property values when --fullZbigniew Jędrzejewski-Szmek2023-03-281-1/+1
|
* basic: add RuntimeScope enumLennart Poettering2023-03-101-6/+18
| | | | | | | | | | | | In various tools and services we have a per-system and per-user concept. So far we sometimes used a boolean indicating whether we are in system mode, or a reversed boolean indicating whether we are in user mode, or the LookupScope enum used by the lookup path logic. Let's address that, in introduce a common enum for this, we can use all across the board. This is mostly just search/replace, no actual code changes.
* meson: Use dicts for test definitionsJan Janssen2023-02-211-2/+6
| | | | | | | Although this slightly more verbose it makes it much easier to reason about. The code that produces the tests heavily benefits from this. Test lists are also now sorted by test name.
* meson: Do not include headers in source listsJan Janssen2023-01-241-4/+3
| | | | | | Meson+ninja+compiler do this for us and are better at it. https://mesonbuild.com/FAQ.html#do-i-need-to-add-my-headers-to-the-sources-list-like-in-autotools
* busctl: simplify peeking the typeLennart Poettering2023-01-161-20/+10
| | | | | | | let's peek the type before we enter the variant, not after, so that we can reuse it as-is, instead having to recombine it later. Follow-up for: #26049
* busctl: fix introspecting DBus propertiesYu Watanabe2023-01-151-2/+19
| | | | | | Follow-up for f2f7785d7a47ffa48ac929648794e1288509ddd8. Fixes #26033.
* busctl-introspect: use _cleanup_David Tardon2022-12-141-23/+11
|
* basic: rename util.h to logarithm.hZbigniew Jędrzejewski-Szmek2022-11-081-1/+0
| | | | | util.h is now about logarithms only, so we can rename it. Many files included util.h for no apparent reason… Those includes are dropped.
* basic: move version() to build.h+cZbigniew Jędrzejewski-Szmek2022-11-081-0/+1
|
* shared/format-table: use enum instead of Table.empty_stringZbigniew Jędrzejewski-Szmek2022-09-221-3/+1
| | | | | | | | | | | | All users were setting this to some static string (usually "-"), so let's simplify things by not doing strdup, but instead limiting callers to a fixed set of values. In preparation for the next commit, the function is renamed from "empty" to "replacement", because it'll be used for more than empty fields. I didn't do the whole string-table setup, because it's all used internally in one file and this way we can immediately assert if an invalid value is passed in. Some callers were (void)ing the error, others were ignoring it, and others propagating. It's nicer to remove the boilerplate.
* tree-wide: use ASSERT_PTR moreDavid Tardon2022-09-132-7/+3
|
* busctl: Add introspect support for methods with same name but different ↵Sebastian Scheibner2022-09-061-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | signature D-Bus interfaces can have multiple methods with the same name, as long as they have different arguments (signature). Currently busctl can call those methods but when introspecting the interface it just displays "Duplicate method" This PR fixes the behavior, by also adding the signature to the hash for the members set. Before this patch: $ busctl introspect org.asamk.Signal /org/asamk/Signal Invalid introspection data: duplicate method 'sendMessage' on interface 'org.asamk.Signal'. After this patch: $ busctl introspect org.asamk.Signal /org/asamk/Signal NAME TYPE SIGNATURE RESULT/VALUE FLAGS org.asamk.Signal interface - - - .sendMessage method as x - .sendMessage method s x - Calling the methods already works as expected, as the user must specify the signature explicitely: busctl --user call org.asamk.Signal /org/asamk/Signal org.asamk.Signal sendMessage "as" 2 foo bar busctl --user call org.asamk.Signal /org/asamk/Signal org.asamk.Signal sendMessage "s" foo $ busctl --xml introspect org.asamk.Signal /org/asamk/Signal <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> <node name="/org/asamk/Signal"> <interface name="org.asamk.Signal"> <method name="sendMessage" > <arg type="as" direction="in"/> <arg type="x" direction="out"/> </method> <method name="sendMessage" > <arg type="s" direction="in"/> <arg type="x" direction="out"/> </method> <interface name="org.freedesktop.DBus.Introspectable"> <method name="Introspect"> <arg type="s" direction="out"/> </method> </interface> <interface name="org.freedesktop.DBus.Peer"> <method name="Ping"> </method> </interface> </node>
* busctl: Fix warning about invaild introspection dataSebastian Scheibner2022-09-061-8/+12
| | | | | The set_put function returns 0 if the element is already in the set and not EEXIST, like e.g. hashmap does.
* Use https for freedesktop.orgMichael Biebl2022-06-281-7/+7
| | | | grep -l -r http:// | xargs sed -E -i s'#http://(.*).freedesktop.org#https://\1.freedesktop.org#'
* strv: make iterator in STRV_FOREACH() declaread in the loopYu Watanabe2022-03-191-4/+1
| | | | This also avoids multiple evaluations in STRV_FOREACH_BACKWARDS()
* test: Use TEST macros in more placesJan Janssen2022-03-161-10/+2
|
* meson: Use files() for testsJan Janssen2022-01-111-3/+3
| | | | | | Not having to provide the full path in the source tree is much nicer and the produced lists can also be used anywhere in the source tree.
* bus-dump: change capture output to use pcapng (#21738)Stephen Hemminger2021-12-251-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes busctl capture to generate pcapng format instead of the legacy pcap format files. It includes basic meta-data in the file and still uses microsecond time resolution. In future, more things can be added such as high resolution timestams, statistics, etc. PCAP Next Generation capture file format is what tshark uses and is in process of being standardized in IETF. It is also readable with libpcap. $ capinfos /tmp/new.pcapng File name: /tmp/new.pcapng File type: Wireshark/... - pcapng File encapsulation: D-Bus File timestamp precision: microseconds (6) Packet size limit: file hdr: (not set) Packet size limit: inferred: 4096 bytes Number of packets: 22 File size: 21kB Data size: 20kB Capture duration: 0.005694 seconds First packet time: 2021-12-11 11:57:42.788374 Last packet time: 2021-12-11 11:57:42.794068 Data byte rate: 3,671kBps Data bit rate: 29Mbps Average packet size: 950.27 bytes Average packet rate: 3,863 packets/s SHA256: b85ed8b094af60c64aa6d9db4a91404e841736d36b9e662d707db9e4096148f1 RIPEMD160: 81f9bac7ec0ec5cd1d55ede136a5c90413894e3a SHA1: 8400822ef724b934d6000f5b7604b9e6e91be011 Strict time order: True Capture oper-sys: Linux 5.14.0-0.bpo.2-amd64 Capture application: systemd 250 (250-rc2-33-gdc79ae2+) Number of interfaces in file: 1 Interface #0 info: Encapsulation = D-Bus (146 - dbus) Capture length = 4096 Time precision = microseconds (6) Time ticks per second = 1000000 Number of stat entries = 0 Number of packets = 22
* Merge pull request #20138 from keszybz/coding-style-variable-declsLuca Boccassi2021-11-051-11/+11
|\ | | | | A coding style tweak and checking of sd_notify() calls and voidification of pager_open()
| * Make pager_open() return voidZbigniew Jędrzejewski-Szmek2021-11-031-11/+11
| |
* | tree-wide: do not print hint about -M if -M is already usedZbigniew Jędrzejewski-Szmek2021-11-041-3/+3
| | | | | | | | | | | | | | | | (Or when -H is used, since -H and -M are incompatible.) Note that the slightly unusual form with separate boolean variables (hint_vars, hint_addr) instead of e.g. a const char* variable to hold the message, because this way we don't trigger the warning about non-literal format.
* | busctl: do not print hint about -M if -M is already usedZbigniew Jędrzejewski-Szmek2021-11-041-1/+1
|/ | | | (Or when -H is used, since -H and -M are incompatible.)
* test: shorten code a bitYu Watanabe2021-10-121-42/+4
|
* test: add a test for parsing xml obtained by DBus Introspect methodYu Watanabe2021-10-102-0/+416
|
* busctl: add missing headerYu Watanabe2021-10-101-0/+1
|
* busctl: shorten code a bitYu Watanabe2021-10-101-2/+1
|
* busctl: use set_ensure_consume()Yu Watanabe2021-10-101-9/+1
|
* basic: split out glyph/emoji related calls from locale-util.[ch] into ↵Lennart Poettering2021-10-051-1/+1
| | | | | | | | glyph-util.[ch] These functions are used pretty much independently of locale, i.e. the only info relevant is whether th locale is UTF-8 or not. Hence let's give this its own pair of .c/.h files.
* tree-wide: port everything over to new sd-id128 compund literal blissLennart Poettering2021-08-201-3/+1
|
* Drop the text argument from assert_not_reached()Zbigniew Jędrzejewski-Szmek2021-08-032-5/+5
| | | | | | | | | | | | | | | | | In general we almost never hit those asserts in production code, so users see them very rarely, if ever. But either way, we just need something that users can pass to the developers. We have quite a few of those asserts, and some have fairly nice messages, but many are like "WTF?" or "???" or "unexpected something". The error that is printed includes the file location, and function name. In almost all functions there's at most one assert, so the function name alone is enough to identify the failure for a developer. So we don't get much extra from the message, and we might just as well drop them. Dropping them makes our code a tiny bit smaller, and most importantly, improves development experience by making it easy to insert such an assert in the code without thinking how to phrase the argument.
* alloc-util: simplify GREEDY_REALLOC() logic by relying on malloc_usable_size()Lennart Poettering2021-05-191-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | We recently started making more use of malloc_usable_size() and rely on it (see the string_erase() story). Given that we don't really support sytems where malloc_usable_size() cannot be trusted beyond statistics anyway, let's go fully in and rework GREEDY_REALLOC() on top of it: instead of passing around and maintaining the currenly allocated size everywhere, let's just derive it automatically from malloc_usable_size(). I am mostly after this for the simplicity this brings. It also brings minor efficiency improvements I guess, but things become so much nicer to look at if we can avoid these allocation size variables everywhere. Note that the malloc_usable_size() man page says relying on it wasn't "good programming practice", but I think it does this for reasons that don't apply here: the greedy realloc logic specifically doesn't rely on the returned extra size, beyond the fact that it is equal or larger than what was requested. (This commit was supposed to be a quick patch btw, but apparently we use the greedy realloc stuff quite a bit across the codebase, so this ends up touching *a*lot* of code.)
* tree-wide: avoid uninitialized warning on _cleanup_ variablesLuca Boccassi2021-04-141-4/+4
| | | | | | | With some versions of the compiler, the _cleanup_ attr makes it think the variable might be freed/closed when uninitialized, even though it cannot happen. The added cost is small enough to be worth the benefit, and optimized builds will help reduce it even further.
* tree-wide: use UINT64_MAX or friendsYu Watanabe2021-03-051-1/+1
|
* table: drop last SIZE_MAX from table_set_sort() and table_set_display()Yu Watanabe2021-03-051-5/+3
|
* Merge pull request #18596 from keszybz/systemctl-quiet-legendLennart Poettering2021-02-171-20/+11
|\ | | | | systemctl: hide legends with --quiet, allow overriding
| * tree-wide: add a helper to parse boolean optargZbigniew Jędrzejewski-Szmek2021-02-171-20/+11
| | | | | | | | | | | | | | | | | | This nicely covers the case when optarg is optional. The same parser can be used when the option string passed to getopt_long() requires a parameter and when it doesn't. The error messages are made consistent. Also fixes a log error c&p in --crash-reboot message.
* | tree-wide: return NULL from freeing functionsZbigniew Jędrzejewski-Szmek2021-02-161-7/+5
| | | | | | | | | | | | I started working on this because I wanted to change how DEFINE_TRIVIAL_CLEANUP_FUNC is defined. Even independently of that change, it's nice to make make things more consistent and predictable.
* | Merge pull request #18481 from keszybz/rpm-restart-post-transZbigniew Jędrzejewski-Szmek2021-02-161-2/+2
|\ \ | |/ |/| Restart units after the rpm transaction
| * sd-bus: standarize on NULL for empty signature in method callsZbigniew Jędrzejewski-Szmek2021-02-121-2/+2
| | | | | | | | | | We would use sometimes "" and sometimes NULL. They are equivalent, so let's use NULL everywhere, except for a two places in tests.
* | Move and rename parse_json_argument() functionZbigniew Jędrzejewski-Szmek2021-02-151-1/+2
|/ | | | | json.[ch] is a very generic implementation, and cmdline argument parsing doesn't fit there.
* tree-wide: enable colorized logging for daemons when run in consoleYu Watanabe2021-02-011-1/+1
| | | | It may be useful when debugging daemons.
* tree-wide: Drop custom formatting for print() help messagesDaan De Meyer2021-01-311-6/+5
| | | | | | | | | | | | I think this formatting was originally used because it simplified adding new options to the help messages. However, these days, most tools their help message end with "\nSee the %s for details.\n" so the final line almost never has to be edited which eliminates the benefit of the custom formatting used for printf() help messages. Let's make things more consistent and use the same formatting for printf() help messages that we use everywhere else. Prompted by https://github.com/systemd/systemd/pull/18355#discussion_r567241580
* busctl: show --help in pagerLennart Poettering2021-01-211-0/+2
| | | | We do this for other larger --help texts, do so here too.
* busctl/homectl: port the obvious cases to table_print_with_pager()Lennart Poettering2021-01-211-10/+1
|
* meson: move source file list for busctlYu Watanabe2021-01-191-0/+6
|
* busctl: port busctl to JSON_FORMAT_OFF tooLennart Poettering2021-01-091-44/+16
| | | | | This is a bit more complex, since busctl's JSON code predates json.c and was only minimally updated sofar.