summaryrefslogtreecommitdiff
path: root/src/shared
AgeCommit message (Collapse)Author
2015-06-15Merge pull request #214 from poettering/signal-rework-2Lennart Poettering
everywhere: port everything to sigprocmask_many() and friends
2015-06-15everywhere: port everything to sigprocmask_many() and friendsLennart Poettering
This ports a lot of manual code over to sigprocmask_many() and friends. Also, we now consistly check for sigprocmask() failures with assert_se(), since the call cannot realistically fail unless there's a programming error. Also encloses a few sd_event_add_signal() calls with (void) when we ignore the return values for it knowingly.
2015-06-15util: when creating temporary file names, allow including extra id string in itLennart Poettering
This adds a "char *extra" parameter to tempfn_xxxxxx(), tempfn_random(), tempfn_ranomd_child(). If non-NULL this string is included in the middle of the newly created file name. This is useful for being able to distuingish the kind of temporary file when we see one. This also adds tests for the three call. For now, we don't make use of this at all, but port all users over.
2015-06-15firewall: rename fw-util.[ch] → firewall-util.[ch]Daniel Mack
The names fw-util.[ch] are too ambiguous, better rename the files to firewall-util.[ch]. Also rename the test accordingly.
2015-06-11build-sys: split internal basic/ library from shared/Kay Sievers
basic/ can be used by everything cannot use anything outside of basic/ libsystemd/ can use basic/ cannot use shared/ shared/ can use libsystemd/
2015-06-11Merge pull request #6 from xnox/drop-nameLennart Poettering
shared: Drop 'name=' prefix from SYSTEMD_CGROUP_CONTROLLER define.
2015-06-10shared: add convenience function for validating dns namesNick Owens
2015-06-10resolve: move dns routines into sharedNick Owens
2015-06-10util: introduce CMSG_FOREACH() macro and make use of it everywhereLennart Poettering
It's only marginally shorter then the usual for() loop, but certainly more readable.
2015-06-10tree-wide: whenever we fork off a foreign child process reset signal ↵Lennart Poettering
mask/handlers Also, when the child is potentially long-running make sure to set a death signal. Also, ignore the result of the reset operations explicitly by casting them to (void).
2015-06-10signal-util: modernize and share more codeLennart Poettering
2015-06-09path-util: Fix path_is_mount_point for parent mount points in symlink modeMartin Pitt
When we have a structure like this: /bin -> /usr/bin /usr is a mount point Then path_is_mount_point("/bin", AT_SYMLINK_FOLLOW) needs to look at the pair /usr/bin and /usr, not at the pair / and /usr/bin, as the latter have different mount IDs. But we only want to consider the base name, not any parent. Thus we have to resolve the given path first to get the real parent when allowing symlinks. Bug: https://github.com/systemd/systemd/issues/61
2015-06-09util:bind_remount_recursive(): handle return 0 of set_consume()Harald Hoyer
set_consume() does not return -EEXIST, but 0, in case the key is already in the Set.
2015-06-09Revert "util:bind_remount_recursive() fix "use after free""Harald Hoyer
This reverts commit 46be6129d3e52556eb0f2ae4d07818f9f3f7af7a.
2015-06-08tree-wide: remove spurious spaceThomas Hindoe Paaboel Andersen
2015-06-08util:bind_remount_recursive() fix "use after free"Harald Hoyer
set_consume(done, x) consumes x with free(x) but mount(…, x, …) uses it afterwards. coverity CID 1299006
2015-06-03fstab-generator: cescape device name in root-fsck serviceAndrei Borzenkov
We unescape ExecStart line when parsing it, so escape device name before adding it to unit file. fixes #50
2015-06-03util: fix another cunescape() regressionDaniel Mack
Fix a regression caused by 4034a06d ("util: rework word parsing and c unescaping code") which broke octal escape sequences. The reason for this breakage is that cunescape_one() expects 4 characters in an octal encoding, which is a stray left-over from the old code which operated on different variables to make the length check. While at it, add a test case to prevent the same thing from happening again.
2015-06-02Merge pull request #12 from ↵Tom Gundersen
systemd-mailing-devs/1433236104-9967-1-git-send-email-m.olbrich@pengutronix.de missing: add more btrfs defines
2015-06-02shared: Drop 'name=' prefix from SYSTEMD_CGROUP_CONTROLLER define.Dimitri John Ledkov
In cgtop,mount-setup,nspawn the name= prefix is hard-coded in the mount options, and the define is not used. Everywhere else, we explicitly white-list allow 'name=' prefix to be used with all controllers, and strip it out to 'normalise' the controller name. That work is mostly inflicted on us due to 'name=' prefix in the define. Dropping this prefix makes everything more sane overall.
2015-06-02random-util: guard including sys/auxv.h with the corresponding ifdef checkMichael Olbrich
2015-06-02missing: add more btrfs definesMichael Olbrich
2015-05-30conf-parser: parsing error logs should show a type not a vartypeRonny Chevalier
Instead of this: [filename:1] Failed to parse nsec_t value, ignoring: garbage we show this: [filename:1] Failed to parse nsec value, ignoring: garbage
2015-05-29util: split out signal-util.[ch] from util.[ch]Lennart Poettering
No functional changes.
2015-05-29path-util: Change path_is_mount_point() symlink arg from bool to flagsMartin Pitt
This makes path_is_mount_point() consistent with fd_is_mount_point() wrt. flags.
2015-05-29path-util: Fix path_is_mount_point for filesMartin Pitt
Commits 27cc6f166 and f25afeb broke path_is_mount_point() for files (such as /etc/machine-id → /run/machine-id bind mounts) as with the factorization of fd_is_mount_point() we lost the parent directory. We cannot determine that from an fd only as openat(fd, "..") only works for directory fds. Change fd_is_mount_point() to behave like openat(): It now takes a file descriptor of the containing directory, a file name in it, and flags (which can be 0 or AT_SYMLINK_FOLLOW). Unlike name_to_handle_at() or openat(), fstatat() only accepts the inverse flag AT_SYMLINK_NOFOLLOW and complains with EINVAL about AT_SYMLINK_FOLLOW; so we need to transform the flags for that fallback. Adjust rm_rf_children() accordingly (only other caller of fd_is_mount_point() aside from path_is_mount_point()). Add test cases for files, links, and file bind mounts (the latter will only work when running as root). Split out a new test_path_is_mount_point() test case function as it got significantly larger now.
2015-05-27missing: add more IFLA_VXLAN_* definesMichael Olbrich
Otherwise building faild with kernel headers < v3.16
2015-05-26treewide: fix typosTorstein Husebø
2015-05-24shared: generator - correct path to systemd-fsckMike Gilbert
In generated systemd-fsck-root.service. This would break if rootprefix is not /usr/lib/systemd. [tomegun: flesh out commit message]
2015-05-21json: minor style fixessystemd/v220Lennart Poettering
2015-05-21util: an array with one entry is always orderedLennart Poettering
2015-05-21util: introduce PERSONALITY_INVALID as macro for 0xffffffffLULennart Poettering
2015-05-21nspawn: finish user namespace supportLennart Poettering
2015-05-20json: avoid cleanup of unitialized variableZbigniew Jędrzejewski-Szmek
2015-05-20util: introduce reset_uid_gid() for resetting all uids and gids to 0Lennart Poettering
2015-05-20core,nspawn: unify code that moves the root dirLennart Poettering
2015-05-19bootctl: modernizationZbigniew Jędrzejewski-Szmek
Use strjoina to avoid error handling, and openat to simplify things. Some fixes on the way: - ferror does not set errno, so the return value was wrong in some cases - errors are propagated in more cases - EFI/systemd was created, but EFI/systemd-boot was deleted - something is always printed on error - when checking the version, comparison was done against "systemd-bo" for some reason - return value was converted from negative to EXIT_SUCCESS/EXIT_FAILURE twice, resulting in EXIT_SUCCESS all the time
2015-05-19json: fix a mem leakThomas Hindoe Paaboel Andersen
2015-05-19shared/json: Added DOM-like JSON parserPavel Odvody
This makes working with complexly structured documents easy and more reliable as the parser is not susceptible to element re-ordering. Also fixes a bug when the tokenizer would choke after reading a number.
2015-05-19shared/import-util: Tag renamed to referencePavel Odvody
Added (sha256) digest validation function
2015-05-19util: fix typoJan Synacek
2015-05-19hostname: Allow comments in /etc/hostnameMartin Pitt
The hostname(1) tool allows comments in /etc/hostname. Introduce a new read_hostname_config() in hostname-util which reads a hostname configuration file like /etc/hostname, strips out comments, whitespace, and cleans the hostname. Use it in hostname-setup.c and hostnamed and remove duplicated code. Update hostname manpage. Add tests. https://launchpad.net/bugs/1053048
2015-05-19core: introduce seperate reverse dependencies for Requires= and Requisite=Lennart Poettering
This allows us to ensure that Requisite= dependencies never cause propagation between units, while Requires= dependencies might. http://lists.freedesktop.org/archives/systemd-devel/2015-May/031742.html
2015-05-19journalctl: clean up how we log errorsLennart Poettering
All functions should either log the errors they run into, or only return them in which case the caller should log them. Make sure this rule is followed, so that each error is logged precisely once, and neither never, nor more than once.
2015-05-18resolved: fix crash when shutting downLennart Poettering
Reported by Cristian Rodríguez http://lists.freedesktop.org/archives/systemd-devel/2015-May/031626.html
2015-05-18util: split all hostname related calls into hostname-util.cLennart Poettering
2015-05-18fstab-generator: add x-systemd.requires and x-systemd.requires-mounts-forKarel Zak
Currently we have no way how to specify dependencies between fstab entries (or another units) in the /etc/fstab. It means that users are forced to bypass fstab and write .mount units manually. The patch introduces new systemd fstab options: x-systemd.requires=<PATH> - to specify dependence an another mount (PATH is translated to unit name) x-systemd.requires=<UNIT> - to specify dependence on arbitrary UNIT x-systemd.requires-mounts-for=<PATH ...> - to specify dependence on another paths, implemented by RequiresMountsFor=. The option may be specified more than once. For example two bind mounts where B depends on A: /mnt/test/A /mnt/test/A none bind,defaults /mnt/test/A /mnt/test/B none bind,x-systemd.requires=/mnt/test/A More complex example with overlay FS where one mount point depends on "low" and "upper" directories: /dev/sdc1 /mnt/low ext4 defaults /dev/sdc2 /mnt/high ext4 defaults overlay /mnt/merged overlay lowerdir=/mnt/low,upperdir=/mnt/high/data,workdir=/mnt/high/work,x-systemd.requires-mounts-for=/mnt/low,x-systemd.requires-mounts-for=mnt/high https://bugzilla.redhat.com/show_bug.cgi?id=812826 https://bugzilla.redhat.com/show_bug.cgi?id=1164334
2015-05-16util: loop_write - accept 0-length messageTom Gundersen
write() can send empty messages, so make sure loop_write() can do the same.
2015-05-15socket-util: socket_address_parse() should not log errors on its ownLennart Poettering
Given that socket_address_parse() is mostly a "library" call it shouldn't log on its own, but leave that to its caller. This patch removes logging from the call in case IPv6 is not available but and IPv6 address shall be parsed. Instead a new call socket_address_parse_and_warn() is introduced which first invokes socket_address_parse() and then logs if necessary. This should fix "make check" on ipv6-less kernels: http://lists.freedesktop.org/archives/systemd-devel/2015-April/031385.html
2015-05-15generator: use fflush_and_check() where appropriateLennart Poettering