summaryrefslogtreecommitdiff
path: root/src/core
AgeCommit message (Collapse)Author
2016-04-29core: merge service_connection_unref() into service_close_socket_fd()Lennart Poettering
We always call one after the other anyway, and this way service_set_socket_fd() and service_close_socket_fd() nicely match each other as one undoes the effect of the other.
2016-04-29core: rerun GC logic for a unit that loses a referenceLennart Poettering
Let's make sure when we drop a reference to a unit, that we run the GC queue on it again. This (together with the previous commit) should deal with the GC issues pointed out in: https://github.com/systemd/systemd/pull/2993#issuecomment-215331189
2016-04-29core: rework socket/service GC logicLennart Poettering
There's no need to set the no_gc bit for service units that socket units prepare, as we always keep a proper reference (as maintained by unit_ref_set()) on them, and such references are honoured by the GC logic anyway. Moreover, explicitly setting the no_gc bit is problematic if the socket gets GC'ed for a reason, as the service might then leak with the bit set.
2016-04-29socket: really always close auxiliary fds when closing socket fdsLennart Poettering
2016-04-29core: make sure to close connection fd when we fail to activate a ↵Lennart Poettering
per-connection service Fixes: #2993 #2691
2016-04-29core: minor error path fixLennart Poettering
In service_set_socket_fd(), let's make sure that if we can't add the requested dependencies we take no possession of the passed connection fd. This way, we follow the strict rule: we take possession of the passed fd on success, but on failure we don't, and the fd remains in possession of the caller.
2016-04-29core: rename StartLimitInterval= to StartLimitIntervalSec=Lennart Poettering
We generally follow the rule that for time settings we suffix the setting name with "Sec" to indicate the default unit if none is specified. The only exception was the rate limiting interval settings. Fix this, and keep the old names for compatibility. Do the same for journald's RateLimitInterval= setting
2016-04-29core: move start ratelimiting check after condition checksLennart Poettering
With #2564 unit start rate limiting was moved from after the condition checks are to before they are made, in an attempt to fix #2467. This however resulted in #2684. However, with a previous commit a concept of per socket unit trigger rate limiting has been added, to fix #2467 more comprehensively, hence the start limit can be moved after the condition checks again, thus fixing #2684. Fixes: #2684
2016-04-29core: introduce activation rate limiting for socket unitsLennart Poettering
This adds two new settings TriggerLimitIntervalSec= and TriggerLimitBurst= that define a rate limit for activation of socket units. When the limit is hit, the socket is is put into a failure mode. This is an alternative fix for #2467, since the original fix resulted in issue #2684. In a later commit the StartLimitInterval=/StartLimitBurst= rate limiter will be changed to be applied after any start conditions checks are made. This way, there are two separate rate limiters enforced: one at triggering time, before any jobs are queued with this patch, as well as the start limit that is moved again to be run immediately before the unit is activated. Condition checks are done in between the two, and thus no longer affect the start limit.
2016-04-29core: Filter by unit name behind the D-Bus, instead on the client side (#3142)kayrus
This commit improves systemd performance on the systems which have thousands of units.
2016-04-29Merge pull request #3069 from Werkov/fix-dependencies-for-bind-mountsLennart Poettering
Always create dependencies for bind mounts
2016-04-26core: set start job timeout from the kernel commandline (#3112)tblume
Add the boot parameter: systemd.default_timeout_start_sec to allow modification of the default start job timeout at boot time.
2016-04-25core: fix description of "resources" service error (#3119)Lennart Poettering
The "resources" error is really just the generic error we return when we hit some kind of error and we have no more appropriate error for the case to return, for example because of some OS error. Hence, reword the explanation and don't claim any relation to resource limits. Admittedly, the "resources" service error is a bit of a misnomer, but I figure it's kind of API now. Fixes: #2716
2016-04-25Always create dependencies for loop device mountsMichal Koutný
In case a file is on a networked filesystem, we may tag the fstab record with _netdev option, however, corrrect dependencies will be created for this mount.
2016-04-25Always create dependencies for bind mountsMichal Koutný
Dependencies were not created for _netdev mountpoints, the reasoning for this is in the commit fc676b00, i.e. to avoid adding dependencies for network mountpoints where What= appears like a path. Thus proposing this semantically more correct condition when dependencies are added for _actual_ bind mounts irrespectively of network flag. Consequently it allows to add _netdev option to bind mounts, which includes them in remote-fs.target, which simplifies configuration.
2016-04-22tree-wide: remove unused variables (#3098)Thomas H. P. Andersen
2016-04-22Merge pull request #3094 from poettering/run-sliceZbigniew Jędrzejewski-Szmek
systemd-run: fix --slice= in conjunction with --scope
2016-04-22core: don't dispatch load queue when setting Slice= for transient unitsLennart Poettering
Let's be more careful when setting up the Slice= property of transient units: let's use manager_load_unit_prepare() instead of manager_load_unit(), so that the load queue isn't dispatched right away, because our own transient unit is in it, and we don#t want to have it loaded until we finished initializing it.
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-22machine-id-setup: explicitly fsync() the machine ID after writingLennart Poettering
As discussed here: https://github.com/systemd/systemd/issues/2619#issuecomment-184670042 Explicitly syncing /etc/machine-id after writing it, is probably a good idea, since it has a strong "commit" character and is generally a one-time thing. Fixes #2619.
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-22Merge pull request #3084 from keszybz/preset-fixesLennart Poettering
Nicer error message is symlinking chokes on an existing file
2016-04-21tree-wide: use mdash instead of a two minusesZbigniew Jędrzejewski-Szmek
2016-04-21core/dbus-manager: drop unused param from installation functionsZbigniew Jędrzejewski-Szmek
2016-04-21Merge pull request #3005 from keszybz/kill-user-procesesLennart Poettering
Kill user session scope by default
2016-04-21core: prefix selinux messages with "selinux: "Zbigniew Jędrzejewski-Szmek
SELinux outputs semi-random messages like "Unknown permission start for class system", and the user has to dig into message metadata to find out where they are comming from. Add a prefix to give a hint.
2016-04-20pid1: disable color output when TERM=dumbZbigniew Jędrzejewski-Szmek
This changes the behaviour of pid1 in the following ways: - obviously $TERM is now checked, - $SYSTEMD_COLORS is now honoured too, before only SYSTEMD_LOG_COLORS was checked, - isatty() is run on stdout not stderr. As requested in #3025.
2016-04-19Merge pull request #3055 from keszybz/preset-fixesLennart Poettering
Another bunch of improvements to the installation code
2016-04-19shared/install,systemctl,core: report offending file on installation errorZbigniew Jędrzejewski-Szmek
Fixes #2191: $ systemctl --root=/ enable sddm Created symlink /etc/systemd/system/display-manager.service, pointing to /usr/lib/systemd/system/sddm.service. $ sudo build/systemctl --root=/ enable gdm Failed to enable unit, file /etc/systemd/system/display-manager.service already exists and is a symlink to /usr/lib/systemd/system/sddm.service. $ sudo build/systemctl --root= enable sddm $ sudo build/systemctl --root= enable gdm Failed to enable unit: File /etc/systemd/system/display-manager.service already exists and is a symlink to /usr/lib/systemd/system/sddm.service. (I tried a few different approaches to pass the error information back to the caller. Adding a new parameter to hold the error results in a gigantic patch and a lot of hassle to pass the args arounds. Adding this information to the changes array is straightforward and can be more easily extended in the future.) In case local installation is performed, the full set of errors can be reported and we do that. When running over dbus, only the first error is reported.
2016-04-18shared/install: add helper function unit_file_changes_have_modification()Zbigniew Jędrzejewski-Szmek
As suggested in review of #3049.
2016-04-18Various formatting and style fixesZbigniew Jędrzejewski-Szmek
2016-04-17tree-wide: fall back to now(CLOCK_MONOTONIC) if CLOCK_BOOTTIME unsupported ↵Lubomir Rintel
(#3037) It was added in 2.6.39, and causes an assertion to fail when running in mock hosted on 2.6.32-based RHEL-6: Assertion 'clock_gettime(map_clock_id(clock_id), &ts) == 0' failed at systemd/src/basic/time-util.c:70, function now(). Aborting.
2016-04-16tree-wide: introduce PATH_IN_SET macroZbigniew Jędrzejewski-Szmek
2016-04-16systemctl/core: ignore masked units in preset-allZbigniew Jędrzejewski-Szmek
With any masked unit that would that would be enabled by presets, we'd get: test@rawhide $ sudo systemctl preset-all Failed to execute operation: Unit file is masked. test@rawhide $ sudo systemctl --root=/ preset-all Operation failed: Cannot send after transport endpoint shutdown Simply ignore those units: test@rawhide $ sudo systemctl preset-all Unit xxx.service is masked, ignoring.
2016-04-16tree-wide: use ERFKILL instead of ESHUTDOWN for "unit masked"Zbigniew Jędrzejewski-Szmek
If the error code ever leaks (we print the strerror error instead of providing our own), the message for ESHUTDOWN is "Cannot send after transport endpoint shutdown", which can be misleading. In particular it suggest that some mishandling of the dbus connection occured. Let's change that to ERFKILL which has the advantage that a) it sounds implausible as actual error, b) has the connotation of disabling something manually.
2016-04-14core/mount-setup.c: also relabel /dev/shm for selinux (#3039)Harald Hoyer
daemons, which wish to transition state from the initramfs to the real root, might use /dev/shm for their state. As /dev is not relabeled across mount points, /dev/shm has to be relabled explicitly.
2016-04-13tree-wide: remove useless NULLs from strjoinaZbigniew Jędrzejewski-Szmek
The coccinelle patch didn't work in some places, I have no idea why.
2016-04-13basic/util: silence stupid gcc warnings about unitialized variableZbigniew Jędrzejewski-Szmek
2016-04-12Merge pull request #2973 from poettering/search-pathMartin Pitt
Many fixes, in particular to the install logic
2016-04-12load-fragment: Resolve specifiers in DeviceAllow (#3019)Nicolas Braud-Santoni
Closes #1602
2016-04-12core: make sure we always free the list of changesLennart Poettering
2016-04-12core: keep track of the mtime of the transient unit file we wroteLennart Poettering
Otherwise "systemctl status" will immediately report that our unit file is out of date.
2016-04-12core: make sure we generate a nicer error when a linked unit is attempted to ↵Lennart Poettering
be enabled We don't allow using config symlinks to enable units, but the error message we printed was awful. Fix that, and generate a more readable error. Fixes #3010.
2016-04-12core: optimize unit_write_drop_in a bitLennart Poettering
There's no point in first determining the drop-in file name path, then forgetting it again, and then determining it again. Instead, just generated it once, and then write to ti directly.
2016-04-12core: when creating a drop-in snippet, add a comment explaining this to itLennart Poettering
2016-04-12core,systemctl: add new "systemctl revert" commandLennart Poettering
This allows dropping all user configuration and reverting back to the vendor default of a unit file. It basically undoes what "systemctl edit", "systemctl set-property" and "systemctl mask" do.
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-12systemctl: don't confuse sysv code with generated unitsLennart Poettering
The SysV compat code checks whether there's a native unit file before looking for a SysV init script. Since the newest rework generated units will show up in the unit path, and hence the checks ended up assuming that there always was a native unit file for each init script: the generated one. With this change the generated unit file directory is suppressed from the search path when this check is done, to avoid the confusion.
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.