summaryrefslogtreecommitdiff
path: root/src/core/manager.c
AgeCommit message (Collapse)Author
2014-05-22cgroups: simplify CPUQuota= logicLennart Poettering
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.
2014-05-22cgroup: rework startup logicLennart Poettering
Introduce a (unsigned long) -1 as "unset" state for cpu shares/block io weights, and keep the startup unit set around all the time.
2014-05-22core: add startup resource control optionWaLyong Cho
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.
2014-05-16core: make sure to serialize jobs for all unitsLennart Poettering
Previously we wouldn't serialize jobs for units that themselves have nothing to serialize. http://lists.freedesktop.org/archives/systemd-devel/2014-May/019051.html
2014-05-15Make systemctl --root look for files in the proper placesZbigniew Jędrzejewski-Szmek
Running systemctl enable/disable/set-default/... with the --root option under strace reveals that it accessed various files and directories in the main fs, and not underneath the specified root. This can lead to correct results only when the layout and configuration in the container are identical, which often is not the case. Fix this by adding the specified root to all file access operations. This patch does not handle some corner cases: symlinks which point outside of the specified root might be interpreted differently than they would be by the kernel if the specified root was the real root. But systemctl does not create such symlinks by itself, and I think this is enough of a corner case not to be worth the additional complexity of reimplementing link chasing in systemd. Also, simplify the code in a few places and remove an hypothetical memory leak on error.
2014-04-25core: expose CFS CPU time quota as high-level unit propertiesLennart Poettering
2014-03-26core: do not read system boot timestamps in systemd --user modeKay Sievers
Before: $ systemd-analyze --user Startup finished in 2.810s (firmware) + 48ms (loader) + 122ms (userspace) = 122ms After: $ systemd-analyze --user Startup finished in 122ms (userspace) = 122ms
2014-03-24core: add a setting to globally control the default for timer unit accuracyLennart Poettering
2014-03-24util: replace close_pipe() with new safe_close_pair()Lennart Poettering
safe_close_pair() is more like safe_close(), except that it handles pairs of fds, and doesn't make and misleading allusion, as it works similarly well for socketpairs() as for pipe()s...
2014-03-24sd-event: rework API to support CLOCK_REALTIME_ALARM and ↵Lennart Poettering
CLOCK_BOOTTIME_ALARM, too
2014-03-19core: move notify sockets to /run and $XDG_RUNTIME_DIRLennart Poettering
A service with PrivateNetwork= cannot access abstract namespace sockets of the host anymore, hence let's better not use abstract namespace sockets for this, since we want to make sure that PrivateNetwork= is useful and doesn't break sd_notify().
2014-03-18util: replace close_nointr_nofail() by a more useful safe_close()Lennart Poettering
safe_close() automatically becomes a NOP when a negative fd is passed, and returns -1 unconditionally. This makes it easy to write lines like this: fd = safe_close(fd); Which will close an fd if it is open, and reset the fd variable correctly. By making use of this new scheme we can drop a > 200 lines of code that was required to test for non-negative fds or to reset the closed fd variable afterwards.
2014-03-12manager: use system state enum where appropriateLennart Poettering
2014-03-12core: introduce system state enumLennart Poettering
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
2014-03-07manager: flush memory stream before using the bufferDaniel Mack
When the manager receives a SIGUSR2 signal, it opens a memory stream with open_memstream(), uses the returned file handle for logging, and dumps the logged content with log_dump(). However, the char* buffer is only safe to use after the file handle has been flushed with fflush, as the man pages states: When the stream is closed (fclose(3)) or flushed (fflush(3)), the locations pointed to by ptr and sizeloc are updated to contain, respectively, a pointer to the buffer and the current size of the buffer. These values remain valid only as long as the caller performs no further output on the stream. If further output is performed, then the stream must again be flushed before trying to access these variables. Without that call, dump remains NULL and the daemon crashes in log_dump().
2014-03-06util: add timeout to generator executionLennart Poettering
2014-03-05missing: if RLIMIT_RTTIME is not defined by the libc, then we need a new ↵Lennart Poettering
define for the max number of rlimits, too
2014-03-03core: introduce new RuntimeDirectory= and RuntimeDirectoryMode= unit settingsLennart Poettering
As discussed on the ML these are useful to manage runtime directories below /run for services.
2014-03-03bus: add sd_bus_track object for tracking peers, and port core over to itLennart Poettering
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.
2014-02-20api: in constructor function calls, always put the returned object pointer ↵Lennart Poettering
first (or second) Previously the returned object of constructor functions where sometimes returned as last, sometimes as first and sometimes as second parameter. Let's clean this up a bit. Here are the new rules: 1. The object the new object is derived from is put first, if there is any 2. The object we are creating will be returned in the next arguments 3. This is followed by any additional arguments Rationale: For functions that operate on an object we always put that object first. Constructors should probably not be too different in this regard. Also, if the additional parameters might want to use varargs which suggests to put them last. Note that this new scheme only applies to constructor functions, not to all other functions. We do give a lot of freedom for those. Note that this commit only changes the order of the new functions we added, for old ones we accept the wrong order and leave it like that.
2014-02-11journald: log provenience of signalsZbigniew Jędrzejewski-Szmek
2014-02-08manager: fix initialization of plymouth socketZbigniew Jędrzejewski-Szmek
I'm not sure why this makes a difference...
2014-02-08core: use automatic cleanup in two functionsZbigniew Jędrzejewski-Szmek
2014-02-07core: allow PIDs to be watched by two units at the same timeLennart Poettering
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.
2014-02-07core: watch SIGCHLD more closely to track processes of units with no ↵Lennart Poettering
reliable cgroup empty notifier When a process dies that we can associate with a specific unit, start watching all other processes of that unit, so that we can associate those processes with the unit too. Also, for service units start doing this as soon as we get the first SIGCHLD for either control or main process, so that we can follow the processes of the service from one to the other, as long as process that remain are processes of the ones we watched that died and got reassigned to us as parent. Similar, for scope units start doing this as soon as the scope controller abandons the unit, and thus management entirely reverts to systemd. To abandon a unit introduce a new Abandon() scope unit method call.
2014-02-06transaction: print more information about conflicting jobsZbigniew Jędrzejewski-Szmek
Also remove some debug statement that should not have been committed.
2014-02-01bus: update kdbus.h (ABI break)Kay Sievers
2014-01-28manager: remove "debugging" "feature"Zbigniew Jędrzejewski-Szmek
2014-01-28manager: requeue the cylon eye for 5s later when a job finishesZbigniew Jędrzejewski-Szmek
We'd reqeue the next status update very soon after. Change it so that we wait for full 5s without any job status changes until we print anything.
2014-01-28manager: print ephemeral information about running jobs' timeouts (v2)Zbigniew Jędrzejewski-Szmek
This reverts commit 28c758de94bc8ba97b89d9dab3f517cf466978d0 but makes job_coldplug smarter. In (v1) I changed the job start timestamp to be always set, so the start time can be reported in the cylon eye message. The bug was that when deserializing jobs, they would be ignored if their start timestamp was unset which was synonymous with no timeout. But after the change, jobs would have a start timestamp set despite having no timeout. After deserialization they would be considered immediately expired. Fix this by checking if the timeout is not zero when considering jobs for expiration.
2014-01-28Revert "manager: print ephemeral information about running jobs' timeouts"Kay Sievers
This reverts commit 2cba2e03524ec0922ddc70f933e8a89b7d23b4ec. It breaks bootup with dracut, the transition to the real rootfs fails.
2014-01-27manager: also turn on output on unit failureZbigniew Jędrzejewski-Szmek
2014-01-27manager: add systemd.show_status=auto modeZbigniew Jędrzejewski-Szmek
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.
2014-01-27Replace mkostemp+unlink with open(O_TMPFILE)Zbigniew Jędrzejewski-Szmek
This will only work on Linux >= 3.11, and probably not on all filesystems. Fallback code is provided.
2014-01-27manager: rearm jobs timerZbigniew Jędrzejewski-Szmek
It would fire just once. Also fix units from sec to usec as appropriate. Decrease the switching interval to 1/3 s, so that when the time remaining is displayed with 1s precision, it doesn't jump by 2s every once in a while. Also, the system is feels noticably faster when the status changes couple of times per second instead of every few seconds.
2014-01-27manager: print ephemeral information about running jobs' timeoutsZbigniew Jędrzejewski-Szmek
Produces output like: [ *** ] (1 of 2) A start job is running for slow.service (33s / 1min 30s) The first nubmer is the time since job start, the second is the job timeout.
2014-01-12core: don't allow setting NOTIFY_SOCKET and similar env vars we need ↵Lennart Poettering
ourselves via SetEnvironment bus calls We just quietly eat them up, so that simple environment importing still works without error.
2014-01-12core: clean up environment block for --user instances a bitLennart Poettering
2014-01-11core: fix unused variableZbigniew Jędrzejewski-Szmek
2014-01-09core: fix lack of notifications after reloadZbigniew Jędrzejewski-Szmek
2014-01-07core: --user -- move generator directories from /tmp to $XDG_RUNTIME_DIRKay Sievers
2014-01-03bus: always create --user bus when kdbus is activeKay Sievers
We set the variable in the unit file for --user, so this check is always true.
2014-01-02Use format patterns for usec_t, pid_t, nsec_t, usec_tZbigniew Jędrzejewski-Szmek
It is nicer to predefine patterns using configure time check instead of using casts everywhere. Since we do not need to use any flags, include "%" in the format instead of excluding it like PRI* macros.
2014-01-02core/manager: print info about interesting signalsZbigniew Jędrzejewski-Szmek
Information about signals which are not routinely received by systemd are printed at info level. This should make it easier to see what is happening in the system.
2013-12-26Use enums to make it obvious what boolean params meanZbigniew Jędrzejewski-Szmek
Suggested-by: Russ Allbery <rra@debian.org>
2013-12-26bus: make system bus kdbus node world-accessibleLennart Poettering
2013-12-23core: when we close the notify fd, we also need to free its event sourceLennart Poettering
2013-12-22shared: switch our hash table implementation over to SipHashLennart Poettering
SipHash appears to be the new gold standard for hashing smaller strings for hashtables these days, so let's make use of it.
2013-12-21core: pass notify fd across reexecsLennart Poettering
That way we the random socket name stays stable across reexec and we won't lose client messages.
2013-12-18core: priorize notification fd processing over notification fd process via ↵Lennart Poettering
sd-event's logic