summaryrefslogtreecommitdiff
path: root/src/shared
AgeCommit message (Collapse)Author
2014-12-30macro: add DIV_ROUND_UP()David Herrmann
This macro calculates A / B but rounds up instead of down. We explicitly do *NOT* use: (A + B - 1) / A as it suffers from an integer overflow, even though the passed values are properly tested against overflow. Our test-cases show this behavior. Instead, we use: A / B + !!(A % B) Note that on "Real CPUs" this does *NOT* result in two divisions. Instead, instructions like idivl@x86 provide both, the quotient and the remainder. Therefore, both algorithms should perform equally well (I didn't verify this, though).
2014-12-29capability: use /proc/sys/kernel/cap_last_capDavid Herrmann
This file was introduced with linux-3.2, use it instead of probing for it via prctl(PR_CAPBSET_READ). For now, keep the old code for backwards compat. We can drop it once 3.2 is our lowest requirement. The test-cap-list code is extended to verify cap_last_cap() is the same as we'd get via prctl probing and /proc.
2014-12-28util: treat -1 as special size in format_bytes()Lennart Poettering
2014-12-28machined: add support for reporting image size via btrfs quotaLennart Poettering
2014-12-28tmpfiles: add new line type 'v' for creating btrfs subvolumesLennart Poettering
2014-12-28machinectl/machined: implement "rename", "clone", "read-only" verbs for ↵Lennart Poettering
machine images
2014-12-28machined: add "machinectl remove" for removing imagesLennart Poettering
2014-12-28machined: Move image discovery logic into src/shared, so that we can make ↵Lennart Poettering
use of it from nspawn
2014-12-26util: always override crtime xattrLennart Poettering
2014-12-26copy: try top copy atime/time/xattrs when copying filesLennart Poettering
2014-12-25test: do not use last cap from kernel in test-cap-listFilipe Brandenburger
The new test-cap-list introduced in commit 2822da4fb7f891 uses the included table of capabilities. However, it uses cap_last_cap() which probes the kernel for the last available capability. On an older kernel (e.g. 3.10 from RHEL 7) that causes the test to fail with the following message: Assertion '!capability_to_name(cap_last_cap()+1)' failed at src/test/test-cap-list.c:30, function main(). Aborting. Fix it by exporting the size of the static table and using it in the test instead of the dynamic one from the current kernel. Tested by successfully running ./test-cap-list and the whole `make check` test suite with this patch on a RHEL 7 host.
2014-12-25machined: beef up machined image listing with creation/modification times of ↵Lennart Poettering
subvolumes We make use of the btrfs subvol crtime for this, and for gpt images of a manually managed xattr, if we can.
2014-12-24util: make creation time xattr logic more genericLennart Poettering
2014-12-24util: fix strict aliasing violations in use of struct inotify_event v5Shawn Paul Landden
There is alot of cleanup that will have to happen to turn on -fstrict-aliasing, but I think our code should be "correct" to the rule.
2014-12-23build-sys: move core/build.h → shared/build.hLennart Poettering
After all, pretty much all our tools include it, and it should hence be shared. Also move sysfs-show.h from core/ to login/, since it has no point to exist in core.
2014-12-23machined: add new call OpenMachineLogin() that starts a getty in a container ↵Lennart Poettering
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.
2014-12-23condition: don't include files from src/coreLennart Poettering
2014-12-23env-util: don't include files from src/core/Lennart Poettering
2014-12-23util: add allocation loop to gettyname_malloc()Lennart Poettering
2014-12-23nspawn,pty: port over to new ptsname_malloc() helperLennart Poettering
2014-12-23systemd-run: support -t mode when combined with -MLennart Poettering
For that, ask machined for a container PTY and use that.
2014-12-23run: add a new "-t" mode for invoking a binary on an allocated TTYLennart Poettering
2014-12-22shared: json - support escaping utf16 surrogate pairsTom Gundersen
We originally only supported escaping ucs2 encoded characters (as \uxxxx). This only covers the BMP. Support escaping also utf16 surrogate pairs (on the form \uxxxx\uyyyy) to cover all of unicode.
2014-12-22shared: utf8 - support decoding the full utf16Tom Gundersen
We originally only supported the BMP (i.e., we treated UTF-16 as UCS-2).
2014-12-22shared: utf8 - support ucs4 -> utf8Tom Gundersen
Originally we only supported ucs2, so move the ucs4 version from libsystemd-terminal to shared and use that everywhere.
2014-12-22verbs: fix typo in error messageDave Reisner
2014-12-19machined: add new GetImage() bus call for retrieving the bus path for an imageLennart Poettering
2014-12-19util: rename ignore_file() to hidden_file()Lennart Poettering
hidden_file() is a bit more precise, since dot files usually shouldn't be ignored, but certainly be considered hidden.
2014-12-19verbs: when invoking the default verb, pass a faked argv array, with just ↵Lennart Poettering
the verb in it That way the dispatcher calls know how they got called.
2014-12-19machined/machinectl: add logic to show list of available imagesLennart Poettering
This adds a new bus call to machined that enumerates /var/lib/container and returns all trees stored in it, distuingishing three types: - GPT disk images, which are files suffixed with ".gpt" - directory trees - btrfs subvolumes
2014-12-19util: when creating temporary filename for atomic creation of files, add an ↵Lennart Poettering
extra "#" to the name That way, we have a simple, somewhat reliable way to detect such temporary files, by simply checking if they start with ".#".
2014-12-19import: add new minimal tool "systemd-import" for pulling down foreign ↵Lennart Poettering
containers and install them locally This adds a simply but powerful tool for downloading container images from the most popular container solution used today. Use it like this: # systemd-import pull-dck mattdm/fedora # systemd-nspawn -M fedora This will donwload the layers for "mattdm/fedora", and make them available locally as /var/lib/container/fedora. The tool is pretty complete, as long as it's only about pulling down images, or updating them. Pushing or searching is not supported yet.
2014-12-19util: add generalization of verb parsing for command line toolsLennart Poettering
We should move loginctl, timedatectl, machinectl over to use this new API instead of a manual one.
2014-12-19util: make sure rm_rf() can be called on symlinks (with the effect of ↵Lennart Poettering
deleting it)
2014-12-19strv: ass new strv_is_uniq() and strv_reverse() callsLennart Poettering
2014-12-18Treat a trailing backslash as an errorZbigniew Jędrzejewski-Szmek
Commit a2a5291b3f5 changed the parser to reject unfinished quoted strings. Unfortunately it introduced an error where a trailing backslash would case an infinite loop. Of course this must fixed, but the question is what to to instead. Allowing trailing backslashes and treating them as normal characters would be one option, but this seems suboptimal. First, there would be inconsistency between handling of quoting and of backslashes. Second, a trailing backslash is most likely an error, at it seems better to point it out to the user than to try to continue. Updated rules: ExecStart=/bin/echo \\ → OK, prints a backslash ExecStart=/bin/echo \ → error ExecStart=/bin/echo "x → error ExecStart=/bin/echo "x"y → error
2014-12-18tree-wide: make condition_free_list return NULLZbigniew Jędrzejewski-Szmek
2014-12-18path-util: fix breakage in path_is_mount_pointDave Reisner
This fixes 2 problems introduced by 6feeeab0bc: 1) If name_to_handle_at returns ENOSYS for the child, we'll wrongly return -ENOSYS when it returns the same for the parent. Immediately jump to the fallback logic when we get ENOSYS. 2) If name_to_handle_at returns EOPNOTSUPP for the child but suceeds for the parent, we'll be comparing an uninitialized value (mount_id) to an initialized value (mount_id_parent). Initialize the mount_id variables to invalid mount_ids to avoid this.
2014-12-18core: use raw_clone instead of fork in signal handlerZbigniew Jędrzejewski-Szmek
fork() is not async-signal-safe and calling it from the signal handler could result in a deadlock when at_fork() handlers are called. Using the raw clone() syscall sidesteps that problem. The tricky part is that raise() does not work, since getpid() does not work. Add raw_getpid() to get the real pid, and use kill() instead of raise(). https://bugs.freedesktop.org/show_bug.cgi?id=86604
2014-12-17path: make the check for unsupported name_to_handle_at symmetricZbigniew Jędrzejewski-Szmek
If child supports, but the parent does not, or when the child does not support, but the parent does, assume the child is a mount point. Only if neither supports use the fallback.
2014-12-17path: follow symbolic link for parent path (2)Umut Tezduyar Lindskog
c0e57ba9e22ee937722958d8b912ade2a37f206d fixed the fallback path. We should do the same for name_to_handle_at().
2014-12-18machinectl: add new commands for copying files from/to containersLennart Poettering
2014-12-18util: in make_stdio() use dup2() rather than dup3()Lennart Poettering
dup3() allows setting O_CLOEXEC which we are not interested in. However, it also fails if called with the same fd as input and output, which is something we don't want. Hence use dup2(). Also, we need to explicitly turn off O_CLOEXEC for the fds, in case the input fd was O_CLOEXEC and < 3.
2014-12-17nspawn: fix invocation of the raw clone() system call on s390 and crisKen Werner
Since the order of the first and second arguments of the raw clone() system call is reversed on s390 and cris it needs to be invoked differently.
2014-12-16path: follow symbolic link for parent pathUmut Tezduyar Lindskog
[zj: When we lstat the target path, symlinks above the last component will be followed by both stat and lstat. So when we look at the parent, we should follow symlinks.]
2014-12-17shared: strv - add strv_clear()Tom Gundersen
This frees the elements of the strv without freeing the strv itself.
2014-12-16shared: path-util - memory leakTom Gundersen
2014-12-16fix compiler warningSusant Sahani
src/shared/utf8.c:268:13: warning: unused variable 'd' [-Wunused-variable] int d;
2014-12-16systemctl: refuse to edit runtime dropins when they already exist in /etcZbigniew Jędrzejewski-Szmek
The check for existing unit files and dropins is unified. path_join() is updated to not insert duplicate separators.
2014-12-16Move dropin listing to sharedZbigniew Jędrzejewski-Szmek
No functional change. This is in preparation for using this in systemctl in the future.