mirror of
https://github.com/systemd/systemd
synced 2025-11-21 09:44:44 +01:00
Compare commits
No commits in common. "606a08b1b56a664ac89c5ca9e583789e0487e013" and "1353564b9d7bd11888b7ca068ffce771ce6d8e7e" have entirely different histories.
606a08b1b5
...
1353564b9d
@ -81,7 +81,7 @@
|
||||
factory reset operation is by starting the <filename>factory-reset.target</filename>
|
||||
unit.</para>
|
||||
|
||||
<para>This sets the <varname>FactoryResetRequest</varname> EFI variable, see below.</para>
|
||||
<para>This sets the <varname>FactoryResetRequested</varname> EFI variable, see below.</para>
|
||||
|
||||
<para>This operation is executed when the <filename>systemd-factory-reset-request.service</filename>
|
||||
unit is started (which is typically one of the services hooked into
|
||||
|
||||
@ -563,7 +563,7 @@ CPUWeight=20 DisableControllers=cpu / \
|
||||
an absolute number of tasks or a percentage value that is taken relative to the configured maximum
|
||||
number of tasks on the system. If assigned the special value <literal>infinity</literal>, no tasks
|
||||
limit is applied. This controls the <literal>pids.max</literal> control group attribute. For
|
||||
details about this control group attribute, see the
|
||||
details about this control group attribute, the
|
||||
<ulink url="https://docs.kernel.org/admin-guide/cgroup-v2.html#pid">pids controller
|
||||
</ulink>.
|
||||
The effective configuration is reported as <varname>EffectiveTasksMax=</varname>.</para>
|
||||
|
||||
@ -167,8 +167,7 @@ static int unmute_pid1(Context *c) {
|
||||
assert(c);
|
||||
|
||||
if (!c->muted_pid1) {
|
||||
if (c->mute_pid1)
|
||||
log_debug("Not restoring PID 1 status console output level.");
|
||||
log_debug("Not restoring PID 1 status console output level.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -186,16 +185,14 @@ static int mute_kernel(Context *c) {
|
||||
|
||||
assert(c);
|
||||
|
||||
if (!c->mute_kernel) {
|
||||
if (!arg_mute_kernel) {
|
||||
log_debug("Muting of kernel printk() console output disabled.");
|
||||
c->saved_kernel = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (detect_container() > 0) {
|
||||
log_debug("Skipping muting of printk() console output, because running in a container.");
|
||||
|
||||
c->mute_kernel = false;
|
||||
log_debug("Skipping muting of print() console output, because running in a container.");
|
||||
c->saved_kernel = -1;
|
||||
return 0;
|
||||
}
|
||||
@ -225,8 +222,7 @@ static int unmute_kernel(Context *c) {
|
||||
assert(c);
|
||||
|
||||
if (c->saved_kernel < 0) {
|
||||
if (c->mute_kernel)
|
||||
log_debug("Not restoring kernel printk() console output level.");
|
||||
log_debug("Not restoring kernel printk() console output level.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -248,6 +244,28 @@ static int unmute_kernel(Context *c) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void context_done(Context *c) {
|
||||
assert(c);
|
||||
|
||||
(void) unmute_pid1(c);
|
||||
(void) unmute_kernel(c);
|
||||
|
||||
if (c->link) {
|
||||
(void) sd_varlink_set_userdata(c->link, NULL);
|
||||
c->link = sd_varlink_flush_close_unref(c->link);
|
||||
}
|
||||
}
|
||||
|
||||
static Context* context_free(Context *c) {
|
||||
if (!c)
|
||||
return NULL;
|
||||
|
||||
context_done(c);
|
||||
return mfree(c);
|
||||
}
|
||||
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(Context*, context_free);
|
||||
|
||||
static void vl_on_disconnect(sd_varlink_server *server, sd_varlink *link, void *userdata) {
|
||||
assert(link);
|
||||
|
||||
@ -255,13 +273,7 @@ static void vl_on_disconnect(sd_varlink_server *server, sd_varlink *link, void *
|
||||
if (!c)
|
||||
return;
|
||||
|
||||
(void) unmute_pid1(c);
|
||||
(void) unmute_kernel(c);
|
||||
|
||||
(void) sd_varlink_set_userdata(c->link, NULL);
|
||||
sd_varlink_flush_close_unref(c->link);
|
||||
|
||||
free(c);
|
||||
context_free(c);
|
||||
}
|
||||
|
||||
static int vl_method_mute(
|
||||
@ -274,7 +286,7 @@ static int vl_method_mute(
|
||||
|
||||
assert(link);
|
||||
|
||||
_cleanup_free_ Context *nc = new(Context, 1);
|
||||
_cleanup_(context_freep) Context *nc = new(Context, 1);
|
||||
if (!nc)
|
||||
return -ENOMEM;
|
||||
|
||||
@ -368,7 +380,7 @@ static int run(int argc, char* argv[]) {
|
||||
if (!arg_mute_pid1 && !arg_mute_kernel)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Not asked to mute anything, refusing.");
|
||||
|
||||
Context c = {
|
||||
_cleanup_(context_done) Context c = {
|
||||
.mute_pid1 = arg_mute_pid1,
|
||||
.mute_kernel = arg_mute_kernel,
|
||||
.saved_kernel = -1,
|
||||
@ -386,7 +398,7 @@ static int run(int argc, char* argv[]) {
|
||||
RET_GATHER(ret, mute_pid1(&c));
|
||||
RET_GATHER(ret, mute_kernel(&c));
|
||||
|
||||
/* Now tell service manager we are ready to go */
|
||||
/* Now tell service manager we area ready to go */
|
||||
_unused_ _cleanup_(notify_on_cleanup) const char *notify_message =
|
||||
notify_start("READY=1\n"
|
||||
"STATUS=Console status output muted temporarily.",
|
||||
|
||||
@ -10,6 +10,9 @@
|
||||
[Unit]
|
||||
Description=Console Output Muting Service Slice
|
||||
Documentation=man:systemd-mute-console(8)
|
||||
DefaultDependencies=no
|
||||
Conflicts=shutdown.target
|
||||
Before=shutdown.target
|
||||
|
||||
[Slice]
|
||||
# Serialize requests to mute the console.
|
||||
|
||||
@ -19,4 +19,3 @@ ListenStream=/run/systemd/io.systemd.BootControl
|
||||
FileDescriptorName=varlink
|
||||
SocketMode=0600
|
||||
Accept=yes
|
||||
MaxConnectionsPerSource=16
|
||||
|
||||
@ -20,4 +20,3 @@ ListenStream=/run/systemd/io.systemd.MuteConsole
|
||||
FileDescriptorName=varlink
|
||||
SocketMode=0600
|
||||
Accept=yes
|
||||
MaxConnectionsPerSource=16
|
||||
|
||||
@ -20,7 +20,6 @@ ListenStream=/run/systemd/io.systemd.PCRLock
|
||||
FileDescriptorName=varlink
|
||||
SocketMode=0600
|
||||
Accept=yes
|
||||
MaxConnectionsPerSource=16
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
||||
|
||||
@ -20,4 +20,3 @@ ListenStream=/run/systemd/io.systemd.Repart
|
||||
FileDescriptorName=varlink
|
||||
SocketMode=0600
|
||||
Accept=yes
|
||||
MaxConnectionsPerSource=16
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user