Compare commits

..

No commits in common. "0bc2f071e199daca9e02e0261ddf5bfd208e2c9a" and "6f997852c8830ca073c55241b0068ebbf1f94a72" have entirely different histories.

11 changed files with 38 additions and 183 deletions

49
NEWS
View File

@ -495,6 +495,17 @@ CHANGES WITH 247 in spe:
such as replay debuggers where non-deterministic behaviour is not
desirable.
* When building systemd the Meson option
-Dcompat-mutable-uid-boundaries may now be specified. If enabled,
systemd reads the system UID boundaries from /etc/login.defs, instead
of using the built-in values selected during build-time. This is an
option to improve compatibility for upgrades from old systems. It's
strongly recommended not to make use of this functionality on new
systems (or even enable it during build), as it makes something
runtime-configurable that is mostly an implementation detail of the
OS, and permits avoidable differences in deployments that create all
kinds of problems in the long run.
* The autopaging logic in systemd's various tools (such as systemctl)
has been updated to turn on "secure" mode in "less"
(i.e. $LESSECURE=1) if execution in a "sudo" environment is
@ -502,44 +513,6 @@ CHANGES WITH 247 in spe:
via the pipe logic. This behaviour may be overridden via the new
$SYSTEMD_PAGERSECURE environment variable.
* Units which have resource limits (.service, .mount, .swap, .slice,
.socket, and .slice) gained new configuration settings
ManagedOOMSwap=, ManagedOOMMemoryPressure=, and
ManagedOOMMemoryPressureLimitPercent= that speicify resource pressure
limits and optional action taken by systemd-oomd.
* A new service systemd-oomd has been added. It monitors resource
contention for selected parts of the unit hierarchy using the PSI
information reported by the kernel, and kills processes when memory
or swap pressure is above configured limits. This service is only
enabled in developer mode (see below) and should be considered a
preview in this release. Behaviour details and option names are
subject to change without the usual backwards-compatibility promises.
* A new helper oomctl has been added to introspect systemd-oomd state.
If also is only available in developer mode and should be considered
a preview without the usual backwards-compatibility promises.
* New meson option -Dcompat-mutable-uid-boundaries= has been added. If
enabled, systemd reads the system UID boundaries from /etc/login.defs
at runtime, instead of using the built-in values selected during
build. This is an option to improve compatibility for upgrades from
old systems. It's strongly recommended not to make use of this
functionality on new systems (or even enable it during build), as it
makes something runtime-configurable that is mostly an implementation
detail of the OS, and permits avoidable differences in deployments
that create all kinds of problems in the long run.
* New meson option '-Dmode=developer|release' has been added. When
'developer', additional checks and features are enabled that are
relevant during upstream development, e.g. verification that
semi-automatically-generated documentation has been properly updated
following API changes. Those checks are considered hints for
developers and are not actionable in downstream builds. In addition,
extra features that are not ready for general consumption may be
enabled in developer mode. It is thus recommended to set
'-Dmode=release' in end-user and distro builds.
CHANGES WITH 246:
* The service manager gained basic support for cgroup v2 freezer. Units

View File

@ -1,74 +0,0 @@
<?xml version='1.0'?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" >
<!-- SPDX-License-Identifier: LGPL-2.1+ -->
<refentry id="org.freedesktop.oom1" conditional='ENABLE_OOMD'
xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>
<title>org.freedesktop.oom1</title>
<productname>systemd</productname>
</refentryinfo>
<refmeta>
<refentrytitle>org.freedesktop.oom1</refentrytitle>
<manvolnum>5</manvolnum>
</refmeta>
<refnamediv>
<refname>org.freedesktop.oom1</refname>
<refpurpose>The D-Bus interface of systemd-oomd</refpurpose>
</refnamediv>
<refsect1>
<title>Introduction</title>
<para>
<citerefentry><refentrytitle>systemd-oomd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
is a system service which implements a userspace out-of-memory (OOM) killer. This page describes the
D-Bus interface.</para>
</refsect1>
<refsect1>
<title>The Manager Object</title>
<para>The service exposes the following interfaces on the Manager object on the bus:</para>
<programlisting executable="systemd-oomd" node="/org/freedesktop/oom1" interface="org.freedesktop.oom1.Manager">
node /org/freedesktop/oom1 {
interface org.freedesktop.oom1.Manager {
methods:
DumpByFileDescriptor(out h fd);
};
interface org.freedesktop.DBus.Peer { ... };
interface org.freedesktop.DBus.Introspectable { ... };
interface org.freedesktop.DBus.Properties { ... };
};
</programlisting>
<!--method DumpByFileDescriptor is not documented!-->
<!--Autogenerated cross-references for systemd.directives, do not edit-->
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.oom1.Manager"/>
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.oom1.Manager"/>
<variablelist class="dbus-method" generated="True" extra-ref="DumpByFileDescriptor()"/>
<!--End of Autogenerated section-->
<refsect2>
<title>Methods</title>
<para>...</para>
</refsect2>
</refsect1>
<refsect1>
<title>Versioning</title>
<para>These D-Bus interfaces follow <ulink url="http://0pointer.de/blog/projects/versioning-dbus.html">
the usual interface versioning guidelines</ulink>.</para>
</refsect1>
</refentry>

View File

