1
0
mirror of https://github.com/systemd/systemd synced 2026-04-06 23:24:52 +02:00

Compare commits

..

No commits in common. "da845dabf576f73f76af2704254e0ce7d8167356" and "6e671b3f07c1984c7281b432d0c70623c51acb59" have entirely different histories.

25 changed files with 74 additions and 157 deletions

View File

@ -4,6 +4,7 @@ custom_target(
'README',
input : 'README.in',
output : 'README',
command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'],
command : [meson_render_jinja2, config_h, '@INPUT@'],
capture : true,
install : conf.get('HAVE_SYSV_COMPAT') == 1,
install_dir : sysvinit_path)

View File

@ -56,6 +56,11 @@
# Sort by brand, model
# UC-Logic TABLET 1060N Pad
id-input:modalias:input:b0003v5543p0081*
ID_INPUT_TABLET=1
ID_INPUT_TABLET_PAD=1
# XP-PEN STAR 06
id-input:modalias:input:b0003v28bdp0078*
ID_INPUT_TABLET=1

View File

@ -30,7 +30,8 @@ custom_entities_ent = custom_target(
'custom-entities.ent',
input : 'custom-entities.ent.in',
output : 'custom-entities.ent',
command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'])
command : [meson_render_jinja2, config_h, '@INPUT@'],
capture : true)
man_pages = []
html_pages = []

View File

@ -551,8 +551,7 @@ NAutoVTs=8
<title><command>systemd-analyze verify <replaceable>FILE</replaceable>...</command></title>
<para>This command will load unit files and print warnings if any errors are detected. Files specified
on the command line will be loaded, but also any other units referenced by them. A unit's name on disk
can be overridden by specifying an alias after a colon; see below for an example. The full unit search
on the command line will be loaded, but also any other units referenced by them. The full unit search
path is formed by combining the directories for all command line arguments, and the usual unit load
paths. The variable <varname>$SYSTEMD_UNIT_PATH</varname> is supported, and may be used to replace or
augment the compiled in set of unit load paths; see
@ -614,27 +613,6 @@ Service a.service not loaded, a.socket cannot be started.
Service b@0.service not loaded, b.socket cannot be started.
</programlisting>
</example>
<example>
<title>Aliasing a unit</title>
<programlisting>$ cat /tmp/source
[Unit]
Description=Hostname printer
[Service]
Type=simple
ExecStart=/usr/bin/echo %H
MysteryKey=true
$ systemd-analyze verify /tmp/source
Failed to prepare filename /tmp/source: Invalid argument
$ systemd-analyze verify /tmp/source:alias.service
/tmp/systemd-analyze-XXXXXX/alias.service:7: Unknown key name 'MysteryKey' in section 'Service', ignoring.
</programlisting>
</example>
</refsect2>
<refsect2>

View File

@ -52,7 +52,8 @@ foreach file : rules_in
file,
input : file + '.in',
output: file,
command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'],
command : [meson_render_jinja2, config_h, '@INPUT@'],
capture : true,
install : true,
install_dir : udevrulesdir)
endforeach

View File

@ -14,7 +14,8 @@ custom_target(
'systemctl',
input : 'systemctl.in',
output : 'systemctl',
command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'],
command : [meson_render_jinja2, config_h, '@INPUT@'],
capture : true,
install : bashcompletiondir != 'no',
install_dir : bashcompletiondir)

View File

@ -9,7 +9,8 @@ custom_target(
'_systemctl',
input : '_systemctl.in',
output : '_systemctl',
command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'],
command : [meson_render_jinja2, config_h, '@INPUT@'],
capture : true,
install : zshcompletiondir != 'no',
install_dir : zshcompletiondir)

View File

