summaryrefslogtreecommitdiff
path: root/src/machine/machine.h
Commit message (Collapse)AuthorAgeFilesLines
* machine: propagate error from machine_newDavid Tardon2022-12-141-1/+1
|
* tree-wide: use -EINVAL for enum invalid valuesZbigniew Jędrzejewski-Szmek2021-02-101-3/+3
| | | | | | | | | As suggested in https://github.com/systemd/systemd/pull/11484#issuecomment-775288617. This does not touch anything exposed in src/systemd. Changing the defines there would be a compatibility break. Note that tests are broken after this commit. They will be fixed in the next one.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* machined: refactor UID/GID machine translationLennart Poettering2020-07-141-0/+6
| | | | | | | Let's move the heavy lifting out of the bus call implemntations, and into generic code. This allows us to expose them easily via Varlink too in a later commit.
* machined: only Unref units that we AddRef'dZbigniew Jędrzejewski-Szmek2019-10-291-0/+1
| | | | | | | | | | | | 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.
* terminal-util: introduce openpt_allocate()Franck Bui2019-06-181-1/+1
| | | | | | | | | | | | | | | | 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().
* headers: remove unneeded includes from util.hZbigniew Jędrzejewski-Szmek2019-03-271-0/+1
| | | | | 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.
* machine: introduce machine_hash_ops and use itYu Watanabe2018-12-021-1/+1
|
* machine: use size_t for array sizes (#10309)Lennart Poettering2018-10-091-1/+1
| | | | Some uses of n_netif already assumed it had time size_t. Others were a bit sloppy. Let's clean this up.
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-4/+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-141-2/+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 license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+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.
* machined: change check_gc to may_gc everywheregc-cleanupZbigniew Jędrzejewski-Szmek2018-02-151-1/+1
|
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* machined: expose "UID shift" concept for containersLennart Poettering2017-02-171-0/+2
| | | | | | | | | | | | UID/GID mapping with userns can be arbitrarily complex. Let's break this down to a single admin-friendly parameter: let's expose the UID/GID shift of a container via a new bus call for each container, and let's show this as part of "machinectl status" if it is not 0. This should work for pretty much all real-life full OS container setups (i.e. the stuff machined is suppose to be useful for). For everything else we generate a clean error, clarifying that we can't expose the mapping.
* machined: rework copy-from/copy-to operation to use generic Operation objectLennart Poettering2016-05-021-17/+3
| | | | | With this all potentially slow operations are done out-of-process, asynchronously, using the same "Operation" object.
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* machined: when opening a shell via machined, pass tty fds inLennart Poettering2015-10-081-0/+1
| | | | | | | | | With this change we'll open the shell's tty right from machined and then pass it to the transient unit we create. This way we make sure the pty is opened exactly as long as the transient service is around, and no longer, and vice versa. This way pty forwarders do not have to deal with EIO problems due to vhangup, as the pty is open all the time from the point we set things up to the point where the service goes away.
* machined: introduce pseudo-machine ".host" refererring to the host systemLennart Poettering2015-08-241-1/+4
| | | | | | | | | | | | | | Some of the operations machined/machinectl implement are also very useful when applied to the host system (such as machinectl login, machinectl shell or machinectl status), hence introduce a pseudo-machine by the name of ".host" in machined that refers to the host system, and may be used top execute operations on the host system with. This copies the pseudo-image ".host" machined already implements for image related commands. (This commit also adds a PK privilege for opening a PTY in a container, which was previously not accessible for non-root.)
* machined: rework state tracking logic for machinesLennart Poettering2015-08-061-0/+2
| | | | | | | | | | | | | | | This splits up the stopping logic for machines into two steps: first on machine_stop() we begin with the shutdown of a machine by queuing the stop method call for it. Then, in machine_finalize() we actually remove the rest of its runtime context. This mimics closely how sessions are handled in logind. This also reworks the GC logic to strictly check the current state of the machine unit, rather than shortcutting a few cases, like for example assuming that UnitRemoved really means a machine is gone (which it isn't since Reloading might trigger it, see #376). Fixes #376.
* machine: drop state variable from Machine objectLennart Poettering2015-08-061-1/+0
| | | | We never made use of it, let's get rid of it.
* machined: make sure to track machine unit states properlyLennart Poettering2015-04-281-0/+2
| | | | | | | | | If a unit is stopped for a moment, we need to invalidate our knowledge of it, otherwise we might be confused by automatic restarts This makes reboots for nspawn containers run as service work correctly. https://bugs.freedesktop.org/show_bug.cgi?id=87428
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-231-1/+0
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* machined: make "machinectl copy-to" and "machinectl copy-from" server side ↵Lennart Poettering2015-02-171-0/+17
| | | | | | operations This way, any bus client can make use of these calls.
* Revert "machined: don't force terminate registered machines"Lennart Poettering2014-12-291-1/+0
| | | | | | | | | | This reverts commit 206e7a5f7b55ac61188efd895e65ab26e478cbb2. We actually want to allow shutting down containers that use RegisterMachine() rather than CreateMachine() to register their own unit. It should be safe to do so, since the primary usecase for RegisterMachine() are container managers that run only a single container within their own unit, such as systemd-nspawn.
* machined: Move image discovery logic into src/shared, so that we can make ↵Lennart Poettering2014-12-281-16/+0
| | | | use of it from nspawn
* machined: add new call OpenMachineLogin() that starts a getty in a container ↵Lennart Poettering2014-12-231-0/+1
| | | | | | | on a pty and returns the pty master fd to the client This is a one-stop solution for "machinectl login", and should simplify getting logins in containers.
* machined: add OpenMachinePTY() bus call for allocating a PTY device within a ↵Lennart Poettering2014-12-231-0/+1
| | | | | | container Then, port "machinectl" over to make use of it.
* machined: allow registering host-side network interfaces for communication ↵Lennart Poettering2014-07-101-0/+3
| | | | with containers
* machinectl: show /etc/os-release information of container in status outputLennart Poettering2014-07-031-0/+1
|
* machined: don't force terminate registered machinesLennart Poettering2014-07-031-0/+1
| | | | | | | When a machine is registered in machined with CreateMachine it is OK to kill the machine when it is terminated, but when an existing unit is simply registered via RegisterMachine we shouldn't do that, as the unit is controlled by somebody else.
* machined: add logic to query IP addresses of containersLennart Poettering2014-05-181-0/+4
|
* machined: optionally, allow registration of pre-existing units (scopesLennart Poettering2014-02-111-1/+1
| | | | or services) as machine with machined
* bus: also add error parameter to object find and enumerator callbacksLennart Poettering2013-11-221-1/+2
| | | | | Just in order to bring things inline with the method and property callbacks.
* machined: simplificationsLennart Poettering2013-11-051-1/+1
|
* machined: port over to libsystemd-busLennart Poettering2013-10-301-8/+7
|
* machined: forward scope properties array from client to systemdLennart Poettering2013-07-111-1/+1
| | | | This makes nspawn's --scope= switch work again.
* machined: split out machine registration stuff from logindLennart Poettering2013-07-021-0/+109
Embedded folks don't need the machine registration stuff, hence it's nice to make this optional. Also, I'd expect that machinectl will grow additional commands quickly, for example to join existing containers and suchlike, hence it's better keeping that separate from loginctl.