summaryrefslogtreecommitdiff
path: root/src/machine
Commit message (Collapse)AuthorAgeFilesLines
* label: unify code to make directories, symlinksLennart Poettering2014-10-231-0/+1
|
* hashmap: introduce hash_ops to make struct Hashmap smallerMichal Schmidt2014-09-151-3/+3
| | | | | | | | | It is redundant to store 'hash' and 'compare' function pointers in struct Hashmap separately. The functions always comprise a pair. Store a single pointer to struct hash_ops instead. systemd keeps hundreds of hashmaps, so this saves a little bit of memory.
* machined: remove redundant sd_notifyDave Reisner2014-09-081-4/+0
| | | | | | We already call this on via bus_event_loop_with_idle on exit. This makes machined consistent with other similar daemons: localed, hostnamed, timedated.
* notify: send STOPPING=1 from our daemonsLennart Poettering2014-08-211-0/+1
|
* machine_kill(): Don't kill the unit when killing the leaderEelco Dolstra2014-08-141-0/+2
| | | | | | | | | | If "machinectl poweroff" or "machinectl reboot" is used on a systemd-nspawn container started with --keep-unit and --register, it should *only* send the appropriate signal to the leader PID (i.e. the container's systemd process). It shouldn't fall through to manager_kill_unit() to also send the signal to the unit. The latter ends up killing systemd-nspawn, which takes down the container prematurely.
* networkd: add minimal client tool "networkd" to query network statusLennart Poettering2014-08-121-1/+1
| | | | | | | In the long run this should become a full fledged client to networkd (but not before networkd learns bus support). For now, just pull interesting data out of networkd, udev, and rtnl and present it to the user, in a simple but useful output.
* machined: fix address API signaturesLennart Poettering2014-08-041-1/+1
|
* machine: make sure unpriviliged "machinectl status" can show the machine's ↵Lennart Poettering2014-08-041-4/+8
| | | | OS version
* bus: always explicitly close bus from main programsLennart Poettering2014-08-041-2/+2
| | | | | | | | | | | | | | Since b5eca3a2059f9399d1dc52cbcf9698674c4b1cf0 we don't attempt to GC busses anymore when unsent messages remain that keep their reference, when they otherwise are not referenced anymore. This means that if we explicitly want connections to go away, we need to close them. With this change we will no do so explicitly wherver we connect to the bus from a main program (and thus know when the bus connection should go away), or when we create a private bus connection, that really should go away after our use. This fixes connection leaks in the NSS and PAM modules.
* Unify parse_argv styleZbigniew Jędrzejewski-Szmek2014-08-031-7/+4
| | | | | | | | | | | | | | | | getopt is usually good at printing out a nice error message when commandline options are invalid. It distinguishes between an unknown option and a known option with a missing arg. It is better to let it do its job and not use opterr=0 unless we actually want to suppress messages. So remove opterr=0 in the few places where it wasn't really useful. When an error in options is encountered, we should not print a lengthy help() and overwhelm the user, when we know precisely what is wrong with the commandline. In addition, since help() prints to stdout, it should not be used except when requested with -h or --help. Also, simplify things here and there.
* Reject invalid quoted stringsZbigniew Jędrzejewski-Szmek2014-07-311-3/+3
| | | | | | | | | | | | | | | | | | | | | | String which ended in an unfinished quote were accepted, potentially with bad memory accesses. Reject anything which ends in a unfished quote, or contains non-whitespace characters right after the closing quote. _FOREACH_WORD now returns the invalid character in *state. But this return value is not checked anywhere yet. Also, make 'word' and 'state' variables const pointers, and rename 'w' to 'word' in various places. Things are easier to read if the same name is used consistently. mbiebl_> am I correct that something like this doesn't work mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-passwd "Unlock EncFS"' mbiebl_> systemd seems to strip of the quotes mbiebl_> systemctl status shows mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-password Unlock EncFS $RootDir $MountPoint mbiebl_> which is pretty weird
* machinectl: make sure we are not reading an unitialized variableZbigniew Jędrzejewski-Szmek2014-07-181-0/+2
|
* change type for address family to "int"Lennart Poettering2014-07-182-9/+9
| | | | | | | | Let's settle on a single type for all address family values, even if UNIX is very inconsitent on the precise type otherwise. Given that socket() is the primary entrypoint for the sockets API, and that uses "int", and "int" is relatively simple and generic, we settle on "int" for this.
* shared: rename PROTO_ADDRESS_SIZE() to FAMILY_ADDRESS_SIZE()Lennart Poettering2014-07-181-1/+1
| | | | | We mostly use "family" to refer to AF_INET, AF_INET6, etc, let's use this terminology here, too
* machinectl: show network interface name for containersLennart Poettering2014-07-101-11/+64
| | | | | Also, append the if indexes as scope field to the addresses we show. That way they may be used for connecting to the containers directly.
* machined: allow registering host-side network interfaces for communication ↵Lennart Poettering2014-07-104-7/+127
| | | | with containers
* machined: when querying addresses of a container, use same code as ↵Lennart Poettering2014-07-101-88/+13
| | | | nss-myhostname uses
* shared: split out in_addr related calls from socket-util.[ch] into its ↵Lennart Poettering2014-07-101-1/+1
| | | | | | | private in-addr-util.[ch] These are enough calls for a new file, and they are sufficiently different from the sockaddr-related calls, hence let's split this out.
* machined: various modernizations when enumerating container addressesLennart Poettering2014-07-101-18/+34
|
* machine: don't return uninitialized variableTom Gundersen2014-07-061-1/+1
| | | | Repotred by Ronny Chevalier
* machine: properly distuingish created and registered machinesLennart Poettering2014-07-031-1/+2
|
* machinectl: show /etc/os-release information of container in status outputLennart Poettering2014-07-035-2/+165
|
* machined: don't force terminate registered machinesLennart Poettering2014-07-033-4/+8
| | | | | | | 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.
* sd-bus: support connecting to remote hosts, directly into containersLennart Poettering2014-07-031-18/+1
| | | | | | | | | | systemctl -H root@foobar:waldi will now show a list of services running on container "waldi" on host "foobar", using "root" for authenticating at "foobar". Since entereing a container requires priviliges, this will only work correctly for root logins.
* machine: minor modernizationsLennart Poettering2014-06-121-5/+10
|
* machine: escape fields we store in /run, so that they can be properly ↵Lennart Poettering2014-05-221-6/+31
| | | | unescaped by parse_env_file()
* machined: make sure GetMachineAddresses() is available for unprivileged ↵Lennart Poettering2014-05-191-0/+8
| | | | processes
* machined: add logic to query IP addresses of containersLennart Poettering2014-05-184-34/+307
|
* Remove unnecessary casts in printfsZbigniew Jędrzejewski-Szmek2014-05-153-5/+5
| | | | No functional change expected :)
* sd-bus: introduce sd_bus_slot objects encapsulating callbacks or vtables ↵Lennart Poettering2014-05-152-4/+8
| | | | | | | | | | | attached to a bus connection This makes callback behaviour more like sd-event or sd-resolve, and creates proper object for unregistering callbacks. Taking the refernce to the slot is optional. If not taken life time of the slot will be bound to the underlying bus object (or in the case of an async call until the reply has been recieved).
* util: replace close_pipe() with new safe_close_pair()Lennart Poettering2014-03-241-1/+1
| | | | | | safe_close_pair() is more like safe_close(), except that it handles pairs of fds, and doesn't make and misleading allusion, as it works similarly well for socketpairs() as for pipe()s...
* util: replace close_nointr_nofail() by a more useful safe_close()Lennart Poettering2014-03-181-4/+2
| | | | | | | | | | | | | | | safe_close() automatically becomes a NOP when a negative fd is passed, and returns -1 unconditionally. This makes it easy to write lines like this: fd = safe_close(fd); Which will close an fd if it is open, and reset the fd variable correctly. By making use of this new scheme we can drop a > 200 lines of code that was required to test for non-negative fds or to reset the closed fd variable afterwards.
* machinectl: reimplement machinectl's "reboot" verb on top of "kill", and add ↵Lennart Poettering2014-03-181-66/+19
| | | | | | | | | new verb "poweroff" There's really no point to send the reboot SIGINT from machinectl directly, if machined can do that anyway. This saves code, and makes machinectl network transparent for these verbs. And while we are at it we can easily add a "poweroff" verb in addition to "reboot". Yay!
* machined: fix Kill() bus call on machine objects when "what" is specified as ↵Lennart Poettering2014-03-183-4/+12
| | | | "leader"
* bus: replace sd_bus_label_{escape,unescape}() by new ↵Lennart Poettering2014-03-111-2/+3
| | | | | | | | | | | sd_bus_path_{encode,decode}() The new calls work similarly, but enforce a that a common, fixed bus path prefix is used. This follows discussions with Simon McVittie on IRC that it should be a good idea to make sure that people don't use the escaping applied here too wildly as anything other than the last label of a bus path.
* Introduce strv_consume which takes ownershipZbigniew Jędrzejewski-Szmek2014-03-041-4/+2
| | | | This mirrors set_consume and makes the common use a bit nicer.
* api: in constructor function calls, always put the returned object pointer ↵Lennart Poettering2014-02-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | first (or second) Previously the returned object of constructor functions where sometimes returned as last, sometimes as first and sometimes as second parameter. Let's clean this up a bit. Here are the new rules: 1. The object the new object is derived from is put first, if there is any 2. The object we are creating will be returned in the next arguments 3. This is followed by any additional arguments Rationale: For functions that operate on an object we always put that object first. Constructors should probably not be too different in this regard. Also, if the additional parameters might want to use varargs which suggests to put them last. Note that this new scheme only applies to constructor functions, not to all other functions. We do give a lot of freedom for those. Note that this commit only changes the order of the new functions we added, for old ones we accept the wrong order and leave it like that.
* sd-bus: the bus returned should be the first argJason A. Donenfeld2014-02-201-1/+1
| | | | This matches the API of previous headers, such as sd-journal.h.
* make gcc shut upLennart Poettering2014-02-191-2/+2
| | | | | | | If -flto is used then gcc will generate a lot more warnings than before, among them a number of use-without-initialization warnings. Most of them without are false positives, but let's make them go away, because it doesn't really matter.
* machinectl: remove unused --no-ask-passwordThomas Hindoe Paaboel Andersen2014-02-181-8/+0
|
* machinectl: add bash completionThomas Hindoe Paaboel Andersen2014-02-181-2/+12
|
* machinectl: add new "machinectl reboot" callLennart Poettering2014-02-121-1/+66
|
* machined: fix enumeration of existing machines on restartLennart Poettering2014-02-111-0/+4
|
* machined: optionally, allow registration of pre-existing units (scopesLennart Poettering2014-02-115-35/+110
| | | | or services) as machine with machined
* machined: since we can now somewhat reliable get notifications for dyingLennart Poettering2014-02-071-8/+0
| | | | scopes we don't need to lower the stop timeout anymore
* Update some message formatsZbigniew Jędrzejewski-Szmek2014-02-051-6/+6
| | | | | | | | Use PID_FMT/USEC_FMT/... in more places. Also update logind error messages to print the full path to a file that failed. This should make debugging easier for people who do not know off the top of their head where logind stores it state.
* machinectl: fix success check when getting pty from within containerLennart Poettering2013-12-231-4/+4
|
* bus: when getting a kdbus connection into a container wait first for child, ↵Lennart Poettering2013-12-231-9/+9
| | | | | | | then read message There's no EOF generated for AF_UNIX/SOCK_DGRAM sockets, hence let's wait for the child first to see if it succeeded, only then read the socket.
* bus: decorate the various object vtables with SD_BUS_VTABLE_PROPERTY_CONST ↵Lennart Poettering2013-12-221-11/+11
| | | | where appropriate
* machined: implement exit-on-idleLennart Poettering2013-12-191-16/+13
|