@ -26,7 +26,6 @@
#include "copy.h"
#include "def.h"
#include "exit-status.h"
#include "extract-word.h"
#include "fd-util.h"
#include "fileio.h"
#include "filesystems.h"
@ -43,7 +42,6 @@
#include "parse-util.h"
#include "path-util.h"
#include "pretty-print.h"
#include "rm-rf.h"
#if HAVE_SECCOMP
# include "seccomp-util.h"
#endif
@ -55,7 +53,6 @@
#include "strxcpyx.h"
#include "terminal-util.h"
#include "time-util.h"
#include "tmpfile-util.h"
#include "unit-name.h"
#include "util.h"
#include "verb-log-control.h"
@ -233,53 +230,6 @@ static int compare_unit_start(const UnitTimes *a, const UnitTimes *b) {
return CMP(a->activating, b->activating);
}
static int process_aliases(char *argv[], char *tempdir, char ***ret) {
_cleanup_strv_free_ char **filenames = NULL;
char **filename;
int r;
assert(argv);
assert(tempdir);
assert(ret);
STRV_FOREACH(filename, strv_skip(argv, 1)) {
_cleanup_free_ char *src = NULL, *dst = NULL, *arg = NULL;
char *parse_arg;
arg = strdup(*filename);
if (!arg)
return -ENOMEM;
parse_arg = arg;
r = extract_first_word((const char **) &parse_arg, &src, ":", 0);
if (r < 0)
return r;
if (!parse_arg) {
r = strv_extend(&filenames, src);
if (r < 0)
return -ENOMEM;
continue;
}
dst = path_join(tempdir, basename(parse_arg));
if (!dst)
return -ENOMEM;
r = copy_file(src, dst, 0, 0644, 0, 0, COPY_REFLINK);
if (r < 0)
return r;
r = strv_consume(&filenames, TAKE_PTR(dst));
if (r < 0)
return -ENOMEM;
}
*ret = TAKE_PTR(filenames);
return 0;
}
static UnitTimes* unit_times_free_array(UnitTimes *t) {
for (UnitTimes *p = t; p && p->has_data; p++)
free(p->name);
@ -2307,19 +2257,7 @@ static int do_condition(int argc, char *argv[], void *userdata) {
}
static int do_verify(int argc, char *argv[], void *userdata) {
_cleanup_strv_free_ char **filenames = NULL;
_cleanup_(rm_rf_physical_and_freep) char *tempdir = NULL;
int r;
r = mkdtemp_malloc("/tmp/systemd-analyze-XXXXXX", &tempdir);
if (r < 0)
return log_error_errno(r, "Failed to setup working directory: %m");
r = process_aliases(argv, tempdir, &filenames);
if (r < 0)
return log_error_errno(r, "Couldn't process aliases: %m");
return verify_units(filenames, arg_scope, arg_man, arg_generators, arg_recursive_errors, arg_root);
return verify_units(strv_skip(argv, 1), arg_scope, arg_man, arg_generators, arg_recursive_errors, arg_root);
}
static int do_security(int argc, char *argv[], void *userdata) {

View File

@ -149,7 +149,8 @@ load_fragment_gperf_gperf = custom_target(
'load-fragment-gperf.gperf',
input : 'load-fragment-gperf.gperf.in',
output: 'load-fragment-gperf.gperf',
command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'])
command : [meson_render_jinja2, config_h, '@INPUT@'],
capture : true)
load_fragment_gperf_c = custom_target(
'load-fragment-gperf.c',
@ -201,7 +202,8 @@ foreach item : in_files
file,
input : file + '.in',
output: file,
command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'],
command : [meson_render_jinja2, config_h, '@INPUT@'],
capture : true,
install : (dir == pkgsysconfdir) ? install_sysconfdir_samples : (dir != 'no'),
install_dir : dir)
endforeach

View File

@ -54,7 +54,8 @@ foreach tuple : in_files
file,
input : file + '.in',
output: file,
command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'],
command : [meson_render_jinja2, config_h, '@INPUT@'],
capture : true,
install : tuple[1],
install_dir : pkgsysconfdir)
endforeach

View File

@ -183,7 +183,8 @@ custom_target(
'libsystemd.pc',
input : 'libsystemd.pc.in',
output : 'libsystemd.pc',
command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'],
command : [meson_render_jinja2, config_h, '@INPUT@'],
capture : true,
install : pkgconfiglibdir != 'no',
install_dir : pkgconfiglibdir)

View File

@ -43,7 +43,8 @@ custom_target(
'libudev.pc',
input : 'libudev.pc.in',
output : 'libudev.pc',
command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'],
command : [meson_render_jinja2, config_h, '@INPUT@'],
capture : true,
install : pkgconfiglibdir != 'no',
install_dir : pkgconfiglibdir)

View File

@ -81,7 +81,8 @@ foreach tuple : in_files
file,
input : file + '.in',
output: file,
command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'],
command : [meson_render_jinja2, config_h, '@INPUT@'],
capture : true,
install : tuple[2] and install,
install_dir : dir)
endforeach

