summaryrefslogtreecommitdiff
path: root/src/core
AgeCommit message (Collapse)Author
2015-10-01core: add new setting Writable= to ListenSpecial= socket unitsLennart Poettering
Writable= is a new boolean setting. If ture, then ListenSpecial= will open the specified path in O_RDWR mode, rather than just O_RDONLY. This is useful for implementing services like rfkill, where /dev/rfkill is more useful when opened in write mode, if we want to not only save but also restore its state.
2015-10-01tree-wide: add missing errno arguments to log_*_errno()Michal Schmidt
A few of the recent conversions to log_*_errno() were missing the errno value arguments. Fixes: e53fc357a9b "tree-wide: remove a number of invocations of strerror() and replace by %m"
2015-10-01Merge pull request #1426 from poettering/log-syntaxDaniel Mack
logging fixes and more
2015-09-30Merge pull request #1419 from keszybz/shell-completionLennart Poettering
Shell completion tweaks
2015-09-30core: make sure we expose the empty string when we detect no virtualizationLennart Poettering
On the bus, stick to exposing the empty string as "no virtualization", instead of none. Fixes #1423
2015-09-30tree-wide: remove a number of invocations of strerror() and replace by %mLennart Poettering
Let's clean up our tree a bit, and reduce invocations of the thread-unsafe strerror() by replacing it with printf()'s %m specifier.
2015-09-30basic: split out cpu set specific APIs into cpu-set-util.[ch]Lennart Poettering
2015-09-30util: rename parse_cpu_set() to parse_cpu_set_and_warn()Lennart Poettering
It's pretty untypical for our parsing functions to log on their own. Clarify in the name that this one does.
2015-09-30log: move log_invalid_utf8() to log.hLennart Poettering
Also, make sure it follows the same scheme as log_syntax() does in its behaviour.
2015-09-30tree-wide: clean up log_syntax() usageLennart Poettering
- Rely everywhere that we use abs() on the error code passed in anyway, thus don't need to explicitly negate what we pass in - Never attach synthetic error number information to log messages. Only log about errors we *receive* with the error number we got there, don't log any synthetic error, that don#t even propagate, but just eat up. - Be more careful with attaching exactly the error we get, instead of errno or unrelated errors randomly. - Fix one occasion where the error number and line number got swapped. - Make sure we never tape over OOM issues, or inability to resolve specifiers
2015-09-29core: add a "Requires=" dependency between units and the slices they are ↵Lennart Poettering
located in We place the processes we fork off in the cgroup anyway, and we probably shouldn't be able to get that far if we couldn't set up the slice due to resource problems or unmet conditions. Hence upgrade the dependency between units and the slices they are located in from Wants= to Requires=.
2015-09-29core: rework crash handlingLennart Poettering
This introduces a new systemd.crash_reboot=1 kernel command line option that triggers a reboot after crashing. This also cleans up crash VT handling. Specifically, it cleans up the configuration setting, to be between 1..63 or a boolean. This is to replace the previous logic where "-1" meant disabled. We continue to accept that setting, but only document the boolean syntax instead. This also brings the documentation of the default settings in sync with what actually happens. The CrashChVT= configuration file setting is renamed to CrashChangeVT=, following our usual logic of not abbreviating unnecessarily. The old setting stays support for compat reasons. Fixes #1300
2015-09-29socket: rename ffs_xyz to usbffs_xyzLennart Poettering
The relation to USB should really be clearer.
2015-09-29core: turn a large if statement into a switchLennart Poettering
2015-09-29selinux: add _cleanup_ concepts to SELinux label allocationLennart Poettering
2015-09-29core: simplify how we create socket fdsLennart Poettering
Let's always return the allocated fds as return values where possible, and make more use of _cleanup_close_
2015-09-29core: small error message wording improvementsLennart Poettering
2015-09-29core: properly use the ExitCode bus property when exiting is --user instanceLennart Poettering
2015-09-29core: allow setting WorkingDirectory= to the special value ~Lennart Poettering
If set to ~ the working directory is set to the home directory of the user configured in User=. This change also exposes the existing switch for the working directory that allowed making missing working directories non-fatal. This also changes "machinectl shell" to make use of this to ensure that the invoked shell is by default in the user's home directory. Fixes #1268.
2015-09-29util: introduce common version() implementation and use it everywhereLennart Poettering
This also allows us to drop build.h from a ton of files, hence do so. Since we touched the #includes of those files, let's order them properly according to CODING_STYLE.
2015-09-29util: unify implementation of NOP signal handlerLennart Poettering
This is highly complex code after all, we really should make sure to only keep one implementation of this extremely difficult function around.
2015-09-29core: remove set_default_unit()Lennart Poettering
The new free_and_strdup() call does pretty much the same thing these days, no need to keep a private limited purpose version around.
2015-09-29core: modernize prepare_reexecute()Lennart Poettering
2015-09-29core: exit early if we hit OOMLennart Poettering
2015-09-29core: use %m rather than strerror() where we canLennart Poettering
2015-09-29main: minor clean-upsLennart Poettering
Add (void) casting for a couple of functions where we knowingly ignore the returning error code. Use EXIT_FAILURE where appropriate. Try to initialize structures at declaration time, or at once.
2015-09-29tree-wide: take benefit of the fact that fdset_free() returns NULLLennart Poettering
2015-09-29core: order #includes in main.cLennart Poettering
2015-09-29strv: add strv_free_free() to strv.c and make use of itLennart Poettering
Let's teach it a new trick, and make it return NULL.
2015-09-29tree-wide: port more code to use send_one_fd() and receive_one_fd()Lennart Poettering
Also, make it slightly more powerful, by accepting a flags argument, and make it safe for handling if more than one cmsg attribute happens to be attached.
2015-09-29core: sort includes of manager.[ch] according to CODING_STYLELennart Poettering
2015-09-28Move all unit states to basic/ and extend systemctl --state=helpZbigniew Jędrzejewski-Szmek
2015-09-28Move UnitActiveState to basic/Zbigniew Jędrzejewski-Szmek
Preparation to allow systemctl to query the list of unit states.
2015-09-24load-fragment: Use parse_cpu_set in CPUAffinity supportFilipe Brandenburger
Tested with a dummy service running 'sleep', modifying its CPUAffinity, restarting the service and checking the ^Cpus_allowed entries in the /proc/PID/status file.
2015-09-24util: refactor cpu_set parsing into its own functionFilipe Brandenburger
Use the new code in config_parse_cpu_affinity2. Tested by modifying CPUAffinity=... setting in /etc/systemd/system.conf and reloading the daemon, then checking ^Cpus_allowed in /proc/1/status to confirm the correct CPU mask is in place.
2015-09-23Merge pull request #1349 from dvdhrm/sync-pamLennart Poettering
core: make setup_pam() synchronous
2015-09-23exec: move mac_smack_apply_pid() and setup_pam() to same condition blockSangjung Woo
This cleans up exec_child() function by moving mac_smack_apply_pid() and setup_pam() to the same condition block, since both of them have the same condition (i.e params->apply_permissions). It improves readability without changing its operation.
2015-09-23exec: call setup_pam() after SMACK labelingSangjung Woo
When 'SmackProcessLabel=' is used in user@.service file, all processes launched in systemd user session should be labeled as the designated name of 'SmackProcessLabel' directive. However, if systemd has its own smack label using '--with-smack-run-label' configuration, '(sd-pam)' is labeled as the specific name of '--with-smack-run-label'. If 'SmackProcessLabel=' is used in user@.service file without '--with-smack-run-label' configuration, (sd-pam) is labeled as "_" since systemd (i.e. pid=1) is labeled as "_". This is mainly because setup_pam() function is called before applying smack label to child process. This patch fixes it by calling setup_pam() after setting the smack label.
2015-09-23Merge pull request #1339 from alkino/masterDaniel Mack
Hook more properties for transient units
2015-09-23Hook more properties for transient unitsNicolas Cornu
systemd-run can now launch units with WorkingDirectory, RootDirectory set.
2015-09-23core: make setup_pam() synchronousDavid Herrmann
If we spawn a unit with a non-empty 'PAMName=', we fork off a child-process _inside_ the unit, known as '(sd-pam)', which watches the session. It waits for the main-process to exit and then finishes it via pam_close_session(3). However, the '(sd-pam)' setup is highly asynchronous. There is no guarantee that process gets spawned before we finish the unit setup. Therefore, there might be a root-owned process inside of the cgroup of the unit, thus causing cg_migrate() to error-out with EPERM. This patch makes setup_pam() synchronous and waits for the '(sd-pam)' setup to finish before continuing. This guarantees that setresuid(2) was at least tried before we continue with the child setup of the real unit. Note that if setresuid(2) fails, we already warn loudly about it. You really must make sure that you own the passed user if using 'PAMName='. It seems very plausible to rely on that assumption.
2015-09-22core: fix shutdown of --userDavid Herrmann
Shutting down a user session currently fails with: Sep 22 22:35:38 david-t2 systemd[640]: Reached target Shutdown. Sep 22 22:35:38 david-t2 systemd[640]: Starting Exit the Session... Sep 22 22:35:38 david-t2 systemd[640]: Received SIGRTMIN+24 from PID 659 (kill). Sep 22 22:35:38 david-t2 systemd[640]: Shutting down. Sep 22 22:35:38 david-t2 systemd[640]: Not executed by init (PID 1). Sep 22 22:35:38 david-t2 systemd[640]: Critical error while doing system shutdown: Operation not permitted This is a regression from: commit 287419c119ef961db487a281162ab037eba70c61 Author: Alban Crequy <alban.crequy@gmail.com> Date: Fri Sep 18 13:37:34 2015 +0200 containers: systemd exits with non-zero code Make sure we never ever execute systemd-shutdown from within a user-manager. Restore the previous behavior by partially reverting given commit.
2015-09-22Merge pull request #1335 from poettering/some-fixesDaniel Mack
A variety of mostly unrelated fixes
2015-09-22Merge pull request #1336 from pszewczyk/functionfs_sockets_v3Lennart Poettering
core: add support for usb functionfs v3
2015-09-22core: Add FFSDescriptors and FFSStrings service parametersPawel Szewczyk
By using these parameters functionfs service can specify ffs descriptors and strings which should be written to ep0.
2015-09-22core: Add socket type for usb functionfs endpointsPawel Szewczyk
For handling functionfs endpoints additional socket type is added.
2015-09-22cgtop: underline table headerLennart Poettering
Let's underline the header line of the table shown by cgtop, how it is customary for tables. In order to do this, let's introduce new ANSI underline macros, and clean up the existing ones as side effect.
2015-09-22util: add safe_closedir() similar to safe_fclose()Lennart Poettering
2015-09-22Merge pull request #986 from karelzak/monitorLennart Poettering
mount: use libmount to monitor mountinfo & utab
2015-09-22core: Add list of additional file descriptors to socket portPawel Szewczyk
Some additional files related to single socket may appear in the filesystem and they should be opened and passed to related service. This commit adds optional list of file descriptors, which are dynamically discovered and opened.