summaryrefslogtreecommitdiff
path: root/src/core
AgeCommit message (Collapse)Author
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
2015-04-28service: make restart logic a bit easier to understandLennart Poettering
2015-04-28exit-status: introduce common exit_status_set_test() call for testing exit ↵Lennart Poettering
status set membership
2015-04-28scope: use correct enum typeThomas Hindoe Paaboel Andersen
2015-04-28unit: Drop unused variablesMartin Pitt
src/core/unit.c: In function 'unit_coldplug': src/core/unit.c:2884:18: warning: unused variable 'i' [-Wunused-variable] Iterator i; ^ src/core/unit.c:2883:15: warning: unused variable 'other' [-Wunused-variable] Unit *other; ^
2015-04-28core: when we cannot add PID to a scope cgroup, log about itLennart Poettering
Also, place the scope unit in failed state.
2015-04-27core: coldplug all units which participate in jobs during coldpluggingIvan Shapovalov
This is yet another attempt to fix coldplugging order (more especially, the problem which happens when one creates a job during coldplugging and it references a not-yet-coldplugged unit). Now we forcibly coldplug all units which participate in jobs. This is a superset of previously implemented handling of the UNIT_TRIGGERS dependencies, so that handling is removed. http://lists.freedesktop.org/archives/systemd-devel/2015-April/031212.html https://bugs.freedesktop.org/show_bug.cgi?id=88401 (once again)
2015-04-24core: minor simplificationLennart Poettering
2015-04-24unit: don't add automatic dependencies on device units if they aren't supportedLennart Poettering
http://lists.freedesktop.org/archives/systemd-devel/2015-April/031187.html
2015-04-24manager: don't fail fatally if we cannot coldplug a unitLennart Poettering
It's better to continue as good as we can, than to totally fail. Hence, let's log about the failure and continue.
2015-04-24core: always coldplug units that are triggered by other units before thoseLennart Poettering
Let's make sure that we don't enqueue triggering jobs for units before those units are actually fully loaded. http://lists.freedesktop.org/archives/systemd-devel/2015-April/031176.html https://bugs.freedesktop.org/show_bug.cgi?id=88401
2015-04-24core: return 0 from device_serialize()Daniel Mack
Fixes: CC src/core/libsystemd_core_la-device.lo src/core/device.c: In function 'device_serialize': src/core/device.c:169:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
2015-04-24Revert "core: do not spawn jobs or touch other units during coldplugging"Lennart Poettering
This reverts commit 6e392c9c45643d106673c6643ac8bf4e65da13c1. We really shouldn't invent external state keeping hashmaps, if we can keep this state in the units themselves.
2015-04-24device: rework how we enter tentative stateLennart Poettering
This reworks how we enter tentative state and does so only when a device was previously not announced via udev. The previous check actually just checked whether a new state bit was set, which is not correct. Also, to be able to reliably maintain the tentative state across daemon reloads, we need to serialize and deserialize it.
2015-04-24service: improve readability, by reducing line-breaksLennart Poettering
2015-04-23core: fix parsing of mount flagsLennart Poettering
As reported my Maciej Wereski: http://lists.freedesktop.org/archives/systemd-devel/2015-February/028320.html
2015-04-23core: downgrade warning about duplicate device namesLennart Poettering
http://lists.freedesktop.org/archives/systemd-devel/2015-April/031094.html
2015-04-23core: explicitly specify credentials for direct connections, tooLennart Poettering
So far we authenticate direct connections primarily at connection time, but let's also do this for each method individually, by attaching the creds we need for that right away.
2015-04-22kmod-setup: load ip_tables kmod at bootLennart Poettering
The module is currently no auto-loadable (and this is unlikely to change anytime soon, given it's API is via getsockopt/setsockopt). It is needed by networkd and nspawn currently. Users who really don't like the module to be loaded have the option to blacklist it still, or not compile it at all. But for all others this should make things work out-of-the-box.
2015-04-21automount: remove unused variableThomas Hindoe Paaboel Andersen
2015-04-21build-sys: move systemd.pc from pkgconfiglibdir back into pkgconfigdatadirLennart Poettering
The original idea of systemd.pc was to contain arch-independent system and systemd information. By exposing libdir as part of the fields (added in eb39a6239c631873db62f6a942e6cb3dab0a2db4), it started to carry arch-dependent data, thus breaking multilib systems. It was then moved to pkgconfiglibdir to deal with this (in aec432c6134146e138124c4130be2ee89dca07fa), but actually the right approach is to simply not include libdir in the .pc file at all. THis patch hence more or less reverts both commits again, and moves the .pc file back into pkgconfigdatadir. As alternative for querying the systems primary libdir there's now "systemd-path system-library-arch", hence a more correct alternative exists for querying this variable from the .pc file.
2015-04-21core: make unit deserialization more defensiveLennart Poettering
2015-04-21automount: various smaller fixesLennart Poettering