View File

@ -166,7 +166,8 @@ custom_target(
'resolved.conf',
input : 'resolved.conf.in',
output : 'resolved.conf',
command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'],
command : [meson_render_jinja2, config_h, '@INPUT@'],
capture : true,
install : conf.get('ENABLE_RESOLVE') == 1 and install_sysconfdir_samples,
install_dir : pkgsysconfdir)

View File

@ -18,7 +18,8 @@ foreach tuple : in_files
file,
input : file + '.in',
output : file,
command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'],
command : [meson_render_jinja2, config_h, '@INPUT@'],
capture : true,
install : tuple[1],
install_dir : tuple.length() > 2 ? tuple[2] : '',
install_mode : tuple.length() > 3 ? tuple[3] : false,

View File

@ -11,7 +11,7 @@
int main(int argc, char *argv[]) {
nsec_t nsec;
uint64_t v, pid_max, threads_max, limit;
uint64_t v, w;
int r;
log_parse_environment();
@ -26,51 +26,40 @@ int main(int argc, char *argv[]) {
assert_se(procfs_tasks_get_current(&v) >= 0);
log_info("Current number of tasks: %" PRIu64, v);
pid_max = TASKS_MAX;
r = procfs_get_pid_max(&pid_max);
if (r == -ENOENT || ERRNO_IS_PRIVILEGE(r))
return log_tests_skipped_errno(r, "can't get pid max");
assert(r >= 0);
log_info("kernel.pid_max: %"PRIu64, pid_max);
v = TASKS_MAX;
r = procfs_get_pid_max(&v);
assert(r >= 0 || r == -ENOENT || ERRNO_IS_PRIVILEGE(r));
log_info("kernel.pid_max: %"PRIu64, v);
threads_max = TASKS_MAX;
r = procfs_get_threads_max(&threads_max);
if (r == -ENOENT || ERRNO_IS_PRIVILEGE(r))
return log_tests_skipped_errno(r, "can't get threads max");
assert(r >= 0);
log_info("kernel.threads-max: %"PRIu64, threads_max);
w = TASKS_MAX;
r = procfs_get_threads_max(&w);
assert(r >= 0 || r == -ENOENT || ERRNO_IS_PRIVILEGE(r));
log_info("kernel.threads-max: %"PRIu64, w);
limit = MIN(pid_max - (pid_max > 0), threads_max);
v = MIN(v - (v > 0), w);
assert_se(r >= 0);
log_info("Limit of tasks: %" PRIu64, limit);
assert_se(limit > 0);
log_info("Limit of tasks: %" PRIu64, v);
assert_se(v > 0);
r = procfs_tasks_set_limit(v);
if (r == -ENOENT || ERRNO_IS_PRIVILEGE(r))
return log_tests_skipped("can't set task limits");
assert(r >= 0);
/* This call should never fail, as we're trying to set it to the same limit */
assert(procfs_tasks_set_limit(limit) >= 0);
if (v > 100) {
log_info("Reducing limit by one to %"PRIu64"", v-1);
if (limit > 100) {
log_info("Reducing limit by one to %"PRIu64"", limit-1);
r = procfs_tasks_set_limit(v-1);
log_info_errno(r, "procfs_tasks_set_limit: %m");
assert_se(r >= 0 || ERRNO_IS_PRIVILEGE(r) || r == -EROFS);
r = procfs_tasks_set_limit(limit-1);
if (IN_SET(r, -ENOENT, -EROFS) || ERRNO_IS_PRIVILEGE(r))
return log_tests_skipped_errno(r, "can't set tasks limit");
assert_se(r >= 0);
assert_se(procfs_get_threads_max(&w) >= 0);
assert_se(r >= 0 ? w == v - 1 : w == v);
assert_se(procfs_get_pid_max(&v) >= 0);
/* We never decrease the pid_max, so it shouldn't have changed */
assert_se(v == pid_max);
assert_se(procfs_tasks_set_limit(v) >= 0);
assert_se(procfs_get_threads_max(&v) >= 0);
assert_se(v == limit-1);
assert_se(procfs_tasks_set_limit(limit) >= 0);
assert_se(procfs_get_pid_max(&v) >= 0);
assert_se(v == pid_max);
assert_se(procfs_get_threads_max(&v) >= 0);
assert_se(v == limit);
assert_se(procfs_get_threads_max(&w) >= 0);
assert_se(v == w);
}
return 0;

View File

@ -38,7 +38,8 @@ custom_target(
'timesyncd.conf',
input : 'timesyncd.conf.in',
output : 'timesyncd.conf',
command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'],
command : [meson_render_jinja2, config_h, '@INPUT@'],
capture : true,
install : conf.get('ENABLE_TIMESYNCD') == 1 and install_sysconfdir_samples,
install_dir : pkgsysconfdir)

View File

@ -162,7 +162,8 @@ custom_target(
'udev.pc',
input : 'udev.pc.in',
output : 'udev.pc',
command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'],
command : [meson_render_jinja2, config_h, '@INPUT@'],
capture : true,
install : pkgconfigdatadir != 'no',
install_dir : pkgconfigdatadir)

View File

@ -4,6 +4,7 @@ custom_target(
'90-vconsole.rules',
input : '90-vconsole.rules.in',
output : '90-vconsole.rules',
command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'],
command : [meson_render_jinja2, config_h, '@INPUT@'],
capture : true,
install : conf.get('ENABLE_VCONSOLE') == 1,
install_dir : udevrulesdir)

View File

@ -16,7 +16,8 @@ custom_target(
'50-coredump.conf',
input : '50-coredump.conf.in',
output : '50-coredump.conf',
command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'],
command : [meson_render_jinja2, config_h, '@INPUT@'],
capture : true,
install : conf.get('ENABLE_COREDUMP') == 1,
install_dir : sysctldir)

View File

@ -33,7 +33,8 @@ foreach tuple : in_files
file,
input : file + '.in',
output: file,
command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'],
command : [meson_render_jinja2, config_h, '@INPUT@'],
capture : true,
install : tuple[1],
install_dir : sysusersdir)
endforeach

View File

@ -76,14 +76,6 @@ systemd-analyze verify /tmp/.testfile.service
rm /tmp/.testfile.service
# Alias a unit file's name on disk (see #20061)
cp /tmp/testfile.service /tmp/testsrvc
systemd-analyze verify /tmp/testsrvc \
&& { echo 'unexpected success'; exit 1; }
systemd-analyze verify /tmp/testsrvc:alias.service
# Zero exit status since the value used for comparison determine exposure to security threats is by default 100
systemd-analyze security --offline=true /tmp/testfile.service

View File

@ -40,7 +40,8 @@ foreach pair : in_files
pair[0],
input : pair[0] + '.in',
output: pair[0],
command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'],
command : [meson_render_jinja2, config_h, '@INPUT@'],
capture : true,
install : enable_tmpfiles,
install_dir : tmpfilesdir)
else

View File

@ -2,7 +2,6 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
import ast
import os
import re
import sys
@ -28,8 +27,4 @@ def render(filename, defines):
if __name__ == '__main__':
defines = parse_config_h(sys.argv[1])
output = render(sys.argv[2], defines)
with open(sys.argv[3], 'w') as f:
f.write(output)
info = os.stat(sys.argv[2])
os.chmod(sys.argv[3], info.st_mode)
print(render(sys.argv[2], defines))

View File

@ -272,7 +272,8 @@ foreach tuple : in_units
file,
input : file + '.in',
output : file,
command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'],
command : [meson_render_jinja2, config_h, '@INPUT@'],
capture : true,
install : install,
install_dir : systemunitdir)