@ -54,7 +54,6 @@ manpages = [
['org.freedesktop.locale1', '5', [], 'ENABLE_LOCALED'],
['org.freedesktop.login1', '5', [], 'ENABLE_LOGIND'],
['org.freedesktop.machine1', '5', [], 'ENABLE_MACHINED'],
['org.freedesktop.oom1', '5', [], 'ENABLE_OOMD'],
['org.freedesktop.resolve1', '5', [], 'ENABLE_RESOLVE'],
['org.freedesktop.systemd1', '5', [], ''],
['org.freedesktop.timedate1', '5', [], 'ENABLE_TIMEDATED'],

View File

@ -1412,15 +1412,7 @@ conf.set10('ENABLE_HOMED', have)
have = have and conf.get('HAVE_PAM') == 1
conf.set10('ENABLE_PAM_HOME', have)
have = get_option('oomd')
if have == 'auto'
have = get_option('mode') == 'developer'
else
have = have == 'true'
if have and get_option('mode') != 'developer'
error('oomd is not available in release mode (yet)')
endif
endif
have = get_option('oomd') and get_option('mode') == 'developer'
conf.set10('ENABLE_OOMD', have)
want_remote = get_option('remote')

View File

@ -97,7 +97,7 @@ option('coredump', type : 'boolean',
description : 'install the coredump handler')
option('pstore', type : 'boolean',
description : 'install the pstore archival tool')
option('oomd', type : 'combo', choices : ['auto', 'true', 'false'],
option('oomd', type : 'boolean', value : 'false',
description : 'install the userspace oom killer')
option('logind', type : 'boolean',
description : 'install the systemd-logind stack')

View File

@ -333,7 +333,6 @@ libbasic = static_library(
dependencies : [versiondep,
threads,
libcap,
libseccomp,
libselinux,
libm,
libdl],

View File

@ -29,19 +29,8 @@ static int bus_method_dump_by_fd(sd_bus_message *message, void *userdata, sd_bus
return sd_bus_reply_method_return(message, "h", fd);
}
static const sd_bus_vtable manager_vtable[] = {
const sd_bus_vtable manager_vtable[] = {
SD_BUS_VTABLE_START(0),
SD_BUS_METHOD_WITH_NAMES("DumpByFileDescriptor",
NULL,,
"h",
SD_BUS_PARAM(fd),
bus_method_dump_by_fd,
SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("DumpByFileDescriptor", NULL, "h", bus_method_dump_by_fd, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_VTABLE_END
};
const BusObjectImplementation manager_object = {
"/org/freedesktop/oom1",
"org.freedesktop.oom1.Manager",
.vtables = BUS_VTABLES(manager_vtable),
};

View File

@ -1,8 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
#include "bus-object.h"
#include "sd-bus.h"
typedef struct Manager Manager;
extern const BusObjectImplementation manager_object;
extern const sd_bus_vtable manager_vtable[];

View File

@ -455,9 +455,9 @@ static int manager_connect_bus(Manager *m) {
if (r < 0)
return log_error_errno(r, "Failed to connect to bus: %m");
r = bus_add_implementation(m->bus, &manager_object, m);
r = sd_bus_add_object_vtable(m->bus, NULL, "/org/freedesktop/oom1", "org.freedesktop.oom1.Manager", manager_vtable, m);
if (r < 0)
return r;
return log_error_errno(r, "Failed to add manager object vtable: %m");
r = bus_log_control_api_register(m->bus);
if (r < 0)

View File

@ -2,15 +2,12 @@
#include <getopt.h>
#include "bus-log-control-api.h"
#include "bus-object.h"
#include "cgroup-util.h"
#include "conf-parser.h"
#include "daemon-util.h"
#include "log.h"
#include "main-func.h"
#include "oomd-manager.h"
#include "oomd-manager-bus.h"
#include "parse-util.h"
#include "pretty-print.c"
#include "psi-util.h"
@ -46,31 +43,25 @@ static int help(void) {
return log_oom();
printf("%s [OPTIONS...]\n\n"
"Run the userspace out-of-memory (OOM) killer.\n\n"
" -h --help Show this help\n"
" --version Show package version\n"
" --dry-run Only print destructive actions instead of doing them\n"
" --bus-introspect=PATH Write D-Bus XML introspection data\n"
"\nSee the %s for details.\n"
, program_invocation_short_name
, link
);
"Run the userspace out-of-memory (OOM) killer.\n\n"
" -h --help Show this help\n"
" --dry-run Log write/destructive actions instead of doing them\n"
"\nSee the %s for details.\n"
, program_invocation_short_name
, link
);
return 0;
}
static int parse_argv(int argc, char *argv[]) {
enum {
ARG_VERSION = 0x100,
ARG_DRY_RUN,
ARG_BUS_INTROSPECT,
};
static const struct option options[] = {
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, ARG_VERSION },
{ "dry-run", no_argument, NULL, ARG_DRY_RUN },
{ "bus-introspect", required_argument, NULL, ARG_BUS_INTROSPECT },
{ "help", no_argument, NULL, 'h' },
{ "dry-run", no_argument, NULL, ARG_DRY_RUN },
{}
};
@ -83,34 +74,20 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
return help();
case 'h':
return help();
case ARG_VERSION:
return version();
case ARG_DRY_RUN:
arg_dry_run = true;
break;
case ARG_DRY_RUN:
arg_dry_run = true;
break;
case '?':
return -EINVAL;
case ARG_BUS_INTROSPECT:
return bus_introspect_implementations(
stdout,
optarg,
BUS_IMPLEMENTATIONS(&manager_object,
&log_control_object));
case '?':
return -EINVAL;
default:
assert_not_reached("Unknown option code.");
default:
assert_not_reached("Invalid option passed.");
}
if (optind < argc)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"This program takes no arguments.");
return 1;
}

View File

@ -333,7 +333,7 @@ tests += [
[['src/test/test-parse-util.c'],
[],
[libseccomp]],
[]],
[['src/test/test-sysctl-util.c'],
[],