summaryrefslogtreecommitdiff
path: root/src/machine
Commit message (Collapse)AuthorAgeFilesLines
* machinectl: allow --max-addresses=0Zbigniew Jędrzejewski-Szmek2022-10-201-21/+16
| | | | Sometimes the addresses are not important, so allow skipping them in output.
* shared/install: rename UnitFileChange to InstallChangeZbigniew Jędrzejewski-Szmek2022-10-131-2/+2
| | | | | It's shorter and more generic. The struct can contain info about changes to unit files, but also symlinks and errors.
* Merge pull request #24686 from d4nuu8/delta_outputLennart Poettering2022-09-231-2/+2
|\ | | | | shared/logs-show: add new --output= format "short-delta"
| * shared/logs-show: add new --output= format "short-delta"Daniel Braunwarth2022-09-231-2/+2
| | | | | | | | | | | | | | This new output formatting option is similar to "short-monotonic" but also shows the time delta between two messages. This fixes #24641.
* | shared/format-table: use enum instead of Table.empty_stringZbigniew Jędrzejewski-Szmek2022-09-221-1/+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-136-138/+57
|
* tree-wide: change --kill-who to --kill-whomZbigniew Jędrzejewski-Szmek2022-08-261-11/+11
| | | | | | | | | | | getopt allows non-ambiguous abbreviations, so backwards-compat is maintained, and people can use --kill-who (or even shorter abbreviations). English is flexible, so in common speach people would use both forms, even if "whom" is technically more correct. The advantage of using the longer form in the code is that we effectively allow both forms, so we stop punishing people who DTGCT¹, but still allow people to use the spoken form if they prefer. 1. Do the gramatically correct thing
* tree-wide: port things dirname_malloc() → path_extract_directory()Lennart Poettering2022-08-231-14/+10
|
* machine: drop an unused variableFrantisek Sumsal2022-08-201-4/+2
|
* machinectl: Add plumbing for a `--force` flag for file copyAlexander Wilson2022-07-274-1/+54
| | | | | | machine: Add APIs CopyTo[Machine]WithFlags + CopyFrom[Machine]WithFlags - Same API to those without `WithFlags` (except this can take flags) - Initially, only a flag to allow replacing a file if it already exists
* machine: switch to BusLocator-oriented helpersQuentin Deslandes2022-07-052-24/+7
| | | | Replace existing sd_bus_x calls with counterparts from bus-locator.h.
* Use https for freedesktop.orgMichael Biebl2022-06-282-2/+2
| | | | grep -l -r http:// | xargs sed -E -i s'#http://(.*).freedesktop.org#https://\1.freedesktop.org#'
* Merge pull request #23616 from keszybz/in-addr-to-string-formattingYu Watanabe2022-06-091-7/+2
|\ | | | | Add macros that allocate a fixed buffer for in_addr_to_string(), in_addr_prefix+to_string()
| * tree-wide: convert inet_ntop() calls to anonymous-buffer macrosZbigniew Jędrzejewski-Szmek2022-06-061-7/+2
| |
* | machinectl: ignore return value of get_process_comm()Shreenidhi Shedi2022-06-051-1/+1
|/ | | | Fixes: CID#1469720
* machine: update to use new-style sd-bus macros (#23012)Amarjargal2022-04-082-383/+243
| | | | | | | | | | * machine: update to use new-style sd-bus macros Replace old SD_BUS_METHOD_WITH_NAMES and SD_BUS_SIGNAL_WITH_NAMES macros to the new SD_BUS_METHOD_WITH_ARGS and SD_BUS_SIGNAL_WITH_ARGS macros. Meson test, mkosi test image and running machinectl after build returned no error. But since I don't have any virtual machines or containers, I'm not sure how to test the changes thoroughly.
* time-util: assume CLOCK_BOOTTIME always existsLennart Poettering2022-03-281-1/+1
| | | | | | | | Let's raise our supported baseline a bit: CLOCK_BOOTTIME started to work with timerfd in kernel 3.15 (i.e. back in 2014), let's require support for it now. This will raise our baseline only modestly from 3.13 → 3.15.
* various: make parse_env_file error handling the same in various placesZbigniew Jędrzejewski-Szmek2022-03-181-5/+3
| | | | | No big reason to do this, except that I was looking at all call sites and it's nicer if the same style is used accross the codebase.
* meson: move files' closing brace to separate lineZbigniew Jędrzejewski-Szmek2022-03-031-2/+4
|
* meson: do not use split() in file listsZbigniew Jędrzejewski-Szmek2022-03-021-18/+16
| | | | | | | | | | | The approach to use '''…'''.split() instead of a list of strings was initially used when converting from automake because it allowed identical blocks of lines to be used for both, making the conversion easier. But over the years we have been using normal lists more and more, especially when there were just a few filenames listed. This converts the rest. No functional change.
* tree-wide: use timestamp_is_set() moreLennart Poettering2022-02-221-2/+2
|
* machined: use one_zero() on one more occasionLennart Poettering2022-02-181-1/+1
|
* machined: sd-bus expects 'int', not 'bool' when returning unmarshalled booleansLennart Poettering2022-02-181-2/+1
| | | | | Fixes: #22555 Follow-up for: #22160
* machined: provide more details to polkit authLudwig Nussel2022-01-183-16/+112
|
* Merge pull request #22092 from keszybz/docs-linksZbigniew Jędrzejewski-Szmek2022-01-121-1/+1
|\ | | | | Add more doc pages, adjust links, add explanatory headers to examples and relax license to CC-0
| * policy files: adjust landing page linkZbigniew Jędrzejewski-Szmek2022-01-121-1/+1
| |
* | meson: Use files() for testsJan Janssen2022-01-111-1/+1
|/ | | | | | 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.
* machined: set TTYPath for container shellLudwig Nussel2021-12-231-1/+2
| | | | | TTYPath is needed for proper utmp registration of the shell to receive wall messages.
* meson: stop building out convenience libraries by defaultZbigniew Jędrzejewski-Szmek2021-12-161-1/+2
| | | | | | | | | | | | | | | | | The meson default for static_library() are: build_by_default=true, install=false. We never interact with the static libraries, and we only care about them as a stepping-stone towards the installable executables or libraries. Thus let's only build them if they are a dependency of something else we are building. While at it, let's drop install:false, since this appears to be the default. This change would have fixed the issue with lib_import_common failing to build too: we wouldn't attempt to build it. In practice this changes very little, because we generally only declare static libraries where there's something in the default target that will make use of them. But it seems to be a better pattern to set build_by_default to false.
* Define FOREACH_DIRENT through FOREACH_DIRENT_ALLZbigniew Jędrzejewski-Szmek2021-12-151-1/+0
| | | | As in the previous commit, 'de' is used as the iterator variable name.
* json: add new JSON_BUILD_CONST_STRING() macroLennart Poettering2021-11-251-5/+5
| | | | | | | | | | | | | | | | This macro is like JSON_BUILD_STRING() but uses our json library's ability to use literal strings directly as JsonVariant objects. The changes all our codebase to use this new macro whenever we build JSON objects from literal strings. (I tried to make this automatic, i.e. to detect in JSON_BUILD_STRING() whether something is a literal string nicely and thus do this stuff automatically, but I couldn't find a way.) This should reduce memory usage of our JSON code a bit. Constant strings we use very often will now be shared and mapped directly from the ELF image.
* shared: clean up mkdir.h/label.h situationLennart Poettering2021-11-162-2/+2
| | | | | | | | | | Previously the mkdir_label() family of calls was implemented in src/shared/mkdir-label.c but its functions partly declared ins src/shared/label.h and partly in src/basic/mkdir.h (!!). That's weird (and wrong). Let's clean this up, and add a proper mkdir-label.h matching the .c file.
* tree-wide: use new RET_NERRNO() helper at various placesLennart Poettering2021-11-161-8/+2
|
* Merge pull request #20138 from keszybz/coding-style-variable-declsLuca Boccassi2021-11-052-15/+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-6/+6
| |
| * tree-wide: warn when sd_notify fails with READY=1 or FDSTOREREMOVE=1Zbigniew Jędrzejewski-Szmek2021-11-031-9/+5
| | | | | | | | | | | | | | | | Most sd_notify() calls are like log_info() — the result is only informative and if they fail, it's best ignore this. But if a call with READY=1 fails, the unit may enter a failed state, so we should warn about this. Similarly for FSTOREREMOVE=1: the manager may be left with a stale fd, at least wasting resources.
* | tree-wide: 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.) 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.
* alloc-util: add strdupa_safe() + strndupa_safe() and use it everywhereLennart Poettering2021-10-141-1/+1
| | | | | | | | | | | | | Let's define two helpers strdupa_safe() + strndupa_safe() which do the same as their non-safe counterparts, except that they abort if called with allocations larger than ALLOCA_MAX. This should ensure that all our alloca() based allocations are subject to this limit. afaics glibc offers three alloca() based APIs: alloca() itself, strndupa() + strdupa(). With this we have now replacements for all of them, that take the limit into account.
* tree-wide: make format_ifname() or friends return negative errno on failureYu Watanabe2021-09-291-2/+2
| | | | | | | | Also, - drop unnecessary +1 from buffer size, as IF_NAMESIZE or IFNAMSIZ includes the nul at the end. - format_ifname() does not update buffer on failure, - introduces format_ifname_alloc(), FORMAT_IFNAME(), and their friends.
* variuos: add missing includesZbigniew Jędrzejewski-Szmek2021-09-221-0/+1
|
* import: allow file:// in addition to HTTP(S)Lennart Poettering2021-08-201-2/+2
| | | | | | | | | Previously we only allows http/https urls, let's open this up a bit. Why? Because it makes testing *so* *much* *easier* as we don't need to run a HTTP server all the time. CURL mostly abstracts the differences of http/https away from us, hence we can get away with very little extra work.
* machinectl: allow --setenv=FOOZbigniew Jędrzejewski-Szmek2021-08-111-7/+3
|
* Drop the text argument from assert_not_reached()Zbigniew Jędrzejewski-Szmek2021-08-031-1/+1
| | | | | | | | | | | | | | | | | 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.
* machined-varlink: fix double freeDavid Tardon2021-08-021-1/+1
| | | | Fixes: #18599
* tree-wide: FORMAT_TIMESTAMP() or friends must be used as a function argumentYu Watanabe2021-07-151-44/+33
| | | | Follow-ups for #20109.
* tree-wide: add FORMAT_BYTES()Zbigniew Jędrzejewski-Szmek2021-07-091-12/+9
|
* tree-wide: add FORMAT_TIMESTAMP_RELATIVE()Zbigniew Jędrzejewski-Szmek2021-07-091-5/+3
|
* tree-wide: use FORMAT_TIMESTAMP()Zbigniew Jędrzejewski-Szmek2021-07-091-5/+3
|
* alloc-util: simplify GREEDY_REALLOC() logic by relying on malloc_usable_size()Lennart Poettering2021-05-192-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | 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.)
* bus-print-property: introduce BusPrintPropertyFlagsYu Watanabe2021-04-281-6/+7
| | | | Follow-ups for 1ceaad69378272c64da4ecaab0d59ebb7a92ca0a.