summaryrefslogtreecommitdiff
path: root/src/core/manager.h
Commit message (Collapse)AuthorAge
* core: emit changes for NFailedUnits propertyLucas De Marchi2015-02-26
| | | | | | | By notifying the clients when this property is changed it's possible to allow "system health monitor" tools to get transitions like running<->degraded. This is an alternative to send changes on the SystemState property since the latter is more difficult to derive.
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-23
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* core: when the user hits Ctrl-Alt-Del more than 7x per 2s, reboot immediatelyLennart Poettering2015-01-28
| | | | | This should be useful for cases where clean rebooting doesn't work, and the user wants to hurry up the reboot.
* Implement masking and overriding of generatorsZbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | | | | | | | | | | | | | | | | | Sometimes it is necessary to stop a generator from running. Either because of a bug, or for testing, or some other reason. The only way to do that would be to rename or chmod the generator binary, which is inconvenient and does not survive upgrades. Allow masking and overriding generators similarly to units and other configuration files. For the systemd instance, masking would be more common, rather than overriding generators. For the user instances, it may also be useful for users to have generators in $XDG_CONFIG_HOME to augment or override system-wide generators. Directories are searched according to the usual scheme (/usr/lib, /usr/local/lib, /run, /etc), and files with the same name in higher priority directories override files with the same name in lower priority directories. Empty files and links to /dev/null mask a given name. https://bugs.freedesktop.org/show_bug.cgi?id=87230
* mount: monitor for utab changes with inotifyChris Leech2014-11-28
| | | | | | | | | | | | | | Parsing the mount table with libmount races against the mount command, which will handle the actual mounting before updating utab. This means the poll event on /proc/self/mountinfo can kick of a reparse in systemd before the utab information is available. This change adds in an additional event source using inotify to watch for changes to utab. It only watches for IN_MOVED_TO events, matching libmount behavior of always overwriting this file using rename(2). This does add a second pass through the mount table parsing when utab is updated.
* manager: let manager_free() handle NULLsZbigniew Jędrzejewski-Szmek2014-11-23
| | | | This makes the calling code a bit simpler.
* manager: print warning on console before rebootZbigniew Jędrzejewski-Szmek2014-10-27
| | | | It will be printed even if a prompt is blocking other messages.
* manager: convert ephemeral to enumZbigniew Jędrzejewski-Szmek2014-10-27
| | | | In preparation for subsequent changes.
* manager: do not print anything while passwords are being queriedZbigniew Jędrzejewski-Szmek2014-10-27
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=73942
* core: remove system start timeout logic againLennart Poettering2014-10-28
| | | | | | | | | | | | The system start timeout as previously implemented would get confused by long-running services that are included in the initial system startup transaction for example by being cron-job-like long-running services triggered immediately at boot. Such long-running jobs would be subject to the default 15min timeout, esily triggering it. Hence, remove this again. In a subsequent commit, introduce per-target job timeouts instead, that allow us to control these timeouts more finegrained.
* core: split up "starting" manager state into "initializing" and "starting"Lennart Poettering2014-08-22
| | | | | | | | We'll stay in "initializing" until basic.target has reached, at which point we will enter "starting". This is preparation so that we can change the startip timeout to only apply to the first phase of startup, not the full procedure.
* core: add support for a configurable system-wide start-up timeoutLennart Poettering2014-08-22
| | | | | | | | | | | | | | | | | | | When this system-wide start-up timeout is hit we execute one of the failure actions already implemented for services that fail. This should not only be useful on embedded devices, but also on laptops which have the power-button reachable when the lid is closed. This devices, when in a backpack might get powered on by accident due to the easily reachable power button. We want to make sure that the system turns itself off if it starts up due this after a while. When the system manages to fully start-up logind will suspend the machine by default if the lid is closed. However, in some cases we don't even get as far as logind, and the boot hangs much earlier, for example because we ask for a LUKS password that nobody ever enters. Yeah, this is a real-life problem on my Yoga 13, which has one of those easily accessible power buttons, even if the device is closed.
* core: Verify systemd1 DBus method callers via polkitStef Walter2014-08-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | DBus methods that retrieve information can be called by anyone. DBus methods that modify state of units are verified via polkit action: org.freedesktop.systemd1.manage-units DBus methods that modify state of unit files are verified via polkit action: org.freedesktop.systemd1.manage-unit-files DBus methods that reload the entire daemon state are verified via polkit action: org.freedesktop.systemd1.reload-daemon DBus methods that modify job state are callable from the clients that started the job. root (ie: CAP_SYS_ADMIN) can continue to perform all calls, property access etc. There are several DBus methods that can only be called by root. Open up the dbus1 policy for the above methods. (Heavily modified by Lennart, making use of the new bus_verify_polkit_async() version that doesn't force us to always pass the original callback around. Also, interactive auhentication must be opt-in, not unconditional, hence I turned this off.)
* test-engine: fix access to unit load pathZbigniew Jędrzejewski-Szmek2014-07-20
| | | | | | | | Also add a bit of debugging output to help diagnose problems, add missing units, and simplify cppflags. Move test-engine to normal tests from manual tests, it should now work without destroying the system.
* firstboot: get rid of firstboot generator again, introduce ↵Lennart Poettering2014-07-07
| | | | | | | | ConditionFirstBoot= instead As Zbigniew pointed out a new ConditionFirstBoot= appears like the nicer way to hook in systemd-firstboot.service on first boots (those with /etc unpopulated), so let's do this, and get rid of the generator again.
* firstboot: add new component to query basic system settings on first boot, ↵Lennart Poettering2014-07-07
| | | | | | | | | | | | | | | | | | | | or when creating OS images offline A new tool "systemd-firstboot" can be used either interactively on boot, where it will query basic locale, timezone, hostname, root password information and set it. Or it can be used non-interactively from the command line when prepareing disk images for booting. When used non-inertactively the tool can either copy settings from the host, or take settings on the command line. $ systemd-firstboot --root=/path/to/my/new/root --copy-locale --copy-root-password --hostname=waldi The tool will be automatically invoked (interactively) now on first boot if /etc is found unpopulated. This also creates the infrastructure for generators to be notified via an environment variable whether they are running on the first boot, or not.
* cgroups: simplify CPUQuota= logicLennart Poettering2014-05-22
| | | | | | | | | Only accept cpu quota values in percentages, get rid of period definition. It's not clear whether the CFS period controllable per-cgroup even has a future in the kernel, hence let's simplify all this, hardcode the period to 100ms and only accept percentage based quota values.
* core: add startup resource control optionWaLyong Cho2014-05-22
| | | | | | | | | | | Similar to CPUShares= and BlockIOWeight= respectively. However only assign the specified weight during startup. Each control group attribute is re-assigned as weight by CPUShares=weight and BlockIOWeight=weight after startup. If not CPUShares= or BlockIOWeight= be specified, then the attribute is re-assigned to each default attribute value. (default cpu.shares=1024, blkio.weight=1000) If only CPUShares=weight or BlockIOWeight=weight be specified, then that implies StartupCPUShares=weight and StartupBlockIOWeight=weight.
* core: expose CFS CPU time quota as high-level unit propertiesLennart Poettering2014-04-25
|
* core: add a setting to globally control the default for timer unit accuracyLennart Poettering2014-03-24
|
* core: introduce system state enumLennart Poettering2014-03-12
| | | | | | | | | | | The system state knows the states starting → running/degraded/maintenance → stopping, where: starting = system startup running = normal operation degraded = at least one unit is currently in failed state maintenance = rescue/emergency mode is active or queued stopping = system shutdown
* missing: if RLIMIT_RTTIME is not defined by the libc, then we need a new ↵Lennart Poettering2014-03-05
| | | | define for the max number of rlimits, too
* core: move ShowStatus type into the coreLennart Poettering2014-03-03
| | | | | Let's make the scope of the show-status stuff a bit smaller, and make it private to the core, rather than shared API in shared/.
* core: introduce new RuntimeDirectory= and RuntimeDirectoryMode= unit settingsLennart Poettering2014-03-03
| | | | | As discussed on the ML these are useful to manage runtime directories below /run for services.
* bus: add sd_bus_track object for tracking peers, and port core over to itLennart Poettering2014-03-03
| | | | | | | | | | | | | | | | | | | This is primarily useful for services that need to track clients which reference certain objects they maintain, or which explicitly want to subscribe to certain events. Something like this is done in a large number of services, and not trivial to do. Hence, let's unify this at one place. This also ports over PID 1 to use this to ensure that subscriptions to job and manager events are correctly tracked. As a side-effect this makes sure we properly serialize and restore the track list across daemon reexec/reload, which didn't work correctly before. This also simplifies how we distribute messages to broadcast to the direct busses: we only track subscriptions for the API bus and implicitly assume that all direct busses are subscribed. This should be a pretty OK simplification since clients connected via direct bus connections are shortlived anyway.
* core: add global settings for enabling CPUAccounting=, MemoryAccounting=, ↵Lennart Poettering2014-02-24
| | | | BlockIOAccounting= for all units at once
* core: allow PIDs to be watched by two units at the same timeLennart Poettering2014-02-07
| | | | | | | | In some cases it is interesting to map a PID to two units at the same time. For example, when a user logs in via a getty, which is reexeced to /sbin/login that binary will be explicitly referenced as main pid of the getty service, as well as implicitly referenced as part of the session scope.
* manager: also turn on output on unit failureZbigniew Jędrzejewski-Szmek2014-01-27
|
* manager: add systemd.show_status=auto modeZbigniew Jędrzejewski-Szmek2014-01-27
| | | | | | | | | | | | | When set to auto, status will shown when the first ephemeral message is shown (a job has been running for five seconds). Then until the boot or shutdown ends, status messages will be shown. No indication about the switch is done: I think it should be clear for the user that first the cylon eye and the ephemeral messages appear, and afterwards messages are displayed. The initial arming of the event source was still wrong, but now should really be fixed.
* core: allocate a kdbus bus for each systemd instance, if we canLennart Poettering2013-11-30
|
* swap: always track the current real device node of all swap devices, even ↵Lennart Poettering2013-11-25
| | | | | | | | | | | | | when not active This way, we can avoid executing two /bin/swapon jobs to be dispatched for the same swap device if it is configured for two different paths. Previously we were just tracking the device nodes of active swap devices, which would not allow us to recognize the identity of two swap devices before they are active. https://bugs.freedesktop.org/show_bug.cgi?id=69835
* swap: split state machine state ACTIVATING into twoLennart Poettering2013-11-25
| | | | | We expect the event on /proc/swaps before we expect the SIGCHILD, reflect this in the state machine.
* core: dispatch run queue only if there's nothing else to doLennart Poettering2013-11-25
| | | | Always read all external events before we decide what we do next.
* core: convert PID 1 to libsystemd-busLennart Poettering2013-11-20
| | | | | | | | | | | | | | | | | | | | | | This patch converts PID 1 to libsystemd-bus and thus drops the dependency on libdbus. The only remaining code using libdbus is a test case that validates our bus marshalling against libdbus' marshalling, and this dependency can be turned off. This patch also adds a couple of things to libsystem-bus, that are necessary to make the port work: - Synthesizing of "Disconnected" messages when bus connections are severed. - Support for attaching multiple vtables for the same interface on the same path. This patch also fixes the SetDefaultTarget() and GetDefaultTarget() bus calls which used an inappropriate signature. As a side effect we will now generate PropertiesChanged messages which carry property contents, rather than just invalidation information.
* analyze: plot the time spent setting up security modulesThomas Hindoe Paaboel Andersen2013-11-10
|
* Remove dead code and unexport some callsLennart Poettering2013-11-08
| | | | | | "make check-api-unused" informs us about code that is not used anymore or that is exported but only used internally. Fix these all over the place.
* manager: configurable StartLimit default valuesLukas Nykryn2013-11-08
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=821723
* Configurable Timeouts/Restarts default valuesOleksii Shevchuk2013-11-05
| | | | | | | https://bugs.freedesktop.org/show_bug.cgi?id=71132 Patch adds DefaultTimeoutStartSec, DefaultTimeoutStopSec, DefaultRestartSec configuration options to manager configuration file.
* macro: clean up usage of gcc attributesLennart Poettering2013-10-16
| | | | Always use our own macros, and name all our own macros the same style.
* core: rework how we match mount units against each otherLennart Poettering2013-09-26
| | | | | | | | | | | | | | | | | | | | | | | Previously to automatically create dependencies between mount units we matched every mount unit agains all others resulting in O(n^2) complexity. On setups with large amounts of mount units this might make things slow. This change replaces the matching code to use a hashtable that is keyed by a path prefix, and points to a set of units that require that path to be around. When a new mount unit is installed it is hence sufficient to simply look up this set of units via its own file system paths to know which units to order after itself. This patch also changes all unit types to only create automatic mount dependencies via the RequiresMountsFor= logic, and this is exposed to the outside to make things more transparent. With this change we still have some O(n) complexities in place when handling mounts, but that's currently unavoidable due to kernel APIs, and still substantially better than O(n^2) as before. https://bugs.freedesktop.org/show_bug.cgi?id=69740
* rework systemd's own process environment handling/passingKay Sievers2013-07-26
| | | | | | | | | | | | | Stop importing non-sensical kernel-exported variables. All parameters in the kernel command line are exported to the initial environment of PID1, but suppressed if they are recognized by kernel built-in code. The EFI booted kernel will add further kernel-internal things which do not belong into userspace. The passed original environ data of the process is not touched and preserved across re-execution, to allow external reading of /proc/self/environ for process properties like container*=.
* systemd: do not output status messages once gettys are runningZbigniew Jędrzejewski-Szmek2013-07-15
| | | | | | | | | | | | | | | | Make Type=idle communication bidirectional: when bootup is finished, the manager, as before, signals idling Type=idle jobs to continue. However, if the boot takes too long, idling jobs signal the manager that they have had enough, wait a tiny bit more, and continue, taking ownership of the console. The manager, when signalled that Type=idle jobs are done, makes a note and will not write to the console anymore. This is a cosmetic issue, but quite noticable, so let's just fix it. Based on Harald Hoyer's patch. https://bugs.freedesktop.org/show_bug.cgi?id=54247 http://unix.stackexchange.com/questions/51805/systemd-messages-after-starting-login/
* core: send out "Reloading" signal before and after doing a full ↵Lennart Poettering2013-07-10
| | | | | | | | | | | | | | reload/reexec of PID 1 Since we'll unload all units/job during a reload, and then readd them it is really useful for clients to be aware of this phase hence sent a signal out before and after. This signal is called "Reloading" (despite the fact that it is also sent out during reexecution, which we consider a special case in this context) and has one boolean parameter which is true for the signal sent before the reload, and false for the signal after the reload. The UnitRemoved/JobRremoved and UnitNew/JobNew due to the reloading are guranteed to be between the pair of Reloading messages.
* core: serialize/deserialize bus subscribersLennart Poettering2013-07-10
|
* core: make GC more aggressiveLennart Poettering2013-07-02
| | | | | | | | | | | Since we should allow registering/unregistering transient units with the same name in a tight-loop, we need to make the GC more aggressive, so that dead units are cleaned up immediately instead of later. hence, execute the GC sweep on every event loop iteration and clean up units. This of course, means we need to be careful with adding units to the GC queue, which we already are since we execute check_gc() of each unit type already when adding something to the queue.
* core: general cgroup reworkLennart Poettering2013-06-27
| | | | | | | | | | | | | | | | Replace the very generic cgroup hookup with a much simpler one. With this change only the high-level cgroup settings remain, the ability to set arbitrary cgroup attributes is removed, so is support for adding units to arbitrary cgroup controllers or setting arbitrary paths for them (especially paths that are different for the various controllers). This also introduces a new -.slice root slice, that is the parent of system.slice and friends. This enables easy admin configuration of root-level cgrouo properties. This replaces DeviceDeny= by DevicePolicy=, and implicitly adds in /dev/null, /dev/zero and friends if DeviceAllow= is used (unless this is turned off by DevicePolicy=).
* manager: add DefaultEnvironment optionUmut Tezduyar2013-06-20
| | | | | | | This complements existing functionality of setting variables through 'systemctl set-environment', the kernel command line, and through normal environment variables for systemd in session mode.
* logind: add infrastructure to keep track of machines, and move to slicesLennart Poettering2013-06-20
| | | | | | | | | | | | | | | | | | | | - This changes all logind cgroup objects to use slice objects rather than fixed croup locations. - logind can now collect minimal information about running VMs/containers. As fixed cgroup locations can no longer be used we need an entity that keeps track of machine cgroups in whatever slice they might be located. Since logind already keeps track of users, sessions and seats this is a trivial addition. - nspawn will now register with logind and pass various bits of metadata along. A new option "--slice=" has been added to place the container in a specific slice. - loginctl gained commands to list, introspect and terminate machines. - user.slice and machine.slice will now be pulled in by logind.service, since only logind.service requires this slice.
* analyze: show unit file loading on plotThomas Hindoe Paaboel Andersen2013-06-02
| | | | | | This will add another color to the legend called "Loading unit files" Like the generators it will mark a part of the systemd bar indicating the time spent while loading unit files.
* analyze: show generators on plotUmut Tezduyar2013-06-02
|