summaryrefslogtreecommitdiff
path: root/src/basic
AgeCommit message (Collapse)Author
2016-05-02copy: return the right error when we can't open a fileLennart Poettering
2016-05-02util: rework sigkill_wait() to not require pid_t pointerLennart Poettering
Let's make sigkill_wait() take a normal pid_t, and add sigkill_waitp() that takes a pointer (which is useful for usage in _cleanup_), following the usual logic we have for this.
2016-04-29Merge pull request #3151 from keszybz/pr3149-2Zbigniew Jędrzejewski-Szmek
Assorted fixes #3149 + one commit tacked on top
2016-04-29core: make parsing of RLIMIT_NICE aware of actual nice levelsLennart Poettering
2016-04-29build-sys: improve compat with older kernel headersLennart Poettering
In 4.2 kernel headers, some netlink defines are missing that we need. missing.h already can add them in, but currently makes this dependent on a definition that these kernels already have. Change the check hence to check for the newest definition in the table, so that the whole bunch of definitions as added in on all kernels lacking this.
2016-04-29path-util: also support ".old" and ".new" suffixes and recommend themZbigniew Jędrzejewski-Szmek
~ suffix works fine, but looks to much like it the file is supposed to be automatically cleaned up. For new versions of configuration files installers might want to using something that looks more permanent like foobar.new. So let's add treat ".old" and ".new" as special. Update test to match.
2016-04-29copy: also copy AF_UNIX socketsLennart Poettering
We previously would fail with EOPNOTSUPP when encountering an AF_UNIX socket in the directory tree to copy. Fix that, and copy them too (even if they are dead in the result). Fixes: #2914
2016-04-29path-util: document that we shouldn't add further entries to ↵Lennart Poettering
hidden_or_backup_file() And let's add ".bak" as a generic suffix for backups, that people can use without having to register their stuff in our list.
2016-04-29journal: when creating a new journal file, fsync() the directory it is ↵Lennart Poettering
created in too Fixes: #2831
2016-04-29parse-util: fix conversion from size_t on s390 (#3147)Lubomir Rintel
On s390 size_t is an unsigned long, nor an unsigned int. They both are of the same size and can be cast to each other safely, but the compiler still seems unhappy about incompatible pointers. Fixes: 7c2da2ca8
2016-04-29Merge pull request #3137 from keszybz/dirent-simplificationLennart Poettering
Various small cleanups in shared code
2016-04-28basic/mount-util: recognize pvfs2 as network fs (#3140)Zbigniew Jędrzejewski-Szmek
Added to kernel 4.6.
2016-04-28tree-wide: rename hidden_file to hidden_or_backup_file and optimizeZbigniew Jędrzejewski-Szmek
In standard linux parlance, "hidden" usually means that the file name starts with ".", and nothing else. Rename the function to convey what the function does better to casual readers. Stop exposing hidden_file_allow_backup which is rather ugly and rewrite hidden_file to extract the suffix first. Note that hidden_file_allow_backup excluded files with "~" at the end, which is quite confusing. Let's get rid of it before it gets used in the wrong place.
2016-04-27basic/dirent-util: do not call hidden_file_allow_backup from ↵Zbigniew Jędrzejewski-Szmek
dirent_is_file_with_suffix If the file name is supposed to end in a suffix, there's not need to check the name against a list of "special" file names, which is slow. Instead, just check that the name doens't start with a period.
2016-04-27path-util: Add hidden suffixes for ucf (#3131)Martin Pitt
ucf is a standard Debian helper for managing configuration file upgrades which need more interaction or elaborate merging than conffiles managed by dpkg. Ignore its temporary and backup files similarly to the *.dpkg-* ones to avoid creating units for them in generators. https://bugs.debian.org/775903
2016-04-26Merge pull request #3093 from poettering/nspawn-userns-magicLennart Poettering
nspawn automatic user namespaces
2016-04-25nspawn: when readjusting UID/GID ownership of OS trees, skip read-only subtreesLennart Poettering
This should allow tools like rkt to pre-mount read-only subtrees in the OS tree, without breaking the patching code. Note that the code will still fail, if the top-level directory is already read-only.
2016-04-25nspawn: don't try to patch UIDs/GIDs of procfs and suchlikeLennart Poettering
2016-04-25nspawn: make -U a tiny bit smarterLennart Poettering
With this change -U will turn on user namespacing only if the kernel actually supports it and otherwise gracefully degrade to non-userns mode.
2016-04-25util: copy_file_range() returns EBADF when used on a ttyLennart Poettering
In nspawn we invoke copy_bytes() on a TTY fd. copy_file_range() returns EBADF on a TTY and this error is considered fatal by copy_bytes() so far. Correct that, so that nspawn's copy_bytes() operation works again. This is a follow-up for a44202e98b638024c45e50ad404c7069c7835c04.
2016-04-25journal: add inotify watches by-fd instead of by-pathLennart Poettering
This is slightly nicer, since we actually watch the directories we opened and enumerate. However, primarily this is preparation for adding support for opening journal files by fd without specifying any path, to be added in a later commit.
2016-04-22coredump,basic: generalize O_TMPFILE handling a bitLennart Poettering
This moves the O_TMPFILE handling from the coredumping code into common library code, and generalizes it as open_tmpfile_linkable() + link_tmpfile(). The existing open_tmpfile() function (which creates an unlinked temporary file that cannot be linked into the fs) is renamed to open_tmpfile_unlinkable(), to make the distinction clear. Thus, code may now choose between: a) open_tmpfile_linkable() + link_tmpfile() b) open_tmpfile_unlinkable() Depending on whether they want a file that may be linked back into the fs later on or not. In a later commit we should probably convert fopen_temporary() to make use of open_tmpfile_linkable(). Followup for: #3065
2016-04-22tree-wide: don't assume CLOCK_BOOTIME is generally availableLennart Poettering
Before we invoke now(CLOCK_BOOTTIME), let's make sure we actually have that clock, since now() will otherwise hit an assert. Specifically, let's refuse CLOCK_BOOTTIME early in sd-event if the kernel doesn't actually support it. This is a follow-up for #3037, and specifically: https://github.com/systemd/systemd/pull/3037#issuecomment-210199167
2016-04-22core,systemctl: add bus API to retrieve processes of a unitLennart Poettering
This adds a new GetProcesses() bus call to the Unit object which returns an array consisting of all PIDs, their process names, as well as their full cgroup paths. This is then used by "systemctl status" to show the per-unit process tree. This has the benefit that the client-side no longer needs to access the cgroupfs directly to show the process tree of a unit. Instead, it now uses this new API, which means it also works if -H or -M are used correctly, as the information from the specific host is used, and not the one from the local system. Fixes: #2945
2016-04-20networkd: bump MTU to 1280 for interfaces which have IPv6 enabled (#3077)Susant Sahani
IPv6 protocol requires a minimum MTU of 1280 bytes on the interface. This fixes #3046. Introduce helper link_ipv6_enabled() to figure out whether IPV6 is enabled. Introduce network_has_static_ipv6_addresses() to find out if any static ipv6 address configured. If IPv6 is not configured on any interface that is SLAAC, DHCPv6 and static IPv6 addresses not configured, then IPv6 will be automatically disabled for that interface, that is we write "1" to /proc/sys/net/ipv6/conf//disable_ipv6.
2016-04-20basic/terminal-util: cache value for colors_enabledZbigniew Jędrzejewski-Szmek
After all it's something that we query over and over. For example, systemctl calls colors_enabled() four times for each failing service. The compiler is unable to optimize those calls away because they (potentially) accesses external and global state through on_tty() and getenv().
2016-04-18basic: user-utils.c needs missing.h for secure_getenv (#3059)michaelolbrich
Otherwise building may fail with: src/basic/user-util.c: In function 'get_home_dir': src/basic/user-util.c:343:9: error: implicit declaration of function 'secure_getenv' [-Werror=implicit-function-declaration]
2016-04-18networkd: allow setting of multicast querier for linux bridge (#3051)Susant Sahani
2016-04-16install: allow paths like LookupPath.generator to be NULLZbigniew Jędrzejewski-Szmek
Fixes #3047.
2016-04-16tree-wide: introduce PATH_IN_SET macroZbigniew Jędrzejewski-Szmek
2016-04-13basic/util: silence stupid gcc warnings about unitialized variableZbigniew Jędrzejewski-Szmek
2016-04-12tests: override XDG_RUNTIME_DIR where we use the user runtime dirLennart Poettering
We don#t really support systems where XDG_RUNTIME_DIR is not supported for systemd --user. Hence, let's always set our own XDG_RUNTIME_DIR for tests that involve systemd --user, so that we know it is set, and that it doesn't polute the user's actual runtime dir.
2016-04-12tree-wide: add new SIGNAL_VALID() macro-like function that validates signal ↵Lennart Poettering
numbers And port all code over to use it.
2016-04-12basic: remove rbtree code, it's unusedLennart Poettering
it's unused, and should we need it one day we can always resurrect it from git history.
2016-04-12core: rework reboot parameter logic a bitLennart Poettering
Always warn if something fails, and clarify that the involved utility functions do so in their name. Drop the REBOOT_PARAM_FILE macro. We don't do this for other flag file paths like this, so don't do this for this one either. The path isn't configurable anyway, hence let's make this easier to read by avoiding this one indirection.
2016-04-12core: be more paranoid when mixing umask and fopen()Lennart Poettering
Let's be extra careful with the umask when we use simple fopen(), as this creates files with 0777 by default.
2016-04-12core: rework how transient unit files and property drop-ins workLennart Poettering
With this change the logic for placing transient unit files and drop-ins generated via "systemctl set-property" is reworked. The latter are now placed in the newly introduced "control" unit file directory. The fomer are now placed in the "transient" unit file directory. Note that the properties originally set when a transient unit was created will be written to and stay in the transient unit file directory, while later changes are done via drop-ins. This is preparation for a later "systemctl revert" addition, where existing drop-ins are flushed out, but the original transient definition is restored.
2016-04-08basic/util: check return value of dup2 in fork_agent()Zbigniew Jędrzejewski-Szmek
CID #1304689.
2016-04-06Merge pull request #2944 from keszybz/man-coredump-sysctlLennart Poettering
Man coredump sysctl
2016-04-06Merge pull request #2947 from keszybz/test-nssLennart Poettering
Add a test for nss modules and some related fixes
2016-04-05test-nss: test the resolution of various namesZbigniew Jędrzejewski-Szmek
nss-dns is also "tested". It should be almost always available, and provides a reference for comparison.
2016-04-05string-table: split long definitionsZbigniew Jędrzejewski-Szmek
2016-04-04Merge pull request #2959 from keszybz/stop-resolving-localdomainZbigniew Jędrzejewski-Szmek
*.localdomain != localhost
2016-04-04*.localdomain != localhostDavid R. Hedges
".localdomain" is not a reserved suffix (or prefix). I'm not aware of any product expecting *.localdomain to resolve to localhost, however I am aware of at least one product that defaults to ".localdomain" as its DNS suffix provided via DHCP (pfSense). This leads to unexpected results when attempting to access a host that's offline (or a host that's online, when nsswitch.conf is [mis-]configured to have myhostname ahead of DNS). Operate on: localhost (and localhost.) *.localhost (and *.localhost.) localhost.localdomain (and localhost.localdomain.) *.localhost.localdomain (and *.localhost.localdomain.) We should not cover: *.localdomain (nor *.localdomain.) localdomain (nor localdomain.)
2016-04-04basic: fallback to fstatat if entry->d_type is DT_UNKNOWNEvgeny Vereshchagin
* tests-functions: improve FSTYPE-support make clean setup FSTYPE=reiserfs is working fine now :) * basic: fallback to fstatat if entry->d_type is DT_UNKNOWN Fixes localectl on reiserfs: -bash-4.3# mkdir -p /usr/lib/locale -bash-4.3# stat -f /usr/lib/locale/ File: "/usr/lib/locale/" ID: bdb0322715b5366e Namelen: 255 Type: reiserfs Block size: 4096 Blocks: Total: 99835 Free: 60262 Available: 60262 Inodes: Total: 0 Free: 0 -bash-4.3# mkdir /usr/lib/locale/HeyHo -bash-4.3# localectl list-locales --no-pager -bash-4.3# mount -t tmpfs tmpfs /usr/lib/locale -bash-4.3# mkdir /usr/lib/locale/HeyHo -bash-4.3# localectl list-locales --no-pager HeyHo
2016-04-02Move nss typedefs into nss-util.hZbigniew Jędrzejewski-Szmek
In preparation for subsequent changes.
2016-04-02basic/copy: remove unnecessary castZbigniew Jędrzejewski-Szmek
Both types are unsigned, so the cast to the longer type is automatic.
2016-04-02test-compress-benchmark: fix argument parsing on 32bitZbigniew Jędrzejewski-Szmek
The patch is not minimal, but a function to parse size_t is probably going to come in handy in other places, so I think it's nicer to define a proper parsing function than to open-code the cast.
2016-04-01Revert "time-util: fall back to CLOCK_MONOTONIC if CLOCK_BOOTTIME unsupported"Lennart Poettering
2016-03-26core: update populated event handling in unified hierarchyTejun Heo
Earlier during the development of unified hierarchy, the populated event was reported through by the dedicated "cgroup.populated" file; however, the interface was updated so that it's reported through the "populated" field of "cgroup.events" file. Update populated event handling logic accordingly.