summaryrefslogtreecommitdiff
path: root/src/core
AgeCommit message (Collapse)Author
2015-05-20core,nspawn: unify code that moves the root dirLennart Poettering
2015-05-19core: don't consider boot-up finished if we are still reloadingLennart Poettering
http://lists.freedesktop.org/archives/systemd-devel/2015-May/032025.html
2015-05-19core: when propagating restart requests due to deps, downgrade restart to ↵Lennart Poettering
try-restart Previously, if a service A depended on a service B via Requires=, and A was not running and B restarted this would trigger a start of A as well, since the restart was propagated as restart independently of the state of A. This patch ensures that a restart of B would be propagated as a try-restart to A, thus not changing its state if it isn't up. http://lists.freedesktop.org/archives/systemd-devel/2015-May/032061.html
2015-05-19core: sd_bus_error() already checks for NULL, no need to duplicate checkLennart Poettering
2015-05-19core: reinstate propagation of stop/restart jobs via RequsiteOf dependenciesLennart Poettering
This reverts the primary effect of be7d9ff730cb88d7c6a869dd5c47754c78ceaef2. After all Requisite= should be close to Requires=, without the one exception that it doesn't pull in dependencies on start. However, reverse deps on stop/restart should be treated the same way as for Restart=, and this is already documented in the man page, hence stick to it. http://lists.freedesktop.org/archives/systemd-devel/2015-May/032049.html
2015-05-19mount: properly check for mounts currently in /proc/self/mountinfoLennart Poettering
http://lists.freedesktop.org/archives/systemd-devel/2015-May/032059.html
2015-05-19unit: drop support for pre-v44 job serializationLennart Poettering
No distro ships that old systemd versions anyway, hence let's drop support for live-upgrades for them. Offline updates are still supported. And live-upgrades will only lose the job queue, hence basically still work...
2015-05-19core: also enforce ratelimiter if we stop a unit due to BindsTo=Lennart Poettering
This extends on bea355dac94e82697aa98e25d80ee4248263bf92, and extends the ratelimiter to not only be used for StopWhenUnneeded=1 units but also for units that have BindsTo= on a unit that is dead. http://lists.freedesktop.org/archives/systemd-devel/2015-April/030224.html
2015-05-19core: use bitfield where possibleLennart Poettering
2015-05-19core: enforce a ratelimiter when stopping units due to StopWhenUnneeded=1Lennart Poettering
Otherwise we might end up in an endless stop loop. http://lists.freedesktop.org/archives/systemd-devel/2015-April/030224.html
2015-05-19unit: fix unit_check_unneeded() dependency iterationLennart Poettering
Fixes a regression introduced in be7d9ff730cb88d7c6a869dd5c47754c78ceaef2.
2015-05-19mount: don't claim a device is gone from /proc/self/mountinfo before it is ↵Lennart Poettering
gone from *all* lines Devices might be referenced by multiple mount points in /proc/self/mountinfo, hence we should consider them unmounted only after they disappeared from all lines, not just from one. http://lists.freedesktop.org/archives/systemd-devel/2015-May/032026.html
2015-05-19device: create units with intended "found" valueMartin Pitt
Change device_found_node() to also create a .device unit if a device is not known by udev; this is the case for "tentative" devices picked up by mountinfo (DEVICE_FOUND_MOUNT). With that we can record the "found" attribute on the unit. Change device_setup_unit() to also accept a NULL udev_device, and don't add the extra udev information in that case. Previously device_found_node() would not create a .device unit, and unit_add_node_link() would then create a "dead" stub one via manager_load_unit(), so we lost the "found" attribute and unmounted everything from that device. https://launchpad.net/bugs/1444402 http://lists.freedesktop.org/archives/systemd-devel/2015-May/031658.html
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: fix OOM checks in dbus-unitThomas Hindoe Paaboel Andersen
CID#1299014
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-18core: Private*/Protect* options with RootDirectoryAlban Crequy
When a service is chrooted with the option RootDirectory=/opt/..., then the options PrivateDevices, PrivateTmp, ProtectHome, ProtectSystem must mount the directories under $RootDirectory/{dev,tmp,home,usr,boot}. The test-ns tool can test setup_namespace() with and without chroot: $ sudo TEST_NS_PROJECTS=/home/lennart/projects ./test-ns $ sudo TEST_NS_CHROOT=/home/alban/debian-tree TEST_NS_PROJECTS=/home/alban/debian-tree/home/alban/Documents ./test-ns
2015-05-18kmod-setup: conditionalize kmod autoloading properlyLennart Poettering
Load kdbus.ko only if we are built with kdbus, and load ip_tables.ko only if we are built with iptables support.
2015-05-18util: split all hostname related calls into hostname-util.cLennart Poettering
2015-05-16load-fragment: put quotes around iffy rvalueZbigniew Jędrzejewski-Szmek
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-15core: Fix assertion with empty Exec*= pathsMartin Pitt
An Exec*= line with whitespace after modifiers, like ExecStart=- /bin/true is considered to have an empty command path. This is as specified, but causes systemd to crash with Assertion 'skip < l' failed at ../src/core/load-fragment.c:607, function config_parse_exec(). Aborting. Aborted (core dumped) Fix this by logging an error instead and ignoring the invalid line. Add corresponding test cases. Also add a test case for a completely empty value which resets the command list. https://launchpad.net/bugs/1454173
2015-05-15core: Execute first boot presets in an enable-only preset-mode.Dimitri John Ledkov
This means any existing enabled units well be preserved and no pre-created symlinks will be removed. This is done on first boot, when the assumption is that /etc is not populated at all (no machine-id setup). For minimal containers that gives a significant first boot speed up, approximately ~20ms / ~16% in my trials.
2015-05-13core: only set event source name when we create an event sourceLennart Poettering
2015-05-13core: make exec code a bit more readableLennart Poettering
Let's add a function that checks whether we need fs namespacing, to make things easier to read, instead of using a humungous if expression...
2015-05-13core: fix memory leak in manager_run_generators()Cristian Rodríguez
If systemd is built with GCC address sanitizer or leak sanitizer the following memory leak ocurs: May 12 02:02:46 linux.site systemd[326]: ================================================================= May 12 02:02:46 linux.site systemd[326]: ==326==ERROR: LeakSanitizer: detected memory leaks May 12 02:02:46 linux.site systemd[326]: Direct leak of 101 byte(s) in 3 object(s) allocated from: May 12 02:02:46 linux.site systemd[326]: #0 0x7fd1f504993f in strdup (/usr/lib64/libasan.so.2+0x6293f) May 12 02:02:46 linux.site systemd[326]: #1 0x55d6ffac5336 in strv_new_ap src/shared/strv.c:163 May 12 02:02:46 linux.site systemd[326]: #2 0x55d6ffac56a9 in strv_new src/shared/strv.c:185 May 12 02:02:46 linux.site systemd[326]: #3 0x55d6ffa80272 in generator_paths src/shared/path-lookup.c:223 May 12 02:02:46 linux.site systemd[326]: #4 0x55d6ff9bdb0f in manager_run_generators src/core/manager.c:2828 May 12 02:02:46 linux.site systemd[326]: #5 0x55d6ff9b1a10 in manager_startup src/core/manager.c:1121 May 12 02:02:46 linux.site systemd[326]: #6 0x55d6ff9a78e3 in main src/core/main.c:1667 May 12 02:02:46 linux.site systemd[326]: #7 0x7fd1f394e8c4 in __libc_start_main (/lib64/libc.so.6+0x208c4) May 12 02:02:46 linux.site systemd[326]: Direct leak of 29 byte(s) in 1 object(s) allocated from: May 12 02:02:46 linux.site systemd[326]: #0 0x7fd1f504993f in strdup (/usr/lib64/libasan.so.2+0x6293f) May 12 02:02:46 linux.site systemd[326]: #1 0x55d6ffac5288 in strv_new_ap src/shared/strv.c:152 May 12 02:02:46 linux.site systemd[326]: #2 0x55d6ffac56a9 in strv_new src/shared/strv.c:185 May 12 02:02:46 linux.site systemd[326]: #3 0x55d6ffa80272 in generator_paths src/shared/path-lookup.c:223 May 12 02:02:46 linux.site systemd[326]: #4 0x55d6ff9bdb0f in manager_run_generators src/core/manager.c:2828 May 12 02:02:46 linux.site systemd[326]: #5 0x55d6ff9b1a10 in manager_startup src/core/manager.c:1121 May 12 02:02:46 linux.site systemd[326]: #6 0x55d6ff9a78e3 in main src/core/main.c:1667 May 12 02:02:46 linux.site systemd[326]: #7 0x7fd1f394e8c4 in __libc_start_main (/lib64/libc.so.6+0x208c4) May 12 02:02:46 linux.site systemd[326]: SUMMARY: AddressSanitizer: 130 byte(s) leaked in 4 allocation(s). There is a leak due to the the use of cleanup_free instead _cleanup_strv_free_
2015-05-13Default to /usr/bin/u?mount, configurable, rather than hard-coded /bin/u?mount.Dimitri John Ledkov
2015-05-13core: never create device depencies for /dev/root mountsLennart Poettering
http://lists.freedesktop.org/archives/systemd-devel/2015-May/031658.html
2015-05-13nspawn: rework custom mount point order, and add support for overlayfsLennart Poettering
Previously all bind mount mounts were applied in the order specified, followed by all tmpfs mounts in the order specified. This is problematic, if bind mounts shall be placed within tmpfs mounts. This patch hence reworks the custom mount point logic, and alwas applies them in strict prefix-first order. This means the order of mounts specified on the command line becomes irrelevant, the right operation will always be executed. While we are at it this commit also adds native support for overlayfs mounts, as supported by recent kernels.
2015-05-12core: drop redundant logging about notification messagesTom Gundersen
Before: May 12 17:11:22 tomegun-x2402 systemd[1]: systemd-udevd.service: Got notification message for unit. May 12 17:11:22 tomegun-x2402 systemd[1]: systemd-udevd.service: Got notification message from PID 195 (READY=1) May 12 17:11:22 tomegun-x2402 systemd[1]: systemd-udevd.service: Ggot READY=1 After: May 12 17:11:22 tomegun-x2402 systemd[1]: systemd-udevd.service: Got notification message from PID 195 (READY=1)
2015-05-11core: rename SystemdRunningAs to ManagerRunningAsLennart Poettering
It's primarily just a property of the Manager object after all, and we try to refer to PID 1 as "manager" instead of "systemd", hence let's to stick to this here too.
2015-05-11unit: move unit_warn_if_dir_nonempty() and friend to unit.cLennart Poettering
The call is only used by the mount and automount unit types, but that's already enough to consider it generic unit functionality, hence move it out of mount.c and into unit.c.
2015-05-11core,network: major per-object logging reworkLennart Poettering
This changes log_unit_info() (and friends) to take a real Unit* object insted of just a unit name as parameter. The call will now prefix all logged messages with the unit name, thus allowing the unit name to be dropped from the various passed romat strings, simplifying invocations drastically, and unifying log output across messages. Also, UNIT= vs. USER_UNIT= is now derived from the Manager object attached to the Unit object, instead of getpid(). This has the benefit of correcting the field for --test runs. Also contains a couple of other logging improvements: - Drops a couple of strerror() invocations in favour of using %m. - Not only .mount units now warn if a symlinks exist for the mount point already, .automount units do that too, now. - A few invocations of log_struct() that didn't actually pass any additional structured data have been replaced by simpler invocations of log_unit_info() and friends. - For structured data a new LOG_UNIT_MESSAGE() macro has been added, that works like LOG_MESSAGE() but prefixes the message with the unit name. Similar, there's now LOG_LINK_MESSAGE() and LOG_NETDEV_MESSAGE(). - For structured data new LOG_UNIT_ID(), LOG_LINK_INTERFACE(), LOG_NETDEV_INTERFACE() macros have been added that generate the necessary per object fields. The old log_unit_struct() call has been removed in favour of these new macros used in raw log_struct() invocations. In addition to removing one more function call this allows generated structured log messages that contain two object fields, as necessary for example for network interfaces that are joined into another network interface, and whose messages shall be indexed by both. - The LOG_ERRNO() macro has been removed, in favour of log_struct_errno(). The latter has the benefit of ensuring that %m in format strings is properly resolved to the specified error number. - A number of logging messages have been converted to use log_unit_info() instead of log_info() - The client code in sysv-generator no longer #includes core code from src/core/. - log_unit_full_errno() has been removed, log_unit_full() instead takes an errno now, too. - log_unit_info(), log_link_info(), log_netdev_info() and friends, now avoid double evaluation of their parameters
2015-05-11core: always initialize ExecParamters.bus_endpoint_fd to -1Lennart Poettering
Otherwise it might be passed in as 0, which is a valid fd, but usually does not refer to a real endpoint.
2015-05-11swap: avoid null pointer dereferenceThomas Hindoe Paaboel Andersen
CID#1297436
2015-05-11treewide: Correct typos and spell plural of bus consistentTorstein Husebø
2015-05-06device: avoid null pointer dereferenceThomas Hindoe Paaboel Andersen
2015-05-06bus: don't switch to kdbus if not requestedDavid Herrmann
Whenever systemd is re-executed, it tries to create a system bus via kdbus. If the system did not have kdbus loaded during bootup, but the module is loaded later on manually, this will cause two system buses running (kdbus and dbus-daemon in parallel). This patch makes sure we never try to create kdbus buses if it wasn't explicitly requested on the command-line.
2015-05-05core: be more strict when manipulating slices names and unescaping paths ↵Lennart Poettering
from unit names Let's better be safe then sorry.
2015-05-05core: bus name units should not allow aliases or instancesLennart Poettering
2015-05-05core: rework unit name validation and manipulation logicLennart Poettering
A variety of changes: - Make sure all our calls distuingish OOM from other errors if OOM is not the only error possible. - Be much stricter when parsing escaped paths, do not accept trailing or leading escaped slashes. - Change unit validation to take a bit mask for allowing plain names, instance names or template names or an combination thereof. - Refuse manipulating invalid unit name
2015-04-30core: simplify %r and %R logic a bitLennart Poettering
Do not calculate the cgroup path manually, just use normal unit fields and calls for that.
2015-04-30core: simplify unit type detection logicLennart Poettering
Introduce a new call unit_type_supported() and make use of it everywhere. Also, drop Manager parameter from per-type supported method prototype.
2015-04-30sd-bus: when we get ENOTTY on the HELLO ioctl assume incompatible API versionLennart Poettering
As perparation for future incompatible kdbus kernel API changes.
2015-04-29core: fix event source annotationsMantas Mikulėnas
These looked like a mass-replace gone slightly wrong – two statements with no { }'s, and no error checking.
2015-04-29tree-wide: get rid of a few more explicit bus parametersLennart Poettering
2015-04-29core: for queued reload message there is no need to store the bus explicitlyLennart Poettering
After all it can be derived from the message directly, and already is.
2015-04-29sd-bus: allow passing NULL as bus parameter to sd_bus_send()Lennart Poettering
If NULL is specified for the bus it is now automatically derived from the passed in message. This commit also changes a number of invocations of sd_bus_send() to make use of this.
2015-04-29sd-bus: drop bus parameter from message callback prototypeLennart Poettering
This should simplify the prototype a bit. The bus parameter is redundant in most cases, and in the few where it matters it can be derived from the message via sd_bus_message_get_bus().
2015-04-29core: annotate event sourcesTom Gundersen