summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
...
* virt: Update cache if the detected vm is virtualbox (#5364)Benjamin Robin2017-07-17
|
* hostname-util: default to the compile time default hostname in ↵Lennart Poettering2017-07-17
| | | | | | | | | gethostname_malloc() Currently, if the hostname is not set gethostname_malloc() defaults to the "sysname", which is "linux" on Linux. Let's change that to also honour the compile-time fallback hostname as specified on the configure command line.
* virt: swap order of cpuid and dmi again, but properly detect oracle (#5355)Christian Hesse2017-07-17
| | | | | | | This breaks again, this time for setups where Qemu is not reported via DMI for whatever reason. So swap order of cpuid and dmi again, but properly detect oracle. See issue #5318.
* virt: detect qemu/kvm as 'kvm'Christian Hesse2017-07-17
| | | | | | | | | | In commit 050e65a we swapped order of detect_vm_{cpuid,dmi}(). That fixed Virtualbox but broke qemu with kvm, which is expected to return 'kvm'. So check for qemu/kvm first, then DMI, CPUID last. This fixes #5318. Signed-off-by: Christian Hesse <mail@eworm.de>
* machined: when copying files from/to userns containers chown to rootLennart Poettering2017-07-17
| | | | | | | | This changes the file copy logic of machined to set the UID/GID of all copied files to 0 if the host and container do not share the same user namespace. Fixes: #4078
* copy: change the various copy_xyz() calls to take a unified flags parameterLennart Poettering2017-07-17
| | | | | | | | This adds a unified "copy_flags" parameter to all copy_xyz() function calls, replacing the various boolean flags so far used. This should make many invocations more readable as it is clear what behaviour is precisely requested. This also prepares ground for adding support for more modes later on.
* core/manager: split out creation of serialization fd out to a helperZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | There is a slight change in behaviour: the user manager for root will create a temporary file in /run/elogind, not /tmp. I don't think this matters, but simplifies implementation.
* Allow braceless variables to be expandedZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | | (Only in environment.d files.) We have only basic compatibility with shell syntax, but specifying variables without using braces is probably more common, and I think a lot of people would be surprised if this didn't work.
* env-util,fileio: immediately replace variables in load_env_file_push()Zbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | | | | | | | | | | | | | strv_env_replace was calling env_match(), which in effect allowed multiple values for the same key to be inserted into the environment block. That's pointless, because APIs to access variables only return a single value (the latest entry), so it's better to keep the block clean, i.e. with just a single entry for each key. Add a new helper function that simply tests if the part before '=' is equal in two strings and use that in strv_env_replace. In load_env_file_push, use strv_env_replace to immediately replace the previous assignment with a matching name. Afaict, none of the callers are materially affected by this change, but it seems like some pointless work was being done, if the same value was set multiple times. We'd go through parsing and assigning the value for each entry. With this change, we handle just the last one.
* basic/fileio: add helper function for a set of two common checksZbigniew Jędrzejewski-Szmek2017-07-17
|
* sd-event: "when exiting no signal event are pending" is a wrong assertion ↵Franck Bui2017-07-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#5271) The code make the following assertion: when freeing a event loop object (usually it's done after exiting from the main event loop), no signal events are still queued and are pending. This assertion can be found in event_unmask_signal_data() with "assert(!d->current);" assertion. It appears that this assertion can be wrong at least in a specific case described below. Consider the following example which is inspired from udev: a process defines 3 source events: 2 are created by sd_event_add_signal() and 1 is created by sd_event_add_post(). 1. the process receives the 2 signals consecutively so that signal 'A' source event is queued and pending. Consequently the post source event is also queued and pending. This is done by sd_event_wait(). 2. The callback for signal 'A' is called by sd_event_dispatch(). 3. The next call to sd_event_wait() will queue signal 'B' source event. 4. The callback for the post source event is called and calls sd_event_exit(). 5. the event loop is exited. 6. freeing the event loop object will lead to the assertion failure in event_unmask_signal_data(). This patch simply removes this assertion as it doesn't seem to be a bug if the signal data still reference a signal source at this point.
* tree-wide: make bus_map_all_properties return a proper sd_bus_errorLennart Poettering2017-07-17
| | | | | | | | And then show it, to make things a bit friendlier to the user if we fail acquiring some props. In fact, this fixes a number of actual bugs, where we used an error structure for output that we actually never got an error in.
* basic/dirent-util: allow suffix to be omitted for dirent_is_file_with_suffixZbigniew Jędrzejewski-Szmek2017-07-17
|
* treewide: replace homegrown memory_erase with explicit_bzeroZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | | explicit_bzero was added in glibc 2.25. Make use of it. explicit_bzero is hardcoded to zero the memory, so string erase now truncates the string, instead of overwriting it with 'x'. This causes a visible difference only in the journalctl case.
* time-util: Fix overflow check introduce in commit f977849 (#5216)Benjamin Robin2017-07-17
|
* manager: refuse reloading/reexecing when /run is overly fullLennart Poettering2017-07-17
| | | | | | | Let's add an extra safety check: before entering a reload/reexec, let's verify that there's enough room in /run for it. Fixes: #5016
* logind: Don't try to emit a change signal for the 'Sessions' property (#5211)afrantzis2017-07-17
| | | | | | | | | The 'Sessions' property for both org.freedesktop.login1.User and org.freedesktop.login1.Seat is marked as EmitsChangedSignal(false). Trying to emit a change signal that includes the 'Sessions' property leads to the signal not being sent at all. Fixes #5210.
* time-util: add overflow checking to monotonic timestamp specificationsLennart Poettering2017-07-17
|
* time-util: when formatting usec_t as raw integers use PRIu64Lennart Poettering2017-07-17
| | | | After all, usec_t is defined as uint64_t, and not as unsigned long long.
* time-util: when converting to time_t do something useful in 2038Lennart Poettering2017-07-17
| | | | | | On systems where time_t is 32bit we should invalidate the timeval/timespec instead of proceeding with a potentially overflown value.
* time-util: refuse formatting/parsing times that we can't storeLennart Poettering2017-07-17
| | | | | | | | | | | usec_t is always 64bit, which means it can cover quite a number of years. However, 4 digit year display and glibc limitations around time_t limit what we can actually parse and format. Let's make this explicit, so that we never end up formatting dates we can#t parse and vice versa. Note that this is really just about formatting/parsing. Internal calculations with times outside of the formattable range are not affected.
* time: time_t is signed, and mktime() is happy to return negative timeLennart Poettering2017-07-17
| | | | | | | | | | Passing a year such as 1960 to mktime() will result in a negative return value. This is quite confusing, as the man page claims that on failure the call will return -1... Given that our own usec_t type is unsigned, and we can't express times before 1970 hence, let's consider all negative times returned by mktime() as invalid, regardless if just -1, or anything else negative.
* Consistently use ERFKILL for masked unitsZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | | | | | | | | 76ec966f0e33685f833 changed the code from ESHUTDOWN to ERFKILL, but missed one spot in bus-common-errors.c. Fix that. The code in transaction.c was checking for ERFKILL, but I'm not sure if this mismatch had any effect, i.e. if there were any code paths in which the wrong code actually made difference. Also add comments when ESHUTDOWN is used in the journal code, so it's easy to distinguish those cases when grepping. Standarize on the same capitalization. (There's also a bunch of uses in sd-bus.c, but that's clearly different.)
* hexdecoct: use typesafe new() instead of malloc()Lennart Poettering2017-07-17
|
* fs-util: unify code we use to check if dirent's d_name is "." or ".."Lennart Poettering2017-07-17
| | | | | We use different idioms at different places. Let's replace this is the one true new idiom, that is even a bit faster...
* shared/cgroup-show: extract funtion to query unit cgroup pathZbigniew Jędrzejewski-Szmek2017-07-17
| | | | …and use it where possible.
* util-lib: Fix chase_symlinks() with absolute symlinks (#5185)3chas32017-07-17
| | | | | | | | If chase_symlinks() encouters an absolute symlink, it resets the todo buffer to just the newly discovered symlink and discards any of the remaining previous symlink path. Regardless of whether or not the symlink is absolute or relative, we need to preserve the remainder of the path that has not yet been resolved.
* logind: trivial simplificationZbigniew Jędrzejewski-Szmek2017-07-17
| | | | free_and_strdup() handles NULL arg, so make use of that.
* tree-wide: adjust fall through comments so that gcc is happyZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | | | | | | | | | gcc 7 adds -Wimplicit-fallthrough=3 to -Wextra. There are a few ways we could deal with that. After we take into account the need to stay compatible with older versions of the compiler (and other compilers), I don't think adding __attribute__((fallthrough)), even as a macro, is worth the trouble. It sticks out too much, a comment is just as good. But gcc has some very specific requiremnts how the comment should look. Adjust it the specific form that it likes. I don't think the extra stuff we had in those comments was adding much value. (Note: the documentation seems to be wrong, and seems to describe a different pattern from the one that is actually used. I guess either the docs or the code will have to change before gcc 7 is finalized.)
* tree-wide: remove consecutive duplicate words in comments (#5148)Stefan Schweter2017-07-17
|
* virt: update url to hypervisor top-level functional specification (#5149)Stefan Schweter2017-07-17
|
* socket-utils: revert f1811313f42dc7ddaed3c47edc834c2bfd1309b2Susant Sahani2017-07-17
| | | | ':' in not a a valid interface name.
* network: accept colons in network interface names, normally used for alias ↵peoronoob2017-07-17
| | | | interfaces (#5117)
* basic/def: indentationZbigniew Jędrzejewski-Szmek2017-07-17
|
* basic/strv: allow NULLs to be inserted into strvZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | All callers of this function insert non-empty strings, so there's no functional change.
* basic/exec-util: add support for synchronous (ordered) executionZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | | | | | | | | | | | | | | The output of processes can be gathered, and passed back to the callee. (This commit just implements the basic functionality and tests.) After the preparation in previous commits, the change in functionality is relatively simple. For coding convenience, alarm is prepared *before* any children are executed, and not before. This shouldn't matter usually, since just forking of the children should be pretty quick. One could also argue that this is more correct, because we will also catch the case when (for whatever reason), forking itself is slow. Three callback functions and three levels of serialization are used: - from individual generator processes to the generator forker - from the forker back to the main process - deserialization in the main process v2: - replace an structure with an indexed array of callbacks
* basic/conf-files: extend conf_files_list() to list unsuffixed filesZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | 5dd11ab5f36ce71138005 did a similar change for conf_files_list_strv(). Here we do the same for conf_files_list() and conf_files_list_nulstr(). No change for existing users. Tests are added.
* basic/util: move execute_directory() to separate fileZbigniew Jędrzejewski-Szmek2017-07-17
| | | | It's a fairly specialized function. Let's make new files for it and the tests.
* process-util: rename char *r to ans and add commentZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | Add a comment about the return value and rename r to ans. r is nowadays reserved for the integer return value, and char *r is confusing.
* socket-util: drop _pure_ from a function with an output parameterZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | If it writes to memory, it's not pure, by definition. Fixup for 882ac6e769c5c.
* sparse: avoid clash with __bitwise and __force from 4.10 linux/types.h (#5061)Lubomir Rintel2017-07-17
| | | | | | | | It also used __bitwise and __force. It seems easier to rename our versions since they are local to this one single header. Also, undefine them afteerwards, so that we don't pollute the preprocessor macro namespace.
* missing.h: add AF_VSOCK bitsStefan Hajnoczi2017-07-17
| | | | | | | | | | Ubuntu 14.04 (Trusty) kernel header packages ship without <linux/vm_sockets.h>. Only struct sockaddr_vm and VMADDR_CID_ANY will be needed by elogind and they are simple enough to go in missing.h. CentOS 7 <sys/socket.h> does not define AF_VSOCK. Define it so the code can compile although actual socket(2) calls may fail at runtime if the address family isn't available.
* build-sys: add check for gperf lookup function signature (#5055)Mike Gilbert2017-07-17
| | | | | | | gperf-3.1 generates lookup functions that take a size_t length parameter instead of unsigned int. Test for this at configure time. Fixes: https://github.com/elogind/elogind/issues/5039
* util-lib: add a comment explaining the user name rules we enforceLennart Poettering2017-07-17
|
* sd-event: when an event source fails, don't assume the type of it is still setLennart Poettering2017-07-17
| | | | | | | If a callback of an event source returns an error, then the event source might already be half-destroyed, if the callback dropped all refs. Hence, don't assume that the type is still valid, and save it before we issue the callback.
* util-lib: rework path_check_fstype() and path_is_temporary_fs() to use O_PATHLennart Poettering2017-07-17
| | | | Also, add tests to make sure this actually works as intended.
* socket-util: add AF_VSOCK address familyStefan Hajnoczi2017-07-17
| | | | | | | | The AF_VSOCK address family facilitates guest<->host communication on VMware and KVM (virtio-vsock). Adding support to elogind allows guest agents to be launched through .socket unit files. Today guest agents are stand-alone daemons running inside guests that do not take advantage of elogind socket activation.
* socket-util: introduce port argument in sockaddr_port()Stefan Hajnoczi2017-07-17
| | | | | | | | sockaddr_port() either returns a >= 0 port number or a negative errno. This works for AF_INET and AF_INET6 because port ranges are only 16-bit. In AF_VSOCK ports are 32-bit so an int cannot represent all port number and negative errnos. Separate the port and the return code.
* basic/log: use IN_SETZbigniew Jędrzejewski-Szmek2017-07-17
|
* util-lib: be stricter when decoding hex stringsLennart Poettering2017-07-17
| | | | | If a hex string has an uneven length, generate an error instead of silently assuming a trailing '0' was in place.