summaryrefslogtreecommitdiff
path: root/src/machine
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: drop locale.h when locale-util.h is includedYu Watanabe2019-11-041-1/+0
|
* tree-wide: drop string.h when string-util.h or friends are includedYu Watanabe2019-11-044-4/+0
|
* Merge pull request #13866 from keszybz/nspawn-restartsLennart Poettering2019-10-306-4/+50
|\ | | | | Make 'machinectl reboot' functional
| * machined: only Unref units that we AddRef'dZbigniew Jędrzejewski-Szmek2019-10-292-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | b92d0b4c5adef37e9de8f6cc22a0e27b97fcf3ad added AddRef to the StartTransientUnit call in machine_start_scope()/manager_start_scope() and a corresponding Unref call in machine_stop_scope(). But when we are running systemd-nspawn@ with --keep unit, the unit is not created by machined so the AddRef never happens. Then when trying to stop the unit, we'd get: systemd-machined[1101]: Sent message type=method_call sender=n/a destination=org.freedesktop.systemd1 path=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=UnrefUnit cookie=37 reply_cookie=0 signature=s error-name=n/a error-message=n/a systemd-machined[1101]: Got message type=error sender=:1.1 destination=:1.13 path=n/a interface=n/a member=n/a cookie=2443 reply_cookie=37 signature=s error-name=org.freedesktop.systemd1.NotReferenced error-message=Unit has not been referenced yet. systemd-machined[1101]: Failed to drop reference to machine scope, ignoring: Unit has not been referenced yet.
| * machined: add UnregisterMachine methodZbigniew Jędrzejewski-Szmek2019-10-295-1/+42
| | | | | | | | | | | | This is the opposite of RegisterMachine: machined knows that the machine is "gone", but doesn't do anything on its own. We already had TerminateMachine, but that would stop the unit, which isn't always wanted.
* | basic/fs-util: change CHASE_OPEN flag into a separate output parameterZbigniew Jędrzejewski-Szmek2019-10-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | chase_symlinks() would return negative on error, and either a non-negative status or a non-negative fd when CHASE_OPEN was given. This made the interface quite complicated, because dependning on the flags used, we would get two different "types" of return object. Coverity was always confused by this, and flagged every use of chase_symlinks() without CHASE_OPEN as a resource leak (because it would this that an fd is returned). This patch uses a saparate output parameter, so there is no confusion. (I think it is OK to have functions which return either an error or an fd. It's only returning *either* an fd or a non-fd that is confusing.)
* | Highlight the synopsis and summary in --helpZbigniew Jędrzejewski-Szmek2019-10-081-2/+4
| | | | | | | | | | This doesn't cover all the binaries, but I don't know how to script this, and I run out of steam ;)
* | Move the Commands section above Options sectionZbigniew Jędrzejewski-Szmek2019-10-081-30/+31
|/ | | | | | | For executables which take a verb, we should list the verbs first, and then options which modify those verbs second. The general layout of the man page is from general description to specific details, usually Overview, Commands, Options, Return Value, Examples, References.
* tree-wide: get rid of strappend()Lennart Poettering2019-07-123-3/+4
| | | | | It's a special case of strjoin(), so no need to keep both. In particular as typing strjoin() is even shoert than strappend().
* tree-wide: make use of errno_or_else() everywhereLennart Poettering2019-07-112-12/+14
|
* terminal-util: introduce openpt_allocate()Franck Bui2019-06-183-31/+9
| | | | | | | | | | | | | | | | Allocating a pty is done in a couple of places so let's introduce a new helper which does the job. Also the new function, as well as openpt_in_namespace(), returns both pty master and slave so the callers don't need to know about the pty slave allocation details. For the same reasons machine_openpt() prototype has also been changed to return both pty master and slave so callers don't need to allocate a pty slave which might be in a different namespace. Finally openpt_in_namespace() has been renamed into openpt_allocate_in_namespace().
* tree-wide: replace if_indextoname() with format_ifname()Yu Watanabe2019-05-291-2/+2
|
* Merge pull request #12411 from keszybz/pr/12394Lennart Poettering2019-05-081-0/+1
|\ | | | | run: when emitting the calendarspec warning, use red
| * Enable log colors for most of tools in /usr/binZbigniew Jędrzejewski-Szmek2019-05-081-0/+1
| | | | | | | | | | | | | | | | | | | | When emitting the calendarspec warning we want to see some color. Follow-up for 04220fda5c. Exceptions: - systemctl, because it has a lot hand-crafted coloring - tmpfiles, sysusers, stdio-bridge, etc, because they are also used in services and I'm not sure if this wouldn't mess up something.
* | machinectl/loginctl: show json output if requested even if zero entriesLennart Poettering2019-05-081-1/+1
|/
* Make fopen_temporary and fopen_temporary_label unlockedZbigniew Jędrzejewski-Szmek2019-04-121-2/+0
| | | | | | | | This is partially a refactoring, but also makes many more places use unlocked operations implicitly, i.e. all users of fopen_temporary(). AFAICT, the uses are always for short-lived files which are not shared externally, and are just used within the same context. Locking is not necessary.
* basic: add new helper call empty_or_dash_to_null()Lennart Poettering2019-04-081-18/+10
| | | | | We have a function like this at two places already. Let's unify it in one generic location and let's port a number of users over.
* tree-wide: introduce empty_or_dash() helperLennart Poettering2019-04-081-11/+5
| | | | | At quite a few places we check isempty() || streq(…, "-"), let's add a helper to simplify that, and replace that by a single function call.
* headers: remove unneeded includes from util.hZbigniew Jędrzejewski-Szmek2019-03-273-0/+4
| | | | | This means we need to include many more headers in various files that simply included util.h before, but it seems cleaner to do it this way.
* util: split out nulstr related stuff to nulstr-util.[ch]Lennart Poettering2019-03-141-0/+1
|
* bus-unit-util: split out code that shows a unit's process treeLennart Poettering2019-03-131-0/+1
| | | | | The code is complex enough to deserve its own .c file. Let's split this out.
* shared: split out code to wait for jobs to complet into its own source fileLennart Poettering2019-03-131-0/+1
| | | | | | | It's complex enough and quite a few functions. Let's hence split this out. No code change, just some rearranging of source files.
* util: split out sorting related calls to new sort-util.[ch]Lennart Poettering2019-03-131-1/+1
|
* util: split out namespace related stuff into a new namespace-util.[ch] pairLennart Poettering2019-03-131-0/+1
| | | | Just some minor reorganiztion.
* machinectl: do not format size if freed disk space is "-1"Yu Watanabe2019-03-111-6/+14
| | | | Closes #11941.
* machinectl: fix argument index in error logYu Watanabe2019-02-041-2/+2
| | | | Fixes #11628.
* tree-wide: whenever we allocate a new bus object, close it before dropping ↵Lennart Poettering2019-01-171-1/+1
| | | | | | | | | | | | | | | final ref This doesn't really change much, but feels more correct to do, as it ensures that all messages currently queued in the bus connections are definitely unreffed and thus destryoing of the connection object will follow immediately. Strictly speaking this change is entirely unnecessary, since nothing else could have acquired a ref to the connection and queued a message in, however, now that we have the new sd_bus_close_unref() helper it makes a lot of sense to use it here, to ensure that whatever happens nothing that might have been queued fucks with us.
* tree-wide: make sure to flush/close all bus connections when our daemons exitLennart Poettering2019-01-171-1/+1
| | | | | | | Let's make sure everything is written out ebfore we exit, so that no messages keep our bus connections referenced. Fixes: #11462
* timesyncd,resolved,machinectl: drop calls to sd_event_get_exit_code()Zbigniew Jędrzejewski-Szmek2019-01-081-3/+2
| | | | | | | | In all three cases, sd_event_loop() will return the exit code anyway. If sd_event_loop() returns negative, failure is logged and results in an immediate return. Otherwise, we don't care if sd_event_loop() returns 0 or positive, because the return value feeds into DEFINE_MAIN_FUNCTION(), which doesn't make the distinction.
* fileio: replace read_nul_string() by read_line() with a special flagLennart Poettering2018-12-181-4/+4
| | | | | | | read_line() is a lot more careful and optimized than read_nul_string() but does mostly the same thing. let's replace the latter by the former, just with a special flag that toggles between the slightly different EOL rules if both.
* tree-wide: port some code over to safe_fgetc()Lennart Poettering2018-12-181-3/+9
|
* machined: flush nscd caches whenever a machine comes/goesLennart Poettering2018-12-155-0/+44
| | | | This way, nss-mymachines should always serve authoritative data.
* machined: fix memory corruptionLennart Poettering2018-12-151-5/+4
| | | | | | Let's make sure the first hashmap we destroy also frees all machines, because otherwise when freeing the other hashmaps we'll try to deregister the contained machines from the hashmaps already destroyed.
* locale-util: prefix special glyph enum values with SPECIAL_GLYPH_Lennart Poettering2018-12-141-1/+1
| | | | | | | This has been irritating me for quite a while: let's prefix these enum values with a common prefix, like we do for almost all other enums. No change in behaviour, just some renaming.
* tree-wide: Remove O_CLOEXEC from fdopenChris Down2018-12-122-2/+2
| | | | | | | | | | | | fdopen doesn't accept "e", it's ignored. Let's not mislead people into believing that it actually sets O_CLOEXEC. From `man 3 fdopen`: > e (since glibc 2.7): > Open the file with the O_CLOEXEC flag. See open(2) for more information. This flag is ignored for fdopen() As mentioned by @jlebon in #11131.
* Merge pull request #10935 from poettering/rlimit-nofile-safeZbigniew Jędrzejewski-Szmek2018-12-061-1/+1
|\ | | | | | | Merged by hand to resolve a trivial conflict in TODO.
| * machined: prefix child process name with 'sd'Lennart Poettering2018-12-011-1/+1
| | | | | | | | | | | | So far we followed to rule that child processes we fork off without execve() are named "(sd-xyz)", but one child process didn't follow this. Correct that.
* | lockfile: drop unnecessary headers from lockfile-util.hYu Watanabe2018-12-062-0/+2
| |
* | util: drop missing.h from socket-util.hYu Watanabe2018-12-061-0/+1
| |
* | Merge pull request #11042 from yuwata/tiny-coding-style-fixesLennart Poettering2018-12-041-1/+1
|\ \ | | | | | | Tiny coding style fixes
| * | tree-wide: add whitespace between type and variable nameYu Watanabe2018-12-041-1/+1
| | |
* | | tree-wide: specify all table headers in lower-caseLennart Poettering2018-12-031-2/+2
| | |
* | | machinectl: optionally output table in JSONLennart Poettering2018-12-031-1/+7
|/ /
* | Merge pull request #10920 from yuwata/hashmap-destructorLennart Poettering2018-12-035-20/+18
|\ \ | | | | | | hashmap: make hashmap_free() call destructors of key or value
| * | machine: introduce machine_hash_ops and use itYu Watanabe2018-12-023-10/+9
| | |
| * | machine-image: introduce image_hash_ops and use itYu Watanabe2018-12-023-10/+9
| |/
* | util-lib: split out env file parsing code into env-file.cLennart Poettering2018-12-022-1/+2
| | | | | | | | | | | | It's quite complex, let's split this out. No code changes, just some file rearranging.
* | util-lib: split out all temporary file related calls into tmpfiles-util.cLennart Poettering2018-12-023-0/+3
|/ | | | | | | | This splits out a bunch of functions from fileio.c that have to do with temporary files. Simply to make the header files a bit shorter, and to group things more nicely. No code changes, just some rearranging of source files.
* Merge pull request #10989 from keszybz/nss-manLennart Poettering2018-11-291-19/+7
|\ | | | | Add example to nss-mymachines(8)
| * machinectl: fix printing of multiple addressesZbigniew Jędrzejewski-Szmek2018-11-291-1/+1
| | | | | | | | | | | | | | We'd print everything jumbled together: $ machinectl --max-addresses=3 MACHINE CLASS SERVICE OS VERSION ADDRESSES rawhide container systemd-nspawn fedora 30 169.254.40.164fe80::94aa:3aff:fe7b:d4b9