summaryrefslogtreecommitdiffstats
path: root/src/busctl (follow)
Commit message (Collapse)AuthorAgeFilesLines
* busctl,sd-lldp: explicitly specify type of argument in compare functionYu Watanabe2018-09-191-3/+2
| | | | | | Several functions are shared by qsort and hash_ops or Prioq. This makes these functions explicitly specify argument type, and cast to __compar_fn_t where necessary.
* tree-wide: use typesafe_qsort()Yu Watanabe2018-09-191-5/+3
|
* tree-wide: add clickable man page link to all --help textsLennart Poettering2018-08-201-1/+11
| | | | | | | | | | This is a bit like the info link in most of GNU's --help texts, but we don't do info but man pages, and we make them properly clickable on terminal supporting that, because awesome. I think it's generally advisable to link up our (brief) --help texts and our (more comprehensive) man pages a bit, so this should be an easy and straight-forward way to do it.
* busctl: make parameter constLennart Poettering2018-06-251-1/+1
| | | | | it's initialized from an argv[] entry, hence let's be make it non-writable by default.
* busctl: make use of log_error_errno() where we canLennart Poettering2018-06-141-97/+49
|
* busctl: add 'const' where we canLennart Poettering2018-06-141-1/+1
|
* busctl: use fflush_and_check() where appropriateLennart Poettering2018-06-141-4/+4
|
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-143-10/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-143-6/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* tree-wide: drop !! casts to booleansZbigniew Jędrzejewski-Szmek2018-06-131-5/+5
| | | | | | | | | | | They are not needed, because anything that is non-zero is converted to true. C11: > 6.3.1.2: When any scalar value is converted to _Bool, the result is 0 if the > value compares equal to 0; otherwise, the result is 1. https://stackoverflow.com/questions/31551888/casting-int-to-bool-in-c-c
* string-util: rename strdash_if_empty() to empty_to_dash()Yu Watanabe2018-05-101-8/+4
|
* tree-wide: drop spurious newlines (#8764)Lennart Poettering2018-04-192-4/+0
| | | | | | | | Double newlines (i.e. one empty lines) are great to structure code. But let's avoid triple newlines (i.e. two empty lines), quadruple newlines, quintuple newlines, …, that's just spurious whitespace. It's an easy way to drop 121 lines of code, and keeps the coding style of our sources a bit tigther.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-063-39/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* tree-wide: use TAKE_PTR() and TAKE_FD() macrosYu Watanabe2018-04-051-2/+1
|
* macro: introduce TAKE_PTR() macroLennart Poettering2018-03-221-4/+3
| | | | | | | | | | | | | | | | This macro will read a pointer of any type, return it, and set the pointer to NULL. This is useful as an explicit concept of passing ownership of a memory area between pointers. This takes inspiration from Rust: https://doc.rust-lang.org/std/option/enum.Option.html#method.take and was suggested by Alan Jenkins (@sourcejedi). It drops ~160 lines of code from our codebase, which makes me like it. Also, I think it clarifies passing of ownership, and thus helps readability a bit (at least for the initiated who know the new macro)
* tree-wide: voidify pager_open()Yu Watanabe2018-03-191-7/+7
| | | | | | Even if pager_open() fails, in general, we should continue the operations. All erroneous cases in pager_open() show log message in the function. So, it is not necessary to check the returned value.
* busctl: drop redundant pager_open()Yu Watanabe2018-03-191-2/+0
|
* busctl: add missing oom checkYu Watanabe2018-03-191-0/+3
|
* busctl: use dispatch_verb()Yu Watanabe2018-03-191-179/+151
|
* Comment the fact that some tools need to termintate their bus connect firstFranck Bui2018-01-121-0/+2
|
* Revert "tree-wide: use _cleanup_(sd_bus_flush_close_unrefp) at various ↵Franck Bui2018-01-121-1/+2
| | | | | | | | | | | appropriate places" This reverts commit 0b3c84eb7da3a8c28ac248a68228f6a7edbb2e19. The removal of _cleanup_() usages was done on purpose, see cf647b69baee4c478d3909c327e3d917e1563f44. Fixes: #3543
* busctl: add a new --watch-bind switchLennart Poettering2018-01-051-1/+22
| | | | This is useful for testing, and early-boot scripting.
* tree-wide: make use of new STRLEN() macro everywhere (#7639)Lennart Poettering2017-12-141-4/+4
| | | | | Let's employ coccinelle to do this for us. Follow-up for #7625.
* busctl: let's make use of the log_error_errno() callsLennart Poettering2017-12-141-8/+4
|
* busctl: modernize code a bitLennart Poettering2017-12-141-7/+3
| | | | I am puzzled why coccinelle is unwilling to detect these cases...
* tree-wide: use __fsetlocking() instead of fxyz_unlocked()Lennart Poettering2017-12-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Let's replace usage of fputc_unlocked() and friends by __fsetlocking(f, FSETLOCKING_BYCALLER). This turns off locking for the entire FILE*, instead of doing individual per-call decision whether to use normal calls or _unlocked() calls. This has various benefits: 1. It's easier to read and easier not to forget 2. It's more comprehensive, as fprintf() and friends are covered too (as these functions have no _unlocked() counterpart) 3. Philosophically, it's a bit more correct, because it's more a property of the file handle really whether we ever pass it on to another thread, not of the operations we then apply to it. This patch reworks all pieces of codes that so far used fxyz_unlocked() calls to use __fsetlocking() instead. It also reworks all places that use open_memstream(), i.e. use stdio FILE* for string manipulations. Note that this in some way a revert of 4b61c8751135c58be043d86b9fef4c8ec7aadf18.
* busctl: list all short options in help textMarcus Folkesson2017-12-031-1/+1
| | | | Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
* Add set/hashmap helpers for non-trivial freeing and use where straighforwardZbigniew Jędrzejewski-Szmek2017-11-281-6/+1
| | | | | | A macro is needed because otherwise we couldn't ensure type safety. Some simple tests are included. No functional change intended.
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-193-0/+3
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* busctl: fix minor memory leak in busctl (#7331)Lennart Poettering2017-11-141-3/+4
| | | Fixes: #7330
* tree-wide: use _cleanup_(sd_bus_flush_close_unrefp) at various appropriate ↵Lennart Poettering2017-11-101-2/+1
| | | | | | places Let's shorten the code a bit.
* busctl: monitor - ignore the final NameLost messageTom Gundersen2017-05-251-3/+3
| | | | | | | | | Commit f5938e8ff3cf5b6fadd6b440b3b10fc0e5a64733 started dropping all messages before we become a monitor, but the last one was getting through. This drops also the last NameLost message, which indicatse the switch from a regular peer to a monitor.
* busctl: monitor - only start printing messages once we have become a monitor ↵Tom Gundersen2017-05-111-0/+23
| | | | | | | | | | (#5931) A connection becomes a monitor the moment it loses its unique name, so any messages received before that should not be dumped to the console. Currently, we print NameAcquired and NameLost for the unique name of the peer that becomes the monitor, simply discard all messages until we receive our NameLost signal.
* Move busctl sources to src/busctlZbigniew Jędrzejewski-Szmek2017-04-053-0/+2900
busctl is not part of libsystemd, and should not be stored under libsystemd. In particular this is confusing because busctl is linked with libshared, but stuff in libsystemd is not supposed to depend on libshared.