50f48ad37aad99c54de4db34b07c3825cdedcf41 |
|
10-Feb-2016 |
Daniel Mack <daniel@zonque.org> |
cgroup: remove support for NetClass= directive
Support for net_cls.class_id through the NetClass= configuration directive
has been added in v227 in preparation for a per-unit packet filter mechanism.
However, it turns out the kernel people have decided to deprecate the net_cls
and net_prio controllers in v2. Tejun provides a comprehensive justification
for this in his commit, which has landed during the merge window for kernel
v4.5:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=bd1060a1d671
As we're aiming for full support for the v2 cgroup hierarchy, we can no
longer support this feature. Userspace tool such as nftables are moving over
to setting rules that are specific to the full cgroup path of a task, which
obsoletes these controllers anyway.
This commit removes support for tweaking details in the net_cls controller,
but keeps the NetClass= directive around for legacy compatibility reasons. |
b26fa1a2fbcfee7d03b0c8fd15ec3aa64ae70b9f |
|
10-Feb-2016 |
Daniel Mack <daniel@zonque.org> |
tree-wide: remove Emacs lines from all files
This should be handled fine now by .dir-locals.el, so need to carry that
stuff in every file. |
077ba06eaa43f3465613ceb89f9423ee1a6538f9 |
|
17-Nov-2015 |
Lennart Poettering <lennart@poettering.net> |
core: don't generate warnings when write access to the cgroup fs fails in --user due to EACCES
After all, in the classic hierarchy that's pretty much the default case. |
7760171904ef007f19e8f46aa240a00e382d5b74 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move inotify-related definitions to fs-util.[ch] |
6bc73acb01e2782f0ef3ec70dde3dc3f5b5da081 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
process-util: rename get_parent_of_pid() → get_process_ppid()
In order to match the other get_process_xyz() calls. |
b5efdb8af40ea759a1ea584c1bc44ecc81dd00ce |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out allocation calls into alloc-util.[ch] |
8b43440b7ef4b81c69c31de7ff820dc07a780254 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move string table stuff into its own string-table.[ch] |
0d39fa9c69b97a2ceb156053deef69c0866c2b97 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move more file I/O related calls into fileio.[ch] |
6bedfcbb2970e06a4d3280c8fb62083d252ede73 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split string parsing related calls from util.[ch] into parse-util.[ch] |
3ffd4af22052963e7a29431721ee204e634bea75 |
|
25-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out fd-related operations into fd-util.[ch]
There are more than enough to deserve their own .c file, hence move them
over. |
07630cea1f3a845c09309f197ac7c4f11edd3b62 |
|
24-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split our string related calls from util.[ch] into its own file string-util.[ch]
There are more than enough calls doing string manipulations to deserve
its own files, hence do something about it.
This patch also sorts the #include blocks of all files that needed to be
updated, according to the sorting suggestions from CODING_STYLE. Since
pretty much every file needs our string manipulation functions this
effectively means that most files have sorted #include blocks now.
Also touches a few unrelated include files. |
32ee7d3309816994a02b3ff000e9734120d71214 |
|
16-Sep-2015 |
Daniel Mack <daniel@zonque.org> |
cgroup: add support for net_cls controllers
Add a new config directive called NetClass= to CGroup enabled units.
Allowed values are positive numbers for fix assignments and "auto" for
picking a free value automatically, for which we need to keep track of
dynamically assigned net class IDs of units. Introduce a hash table for
this, and also record the last ID that was given out, so the allocator
can start its search for the next 'hole' from there. This could
eventually be optimized with something like an irb.
The class IDs up to 65536 are considered reserved and won't be
assigned automatically by systemd. This barrier can be made a config
directive in the future.
Values set in unit files are stored in the CGroupContext of the
unit and considered read-only. The actually assigned number (which
may have been chosen dynamically) is stored in the unit itself and
is guaranteed to remain stable as long as the unit is active.
In the CGroup controller, set the configured CGroup net class to
net_cls.classid. Multiple unit may share the same net class ID,
and those which do are linked together. |
e7ab4d1ac9f8d99eecd5e2d22eb482a1fb0fbf23 |
|
11-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
cgroup: unify how we invalidate cgroup controller settings
Let's make sure that we follow the same codepaths when adjusting a
cgroup property via the dbus SetProperty() call, and when we execute the
StartupCPUShares= effect. |
d53d94743c5e5e3a4a668b0c707826a90a08949a |
|
11-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
core: refactor cpu shares/blockio weight cgroup logic
Let's stop using the "unsigned long" type for weights/shares, and let's
just use uint64_t for this, as that's what we expose on the bus.
Unify parsers, and always validate the range for these fields.
Correct the default blockio weight to 500, since that's what the kernel
actually uses.
When parsing the weight/shares settings from unit files accept the empty
string as a way to reset the weight/shares value. When getting it via
the bus, uniformly map (uint64_t) -1 to unset.
Open up StartupCPUShares= and StartupBlockIOWeight= to transient units. |
03a7b521e3ffb7f5d153d90480ba5d4bc29d1e8f |
|
10-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
core: add support for the "pids" cgroup controller
This adds support for the new "pids" cgroup controller of 4.3 kernels.
It allows accounting the number of tasks in a cgroup and enforcing
limits on it.
This adds two new setting TasksAccounting= and TasksMax= to each unit,
as well as a gloabl option DefaultTasksAccounting=.
This also updated "cgtop" to optionally make use of the new
kernel-provided accounting.
systemctl has been updated to show the number of tasks for each service
if it is available.
This patch also adds correct support for undoing memory limits for units
using a MemoryLimit=infinity syntax. We do the same for TasksMax= now
and hence keep things in sync here. |
3905f12713df17195118d9caa321299d963ee315 |
|
08-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
cgroups: make sure the "devices" controller's enum is named the same way as the controller in the kernel
Follow-up to 5bf8002a3a6723ce50331c024122078552fb600a. |
19af675e99d32172b58f1c91c8281ba2efd5d863 |
|
04-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
cgroups: delegation to unprivileged services is safe in the unified hierarchy
Delegation to unpriviliged processes is safe in the unified hierarchy,
hence allow it. This has the benefit of permitting "systemd --user"
instances to further partition their resources between user services. |
b3ac818be8d73c97dc4f74ba8bbd2091506df2e6 |
|
04-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
core: split up manager_get_unit_by_pid()
Let's move the actual cgroup part of it into a new separate function
manager_get_unit_by_pid_cgroup(), and then make
manager_get_unit_by_pid() just a wrapper that also checks the two pid
hashmaps.
Then, let's make sure the various calls that want to deliver events to
the owners of a PID check both hashmaps and the cgroup and deliver the
event to *each* of them. OTOH make sure bus calls like GetUnitByPID()
continue to check the PID hashmaps first and the cgroup only as
fallback. |
fea72cc0336f4d90875cdddc1aa9739dcbb174f5 |
|
04-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
macro: introduce new PID_TO_PTR macros and make use of them
This adds a new PID_TO_PTR() macro, plus PTR_TO_PID() and makes use of
it wherever we maintain processes in a hash table. Previously we
sometimes used LONG_TO_PTR() and other times ULONG_TO_PTR() for that,
hence let's make this more explicit and clean up things. |
b3c5bad3d6b71c11fe107699ee7b5d1aee112ad1 |
|
02-Sep-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
tree-wide: fix indentation |
efdb02375beb0a940c3320865572913780b4d7de |
|
01-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
core: unified cgroup hierarchy support
This patch set adds full support the new unified cgroup hierarchy logic
of modern kernels.
A new kernel command line option "systemd.unified_cgroup_hierarchy=1" is
added. If specified the unified hierarchy is mounted to /sys/fs/cgroup
instead of a tmpfs. No further hierarchies are mounted. The kernel
command line option defaults to off. We can turn it on by default as
soon as the kernel's APIs regarding this are stabilized (but even then
downstream distros might want to turn this off, as this will break any
tools that access cgroupfs directly).
It is possibly to choose for each boot individually whether the unified
or the legacy hierarchy is used. nspawn will by default provide the
legacy hierarchy to containers if the host is using it, and the unified
otherwise. However it is possible to run containers with the unified
hierarchy on a legacy host and vice versa, by setting the
$UNIFIED_CGROUP_HIERARCHY environment variable for nspawn to 1 or 0,
respectively.
The unified hierarchy provides reliable cgroup empty notifications for
the first time, via inotify. To make use of this we maintain one
manager-wide inotify fd, and each cgroup to it.
This patch also removes cg_delete() which is unused now.
On kernel 4.2 only the "memory" controller is compatible with the
unified hierarchy, hence that's the only controller systemd exposes when
booted in unified heirarchy mode.
This introduces a new enum for enumerating supported controllers, plus a
related enum for the mask bits mapping to it. The core is changed to
make use of this everywhere.
This moves PID 1 into a new "init.scope" implicit scope unit in the root
slice. This is necessary since on the unified hierarchy cgroups may
either contain subgroups or processes but not both. PID 1 hence has to
move out of the root cgroup (strictly speaking the root cgroup is the
only one where processes and subgroups are still allowed, but in order
to support containers nicey, we move PID 1 into the new scope in all
cases.) This new unit is also used on legacy hierarchy setups. It's
actually pretty useful on all systems, as it can then be used to filter
journal messages coming from PID 1, and so on.
The root slice ("-.slice") is now implicitly created and started (and
does not require a unit file on disk anymore), since
that's where "init.scope" is located and the slice needs to be started
before the scope can.
To check whether we are in unified or legacy hierarchy mode we use
statfs() on /sys/fs/cgroup. If the .f_type field reports tmpfs we are in
legacy mode, if it reports cgroupfs we are in unified mode.
This patch set carefuly makes sure that cgls and cgtop continue to work
as desired.
When invoking nspawn as a service it will implicitly create two
subcgroups in the cgroup it is using, one to move the nspawn process
into, the other to move the actual container processes into. This is
done because of the requirement that cgroups may either contain
processes or other subgroups. |
5fe8876b320e9f6355425df9991ac38363684117 |
|
01-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
core: when looking for the unit for a process, look at the PID hashmaps first
It's cheaper that going to cgroupfs, and also usually the better choice
since it's not racy and can map PIDs even if they were moved to a
different unit. |
6f883237f1b8a96ec0ea354866e033b6fcea9506 |
|
01-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
cgroup: drop "ignore_self" argument from cg_is_empty()
In all cases where the function (or cg_is_empty_recursive()) ignoring
the calling process is actually wrong, as a process keeps a cgroup busy
regardless if its the current one or another. Hence, let's simplify
things and drop the "ignore_self" parameter. |
e9db43d5910717a1084924c512bf85e2b8265375 |
|
01-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
units: enable waiting for unit termination in certain cases
The legacy cgroup hierarchy does not support reliable empty
notifications in containers and if there are left-over subgroups in a
cgroup. This makes it hard to correctly wait for them running empty, and
thus we previously disabled this logic entirely.
With this change we explicitly check for the container case, and whether
the unit is a "delegation" unit (i.e. one where programs may create
their own subgroups). If we are neither in a container, nor operating on
a delegation unit cgroup empty notifications become reliable and thus we
start waiting for the empty notifications again.
This doesn't really fix the general problem around cgroup notifications
but reduces the effect around it.
(This also reorders #include lines by their focus, as suggsted in
CODING_STYLE. We have to add "virt.h", so let's do that at the right
place.)
Also see #317. |
35b7ff80e29524cb01f881ca6d52c669970c88f1 |
|
31-Aug-2015 |
Lennart Poettering <lennart@poettering.net> |
unit: add new macros to test for unit contexts |
b2c23da8cea1987a1a329f5a964d3299b7ca7890 |
|
11-May-2015 |
Lennart Poettering <lennart@poettering.net> |
core: rename SystemdRunningAs to ManagerRunningAs
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. |
0b452006de98294d1690f045f6ea2f7f6630ec3b |
|
10-Apr-2015 |
Ronny Chevalier <chevalier.ronny@gmail.com> |
shared: add process-util.[ch] |
5ad096b3f1331b175340129a8c9a5a9d711e5415 |
|
02-Mar-2015 |
Lennart Poettering <lennart@poettering.net> |
core: expose consumed CPU time per unit
This adds support for showing the accumulated consumed CPU time per-unit
in the "systemctl status" output. The property is also readable via the
bus. |
a3bd89ea99214db7ca2ad6ae59181d5119a54f09 |
|
01-Feb-2015 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
core/cgroup: fix embarrassing typo
https://github.com/docker/docker/issues/10280 |
cc98b3025eeb89addb76a27390cb2baca4eab8b9 |
|
26-Jan-2015 |
Torstein Husebø <torstein@huseboe.net> |
treewide: fix multiple typos |
71c26873600f7816ea418ded6cd6516dd5e4623a |
|
19-Jan-2015 |
Daniel Mack <daniel@zonque.org> |
cgroup: fix typo |
75399049653f2d5e22032da70cf96f20d7b4d9a6 |
|
06-Jan-2015 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
cgroup: memory limits on / are not supported |
6da139137eb4b0ee68ca4aa4ddfdab02e8a5cf98 |
|
06-Jan-2015 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
cgroup: fix error message
systemd[1]: Failed to set memory.limit_in_bytes on : Invalid argument |
714e2e1d56b97dcf2ebae2d0447b48f21e38a600 |
|
05-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
cgroup: downgrade log messages when we cannot write to cgroup trees that are mounted read-only |
7b3fd6313c4b07b6f822a9f979d0c22350a401d9 |
|
10-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
scope: make attachment of initial PIDs a bit more robust |
0cd385d31814c8c1bc0c81d11ef321036b8b0921 |
|
10-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
core: don't migrate PIDs for units that may contain subcgroups, do this only for leaf units
Otherwise a slice or delegation unit might move PIDs around ignoring the
fact that it is attached to a subcgroup. |
b1491eba40715438b0ac874f2be79d5622b971e1 |
|
09-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
core: rename unit_destroy_cgroup() to unit_destroy_cgroup_if_empty() since it's not quite as destructive as it sounds nowadays |
dab5bf859900c0abdbf78c584e4aed42a19768cd |
|
09-Dec-2014 |
Ross Lagerwall <rosslagerwall@gmail.com> |
cgroup: Handle error when destroying cgroup
If a cgroup fails to be destroyed (most likely because there are still
processes running as part of a service after the main pid exits), don't
free and remove the cgroup unit from the manager. This fixes a
regression introduced by the cgroup rework in v205 where systemd would
forget about processes still running after the unit becomes inactive.
(This can happen when the main pid exits and KillMode=process or none). |
4a62c710b62a5a3c7a8a278b810b9d5b5a0c8f4f |
|
28-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: another round of simplifications
Using the same scripts as in f647962d64e "treewide: yet more log_*_errno
+ return simplifications". |
56f64d95763a799ba4475daf44d8e9f72a1bd474 |
|
28-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: use log_*_errno whenever %m is in the format string
If the format string contains %m, clearly errno must have a meaningful
value, so we might as well use log_*_errno to have ERRNO= logged.
Using:
find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/'
Plus some whitespace, linewrap, and indent adjustments. |
23bbb0de4e3f85d9704a5c12a5afa2dfa0159e41 |
|
28-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: more log_*_errno + return simplifications |
da927ba997d68401563b927f92e6e40e021a8e5c |
|
28-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: no need to negate errno for log_*_errno()
It corrrectly handles both positive and negative errno values. |
0a1beeb64207eaa88ab9236787b1cbc2f704ae14 |
|
28-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: auto-convert the simple cases to log_*_errno()
As a followup to 086891e5c1 "log: add an "error" parameter to all
low-level logging calls and intrdouce log_error_errno() as log calls
that take error numbers", use sed to convert the simple cases to use
the new macros:
find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/'
Multi-line log_*() invocations are not covered.
And we also should add log_unit_*_errno(). |
a931ad47a8623163a29d898224d8a8c1177ffdaf |
|
05-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
core: introduce new Delegate=yes/no property controlling creation of cgroup subhierarchies
For priviliged units this resource control property ensures that the
processes have all controllers systemd manages enabled.
For unpriviliged services (those with User= set) this ensures that
access rights to the service cgroup is granted to the user in question,
to create further subgroups. Note that this only applies to the
name=systemd hierarchy though, as access to other controllers is not
safe for unpriviliged processes.
Delegate=yes should be set for container scopes where a systemd instance
inside the container shall manage the hierarchies below its own cgroup
and have access to all controllers.
Delegate=yes should also be set for user@.service, so that systemd
--user can run, controlling its own cgroup tree.
This commit changes machined, systemd-nspawn@.service and user@.service
to set this boolean, in order to ensure that container management will
just work, and the user systemd instance can run fine. |
b1d6dcf5a5c5aa02843c026dede0638f77798cb4 |
|
29-Sep-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Do not format USEC_INFINITY as NULL
systemctl would print 'CPUQuotaPerSecUSec=(null)' for no limit. This
does not look right.
Since USEC_INFINITY is one of the valid values, format_timespan()
could return NULL, and we should wrap every use of it in strna() or
similar. But most callers didn't do that, and it seems more robust to
return a string ("infinity") that makes sense most of the time, even
if in some places the result will not be grammatically correct. |
d81afec1c9bf4b73e3df8996d65ecae95d19b6db |
|
22-Aug-2014 |
Lennart Poettering <lennart@poettering.net> |
core: split up "starting" manager state into "initializing" and "starting"
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. |
1aeab12b19df295dbce1d422d9ee176a332aa800 |
|
15-Aug-2014 |
Lennart Poettering <lennart@poettering.net> |
cgroup: only generate warnings if actually writing to cgroup attributes failed |
6b2f67b31c7d7d4cf39d037fd295a4565efc7186 |
|
15-Aug-2014 |
Lennart Poettering <lennart@poettering.net> |
cgroup: downgrade log messages about non-existant cgroup attributes to LOG_DEBUG |
3a43da2832dc5360a638d043f469a6dcbe025582 |
|
29-Jul-2014 |
Kay Sievers <kay@vrfy.org> |
time-util: add and use USEC/NSEC_INFINIY |
0d8c31ff7237149b505290652864b4e7e866b2a7 |
|
21-Jul-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
test-engine: fix access to unit load path
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. |
9a0549093332880df47c4218209ce126b8586835 |
|
22-May-2014 |
Lennart Poettering <lennart@poettering.net> |
cgroups: simplify CPUQuota= logic
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. |
637f421e5c6ae76f5c59c3badd809bf5f04fca80 |
|
22-May-2014 |
Lennart Poettering <lennart@poettering.net> |
cgroups: always propagate controller membership to siblings, for all controllers
This is the behaviour the kernel cgroup rework exposes for all
controllers, hence let's do this already now for all cases. |
db785129c9bce9294a118484cbc9bb6935ca34c2 |
|
22-May-2014 |
Lennart Poettering <lennart@poettering.net> |
cgroup: rework startup logic
Introduce a (unsigned long) -1 as "unset" state for cpu shares/block io
weights, and keep the startup unit set around all the time. |
95ae05c0e79868c22b3e8e6fbc53432786876730 |
|
22-May-2014 |
WaLyong Cho <walyong.cho@samsung.com> |
core: add startup resource control option
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. |
cd7affaeea16d3904354b810a292e594dfef25dd |
|
08-May-2014 |
Łukasz Stelmach <l.stelmach@samsung.com> |
core: check the right variable for failed open() |
99a17ada9caa8e190b5cafa5cd3c19618feeff48 |
|
05-May-2014 |
Kay Sievers <kay@vrfy.org> |
core: require cgroups filesystem to be available
We should no longer pretend that we can run in any sensible way
without the kernel supporting us with cgroups functionality. |
b2f8b02ec27dfec9cbd23573f47aba494f2e9b5f |
|
25-Apr-2014 |
Lennart Poettering <lennart@poettering.net> |
core: expose CFS CPU time quota as high-level unit properties |
7d711efb9c6fd6d025cb688aa8317ce6a78db711 |
|
19-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
core: make sure we can combine DevicePolicy=closed with PrivateDevices=yes
if PrivateDevices=yes is used we need to make sure we can still
create /dev/null and so on. |
03e334a1c7dc8c20c38902aa039440763acc9b17 |
|
18-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
util: replace close_nointr_nofail() by a more useful safe_close()
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. |
e41969e3d1a8bda8b0b2f7eb012cef1c8835509a |
|
11-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
core: support globbing matches in DeviceAllow= when checking for device groups |
01efdf13a6ee9a14fd6d8b41a5d522d5917e1fbc |
|
24-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
cgroup: certain cgroup attributes are not available in the root cgroup, hence don't bother |
90060676c442604780634c0a993e3f9c3733f8e6 |
|
22-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
cgroup: Extend DeviceAllow= syntax to whitelist groups of devices, not just particular devices nodes |
d4fdc205a4610965cee46408dbd046c922e7620c |
|
19-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
update TODO |
73e231abde39f22097df50542c745e01de879836 |
|
18-Feb-2014 |
Jan Engelhardt <jengelh@inai.de> |
doc: update punctuation
Resolve spotted issues related to missing or extraneous commas, dashes. |
03b90d4bade317c601bc22ccc700396ca6ba5a8e |
|
17-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
core: find the closest parent slice that has a specfic cgroup controller enabled when enabling/disabling cgroup controllers for units |
bc432dc7eb62c5671f2b741a86a66393adb350dc |
|
17-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
core: rework cgroup mask propagation
Previously a cgroup setting down tree would result in cgroup membership
additions being propagated up the tree and to the siblings, however a
unit could never lose cgroup memberships again. With this change we'll
make sure that both cgroup additions and removals propagate properly. |
6414b7c981378a6eef480f6806d7cbfc98ca22a1 |
|
22-Nov-2013 |
David Strauss <david@davidstrauss.net> |
cgroups: Cache controller masks and optimize queues. |
a94042fa9b0733ae0c4e27747ee68d1a7865c8c6 |
|
10-Nov-2013 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
systemd: fix memory leak in cgroup code
If the unit already was in the hashmap, path would be leaked. |
f3669545238702f8ffee7b743ca4347b785b558a |
|
06-Nov-2013 |
David Strauss <david@davidstrauss.net> |
Comment spelling fixes. |
15c60e99a974782351ca8a5ed438dc3729eb5fe7 |
|
06-Nov-2013 |
Lennart Poettering <lennart@poettering.net> |
cgroup: run PID 1 in the root cgroup
This way cleaning up the cgroup tree on shutdown is a lot easier since
we are in the root dir. Also PID 1 was previously artificially placed in
system.slice, even though our rule actually was not to have processes in
slices. The root slice otoh is magic anyway, so having PID 1 in there
sounds less surprising.
Of course, this means that PID is scheduled against the three top-level
slices. |
71fda00f320379f5cbee8e118848de98caaa229d |
|
14-Oct-2013 |
Lennart Poettering <lennart@poettering.net> |
list: make our list macros a bit easier to use by not requring type spec on each invocation
We can determine the list entry type via the typeof() gcc construct, and
so we should to make the macros much shorter to use. |
13b84ec7df103ce388910a2b868fe1668c1e27ef |
|
25-Sep-2013 |
Lennart Poettering <lennart@poettering.net> |
cgroup: if we do a cgroup operation then do something on all supported controllers
Previously we did operations like attach, trim or migrate only on the
controllers that were enabled for a specific unit. With this changes we
will now do them for all supproted controllers, and fall back to all
possible prefix paths if the specified paths do not exist.
This fixes issues if a controller is being disabled for a unit where it
was previously enabled, and makes sure that all processes stay as "far
down" the tree as groups exist. |
e58cec11e6735583c0de7cba68fb68f669472305 |
|
23-Sep-2013 |
Lennart Poettering <lennart@poettering.net> |
cgroup: always enable memory.use_hierarchy= for all cgroups in the memory hierarchy
The non-hierarchial mode contradicts the whole idea of a cgroup tree so
let's not support this. In the future the kernel will only support the
hierarchial logic anyway. |
ddca82aca08712a302cfabdbe59f73ee9ed3f73a |
|
17-Sep-2013 |
Lennart Poettering <lennart@poettering.net> |
cgroup: get rid of MemorySoftLimit=
The cgroup attribute memory.soft_limit_in_bytes is unlikely to stay
around in the kernel for good, so let's not expose it for now. We can
readd something like it later when the kernel guys decided on a final
API for this. |
112a7f4696ebb96abdb42df62e1e794e903f66b3 |
|
16-Sep-2013 |
Gao feng <gaofeng@cn.fujitsu.com> |
cgroup: add missing equals for BlockIOWeight |
81c68af03f4ea9a1adc0767f7a3993a1cbe2ab3d |
|
13-Sep-2013 |
Lukas Nykryn <lnykryn@redhat.com> |
core/cgroup: first print then free |
6a94f2e938c6535917b29a9611d6ad815125ed1b |
|
13-Sep-2013 |
Gao feng <gaofeng@cn.fujitsu.com> |
cgroup: fix incorrectly setting memory cgroup
If the memory_limit of unit is -1, we should write "-1"
to the file memory.limit_in_bytes. not the (unit64_t) -1.
otherwise the memory.limit_in_bytes will be set to zero. |
84121bc2ee2b1af811a50bc6974115aba603c806 |
|
13-Sep-2013 |
Gao feng <gaofeng@cn.fujitsu.com> |
cgroup: correct the log information
it should be memory.soft_limit_in_bytes. |
15b4a7548f2e8f4e5dc0504b1c549edb0c7e0956 |
|
13-Sep-2013 |
Gao feng <gaofeng@cn.fujitsu.com> |
cgroup: add the missing setting of variable's value
set the value of variable "r" to the return value
of cg_set_attribute. |
b58b8e11c5f769e3c80d5169fdcc4bd04b882b7d |
|
28-Aug-2013 |
Harald Hoyer <harald@redhat.com> |
Do not realloc strings, which are already in the hashmap as keys
This prevents corruption of the hashmap, because we would free() the
keys in the hashmap, if the unit is already in there, with the same
cgroup path. |
3d040cf24473f2ed13121d57ed753bad5f8ad09d |
|
28-Aug-2013 |
Harald Hoyer <harald@redhat.com> |
Revert "cgroup.c: check return value of unit_realize_cgroup_now()"
This reverts commit 1f11a0cdfe397cc404d61ee679fc12f58c0a885b. |
1f11a0cdfe397cc404d61ee679fc12f58c0a885b |
|
23-Aug-2013 |
Harald Hoyer <harald@redhat.com> |
cgroup.c: check return value of unit_realize_cgroup_now()
do not recurse further, if unit_realize_cgroup_now() failed |
8e7076caae32a560a11c1643b53fc4f12db4a6b1 |
|
11-Jul-2013 |
Lennart Poettering <lennart@poettering.net> |
cgroup: split out per-device BlockIOWeight= setting into BlockIODeviceWeight=
This way we can nicely map the configuration directive to properties and
back, without requiring two different signatures for the same property. |
8a84192905a9845fda31b65cc433127f9c2f95ae |
|
11-Jul-2013 |
Lennart Poettering <lennart@poettering.net> |
cgroup: don't ever try to destroy the cgroup of the root slice
The root slice is after all the root cgroup, so don't attempt to delete
it. |
be2c1bd2a843aa61901086fccbae15b3aa085fb1 |
|
11-Jul-2013 |
Lennart Poettering <lennart@poettering.net> |
cgroup: don't move systemd into systems.slice when running as --user instance |
376dd21dc0757e8a6d3f60d6d21bb802a90f1983 |
|
10-Jul-2013 |
Lennart Poettering <lennart@poettering.net> |
cgroup: downgrade error message when we cannot remove a cgroup to debug
Some units set KillMode=none to survive the initrd→rootfs transition. We
cannot remove their cgroups, but that shouldn't really be considered an
issue, so let's downgrade the error message. |
06025d9148036ee4de9866f3f067ffa75e14a751 |
|
02-Jul-2013 |
Lennart Poettering <lennart@poettering.net> |
core: don't consider a unit's cgroup empty if only a subcgroup runs empty |
b56c28c31adc101df82c1c3c30740b47cbd4f782 |
|
01-Jul-2013 |
Lennart Poettering <lennart@poettering.net> |
cgroup: implicitly add units to GC queue when their cgroups run empty |
0a1eb06d9aacc1f007be04c4133031e0acc91cdd |
|
01-Jul-2013 |
Lennart Poettering <lennart@poettering.net> |
cgroup: readd proper cgroup empty tracking |
4ad490007b70e6ac18d3cb04fa2ed92eba1451fa |
|
27-Jun-2013 |
Lennart Poettering <lennart@poettering.net> |
core: general cgroup rework
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=). |
9444b1f20e311f073864d81e913bd4f32fe95cfd |
|
20-Jun-2013 |
Lennart Poettering <lennart@poettering.net> |
logind: add infrastructure to keep track of machines, and move to slices
- 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. |
a016b9228f338cb9b380ce7e00826ef462767d98 |
|
17-Jun-2013 |
Lennart Poettering <lennart@poettering.net> |
core: add new .slice unit type for partitioning systems
In order to prepare for the kernel cgroup rework, let's introduce a new
unit type to systemd, the "slice". Slices can be arranged in a tree and
are useful to partition resources freely and hierarchally by the user.
Each service unit can now be assigned to one of these slices, and later
on login users and machines may too.
Slices translate pretty directly to the cgroup hierarchy, and the
various objects can be assigned to any of the slices in the tree. |
7027ff61a34a12487712b382a061c654acc3a679 |
|
16-Apr-2013 |
Lennart Poettering <lennart@poettering.net> |
nspawn: introduce the new /machine/ tree in the cgroup tree and move containers there
Containers will now carry a label (normally derived from the root
directory name, but configurable by the user), and the container's root
cgroup is /machine/<label>. This label is called "machine name", and can
cover both containers and VMs (as soon as libvirt also makes use of
/machine/).
libsystemd-login can be used to query the machine name from a process.
This patch also includes numerous clean-ups for the cgroup code. |
a32360f1a5a85c12f00e9dfb7353280067cccb5b |
|
15-Apr-2013 |
Lennart Poettering <lennart@poettering.net> |
core: always create /user and /machine top-level cgroup dirs
This allows clients to put inotify watches on these trees to watch for
state changes, without having to wait until these dirs are created.
This introduces the new top-level /machine cgroup dir as canonical
location where OS containers and VMs shall be located (as discussed with
the libvirt folks). |
974efc46586854b1f23ccf153b36199c77919de6 |
|
08-Apr-2013 |
Lennart Poettering <lennart@poettering.net> |
cgroup: always keep access mode of 'tasks' and 'cgroup.procs' files in cgroup directories in sync |
8e70580bb07ae46dc0b0bf377de6333540668acc |
|
22-Mar-2013 |
Lennart Poettering <lennart@poettering.net> |
cgroup: minor optimization |
246aa6dd9dcea84bb945d16ec86e69f869dbb9b4 |
|
14-Jan-2013 |
Lennart Poettering <lennart@poettering.net> |
core: add bus API and systemctl commands for altering cgroup parameters during runtime |
67445f4e22ad924394acdd4fd49e6f238244a5ca |
|
18-Sep-2012 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
core: move ManagerRunningAs to shared
Note: I did s/MANAGER/SYSTEMD/ everywhere, even though it makes the
patch quite verbose. Nevertheless, keeping MANAGER prefix in some
places, and SYSTEMD prefix in others would just lead to confusion down
the road. Better to rip off the band-aid now. |
0d0f0c50d3a1d90f03972a6abb82e6413daaa583 |
|
26-Jul-2012 |
Shawn Landden <shawnlandden@gmail.com> |
log.h: new log_oom() -> int -ENOMEM, use it
also a number of minor fixups and bug fixes: spelling, oom errors
that didn't print errors, not properly forwarding error codes,
few more consistency issues, et cetera |
669241a076108e0483d7d8475beaa506106d077e |
|
25-Jul-2012 |
Shawn Landden <shawnlandden@gmail.com> |
use "Out of memory." consistantly (or with "\n")
glibc/glib both use "out of memory" consistantly so maybe we should
consider that instead of this.
Eliminates one string out of a number of binaries. Also fixes extra newline
in udev/scsi_id |
b7def684941808600c344f0be7a2b9fcdda97e0f |
|
13-Jul-2012 |
Lennart Poettering <lennart@poettering.net> |
util: rename join() to strjoin()
This is to match strappend() and the other string related functions. |
9eb977db5b89b44f254ab40c1876a76b7d7ea2d0 |
|
08-May-2012 |
Kay Sievers <kay@vrfy.org> |
util: split-out path-util.[ch] |
88f3e0c91f08c65a479e1aa09f171550b744d829 |
|
03-May-2012 |
Lennart Poettering <lennart@poettering.net> |
service: explicitly remove control/ subcgroup after each control command
The kernel will only notify us of cgroups running empty if no subcgroups
exist anymore. Hence make sure we don't leave our own control/ subcgroup
around longer than necessary.
https://bugzilla.redhat.com/show_bug.cgi?id=818381 |
b59e246565337d6c6967059dd15a52a15277433e |
|
16-Apr-2012 |
Lennart Poettering <lennart@poettering.net> |
logind: remove redundant entries from logind's default controller lists too |
9156e799a258658cf3f51434708cdb194c13eaa4 |
|
16-Apr-2012 |
Lennart Poettering <lennart@poettering.net> |
manager: remove unavailable/redundant entries from default controllers list |
3474ae3c7e1981301d0b35bc89d759ca13f06e8f |
|
16-Apr-2012 |
Lennart Poettering <lennart@poettering.net> |
cgroup: if a controller is not available don't try to create cgroups in its hierarchy |
ecedd90fcdf647f9a7b56b4934b65e30b2979b04 |
|
13-Apr-2012 |
Lennart Poettering <lennart@poettering.net> |
service: place control command in subcgroup control/
Previously, we were brutally and onconditionally killing all processes
in a service's cgroup before starting the service anew, in order to
ensure that StartPre lines cannot be misused to spawn long-running
processes.
On logind-less systems this has the effect that restarting sshd
necessarily calls all active ssh sessions, which is usually not
desirable.
With this patch control processes for a service are placed in a
sub-cgroup called "control/". When starting a service anew we simply
kill this cgroup, but not the main cgroup, in order to avoid killing any
long-running non-control processes from previous runs.
https://bugzilla.redhat.com/show_bug.cgi?id=805942 |
5430f7f2bc7330f3088b894166bf3524a067e3d8 |
|
12-Apr-2012 |
Lennart Poettering <lennart@poettering.net> |
relicense to LGPLv2.1 (with exceptions)
We finally got the OK from all contributors with non-trivial commits to
relicense systemd from GPL2+ to LGPL2.1+.
Some udev bits continue to be GPL2+ for now, but we are looking into
relicensing them too, to allow free copy/paste of all code within
systemd.
The bits that used to be MIT continue to be MIT.
The big benefit of the relicensing is that closed source code may now
link against libsystemd-login.so and friends. |
b30e2f4c18ad81b04e4314fd191a5d458553773c |
|
11-Apr-2012 |
Kay Sievers <kay@vrfy.org> |
move libsystemd_core.la sources into core/ |