summaryrefslogtreecommitdiff
path: root/src/basic
AgeCommit message (Collapse)Author
2016-07-02Merge pull request #3641 from 0xAX/unset-cloexec-for-stdfsLennart Poettering
basic/fd-util: introduce stdio_unset_cloexec() function
2016-07-02treewide: use stdio_unset_cloexec() functionAlexander Kuleshov
2016-07-02basic/fd-util: introduce stdio_unset_cloexec() functionAlexander Kuleshov
There are some places in the systemd which are use the same pattern: fd_cloexec(STDIN_FILENO, false); fd_cloexec(STDOUT_FILENO, false); fd_cloexec(STDERR_FILENO, false); to unset CLOEXEC for standard file descriptors. This patch introduces the stdio_unset_cloexec() function to hide this and make code cleaner.
2016-07-01calendarspec: use ".." notation for ranges of weekdaysDouglas Christman
For backwards compatibility, both the new format (Mon..Wed) and the old format (Mon-Wed) are supported.
2016-07-01calendarspec: allow ranges in date and time specificationsDouglas Christman
Resolves #3042
2016-06-30Merge pull request #3596 from poettering/machine-cleanMartin Pitt
make "machinectl clean" asynchronous, and open it up via PolicyKit
2016-06-30journalctl: Make temporary files directory configurable (#3574)ottopotto
journalctl: Use env variable TMPDIR to save temporary files
2016-06-27basic/strv: introduce STRV_IGNORE macro (#3601)0xAX
to hide casting of '-1' strings and make code cleaner.
2016-06-27basic: pass flags to the fnmatch (#3606)Evgeny Vereshchagin
Fixes: ``` $ systemctl list-unit-files 'hey\*' 0 unit files listed. $ systemctl list-unit-files | grep hey hey\x7eho.service static ```
2016-06-26basic/strv: use SWAP_TWO() macro (#3602)0xAX
2016-06-24machined: "machinectl clean" can take a while, do it asynchronously from a ↵Lennart Poettering
background process This is a follow-up to 5d2036b5f3506bd0ff07042aee8d69c26db32298, and also makes the "machinectl clean" verb asynchronous, after all it's little more than a series of image removals. The changes required to make this happen are a bit more comprehensive as we need to pass information about deleted images back to the client, as well as information about the image we failed on if we failed on one. Hence, create a temporary file in /tmp, serialize that data into, and read it from the parent after the operation is complete.
2016-06-24Merge pull request #3549 from poettering/resolved-moreTom Gundersen
resolved: more fixes, among them "systemctl-resolve --status" to see DNS configuration in effect, and a local DNS stub listener on 127.0.0.53
2016-06-23build-sys: move fdset.[ch] src/basic → src/shared (#3580)Lennart Poettering
It makes use of the sd_listen_fds() call, and as such should live in src/shared, as the distinction between src/basic and src/shared is that the latter may use libsystemd APIs, the former does not. Note that btrfs-util.[ch] and log.[ch] also include header files from libsystemd, but they only need definitions, they do not invoke any function from it. Hence they may stay in src/basic.
2016-06-21tree-wide: some work-arounds for gcc false positives regarding uninitialized ↵Lennart Poettering
variables
2016-06-21resolved: when using the ResolveRecord() bus call, adjust TTL for caching timeLennart Poettering
When we return the full RR wire data, let's make sure the TTL included in it is adjusted by the time the RR sat in the cache. As an optimization we do this only for ResolveRecord() and not for ResolveHostname() and friends, since adjusting the TTL means copying the RR object, and we don#t want to do that if there's no reason to. (ResolveHostname() and friends don't return the TTL hence there's no reason to in that case)
2016-06-21set: add new set_put_strsplit() callLennart Poettering
It's like set_put_strdup(), but splits up a string via an extract_first_word() loop.
2016-06-21string-table: make sure DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN() handles ↵Lennart Poettering
NULL strings nicely xyz_from_string() functions defined with DEFINE_STRING_TABLE_LOOKUP() properly handle NULL strings already. make sure the equivalent functions defined with DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN() do the same.
2016-06-16process-util: fix two bugs in get_process_cmdline() (#3555)Lennart Poettering
See: https://github.com/systemd/systemd/pull/3529#issuecomment-226421007
2016-06-16Merge pull request #3511 from andir/networkd-vrfZbigniew Jędrzejewski-Szmek
networkd: add support for vrf interfaces (#3316)
2016-06-16Merge pull request #3481 from poettering/relative-memcgLennart Poettering
various changes, most importantly regarding memory metrics
2016-06-16networkd: added support for vrf interfaces (#3316)Andreas Rammhold
2016-06-15core: set $JOURNAL_STREAM to the dev_t/ino_t of the journal stream of ↵Lennart Poettering
executed services This permits services to detect whether their stdout/stderr is connected to the journal, and if so talk to the journal directly, thus permitting carrying of metadata. As requested by the gtk folks: #2473
2016-06-15socket-util: Run the fallback when the kernel complains about the null ↵Kai Ruhnau
buffer (#3541) Calling recv with a NULL buffer returns EFAULT instead of EOPNOTSUPP on older kernels (3.14). Fixes #3407 Signed-off-by: Kai Ruhnau <kai.ruhnau@target-sg.com>
2016-06-15tree-wide: htonl() is weird, let's use htobe32() instead (#3538)Lennart Poettering
Super-important change, yeah!
2016-06-14util-lib: rework get_process_cmdline() (#3529)Lennart Poettering
This reworks get_process_cmdline() quite substantially, fixing the following: - Fixes: https://github.com/systemd/systemd/pull/3512/commits/a4e3bf4d7ac2de51191ce136ee9361ba319e106c#r66837630 - The passed max_length is also applied to the "comm" name, if comm_fallback is set. - The right thing happens if max_length == 1 is specified - when the cmdline "foobar" is abbreviated to 6 characters the result is not "foobar" instead of "foo...". - trailing whitespace are removed before the ... suffix is appended. The 7 character abbreviation of "foo barz" is hence "foo..." instead of "foo ...". - leading whitespace are suppressed from the cmdline - a comprehensive test case is added
2016-06-14util: introduce physical_memory_scale() to unify how we scale by physical memoryLennart Poettering
The various bits of code did the scaling all different, let's unify this, given that the code is not trivial.
2016-06-14util-lib: introduce parse_percent() for parsing percent specificationsLennart Poettering
And port a couple of users over to it.
2016-06-14util: when determining the amount of memory on this system, take cgroup ↵Lennart Poettering
limit into account When determining the amount of RAM in the system, let's make sure we also read the root-level cgroup memory limit into account. This isn't particularly useful on the host, but in containers it makes sure that whatever memory the container got assigned is actually used for RAM size calculations.
2016-06-14Merge pull request #3527 from poettering/systemctl-fixesDaniel Mack
Systemctl fixes
2016-06-14build: fix missing symbol for old kernel headers (#3530)Andrew Jeddeloh
Fix issue where IN6_ADDR_GEN_MODE_STABLE_PRIVACY is undefined but IFLA_INET6_ADDR_GEN_MODE is defined and thus the former does not get fixed in missing.h. This occurs with kernel headers new enough to have the IFLA_INET6_ADDR_GEN_MODE but old enough to not yet have IN6_ADDR_GEN_MODE_STABLE_PRIVACY (e.g. 3.18).
2016-06-13unit-name: remove spurious newlineLennart Poettering
2016-06-13core: parse `rd.rescue` and `rd.emergency` as initrd-specific shorthands (#3488)Ivan Shapovalov
Typing `rd.rescue` is easier than `rd.systemd.unit=rescue.target`.
2016-06-12process-util: remove broken support for pid==0Zbigniew Jędrzejewski-Szmek
Our functions that query /proc/pid/ support using pid==0 to mean self. get_process_id also seemed to support that, but it was not implemented correctly: the result should be in *uid, not returned, and also it gave completely bogus result when called from get_process_gid(). But afaict, get_process_{uid,gid} were never called with pid==0, so it's not an actual bug. Remove the broken code to avoid confusion.
2016-06-12util-lib: drop trailing non-printable characters from cmdline (#3512)Max Prokhorov
If max_length is equal or greater than cmdline length all trailing non-printable characters are dropped. If max_length is 0 it should do the same. This should also fix cmdline truncation if the last character is not '\0'. Fixes #3469.
2016-06-12Fixed a small typo in a comment (#3514)Alex Gaynor
2016-06-10networkd: add support to configure VLAN on bridge portsTobias Jungel
2016-06-09Merge pull request #3432 from poettering/resolved-ll-ipv6Martin Pitt
resolved: support IPv6 DNS servers on the local link
2016-06-06util: make it easier to check whether in_addr or in6_addr addresses are NULLLennart Poettering
2016-06-06util-lib: add accessors for unaligned native endian wordsLennart Poettering
2016-06-06exit-status: update comments a bitLennart Poettering
2016-06-06exit-code: minor coding style updatesLennart Poettering
2016-06-06time-util: add triple timestamp objectLennart Poettering
We already have a double timestamp object that we use whenever we need both a MONOTONIC and a REALTIME timestamp taken and stored. With this change we also add a triple timestamp object that in addition stores a BOOTTIME timestamp, which is useful for a few usecases. Note that we keep dual_timestamp around, as it is useful in many cases where triple_timestamp is not, in particular because retrieving the monotonic and realtime timestamps is much cheaper on Linux that getting the boottime timestamp.
2016-06-06resolved: support IPv6 DNS servers on the local linkLennart Poettering
Make sure we can parse DNS server addresses that use the "zone id" syntax for local link addresses, i.e. "fe80::c256:27ff:febb:12f%wlp3s0", when reading /etc/resolv.conf. Also make sure we spit this out correctly again when writing /etc/resolv.conf and via the bus. Fixes: #3359
2016-06-04Merge pull request #3392 from poettering/assorted-stuffZbigniew Jędrzejewski-Szmek
Assorted stuff
2016-06-03missing include added for build with -DDEBUG (#3424)Tobias Jungel
2016-05-30pager: don't start pager if the terminal is explicitly set to TERM=dumbLennart Poettering
As suggested here: https://bugs.freedesktop.org/show_bug.cgi?id=64737#c8 This adds a new call terminal_is_dumb() and makes use of this where appropriate.
2016-05-30tree-wide: check colors_enabled() before outputting ANSI color stringsLennart Poettering
2016-05-30util-lib: make localed's nonempty() generic, rename it to empty_to_null() ↵Lennart Poettering
and make use of it everywhere
2016-05-29util-lib: Add sparc64 support for process creation (#3348)Michael Karcher
The current raw_clone function takes two arguments, the cloning flags and a pointer to the stack for the cloned child. The raw cloning without passing a "thread main" function does not make sense if a new stack is specified, as it returns in both the parent and the child, which will fail in the child as the stack is virgin. All uses of raw_clone indeed pass NULL for the stack pointer which indicates that both processes should share the stack address (so you better don't pass CLONE_VM). This commit refactors the code to not require the caller to pass the stack address, as NULL is the only sensible option. It also adds the magic code needed to make raw_clone work on sparc64, which does not return 0 in %o0 for the child, but indicates the child process by setting %o1 to non-zero. This refactoring is not plain aesthetic, because non-NULL stack addresses need to get mangled before being passed to the clone syscall (you have to apply STACK_BIAS), whereas NULL must not be mangled. Implementing the conditional mangling of the stack address would needlessly complicate the code. raw_clone is moved to a separete header, because the burden of including the assert machinery and sched.h shouldn't be applied to every user of missing_syscalls.h
2016-05-28Merge pull request #3326 from tomty89/update-2Zbigniew Jędrzejewski-Szmek
networkd: IPv6 fixes