mirror of
https://git.proxmox.com/git/systemd
synced 2025-08-13 19:19:42 +00:00
New upstream version 248.1
This commit is contained in:
parent
3a6ce6777f
commit
5b5a102a31
@ -42,6 +42,7 @@ BuildPackages=
|
||||
python
|
||||
python-lxml
|
||||
qrencode
|
||||
rsync
|
||||
xz
|
||||
zstd
|
||||
|
||||
|
@ -130,7 +130,7 @@ names for them in UIs.
|
||||
discovered Windows installation might have the identifier `auto-windows` or
|
||||
`auto-windows-10` or so.).
|
||||
|
||||
4. Similar, boot menu entries referring to Apple MacOS X installations should
|
||||
4. Similar, boot menu entries referring to Apple macOS installations should
|
||||
use the identifier `osx` or one that is prefixed with `osx-`. If such an
|
||||
entry is automatically discovered by the boot loader use `auto-osx` as
|
||||
identifier, or `auto-osx-` as prefix for the identifier, see above.
|
||||
|
@ -208,7 +208,7 @@ On EFI, any such images shall be added to the list of valid boot entries.
|
||||
|
||||
Note that these configurations snippets do not need to be the only configuration source for a boot loader. It may extend this list of entries with additional items from other configuration files (for example its own native configuration files) or automatically detected other entries without explicit configuration.
|
||||
|
||||
To make this explicitly clear: this specification is designed with "free" operating systems in mind, starting Windows or MacOS is out of focus with these configuration snippets, use boot-loader specific solutions for that. In the text above, if we say "OS" we hence imply "free", i.e. primarily Linux (though this could be easily be extended to the BSDs and whatnot).
|
||||
To make this explicitly clear: this specification is designed with "free" operating systems in mind, starting Windows or macOS is out of focus with these configuration snippets, use boot-loader specific solutions for that. In the text above, if we say "OS" we hence imply "free", i.e. primarily Linux (though this could be easily be extended to the BSDs and whatnot).
|
||||
|
||||
Note that all paths used in the configuration snippets use a Unix-style "/" as path separator. This needs to be converted to an EFI-style "\" separator in EFI boot loaders.
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
<citerefentry><refentrytitle>systemd-coredump</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
|
||||
a handler for core dumps invoked by the kernel. Whether <command>systemd-coredump</command> is used
|
||||
is determined by the kernel's
|
||||
<varname>kernel.core_pattern</varname> <citerefentry project='man-pages'><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>
|
||||
<varname>kernel.core_pattern</varname> <citerefentry project='man-pages'><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>
|
||||
setting. See
|
||||
<citerefentry><refentrytitle>systemd-coredump</refentrytitle><manvolnum>8</manvolnum></citerefentry>
|
||||
and
|
||||
@ -86,7 +86,9 @@
|
||||
<listitem><para>The maximum size in bytes of a core
|
||||
which will be processed. Core dumps exceeding this size
|
||||
may be stored, but the backtrace will not be generated.
|
||||
</para>
|
||||
Like other sizes in this same config file, the usual
|
||||
suffixes to the base of 1024 are allowed (B, K, M,
|
||||
G, T, P, and E.)</para>
|
||||
|
||||
<para>Setting <varname>Storage=none</varname> and <varname>ProcessSizeMax=0</varname>
|
||||
disables all coredump handling except for a log entry.</para>
|
||||
@ -98,15 +100,18 @@
|
||||
<term><varname>JournalSizeMax=</varname></term>
|
||||
|
||||
<listitem><para>The maximum (uncompressed) size in bytes of a
|
||||
core to be saved.</para></listitem>
|
||||
core to be saved. Unit suffixes are allowed just as in
|
||||
<option>ProcessSizeMax=</option></para></listitem>.
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>MaxUse=</varname></term>
|
||||
<term><varname>KeepFree=</varname></term>
|
||||
|
||||
<listitem><para>Enforce limits on the disk space taken up by
|
||||
externally stored core dumps. <option>MaxUse=</option> makes
|
||||
<listitem><para>Enforce limits on the disk space, specified
|
||||
in bytes, taken up by externally stored core dumps.
|
||||
Unit suffixes are allowed just as in <option>ProcessSizeMax=</option>.
|
||||
<option>MaxUse=</option> makes
|
||||
sure that old core dumps are removed as soon as the total disk
|
||||
space taken up by core dumps grows beyond this limit (defaults
|
||||
to 10% of the total disk size). <option>KeepFree=</option>
|
||||
|
@ -846,6 +846,10 @@
|
||||
<title>Exit status</title>
|
||||
|
||||
<para>On success, 0 is returned, a non-zero failure code otherwise.</para>
|
||||
|
||||
<para>When a command is invoked with <command>with</command>, the exit status of the child is
|
||||
propagated. Effectively, <command>homectl</command> will exit without error if the command is
|
||||
successfully invoked <emphasis>and</emphasis> finishes successfully.</para>
|
||||
</refsect1>
|
||||
|
||||
<xi:include href="common-variables.xml" />
|
||||
|
@ -184,17 +184,20 @@ html = custom_target(
|
||||
depends : html_pages,
|
||||
command : ['echo'])
|
||||
|
||||
run_target(
|
||||
'doc-sync',
|
||||
depends : man_pages + html_pages,
|
||||
command : ['rsync', '-rlv',
|
||||
'--delete-excluded',
|
||||
'--include=man',
|
||||
'--include=*.html',
|
||||
'--exclude=*',
|
||||
'--omit-dir-times',
|
||||
meson.current_build_dir(),
|
||||
get_option('www-target')])
|
||||
rsync = find_program('rsync', required : false)
|
||||
if rsync.found()
|
||||
run_target(
|
||||
'doc-sync',
|
||||
depends : man_pages + html_pages,
|
||||
command : [rsync, '-rlv',
|
||||
'--delete-excluded',
|
||||
'--include=man',
|
||||
'--include=*.html',
|
||||
'--exclude=*',
|
||||
'--omit-dir-times',
|
||||
meson.current_build_dir(),
|
||||
get_option('www-target')])
|
||||
endif
|
||||
|
||||
############################################################
|
||||
|
||||
|
@ -40,7 +40,7 @@ node /org/freedesktop/portable1 {
|
||||
methods:
|
||||
GetImage(in s image,
|
||||
out o object);
|
||||
ListImages(out a(ssbtttso) UNNAMED);
|
||||
ListImages(out a(ssbtttso) images);
|
||||
GetImageOSRelease(in s image,
|
||||
out a{ss} os_release);
|
||||
GetImageMetadata(in s image,
|
||||
@ -249,12 +249,12 @@ node /org/freedesktop/portable1 {
|
||||
node /org/freedesktop/portable1 {
|
||||
interface org.freedesktop.portable1.Image {
|
||||
methods:
|
||||
GetOSRelease(out a{ss} UNNAMED);
|
||||
GetOSRelease(out a{ss} os_release);
|
||||
GetMetadata(in as matches,
|
||||
out s image,
|
||||
out ay os_release,
|
||||
out a{say} units);
|
||||
GetState(out s UNNAMED);
|
||||
GetState(out s state);
|
||||
Attach(in as matches,
|
||||
in s profile,
|
||||
in b runtime,
|
||||
|
@ -65,8 +65,8 @@
|
||||
union type:</para>
|
||||
|
||||
<programlisting>typedef union sd_id128 {
|
||||
uint8_t bytes[16];
|
||||
uint64_t qwords[2];
|
||||
uint8_t bytes[16];
|
||||
uint64_t qwords[2];
|
||||
} sd_id128_t;</programlisting>
|
||||
|
||||
<para>This union type allows accessing the 128-bit ID as 16
|
||||
@ -95,7 +95,7 @@
|
||||
#define SD_MESSAGE_COREDUMP_STR SD_ID128_MAKE_STR(fc,2e,22,bc,6e,e6,47,b6,b9,07,29,ab,34,a2,50,b1)
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
puts("Match for coredumps: MESSAGE_ID=" SD_MESSAGE_COREDUMP_STR);
|
||||
puts("Match for coredumps: MESSAGE_ID=" SD_MESSAGE_COREDUMP_STR);
|
||||
}
|
||||
</programlisting>
|
||||
|
||||
@ -104,7 +104,7 @@ int main(int argc, char **argv) {
|
||||
following example code will output the string
|
||||
"fc2e22bc6ee647b6b90729ab34a250b1":</para>
|
||||
<programlisting>int main(int argc, char *argv[]) {
|
||||
puts("Match for coredumps: %s", SD_ID128_CONST_STR(SD_MESSAGE_COREDUMP));
|
||||
puts("Match for coredumps: %s", SD_ID128_CONST_STR(SD_MESSAGE_COREDUMP));
|
||||
}</programlisting>
|
||||
|
||||
<para><constant>SD_ID128_FORMAT_STR</constant> and <function>SD_ID128_FORMAT_VAL()</function> may
|
||||
@ -113,10 +113,10 @@ int main(int argc, char **argv) {
|
||||
format string, as shown in the following example:</para>
|
||||
|
||||
<programlisting>int main(int argc, char *argv[]) {
|
||||
sd_id128_t id;
|
||||
id = SD_ID128_MAKE(ee,89,be,71,bd,6e,43,d6,91,e6,c5,5d,eb,03,02,07);
|
||||
printf("The ID encoded in this C file is " SD_ID128_FORMAT_STR ".\n", SD_ID128_FORMAT_VAL(id));
|
||||
return 0;
|
||||
sd_id128_t id;
|
||||
id = SD_ID128_MAKE(ee,89,be,71,bd,6e,43,d6,91,e6,c5,5d,eb,03,02,07);
|
||||
printf("The ID encoded in this C file is " SD_ID128_FORMAT_STR ".\n", SD_ID128_FORMAT_VAL(id));
|
||||
return 0;
|
||||
}</programlisting>
|
||||
|
||||
<para><constant>SD_ID128_UUID_FORMAT_STR</constant> is similar to
|
||||
@ -127,20 +127,20 @@ int main(int argc, char **argv) {
|
||||
<para>Use <function>sd_id128_equal()</function> to compare two 128-bit IDs:</para>
|
||||
|
||||
<programlisting>int main(int argc, char *argv[]) {
|
||||
sd_id128_t a, b, c;
|
||||
a = SD_ID128_MAKE(ee,89,be,71,bd,6e,43,d6,91,e6,c5,5d,eb,03,02,07);
|
||||
b = SD_ID128_MAKE(f2,28,88,9c,5f,09,44,15,9d,d7,04,77,58,cb,e7,3e);
|
||||
c = a;
|
||||
assert(sd_id128_equal(a, c));
|
||||
assert(!sd_id128_equal(a, b));
|
||||
return 0;
|
||||
sd_id128_t a, b, c;
|
||||
a = SD_ID128_MAKE(ee,89,be,71,bd,6e,43,d6,91,e6,c5,5d,eb,03,02,07);
|
||||
b = SD_ID128_MAKE(f2,28,88,9c,5f,09,44,15,9d,d7,04,77,58,cb,e7,3e);
|
||||
c = a;
|
||||
assert(sd_id128_equal(a, c));
|
||||
assert(!sd_id128_equal(a, b));
|
||||
return 0;
|
||||
}</programlisting>
|
||||
|
||||
<para>Use <function>sd_id128_is_null()</function> to check if an 128bit ID consists of only
|
||||
<constant>NUL</constant> bytes:</para>
|
||||
|
||||
<programlisting>int main(int argc, char *argv[]) {
|
||||
assert(sd_id128_is_null(SD_ID128_NULL));
|
||||
assert(sd_id128_is_null(SD_ID128_NULL));
|
||||
}</programlisting>
|
||||
|
||||
<para>Note that new, randomized IDs may be generated with
|
||||
|
@ -115,7 +115,7 @@
|
||||
__attribute__((cleanup(sd_login_monitor_unrefp))) sd_login_monitor *m = NULL;
|
||||
int r;
|
||||
…
|
||||
r = sd_login_monitor_default(&m);
|
||||
r = sd_login_monitor_new(NULL, &m);
|
||||
if (r < 0)
|
||||
fprintf(stderr, "Failed to allocate login monitor object: %s\n", strerror(-r));
|
||||
…
|
||||
|
@ -51,7 +51,7 @@
|
||||
|
||||
<listitem><para>The Microsoft Windows EFI boot manager, if installed</para></listitem>
|
||||
|
||||
<listitem><para>The Apple MacOS X boot manager, if installed</para></listitem>
|
||||
<listitem><para>The Apple macOS boot manager, if installed</para></listitem>
|
||||
|
||||
<listitem><para>The EFI Shell binary, if installed</para></listitem>
|
||||
|
||||
@ -193,7 +193,7 @@
|
||||
|
||||
<varlistentry>
|
||||
<term><keycap>a</keycap></term>
|
||||
<listitem><para>OS X</para></listitem>
|
||||
<listitem><para>macOS</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
|
@ -215,7 +215,7 @@
|
||||
|
||||
<row>
|
||||
<entry>8</entry>
|
||||
<entry><citerefentry><refentrytitle>sd-boot</refentrytitle><manvolnum>8</manvolnum></citerefentry> measures the kernel command line in this PCR.</entry>
|
||||
<entry><citerefentry><refentrytitle>sd-boot</refentrytitle><manvolnum>7</manvolnum></citerefentry> measures the kernel command line in this PCR.</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
|
@ -17,22 +17,29 @@
|
||||
|
||||
<refnamediv>
|
||||
<refname>systemd-cryptsetup@.service</refname>
|
||||
<!-- <refname>system-systemd\x2dcryptsetup.slice</refname> — this causes meson to go haywire because it
|
||||
thinks this is a (windows) path. Let's just not create the alias for this name, and only include it
|
||||
in the synopsis. -->
|
||||
<refname>systemd-cryptsetup</refname>
|
||||
<refpurpose>Full disk decryption logic</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<para><filename>systemd-cryptsetup@.service</filename></para>
|
||||
<para><filename>system-systemd\x2dcryptsetup.slice</filename></para>
|
||||
<para><filename>/usr/lib/systemd/systemd-cryptsetup</filename></para>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para><filename>systemd-cryptsetup@.service</filename> is a
|
||||
service responsible for setting up encrypted block devices. It is
|
||||
instantiated for each device that requires decryption for
|
||||
access.</para>
|
||||
<para><filename>systemd-cryptsetup@.service</filename> is a service responsible for setting up encrypted
|
||||
block devices. It is instantiated for each device that requires decryption for access.</para>
|
||||
|
||||
<para><filename>systemd-cryptsetup@.service</filename> instances are part of the
|
||||
<filename>system-systemd\x2dcryptsetup.slice</filename> slice, which is destroyed only very late in the
|
||||
shutdown procedure. This allows the encrypted devices to remain up until filesystems have been unmounted.
|
||||
</para>
|
||||
|
||||
<para><filename>systemd-cryptsetup@.service</filename> will ask
|
||||
for hard disk passwords via the <ulink
|
||||
|
@ -34,7 +34,7 @@
|
||||
<citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, and provides the implementation for
|
||||
<citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
|
||||
<command>pull-raw</command>, <command>pull-tar</command>, <command>import-raw</command>,
|
||||
<command>import-tar</command>, <command>export-raw</command>, and <command>export-tar</command> commands.</para>
|
||||
<command>import-tar</command>, <command>import-fs</command>, <command>export-raw</command>, and <command>export-tar</command> commands.</para>
|
||||
|
||||
<para>See
|
||||
<citerefentry><refentrytitle>org.freedesktop.import1</refentrytitle><manvolnum>5</manvolnum></citerefentry>
|
||||
|
@ -48,10 +48,9 @@
|
||||
<title>Setup Information</title>
|
||||
|
||||
<para>The system must be running systemd with a full unified cgroup hierarchy for the expected cgroups-v2 features.
|
||||
Furthermore, resource accounting must be turned on for all units monitored by <command>systemd-oomd</command>.
|
||||
The easiest way to turn on resource accounting is by ensuring the values for <varname>DefaultCPUAccounting</varname>,
|
||||
<varname>DefaultIOAccounting</varname>, <varname>DefaultMemoryAccounting</varname>, and
|
||||
<varname>DefaultTasksAccounting</varname> are set to <constant>true</constant> in
|
||||
Furthermore, memory accounting must be turned on for all units monitored by <command>systemd-oomd</command>.
|
||||
The easiest way to turn on memory accounting is by ensuring the value for <varname>DefaultMemoryAccounting=</varname>
|
||||
is set to <constant>true</constant> in
|
||||
<citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
|
||||
|
||||
<para>You will need a kernel compiled with PSI support. This is available in Linux 4.20 and above.</para>
|
||||
|
@ -263,16 +263,18 @@
|
||||
<refsect1>
|
||||
<title>Exit status</title>
|
||||
|
||||
<para>On success, 0 is returned. If the configuration was syntactically invalid (syntax errors,
|
||||
missing arguments, …), so some lines had to be ignored, but no other errors occurred,
|
||||
<constant>65</constant> is returned (<constant>EX_DATAERR</constant> from
|
||||
<filename>/usr/include/sysexits.h</filename>). If the configuration was syntactically valid, but
|
||||
could not be executed (lack of permissions, creation of files in missing directories, invalid
|
||||
contents when writing to <filename>/sys/</filename> values, …), <constant>73</constant> is
|
||||
returned (<constant>EX_CANTCREAT</constant> from <filename>/usr/include/sysexits.h</filename>).
|
||||
Otherwise, <constant>1</constant> is returned (<constant>EXIT_FAILURE</constant> from
|
||||
<filename>/usr/include/stdlib.h</filename>).
|
||||
</para>
|
||||
<para>On success, 0 is returned. If the configuration was syntactically invalid (syntax errors, missing
|
||||
arguments, …), so some lines had to be ignored, but no other errors occurred, <constant>65</constant> is
|
||||
returned (<constant>EX_DATAERR</constant> from <filename>/usr/include/sysexits.h</filename>). If the
|
||||
configuration was syntactically valid, but could not be executed (lack of permissions, creation of files
|
||||
in missing directories, invalid contents when writing to <filename>/sys/</filename> values, …),
|
||||
<constant>73</constant> is returned (<constant>EX_CANTCREAT</constant> from
|
||||
<filename>/usr/include/sysexits.h</filename>). Otherwise, <constant>1</constant> is returned
|
||||
(<constant>EXIT_FAILURE</constant> from <filename>/usr/include/stdlib.h</filename>).</para>
|
||||
|
||||
<para>Note: when creating items, if the target already exists, but is of the wrong type or otherwise does
|
||||
not match the requested state, and forced operation has not been requested with <literal>+</literal>,
|
||||
a message is emitted, but the failure is otherwise ignored.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
|
@ -88,8 +88,8 @@
|
||||
<term><option>-e</option></term>
|
||||
<term><option>--exec-delay=</option></term>
|
||||
<listitem>
|
||||
<para>Delay the execution of <varname>RUN</varname>
|
||||
instructions by the given number of seconds. This option
|
||||
<para>Delay the execution of each <varname>RUN{<replaceable>program</replaceable>}</varname>
|
||||
parameter by the given number of seconds. This option
|
||||
might be useful when debugging system crashes during
|
||||
coldplug caused by loading non-working kernel
|
||||
modules.</para>
|
||||
@ -160,7 +160,7 @@
|
||||
<term><varname>udev.exec_delay=</varname></term>
|
||||
<term><varname>rd.udev.exec_delay=</varname></term>
|
||||
<listitem>
|
||||
<para>Delay the execution of <varname>RUN</varname> instructions by the given
|
||||
<para>Delay the execution of each <varname>RUN{<replaceable>program</replaceable>}</varname> parameter by the given
|
||||
number of seconds. This option might be useful when
|
||||
debugging system crashes during coldplug caused by loading
|
||||
non-working kernel modules.</para>
|
||||
|
@ -2651,7 +2651,8 @@ StandardInputData=SWNrIHNpdHplIGRhIHVuJyBlc3NlIEtsb3BzLAp1ZmYgZWVtYWwga2xvcHAncy
|
||||
this option to configure the logging system to drop log messages of a specific service above the specified
|
||||
level. For example, set <varname>LogLevelMax=</varname><option>info</option> in order to turn off debug logging
|
||||
of a particularly chatty unit. Note that the configured level is applied to any log messages written by any
|
||||
of the processes belonging to this unit, sent via any supported logging protocol. The filtering is applied
|
||||
of the processes belonging to this unit, as well as any log messages written by the system manager process
|
||||
(PID 1) in reference to this unit, sent via any supported logging protocol. The filtering is applied
|
||||
early in the logging pipeline, before any kind of further processing is done. Moreover, messages which pass
|
||||
through this filter successfully might still be dropped by filters applied at a later stage in the logging
|
||||
subsystem. For example, <varname>MaxLevelStore=</varname> configured in
|
||||
|
@ -58,8 +58,8 @@ c+ /dev/char-device-to-[re]create mode user group - major
|
||||
b /dev/block-device-to-create mode user group - major:minor
|
||||
b+ /dev/block-device-to-[re]create mode user group - major:minor
|
||||
C /target/to/create - - - - /source/to/copy
|
||||
x /path-or-glob/to/ignore - - - - -
|
||||
X /path-or-glob/to/ignore/recursively - - - - -
|
||||
x /path-or-glob/to/ignore/recursively - - - - -
|
||||
X /path-or-glob/to/ignore - - - - -
|
||||
r /empty/dir/to/remove - - - - -
|
||||
R /dir/to/remove/recursively - - - - -
|
||||
z /path-or-glob/to/adjust/mode mode user group - -
|
||||
|
@ -63,8 +63,8 @@
|
||||
<term><varname>exec_delay=</varname></term>
|
||||
|
||||
<listitem>
|
||||
<para>An integer. Delay the execution of <varname>RUN</varname>
|
||||
instructions by the given number of seconds. This option
|
||||
<para>An integer. Delay the execution of each <varname>RUN{<replaceable>program</replaceable>}</varname>
|
||||
parameter by the given number of seconds. This option
|
||||
might be useful when debugging system crashes during
|
||||
coldplug caused by loading non-working kernel
|
||||
modules.</para>
|
||||
|
@ -710,7 +710,7 @@ if time_epoch == -1
|
||||
if time_epoch == '' and git.found() and run_command('test', '-e', '.git').returncode() == 0
|
||||
# If we're in a git repository, use the creation time of the latest git tag.
|
||||
latest_tag = run_command('git', 'describe', '--abbrev=0', '--tags').stdout().strip()
|
||||
time_epoch = run_command('git', 'log', '-1', '--format=%at', latest_tag).stdout()
|
||||
time_epoch = run_command('git', 'log', '--no-show-signature', '-1', '--format=%at', latest_tag).stdout()
|
||||
endif
|
||||
if time_epoch == ''
|
||||
NEWS = files('NEWS')
|
||||
@ -797,7 +797,7 @@ if not meson.is_cross_build()
|
||||
id = id_result.stdout().to_int()
|
||||
if id != 65534
|
||||
warning('\n' +
|
||||
'The local group with the configured group name "@0@" of the nobody group does not have UID 65534 (it has @1@).\n'.format(nobody_group, id) +
|
||||
'The local group with the configured group name "@0@" of the nobody group does not have GID 65534 (it has @1@).\n'.format(nobody_group, id) +
|
||||
'Your build will result in an group table setup that is incompatible with the local system.')
|
||||
endif
|
||||
endif
|
||||
|
@ -30,7 +30,7 @@ __get_machines() {
|
||||
}
|
||||
|
||||
_machinectl() {
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword
|
||||
local i verb comps
|
||||
|
||||
local -A OPTS=(
|
||||
|
@ -30,7 +30,7 @@ __get_links() {
|
||||
|
||||
_networkctl() {
|
||||
local i verb comps
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword
|
||||
local -A OPTS=(
|
||||
[STANDALONE]='-a --all -h --help --version --no-pager --no-legend -s --stats -l --full'
|
||||
[ARG]='-n --lines'
|
||||
|
@ -46,7 +46,7 @@ __get_syscall_sets() {
|
||||
|
||||
_systemd_analyze() {
|
||||
local i verb comps mode
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword
|
||||
|
||||
local -A OPTS=(
|
||||
[STANDALONE]='-h --help --version --system --user --global --order --require --no-pager
|
||||
|
@ -25,7 +25,7 @@ __contains_word() {
|
||||
}
|
||||
|
||||
_systemd_cat() {
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword
|
||||
local i verb comps
|
||||
|
||||
local -A OPTS=(
|
||||
|
@ -37,7 +37,7 @@ __get_units_have_cgroup() {
|
||||
}
|
||||
|
||||
_systemd_cgls() {
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword
|
||||
local i verb comps
|
||||
|
||||
local -A OPTS=(
|
||||
|
@ -29,7 +29,7 @@ __get_machines() {
|
||||
}
|
||||
|
||||
_systemd_cgtop() {
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword
|
||||
local comps
|
||||
|
||||
local -A OPTS=(
|
||||
|
@ -24,7 +24,7 @@ __contains_word() {
|
||||
}
|
||||
|
||||
_systemd-delta() {
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword
|
||||
local comps
|
||||
|
||||
local -A OPTS=(
|
||||
|
@ -24,7 +24,7 @@ __contains_word() {
|
||||
}
|
||||
|
||||
_systemd_detect_virt() {
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword
|
||||
local i verb comps
|
||||
|
||||
local -A OPTS=(
|
||||
|
@ -26,7 +26,7 @@ __contains_word () {
|
||||
|
||||
_systemd_id128() {
|
||||
local i verb comps
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword
|
||||
local -A OPTS=(
|
||||
[STANDALONE]='-h --help --version -p --pretty'
|
||||
[ARG]='-a --app-specific'
|
||||
|
@ -58,7 +58,7 @@ __get_rlimit() {
|
||||
}
|
||||
|
||||
_systemd_nspawn() {
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword
|
||||
local i verb comps
|
||||
|
||||
local -A OPTS=(
|
||||
|
@ -30,7 +30,7 @@ __get_names() {
|
||||
|
||||
_systemd_path() {
|
||||
local comps
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword
|
||||
local -A OPTS=(
|
||||
[STANDALONE]='-h --help --version'
|
||||
[ARG]='--suffix'
|
||||
|
@ -39,7 +39,7 @@ _localectl_set-x11-keymap() {
|
||||
local -a _file _layout _model _variant _options
|
||||
local _xorg_lst
|
||||
_xorg_lst=${"$($commands[pkg-config] xkeyboard-config --variable=xkb_base)"}
|
||||
_file=( ${(ps:\n\!:)"$(<$_xorg_lst/rules/xorg.lst)"} )
|
||||
_file=( ${(ps:\n\!:)"$(<$_xorg_lst/rules/base.lst)"} )
|
||||
_layout=( ${${${(M)${(f)_file[2]}:# *}# }%% *} )
|
||||
_model=( ${${${(M)${(f)_file[1]}:# *}# }%% *} )
|
||||
_variant=( ${${${(M)${(f)_file[3]}:# *}# }%% *} )
|
||||
|
@ -151,7 +151,7 @@ static int exec_process(const char *name, char **argv, char **env, int start_fd,
|
||||
|
||||
envp[n_env++] = k;
|
||||
} else {
|
||||
_cleanup_free_ char *p;
|
||||
_cleanup_free_ char *p = NULL;
|
||||
const char *n;
|
||||
|
||||
p = strjoin(*s, "=");
|
||||
@ -421,7 +421,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case ARG_FDNAME: {
|
||||
_cleanup_strv_free_ char **names;
|
||||
_cleanup_strv_free_ char **names = NULL;
|
||||
char **s;
|
||||
|
||||
names = strv_split(optarg, ":");
|
||||
@ -430,7 +430,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
|
||||
STRV_FOREACH(s, names)
|
||||
if (!fdname_is_valid(*s)) {
|
||||
_cleanup_free_ char *esc;
|
||||
_cleanup_free_ char *esc = NULL;
|
||||
|
||||
esc = cescape(*s);
|
||||
log_warning("File descriptor name \"%s\" is not valid.", esc);
|
||||
|
@ -350,7 +350,7 @@ int cache_efi_options_variable(void) {
|
||||
* (NB: For testing purposes, we still check the $SYSTEMD_EFI_OPTIONS env var before accessing this
|
||||
* cache, even when in SecureBoot mode.) */
|
||||
if (is_efi_secure_boot()) {
|
||||
_cleanup_free_ char *k;
|
||||
_cleanup_free_ char *k = NULL;
|
||||
|
||||
k = efi_variable_path(EFI_VENDOR_SYSTEMD, "SystemdOptions");
|
||||
if (!k)
|
||||
|
@ -57,7 +57,7 @@ int fdopen_unlocked(int fd, const char *options, FILE **ret) {
|
||||
}
|
||||
|
||||
int take_fdopen_unlocked(int *fd, const char *options, FILE **ret) {
|
||||
int r;
|
||||
int r;
|
||||
|
||||
assert(fd);
|
||||
|
||||
@ -1003,7 +1003,6 @@ int chase_symlinks_and_fopen_unlocked(
|
||||
_cleanup_close_ int fd = -1;
|
||||
_cleanup_free_ char *final_path = NULL;
|
||||
int mode_flags, r;
|
||||
FILE *f;
|
||||
|
||||
assert(path);
|
||||
assert(open_flags);
|
||||
@ -1017,12 +1016,10 @@ int chase_symlinks_and_fopen_unlocked(
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
|
||||
r = fdopen_unlocked(fd, open_flags, &f);
|
||||
r = take_fdopen_unlocked(&fd, open_flags, ret_file);
|
||||
if (r < 0)
|
||||
return r;
|
||||
TAKE_FD(fd);
|
||||
|
||||
*ret_file = f;
|
||||
if (ret_path)
|
||||
*ret_path = TAKE_PTR(final_path);
|
||||
return 0;
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "path-util.h"
|
||||
#include "process-util.h"
|
||||
#include "random-util.h"
|
||||
#include "ratelimit.h"
|
||||
#include "stat-util.h"
|
||||
#include "stdio-util.h"
|
||||
#include "string-util.h"
|
||||
@ -1715,3 +1716,23 @@ do_rename:
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int posix_fallocate_loop(int fd, uint64_t offset, uint64_t size) {
|
||||
RateLimit rl;
|
||||
int r;
|
||||
|
||||
r = posix_fallocate(fd, offset, size); /* returns positive errnos on error */
|
||||
if (r != EINTR)
|
||||
return -r; /* Let's return negative errnos, like common in our codebase */
|
||||
|
||||
/* On EINTR try a couple of times more, but protect against busy looping
|
||||
* (not more than 16 times per 10s) */
|
||||
rl = (RateLimit) { 10 * USEC_PER_SEC, 16 };
|
||||
while (ratelimit_below(&rl)) {
|
||||
r = posix_fallocate(fd, offset, size);
|
||||
if (r != EINTR)
|
||||
return -r;
|
||||
}
|
||||
|
||||
return -EINTR;
|
||||
}
|
||||
|
@ -146,3 +146,5 @@ int conservative_renameat(int olddirfd, const char *oldpath, int newdirfd, const
|
||||
static inline int conservative_rename(const char *oldpath, const char *newpath) {
|
||||
return conservative_renameat(AT_FDCWD, oldpath, AT_FDCWD, newpath);
|
||||
}
|
||||
|
||||
int posix_fallocate_loop(int fd, uint64_t offset, uint64_t size);
|
||||
|
@ -772,7 +772,7 @@ void lookup_paths_log(LookupPaths *p) {
|
||||
log_debug("Ignoring unit files.");
|
||||
p->search_path = strv_free(p->search_path);
|
||||
} else {
|
||||
_cleanup_free_ char *t;
|
||||
_cleanup_free_ char *t = NULL;
|
||||
|
||||
t = strv_join(p->search_path, "\n\t");
|
||||
log_debug("Looking for unit files in (higher priority first):\n\t%s", strna(t));
|
||||
|
@ -47,7 +47,7 @@ static int proc_cmdline_extract_first(const char **p, char **ret_word, ProcCmdli
|
||||
_cleanup_free_ char *word = NULL;
|
||||
const char *c;
|
||||
|
||||
r = extract_first_word(&q, &word, NULL, EXTRACT_UNQUOTE|EXTRACT_RELAX);
|
||||
r = extract_first_word(&q, &word, NULL, EXTRACT_UNQUOTE|EXTRACT_RELAX|EXTRACT_RETAIN_ESCAPE);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0)
|
||||
|
@ -52,7 +52,7 @@ static volatile int cached_color_mode = _COLOR_INVALID;
|
||||
static volatile int cached_underline_enabled = -1;
|
||||
|
||||
int chvt(int vt) {
|
||||
_cleanup_close_ int fd;
|
||||
_cleanup_close_ int fd = -1;
|
||||
|
||||
/* Switch to the specified vt number. If the VT is specified <= 0 switch to the VT the kernel log messages go,
|
||||
* if that's configured. */
|
||||
@ -514,7 +514,7 @@ int terminal_vhangup_fd(int fd) {
|
||||
}
|
||||
|
||||
int terminal_vhangup(const char *name) {
|
||||
_cleanup_close_ int fd;
|
||||
_cleanup_close_ int fd = -1;
|
||||
|
||||
fd = open_terminal(name, O_RDWR|O_NOCTTY|O_CLOEXEC|O_NONBLOCK);
|
||||
if (fd < 0)
|
||||
|
@ -1547,7 +1547,7 @@ int time_change_fd(void) {
|
||||
.it_value.tv_sec = TIME_T_MAX,
|
||||
};
|
||||
|
||||
_cleanup_close_ int fd;
|
||||
_cleanup_close_ int fd = -1;
|
||||
|
||||
assert_cc(sizeof(time_t) == sizeof(TIME_T_MAX));
|
||||
|
||||
|
@ -126,7 +126,7 @@ static int acquire_path(void) {
|
||||
strv_free_and_replace(arg_path, a);
|
||||
|
||||
if (DEBUG_LOGGING) {
|
||||
_cleanup_free_ char *j;
|
||||
_cleanup_free_ char *j = NULL;
|
||||
|
||||
j = strv_join(arg_path, ":");
|
||||
log_debug("Using %s as boot loader drop-in search path.", j);
|
||||
|
@ -312,7 +312,7 @@ static int status_variables(void) {
|
||||
}
|
||||
|
||||
static int boot_entry_file_check(const char *root, const char *p) {
|
||||
_cleanup_free_ char *path;
|
||||
_cleanup_free_ char *path = NULL;
|
||||
|
||||
path = path_join(root, p);
|
||||
if (!path)
|
||||
|
@ -456,7 +456,7 @@ static VOID print_status(Config *config, CHAR16 *loaded_image_path) {
|
||||
|
||||
device_path = DevicePathFromHandle(entry->device);
|
||||
if (device_path) {
|
||||
_cleanup_freepool_ CHAR16 *str;
|
||||
_cleanup_freepool_ CHAR16 *str = NULL;
|
||||
|
||||
str = DevicePathToStr(device_path);
|
||||
Print(L"device handle '%s'\n", str);
|
||||
|
@ -92,7 +92,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
||||
* is non-NULL explicitly.) */
|
||||
if (efivar_get_raw(LOADER_GUID, L"LoaderImageIdentifier", NULL, NULL) != EFI_SUCCESS &&
|
||||
loaded_image->FilePath) {
|
||||
_cleanup_freepool_ CHAR16 *s;
|
||||
_cleanup_freepool_ CHAR16 *s = NULL;
|
||||
|
||||
s = DevicePathToStr(loaded_image->FilePath);
|
||||
efivar_set(LOADER_GUID, L"LoaderImageIdentifier", s, 0);
|
||||
@ -100,7 +100,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
||||
|
||||
/* if LoaderFirmwareInfo is not set, let's set it */
|
||||
if (efivar_get_raw(LOADER_GUID, L"LoaderFirmwareInfo", NULL, NULL) != EFI_SUCCESS) {
|
||||
_cleanup_freepool_ CHAR16 *s;
|
||||
_cleanup_freepool_ CHAR16 *s = NULL;
|
||||
|
||||
s = PoolPrint(L"%s %d.%02d", ST->FirmwareVendor, ST->FirmwareRevision >> 16, ST->FirmwareRevision & 0xffff);
|
||||
efivar_set(LOADER_GUID, L"LoaderFirmwareInfo", s, 0);
|
||||
@ -108,7 +108,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
||||
|
||||
/* ditto for LoaderFirmwareType */
|
||||
if (efivar_get_raw(LOADER_GUID, L"LoaderFirmwareType", NULL, NULL) != EFI_SUCCESS) {
|
||||
_cleanup_freepool_ CHAR16 *s;
|
||||
_cleanup_freepool_ CHAR16 *s = NULL;
|
||||
|
||||
s = PoolPrint(L"UEFI %d.%02d", ST->Hdr.Revision >> 16, ST->Hdr.Revision & 0xffff);
|
||||
efivar_set(LOADER_GUID, L"LoaderFirmwareType", s, 0);
|
||||
|
@ -379,7 +379,7 @@ EFI_STATUS file_read(EFI_FILE_HANDLE dir, const CHAR16 *name, UINTN off, UINTN s
|
||||
return err;
|
||||
|
||||
if (size == 0) {
|
||||
_cleanup_freepool_ EFI_FILE_INFO *info;
|
||||
_cleanup_freepool_ EFI_FILE_INFO *info = NULL;
|
||||
|
||||
info = LibFileInfo(handle);
|
||||
if (!info)
|
||||
|
@ -797,7 +797,7 @@ static Set* member_set_free(Set *s) {
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(Set*, member_set_free);
|
||||
|
||||
static int on_interface(const char *interface, uint64_t flags, void *userdata) {
|
||||
_cleanup_(member_freep) Member *m;
|
||||
_cleanup_(member_freep) Member *m = NULL;
|
||||
Set *members = userdata;
|
||||
int r;
|
||||
|
||||
@ -828,7 +828,7 @@ static int on_interface(const char *interface, uint64_t flags, void *userdata) {
|
||||
}
|
||||
|
||||
static int on_method(const char *interface, const char *name, const char *signature, const char *result, uint64_t flags, void *userdata) {
|
||||
_cleanup_(member_freep) Member *m;
|
||||
_cleanup_(member_freep) Member *m = NULL;
|
||||
Set *members = userdata;
|
||||
int r;
|
||||
|
||||
@ -871,7 +871,7 @@ static int on_method(const char *interface, const char *name, const char *signat
|
||||
}
|
||||
|
||||
static int on_signal(const char *interface, const char *name, const char *signature, uint64_t flags, void *userdata) {
|
||||
_cleanup_(member_freep) Member *m;
|
||||
_cleanup_(member_freep) Member *m = NULL;
|
||||
Set *members = userdata;
|
||||
int r;
|
||||
|
||||
@ -910,7 +910,7 @@ static int on_signal(const char *interface, const char *name, const char *signat
|
||||
}
|
||||
|
||||
static int on_property(const char *interface, const char *name, const char *signature, bool writable, uint64_t flags, void *userdata) {
|
||||
_cleanup_(member_freep) Member *m;
|
||||
_cleanup_(member_freep) Member *m = NULL;
|
||||
Set *members = userdata;
|
||||
int r;
|
||||
|
||||
|
@ -698,8 +698,7 @@ int bpf_firewall_install(Unit *u) {
|
||||
if (r < 0)
|
||||
return log_unit_error_errno(u, r, "Failed to determine cgroup path: %m");
|
||||
|
||||
flags = (supported == BPF_FIREWALL_SUPPORTED_WITH_MULTI &&
|
||||
(u->type == UNIT_SLICE || unit_cgroup_delegate(u))) ? BPF_F_ALLOW_MULTI : 0;
|
||||
flags = supported == BPF_FIREWALL_SUPPORTED_WITH_MULTI ? BPF_F_ALLOW_MULTI : 0;
|
||||
|
||||
/* Unref the old BPF program (which will implicitly detach it) right before attaching the new program, to
|
||||
* minimize the time window when we don't account for IP traffic. */
|
||||
@ -707,8 +706,7 @@ int bpf_firewall_install(Unit *u) {
|
||||
u->ip_bpf_ingress_installed = bpf_program_unref(u->ip_bpf_ingress_installed);
|
||||
|
||||
if (u->ip_bpf_egress) {
|
||||
r = bpf_program_cgroup_attach(u->ip_bpf_egress, BPF_CGROUP_INET_EGRESS, path,
|
||||
flags | (set_isempty(u->ip_bpf_custom_egress) ? 0 : BPF_F_ALLOW_MULTI));
|
||||
r = bpf_program_cgroup_attach(u->ip_bpf_egress, BPF_CGROUP_INET_EGRESS, path, flags);
|
||||
if (r < 0)
|
||||
return log_unit_error_errno(u, r, "Attaching egress BPF program to cgroup %s failed: %m", path);
|
||||
|
||||
@ -717,8 +715,7 @@ int bpf_firewall_install(Unit *u) {
|
||||
}
|
||||
|
||||
if (u->ip_bpf_ingress) {
|
||||
r = bpf_program_cgroup_attach(u->ip_bpf_ingress, BPF_CGROUP_INET_INGRESS, path,
|
||||
flags | (set_isempty(u->ip_bpf_custom_ingress) ? 0 : BPF_F_ALLOW_MULTI));
|
||||
r = bpf_program_cgroup_attach(u->ip_bpf_ingress, BPF_CGROUP_INET_INGRESS, path, flags);
|
||||
if (r < 0)
|
||||
return log_unit_error_errno(u, r, "Attaching ingress BPF program to cgroup %s failed: %m", path);
|
||||
|
||||
|
@ -420,7 +420,7 @@ void cgroup_context_dump(Unit *u, FILE* f, const char *prefix) {
|
||||
"%sManagedOOMSwap: %s\n"
|
||||
"%sManagedOOMMemoryPressure: %s\n"
|
||||
"%sManagedOOMMemoryPressureLimit: " PERMYRIAD_AS_PERCENT_FORMAT_STR "\n"
|
||||
"%sManagedOOMPreference: %s%%\n",
|
||||
"%sManagedOOMPreference: %s\n",
|
||||
prefix, yes_no(c->cpu_accounting),
|
||||
prefix, yes_no(c->io_accounting),
|
||||
prefix, yes_no(c->blockio_accounting),
|
||||
@ -2786,11 +2786,10 @@ int unit_check_oomd_kill(Unit *u) {
|
||||
return 0;
|
||||
|
||||
if (n > 0)
|
||||
log_struct(LOG_NOTICE,
|
||||
"MESSAGE_ID=" SD_MESSAGE_UNIT_OOMD_KILL_STR,
|
||||
LOG_UNIT_ID(u),
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
LOG_UNIT_MESSAGE(u, "systemd-oomd killed %"PRIu64" process(es) in this unit.", n));
|
||||
log_unit_struct(u, LOG_NOTICE,
|
||||
"MESSAGE_ID=" SD_MESSAGE_UNIT_OOMD_KILL_STR,
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
LOG_UNIT_MESSAGE(u, "systemd-oomd killed %"PRIu64" process(es) in this unit.", n));
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -2818,11 +2817,10 @@ int unit_check_oom(Unit *u) {
|
||||
if (!increased)
|
||||
return 0;
|
||||
|
||||
log_struct(LOG_NOTICE,
|
||||
"MESSAGE_ID=" SD_MESSAGE_UNIT_OUT_OF_MEMORY_STR,
|
||||
LOG_UNIT_ID(u),
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
LOG_UNIT_MESSAGE(u, "A process of this unit has been killed by the OOM killer."));
|
||||
log_unit_struct(u, LOG_NOTICE,
|
||||
"MESSAGE_ID=" SD_MESSAGE_UNIT_OUT_OF_MEMORY_STR,
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
LOG_UNIT_MESSAGE(u, "A process of this unit has been killed by the OOM killer."));
|
||||
|
||||
if (UNIT_VTABLE(u)->notify_cgroup_oom)
|
||||
UNIT_VTABLE(u)->notify_cgroup_oom(u);
|
||||
|
@ -1626,7 +1626,7 @@ int bus_exec_context_set_transient_property(
|
||||
|
||||
unit_write_settingf(u, flags, name, "RootHash=");
|
||||
} else {
|
||||
_cleanup_free_ void *p;
|
||||
_cleanup_free_ void *p = NULL;
|
||||
|
||||
encoded = hexmem(roothash_decoded, roothash_decoded_size);
|
||||
if (!encoded)
|
||||
@ -1672,7 +1672,7 @@ int bus_exec_context_set_transient_property(
|
||||
|
||||
unit_write_settingf(u, flags, name, "RootHashSignature=");
|
||||
} else {
|
||||
_cleanup_free_ void *p;
|
||||
_cleanup_free_ void *p = NULL;
|
||||
ssize_t len;
|
||||
|
||||
len = base64mem(roothash_sig_decoded, roothash_sig_decoded_size, &encoded);
|
||||
|
@ -96,7 +96,7 @@ static int bus_path_set_transient_property(
|
||||
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path in %s is not absolute: %s", type_name, path);
|
||||
|
||||
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
||||
_cleanup_free_ char *k;
|
||||
_cleanup_free_ char *k = NULL;
|
||||
PathSpec *s;
|
||||
|
||||
k = strdup(path);
|
||||
|
@ -4309,24 +4309,23 @@ static int exec_child(
|
||||
r = find_executable_full(command->path, false, &executable, &executable_fd);
|
||||
if (r < 0) {
|
||||
if (r != -ENOMEM && (command->flags & EXEC_COMMAND_IGNORE_FAILURE)) {
|
||||
log_struct_errno(LOG_INFO, r,
|
||||
"MESSAGE_ID=" SD_MESSAGE_SPAWN_FAILED_STR,
|
||||
LOG_UNIT_ID(unit),
|
||||
LOG_UNIT_INVOCATION_ID(unit),
|
||||
LOG_UNIT_MESSAGE(unit, "Executable %s missing, skipping: %m",
|
||||
command->path),
|
||||
"EXECUTABLE=%s", command->path);
|
||||
log_unit_struct_errno(unit, LOG_INFO, r,
|
||||
"MESSAGE_ID=" SD_MESSAGE_SPAWN_FAILED_STR,
|
||||
LOG_UNIT_INVOCATION_ID(unit),
|
||||
LOG_UNIT_MESSAGE(unit, "Executable %s missing, skipping: %m",
|
||||
command->path),
|
||||
"EXECUTABLE=%s", command->path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
*exit_status = EXIT_EXEC;
|
||||
return log_struct_errno(LOG_INFO, r,
|
||||
"MESSAGE_ID=" SD_MESSAGE_SPAWN_FAILED_STR,
|
||||
LOG_UNIT_ID(unit),
|
||||
LOG_UNIT_INVOCATION_ID(unit),
|
||||
LOG_UNIT_MESSAGE(unit, "Failed to locate executable %s: %m",
|
||||
command->path),
|
||||
"EXECUTABLE=%s", command->path);
|
||||
|
||||
return log_unit_struct_errno(unit, LOG_INFO, r,
|
||||
"MESSAGE_ID=" SD_MESSAGE_SPAWN_FAILED_STR,
|
||||
LOG_UNIT_INVOCATION_ID(unit),
|
||||
LOG_UNIT_MESSAGE(unit, "Failed to locate executable %s: %m",
|
||||
command->path),
|
||||
"EXECUTABLE=%s", command->path);
|
||||
}
|
||||
|
||||
r = add_shifted_fd(keep_fds, ELEMENTSOF(keep_fds), &n_keep_fds, executable_fd, &executable_fd);
|
||||
@ -4630,15 +4629,14 @@ static int exec_child(
|
||||
final_argv = command->argv;
|
||||
|
||||
if (DEBUG_LOGGING) {
|
||||
_cleanup_free_ char *line;
|
||||
_cleanup_free_ char *line = NULL;
|
||||
|
||||
line = exec_command_line(final_argv);
|
||||
if (line)
|
||||
log_struct(LOG_DEBUG,
|
||||
"EXECUTABLE=%s", executable,
|
||||
LOG_UNIT_MESSAGE(unit, "Executing: %s", line),
|
||||
LOG_UNIT_ID(unit),
|
||||
LOG_UNIT_INVOCATION_ID(unit));
|
||||
log_unit_struct(unit, LOG_DEBUG,
|
||||
"EXECUTABLE=%s", executable,
|
||||
LOG_UNIT_MESSAGE(unit, "Executing: %s", line),
|
||||
LOG_UNIT_INVOCATION_ID(unit));
|
||||
}
|
||||
|
||||
if (exec_fd >= 0) {
|
||||
@ -4730,14 +4728,13 @@ int exec_spawn(Unit *unit,
|
||||
and, until the next SELinux policy changes, we save further reloads in future children. */
|
||||
mac_selinux_maybe_reload();
|
||||
|
||||
log_struct(LOG_DEBUG,
|
||||
LOG_UNIT_MESSAGE(unit, "About to execute %s", line),
|
||||
"EXECUTABLE=%s", command->path, /* We won't know the real executable path until we create
|
||||
the mount namespace in the child, but we want to log
|
||||
from the parent, so we need to use the (possibly
|
||||
inaccurate) path here. */
|
||||
LOG_UNIT_ID(unit),
|
||||
LOG_UNIT_INVOCATION_ID(unit));
|
||||
log_unit_struct(unit, LOG_DEBUG,
|
||||
LOG_UNIT_MESSAGE(unit, "About to execute %s", line),
|
||||
"EXECUTABLE=%s", command->path, /* We won't know the real executable path until we create
|
||||
the mount namespace in the child, but we want to log
|
||||
from the parent, so we need to use the (possibly
|
||||
inaccurate) path here. */
|
||||
LOG_UNIT_INVOCATION_ID(unit));
|
||||
|
||||
if (params->cgroup_path) {
|
||||
r = exec_parameters_get_cgroup_path(params, &subcgroup_path);
|
||||
@ -4781,13 +4778,12 @@ int exec_spawn(Unit *unit,
|
||||
exit_status_to_string(exit_status,
|
||||
EXIT_STATUS_LIBC | EXIT_STATUS_SYSTEMD);
|
||||
|
||||
log_struct_errno(LOG_ERR, r,
|
||||
"MESSAGE_ID=" SD_MESSAGE_SPAWN_FAILED_STR,
|
||||
LOG_UNIT_ID(unit),
|
||||
LOG_UNIT_INVOCATION_ID(unit),
|
||||
LOG_UNIT_MESSAGE(unit, "Failed at step %s spawning %s: %m",
|
||||
status, command->path),
|
||||
"EXECUTABLE=%s", command->path);
|
||||
log_unit_struct_errno(unit, LOG_ERR, r,
|
||||
"MESSAGE_ID=" SD_MESSAGE_SPAWN_FAILED_STR,
|
||||
LOG_UNIT_INVOCATION_ID(unit),
|
||||
LOG_UNIT_MESSAGE(unit, "Failed at step %s spawning %s: %m",
|
||||
status, command->path),
|
||||
"EXECUTABLE=%s", command->path);
|
||||
}
|
||||
|
||||
_exit(exit_status);
|
||||
@ -4907,6 +4903,7 @@ void exec_context_done(ExecContext *c) {
|
||||
c->stdin_data_size = 0;
|
||||
|
||||
c->network_namespace_path = mfree(c->network_namespace_path);
|
||||
c->ipc_namespace_path = mfree(c->ipc_namespace_path);
|
||||
|
||||
c->log_namespace = mfree(c->log_namespace);
|
||||
|
||||
@ -4923,7 +4920,7 @@ int exec_context_destroy_runtime_directory(const ExecContext *c, const char *run
|
||||
return 0;
|
||||
|
||||
STRV_FOREACH(i, c->directories[EXEC_DIRECTORY_RUNTIME].paths) {
|
||||
_cleanup_free_ char *p;
|
||||
_cleanup_free_ char *p = NULL;
|
||||
|
||||
if (exec_directory_is_private(c, EXEC_DIRECTORY_RUNTIME))
|
||||
p = path_join(runtime_prefix, "private", *i);
|
||||
|
@ -557,6 +557,9 @@ static void job_log_begin_status_message(Unit *u, uint32_t job_id, JobType t) {
|
||||
if (!IN_SET(t, JOB_START, JOB_STOP, JOB_RELOAD))
|
||||
return;
|
||||
|
||||
if (!unit_log_level_test(u, LOG_INFO))
|
||||
return;
|
||||
|
||||
if (log_on_console()) /* Skip this if it would only go on the console anyway */
|
||||
return;
|
||||
|
||||
@ -578,13 +581,12 @@ static void job_log_begin_status_message(Unit *u, uint32_t job_id, JobType t) {
|
||||
* which is supposed the highest level, friendliest output
|
||||
* possible, which means we should avoid the low-level unit
|
||||
* name. */
|
||||
log_struct(LOG_INFO,
|
||||
LOG_MESSAGE("%s", buf),
|
||||
"JOB_ID=%" PRIu32, job_id,
|
||||
"JOB_TYPE=%s", job_type_to_string(t),
|
||||
LOG_UNIT_ID(u),
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
mid);
|
||||
log_unit_struct(u, LOG_INFO,
|
||||
LOG_MESSAGE("%s", buf),
|
||||
"JOB_ID=%" PRIu32, job_id,
|
||||
"JOB_TYPE=%s", job_type_to_string(t),
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
mid);
|
||||
}
|
||||
|
||||
static void job_emit_begin_status_message(Unit *u, uint32_t job_id, JobType t) {
|
||||
@ -844,7 +846,7 @@ static void job_print_done_status_message(Unit *u, JobType t, JobResult result)
|
||||
REENABLE_WARNING;
|
||||
|
||||
if (t == JOB_START && result == JOB_FAILED) {
|
||||
_cleanup_free_ char *quoted;
|
||||
_cleanup_free_ char *quoted = NULL;
|
||||
|
||||
quoted = shell_maybe_quote(u->id, ESCAPE_BACKSLASH);
|
||||
manager_status_printf(u->manager, STATUS_TYPE_NORMAL, NULL, "See 'systemctl status %s' for details.", strna(quoted));
|
||||
@ -879,18 +881,20 @@ static void job_log_done_status_message(Unit *u, uint32_t job_id, JobType t, Job
|
||||
|
||||
/* Show condition check message if the job did not actually do anything due to failed condition. */
|
||||
if (t == JOB_START && result == JOB_DONE && !u->condition_result) {
|
||||
log_struct(LOG_INFO,
|
||||
"MESSAGE=Condition check resulted in %s being skipped.", unit_status_string(u),
|
||||
"JOB_ID=%" PRIu32, job_id,
|
||||
"JOB_TYPE=%s", job_type_to_string(t),
|
||||
"JOB_RESULT=%s", job_result_to_string(result),
|
||||
LOG_UNIT_ID(u),
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
"MESSAGE_ID=" SD_MESSAGE_UNIT_STARTED_STR);
|
||||
log_unit_struct(u, LOG_INFO,
|
||||
"MESSAGE=Condition check resulted in %s being skipped.", unit_status_string(u),
|
||||
"JOB_ID=%" PRIu32, job_id,
|
||||
"JOB_TYPE=%s", job_type_to_string(t),
|
||||
"JOB_RESULT=%s", job_result_to_string(result),
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
"MESSAGE_ID=" SD_MESSAGE_UNIT_STARTED_STR);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!unit_log_level_test(u, job_result_log_level[result]))
|
||||
return;
|
||||
|
||||
format = job_get_done_status_message_format(u, t, result);
|
||||
if (!format)
|
||||
return;
|
||||
@ -922,24 +926,22 @@ static void job_log_done_status_message(Unit *u, uint32_t job_id, JobType t, Job
|
||||
break;
|
||||
|
||||
default:
|
||||
log_struct(job_result_log_level[result],
|
||||
LOG_MESSAGE("%s", buf),
|
||||
"JOB_ID=%" PRIu32, job_id,
|
||||
"JOB_TYPE=%s", job_type_to_string(t),
|
||||
"JOB_RESULT=%s", job_result_to_string(result),
|
||||
LOG_UNIT_ID(u),
|
||||
LOG_UNIT_INVOCATION_ID(u));
|
||||
log_unit_struct(u, job_result_log_level[result],
|
||||
LOG_MESSAGE("%s", buf),
|
||||
"JOB_ID=%" PRIu32, job_id,
|
||||
"JOB_TYPE=%s", job_type_to_string(t),
|
||||
"JOB_RESULT=%s", job_result_to_string(result),
|
||||
LOG_UNIT_INVOCATION_ID(u));
|
||||
return;
|
||||
}
|
||||
|
||||
log_struct(job_result_log_level[result],
|
||||
LOG_MESSAGE("%s", buf),
|
||||
"JOB_ID=%" PRIu32, job_id,
|
||||
"JOB_TYPE=%s", job_type_to_string(t),
|
||||
"JOB_RESULT=%s", job_result_to_string(result),
|
||||
LOG_UNIT_ID(u),
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
mid);
|
||||
log_unit_struct(u, job_result_log_level[result],
|
||||
LOG_MESSAGE("%s", buf),
|
||||
"JOB_ID=%" PRIu32, job_id,
|
||||
"JOB_TYPE=%s", job_type_to_string(t),
|
||||
"JOB_RESULT=%s", job_result_to_string(result),
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
mid);
|
||||
}
|
||||
|
||||
static void job_emit_done_status_message(Unit *u, uint32_t job_id, JobType t, JobResult result) {
|
||||
@ -1048,14 +1050,13 @@ int job_finish_and_invalidate(Job *j, JobResult result, bool recursive, bool alr
|
||||
* this context. And JOB_FAILURE is already handled by the
|
||||
* unit itself. */
|
||||
if (IN_SET(result, JOB_TIMEOUT, JOB_DEPENDENCY)) {
|
||||
log_struct(LOG_NOTICE,
|
||||
"JOB_TYPE=%s", job_type_to_string(t),
|
||||
"JOB_RESULT=%s", job_result_to_string(result),
|
||||
LOG_UNIT_ID(u),
|
||||
LOG_UNIT_MESSAGE(u, "Job %s/%s failed with result '%s'.",
|
||||
u->id,
|
||||
job_type_to_string(t),
|
||||
job_result_to_string(result)));
|
||||
log_unit_struct(u, LOG_NOTICE,
|
||||
"JOB_TYPE=%s", job_type_to_string(t),
|
||||
"JOB_RESULT=%s", job_result_to_string(result),
|
||||
LOG_UNIT_MESSAGE(u, "Job %s/%s failed with result '%s'.",
|
||||
u->id,
|
||||
job_type_to_string(t),
|
||||
job_result_to_string(result)));
|
||||
|
||||
unit_start_on_failure(u);
|
||||
}
|
||||
|
@ -1695,6 +1695,8 @@ int config_parse_exec_cpu_affinity(
|
||||
void *userdata) {
|
||||
|
||||
ExecContext *c = data;
|
||||
const Unit *u = userdata;
|
||||
_cleanup_free_ char *k = NULL;
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
@ -1709,7 +1711,15 @@ int config_parse_exec_cpu_affinity(
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = parse_cpu_set_extend(rvalue, &c->cpu_set, true, unit, filename, line, lvalue);
|
||||
r = unit_full_printf(u, rvalue, &k);
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||
"Failed to resolve unit specifiers in '%s', ignoring: %m",
|
||||
rvalue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = parse_cpu_set_extend(k, &c->cpu_set, true, unit, filename, line, lvalue);
|
||||
if (r >= 0)
|
||||
c->cpu_affinity_from_numa = false;
|
||||
|
||||
@ -4592,7 +4602,7 @@ int config_parse_load_credential(
|
||||
r = extract_first_word(&p, &word, ":", EXTRACT_DONT_COALESCE_SEPARATORS);
|
||||
if (r == -ENOMEM)
|
||||
return log_oom();
|
||||
if (r <= 0) {
|
||||
if (r <= 0 || isempty(p)) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid syntax, ignoring: %s", rvalue);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2036,7 +2036,7 @@ static void log_execution_mode(bool *ret_first_boot) {
|
||||
}
|
||||
} else {
|
||||
if (DEBUG_LOGGING) {
|
||||
_cleanup_free_ char *t;
|
||||
_cleanup_free_ char *t = NULL;
|
||||
|
||||
t = uid_to_name(getuid());
|
||||
log_debug("systemd " GIT_VERSION " running in %suser mode for user " UID_FMT "/%s. (%s)",
|
||||
|
@ -247,7 +247,7 @@ static void manager_print_jobs_in_progress(Manager *m) {
|
||||
}
|
||||
|
||||
static int have_ask_password(void) {
|
||||
_cleanup_closedir_ DIR *dir;
|
||||
_cleanup_closedir_ DIR *dir = NULL;
|
||||
struct dirent *de;
|
||||
|
||||
dir = opendir("/run/systemd/ask-password");
|
||||
@ -1280,7 +1280,6 @@ static unsigned manager_dispatch_stop_when_unneeded_queue(Manager *m) {
|
||||
|
||||
while ((u = m->stop_when_unneeded_queue)) {
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
assert(m->stop_when_unneeded_queue);
|
||||
|
||||
assert(u->in_stop_when_unneeded_queue);
|
||||
LIST_REMOVE(stop_when_unneeded_queue, m->stop_when_unneeded_queue, u);
|
||||
|
@ -2088,7 +2088,7 @@ int setup_namespace(
|
||||
}
|
||||
|
||||
if (log_namespace) {
|
||||
_cleanup_free_ char *q;
|
||||
_cleanup_free_ char *q = NULL;
|
||||
|
||||
q = strjoin("/run/systemd/journal.", log_namespace);
|
||||
if (!q) {
|
||||
@ -2327,7 +2327,7 @@ int mount_image_add(MountImage **m, size_t *n, const MountImage *item) {
|
||||
}
|
||||
|
||||
LIST_FOREACH(mount_options, i, item->mount_options) {
|
||||
_cleanup_(mount_options_free_allp) MountOptions *o;
|
||||
_cleanup_(mount_options_free_allp) MountOptions *o = NULL;
|
||||
|
||||
o = new(MountOptions, 1);
|
||||
if (!o)
|
||||
|
@ -2270,12 +2270,11 @@ static void service_enter_restart(Service *s) {
|
||||
s->n_restarts ++;
|
||||
s->flush_n_restarts = false;
|
||||
|
||||
log_struct(LOG_INFO,
|
||||
"MESSAGE_ID=" SD_MESSAGE_UNIT_RESTART_SCHEDULED_STR,
|
||||
LOG_UNIT_ID(UNIT(s)),
|
||||
LOG_UNIT_INVOCATION_ID(UNIT(s)),
|
||||
LOG_UNIT_MESSAGE(UNIT(s), "Scheduled restart job, restart counter is at %u.", s->n_restarts),
|
||||
"N_RESTARTS=%u", s->n_restarts);
|
||||
log_unit_struct(UNIT(s), LOG_INFO,
|
||||
"MESSAGE_ID=" SD_MESSAGE_UNIT_RESTART_SCHEDULED_STR,
|
||||
LOG_UNIT_INVOCATION_ID(UNIT(s)),
|
||||
LOG_UNIT_MESSAGE(UNIT(s), "Scheduled restart job, restart counter is at %u.", s->n_restarts),
|
||||
"N_RESTARTS=%u", s->n_restarts);
|
||||
|
||||
/* Notify clients about changed restart counter */
|
||||
unit_add_to_dbus_queue(UNIT(s));
|
||||
@ -2718,7 +2717,7 @@ static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int service_deserialize_exec_command(
|
||||
int service_deserialize_exec_command(
|
||||
Unit *u,
|
||||
const char *key,
|
||||
const char *value) {
|
||||
@ -2776,9 +2775,6 @@ static int service_deserialize_exec_command(
|
||||
case STATE_EXEC_COMMAND_PATH:
|
||||
path = TAKE_PTR(arg);
|
||||
state = STATE_EXEC_COMMAND_ARGS;
|
||||
|
||||
if (!path_is_absolute(path))
|
||||
return -EINVAL;
|
||||
break;
|
||||
case STATE_EXEC_COMMAND_ARGS:
|
||||
r = strv_extend(&argv, arg);
|
||||
@ -2786,13 +2782,14 @@ static int service_deserialize_exec_command(
|
||||
return -ENOMEM;
|
||||
break;
|
||||
default:
|
||||
assert_not_reached("Unknown error at deserialization of exec command");
|
||||
break;
|
||||
assert_not_reached("Logic error in exec command deserialization");
|
||||
}
|
||||
}
|
||||
|
||||
if (state != STATE_EXEC_COMMAND_ARGS)
|
||||
return -EINVAL;
|
||||
if (strv_isempty(argv))
|
||||
return -EINVAL; /* At least argv[0] must be always present. */
|
||||
|
||||
/* Let's check whether exec command on given offset matches data that we just deserialized */
|
||||
for (command = s->exec_command[id], i = 0; command; command = command->command_next, i++) {
|
||||
@ -3460,6 +3457,15 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
||||
|
||||
case SERVICE_START_POST:
|
||||
case SERVICE_RELOAD:
|
||||
/* If neither main nor control processes are running then
|
||||
* the current state can never exit cleanly, hence immediately
|
||||
* terminate the service. */
|
||||
if (control_pid_good(s) <= 0)
|
||||
service_enter_stop(s, f);
|
||||
|
||||
/* Otherwise need to wait untill the operation is done. */
|
||||
break;
|
||||
|
||||
case SERVICE_STOP:
|
||||
/* Need to wait until the operation is
|
||||
* done */
|
||||
@ -4255,7 +4261,7 @@ int service_set_socket_fd(Service *s, int fd, Socket *sock, bool selinux_context
|
||||
if (getpeername_pretty(fd, true, &peer) >= 0) {
|
||||
|
||||
if (UNIT(s)->description) {
|
||||
_cleanup_free_ char *a;
|
||||
_cleanup_free_ char *a = NULL;
|
||||
|
||||
a = strjoin(UNIT(s)->description, " (", peer, ")");
|
||||
if (!a)
|
||||
|
@ -244,3 +244,6 @@ ServiceTimeoutFailureMode service_timeout_failure_mode_from_string(const char *s
|
||||
DEFINE_CAST(SERVICE, Service);
|
||||
|
||||
#define STATUS_TEXT_MAX (16U*1024U)
|
||||
|
||||
/* Only exported for unit tests */
|
||||
int service_deserialize_exec_command(Unit *u, const char *key, const char *value);
|
||||
|
@ -31,7 +31,6 @@
|
||||
#NUMAMask=
|
||||
#RuntimeWatchdogSec=0
|
||||
#RebootWatchdogSec=10min
|
||||
#ShutdownWatchdogSec=10min
|
||||
#KExecWatchdogSec=0
|
||||
#WatchdogDevice=
|
||||
#CapabilityBoundingSet=
|
||||
@ -72,3 +71,4 @@
|
||||
#DefaultLimitNICE=
|
||||
#DefaultLimitRTPRIO=
|
||||
#DefaultLimitRTTIME=
|
||||
#DefaultOOMPolicy=stop
|
||||
|
101
src/core/unit.c
101
src/core/unit.c
@ -556,7 +556,7 @@ static void unit_free_requires_mounts_for(Unit *u) {
|
||||
assert(u);
|
||||
|
||||
for (;;) {
|
||||
_cleanup_free_ char *path;
|
||||
_cleanup_free_ char *path = NULL;
|
||||
|
||||
path = hashmap_steal_first_key(u->requires_mounts_for);
|
||||
if (!path)
|
||||
@ -1060,7 +1060,7 @@ int unit_add_exec_dependencies(Unit *u, ExecContext *c) {
|
||||
|
||||
char **dp;
|
||||
STRV_FOREACH(dp, c->directories[dt].paths) {
|
||||
_cleanup_free_ char *p;
|
||||
_cleanup_free_ char *p = NULL;
|
||||
|
||||
p = path_join(u->manager->prefix[dt], *dp);
|
||||
if (!p)
|
||||
@ -1449,6 +1449,9 @@ static int log_unit_internal(void *userdata, int level, int error, const char *f
|
||||
va_list ap;
|
||||
int r;
|
||||
|
||||
if (u && !unit_log_level_test(u, level))
|
||||
return -ERRNO_VALUE(error);
|
||||
|
||||
va_start(ap, format);
|
||||
if (u)
|
||||
r = log_object_internalv(level, error, file, line, func,
|
||||
@ -2152,6 +2155,13 @@ static int unit_log_resources(Unit *u) {
|
||||
value > NOTICEWORTHY_IP_BYTES);
|
||||
}
|
||||
|
||||
/* This check is here because it is the earliest point following all possible log_level assignments. If
|
||||
* log_level is assigned anywhere after this point, move this check. */
|
||||
if (!unit_log_level_test(u, log_level)) {
|
||||
r = 0;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if (have_ip_accounting) {
|
||||
if (any_traffic) {
|
||||
if (igress)
|
||||
@ -2181,7 +2191,7 @@ static int unit_log_resources(Unit *u) {
|
||||
if (n_message_parts == 0)
|
||||
t = strjoina("MESSAGE=", u->id, ": Completed.");
|
||||
else {
|
||||
_cleanup_free_ char *joined;
|
||||
_cleanup_free_ char *joined = NULL;
|
||||
|
||||
message_parts[n_message_parts] = NULL;
|
||||
|
||||
@ -2206,7 +2216,7 @@ static int unit_log_resources(Unit *u) {
|
||||
t = strjoina(u->manager->invocation_log_field, u->invocation_id_string);
|
||||
iovec[n_iovec + 3] = IOVEC_MAKE_STRING(t);
|
||||
|
||||
log_struct_iovec(log_level, iovec, n_iovec + 4);
|
||||
log_unit_struct_iovec(u, log_level, iovec, n_iovec + 4);
|
||||
r = 0;
|
||||
|
||||
finish:
|
||||
@ -3866,7 +3876,7 @@ int unit_patch_contexts(Unit *u) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ExecContext *unit_get_exec_context(Unit *u) {
|
||||
ExecContext *unit_get_exec_context(const Unit *u) {
|
||||
size_t offset;
|
||||
assert(u);
|
||||
|
||||
@ -4478,6 +4488,9 @@ void unit_warn_if_dir_nonempty(Unit *u, const char* where) {
|
||||
assert(u);
|
||||
assert(where);
|
||||
|
||||
if (!unit_log_level_test(u, LOG_NOTICE))
|
||||
return;
|
||||
|
||||
r = dir_is_empty(where);
|
||||
if (r > 0 || r == -ENOTDIR)
|
||||
return;
|
||||
@ -4486,12 +4499,11 @@ void unit_warn_if_dir_nonempty(Unit *u, const char* where) {
|
||||
return;
|
||||
}
|
||||
|
||||
log_struct(LOG_NOTICE,
|
||||
"MESSAGE_ID=" SD_MESSAGE_OVERMOUNTING_STR,
|
||||
LOG_UNIT_ID(u),
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
LOG_UNIT_MESSAGE(u, "Directory %s to mount over is not empty, mounting anyway.", where),
|
||||
"WHERE=%s", where);
|
||||
log_unit_struct(u, LOG_NOTICE,
|
||||
"MESSAGE_ID=" SD_MESSAGE_OVERMOUNTING_STR,
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
LOG_UNIT_MESSAGE(u, "Directory %s to mount over is not empty, mounting anyway.", where),
|
||||
"WHERE=%s", where);
|
||||
}
|
||||
|
||||
int unit_fail_if_noncanonical(Unit *u, const char* where) {
|
||||
@ -4512,12 +4524,11 @@ int unit_fail_if_noncanonical(Unit *u, const char* where) {
|
||||
return 0;
|
||||
|
||||
/* No need to mention "." or "..", they would already have been rejected by unit_name_from_path() */
|
||||
log_struct(LOG_ERR,
|
||||
"MESSAGE_ID=" SD_MESSAGE_OVERMOUNTING_STR,
|
||||
LOG_UNIT_ID(u),
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
LOG_UNIT_MESSAGE(u, "Mount path %s is not canonical (contains a symlink).", where),
|
||||
"WHERE=%s", where);
|
||||
log_unit_struct(u, LOG_ERR,
|
||||
"MESSAGE_ID=" SD_MESSAGE_OVERMOUNTING_STR,
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
LOG_UNIT_MESSAGE(u, "Mount path %s is not canonical (contains a symlink).", where),
|
||||
"WHERE=%s", where);
|
||||
|
||||
return -ELOOP;
|
||||
}
|
||||
@ -5296,35 +5307,32 @@ int unit_pid_attachable(Unit *u, pid_t pid, sd_bus_error *error) {
|
||||
void unit_log_success(Unit *u) {
|
||||
assert(u);
|
||||
|
||||
log_struct(LOG_INFO,
|
||||
"MESSAGE_ID=" SD_MESSAGE_UNIT_SUCCESS_STR,
|
||||
LOG_UNIT_ID(u),
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
LOG_UNIT_MESSAGE(u, "Deactivated successfully."));
|
||||
log_unit_struct(u, LOG_INFO,
|
||||
"MESSAGE_ID=" SD_MESSAGE_UNIT_SUCCESS_STR,
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
LOG_UNIT_MESSAGE(u, "Deactivated successfully."));
|
||||
}
|
||||
|
||||
void unit_log_failure(Unit *u, const char *result) {
|
||||
assert(u);
|
||||
assert(result);
|
||||
|
||||
log_struct(LOG_WARNING,
|
||||
"MESSAGE_ID=" SD_MESSAGE_UNIT_FAILURE_RESULT_STR,
|
||||
LOG_UNIT_ID(u),
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
LOG_UNIT_MESSAGE(u, "Failed with result '%s'.", result),
|
||||
"UNIT_RESULT=%s", result);
|
||||
log_unit_struct(u, LOG_WARNING,
|
||||
"MESSAGE_ID=" SD_MESSAGE_UNIT_FAILURE_RESULT_STR,
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
LOG_UNIT_MESSAGE(u, "Failed with result '%s'.", result),
|
||||
"UNIT_RESULT=%s", result);
|
||||
}
|
||||
|
||||
void unit_log_skip(Unit *u, const char *result) {
|
||||
assert(u);
|
||||
assert(result);
|
||||
|
||||
log_struct(LOG_INFO,
|
||||
"MESSAGE_ID=" SD_MESSAGE_UNIT_SKIPPED_STR,
|
||||
LOG_UNIT_ID(u),
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
LOG_UNIT_MESSAGE(u, "Skipped due to '%s'.", result),
|
||||
"UNIT_RESULT=%s", result);
|
||||
log_unit_struct(u, LOG_INFO,
|
||||
"MESSAGE_ID=" SD_MESSAGE_UNIT_SKIPPED_STR,
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
LOG_UNIT_MESSAGE(u, "Skipped due to '%s'.", result),
|
||||
"UNIT_RESULT=%s", result);
|
||||
}
|
||||
|
||||
void unit_log_process_exit(
|
||||
@ -5351,19 +5359,18 @@ void unit_log_process_exit(
|
||||
else
|
||||
level = LOG_WARNING;
|
||||
|
||||
log_struct(level,
|
||||
"MESSAGE_ID=" SD_MESSAGE_UNIT_PROCESS_EXIT_STR,
|
||||
LOG_UNIT_MESSAGE(u, "%s exited, code=%s, status=%i/%s",
|
||||
kind,
|
||||
sigchld_code_to_string(code), status,
|
||||
strna(code == CLD_EXITED
|
||||
? exit_status_to_string(status, EXIT_STATUS_FULL)
|
||||
: signal_to_string(status))),
|
||||
"EXIT_CODE=%s", sigchld_code_to_string(code),
|
||||
"EXIT_STATUS=%i", status,
|
||||
"COMMAND=%s", strna(command),
|
||||
LOG_UNIT_ID(u),
|
||||
LOG_UNIT_INVOCATION_ID(u));
|
||||
log_unit_struct(u, level,
|
||||
"MESSAGE_ID=" SD_MESSAGE_UNIT_PROCESS_EXIT_STR,
|
||||
LOG_UNIT_MESSAGE(u, "%s exited, code=%s, status=%i/%s",
|
||||
kind,
|
||||
sigchld_code_to_string(code), status,
|
||||
strna(code == CLD_EXITED
|
||||
? exit_status_to_string(status, EXIT_STATUS_FULL)
|
||||
: signal_to_string(status))),
|
||||
"EXIT_CODE=%s", sigchld_code_to_string(code),
|
||||
"EXIT_STATUS=%i", status,
|
||||
"COMMAND=%s", strna(command),
|
||||
LOG_UNIT_INVOCATION_ID(u));
|
||||
}
|
||||
|
||||
int unit_exit_status(Unit *u) {
|
||||
|
@ -645,7 +645,7 @@ typedef struct UnitVTable {
|
||||
|
||||
extern const UnitVTable * const unit_vtable[_UNIT_TYPE_MAX];
|
||||
|
||||
static inline const UnitVTable* UNIT_VTABLE(Unit *u) {
|
||||
static inline const UnitVTable* UNIT_VTABLE(const Unit *u) {
|
||||
return unit_vtable[u->type];
|
||||
}
|
||||
|
||||
@ -808,7 +808,7 @@ void unit_ref_unset(UnitRef *ref);
|
||||
|
||||
int unit_patch_contexts(Unit *u);
|
||||
|
||||
ExecContext *unit_get_exec_context(Unit *u) _pure_;
|
||||
ExecContext *unit_get_exec_context(const Unit *u) _pure_;
|
||||
KillContext *unit_get_kill_context(Unit *u) _pure_;
|
||||
CGroupContext *unit_get_cgroup_context(Unit *u) _pure_;
|
||||
|
||||
@ -879,6 +879,11 @@ static inline bool unit_has_job_type(Unit *u, JobType type) {
|
||||
return u && u->job && u->job->type == type;
|
||||
}
|
||||
|
||||
static inline bool unit_log_level_test(const Unit *u, int level) {
|
||||
ExecContext *ec = unit_get_exec_context(u);
|
||||
return !ec || ec->log_level_max < 0 || ec->log_level_max >= LOG_PRI(level);
|
||||
}
|
||||
|
||||
/* unit_log_skip is for cases like ExecCondition= where a unit is considered "done"
|
||||
* after some execution, rather than succeeded or failed. */
|
||||
void unit_log_skip(Unit *u, const char *result);
|
||||
@ -918,9 +923,10 @@ int unit_thaw_vtable_common(Unit *u);
|
||||
#define log_unit_full_errno(unit, level, error, ...) \
|
||||
({ \
|
||||
const Unit *_u = (unit); \
|
||||
(log_get_max_level() < LOG_PRI(level)) ? -ERRNO_VALUE(error) : \
|
||||
_u ? log_object_internal(level, error, PROJECT_FILE, __LINE__, __func__, _u->manager->unit_log_field, _u->id, _u->manager->invocation_log_field, _u->invocation_id_string, ##__VA_ARGS__) : \
|
||||
log_internal(level, error, PROJECT_FILE, __LINE__, __func__, ##__VA_ARGS__); \
|
||||
const int _l = (level); \
|
||||
(log_get_max_level() < LOG_PRI(_l) || (_u && !unit_log_level_test(_u, _l))) ? -ERRNO_VALUE(error) : \
|
||||
_u ? log_object_internal(_l, error, PROJECT_FILE, __LINE__, __func__, _u->manager->unit_log_field, _u->id, _u->manager->invocation_log_field, _u->invocation_id_string, ##__VA_ARGS__) : \
|
||||
log_internal(_l, error, PROJECT_FILE, __LINE__, __func__, ##__VA_ARGS__); \
|
||||
})
|
||||
|
||||
#define log_unit_full(unit, level, ...) (void) log_unit_full_errno(unit, level, 0, __VA_ARGS__)
|
||||
@ -937,6 +943,27 @@ int unit_thaw_vtable_common(Unit *u);
|
||||
#define log_unit_warning_errno(unit, error, ...) log_unit_full_errno(unit, LOG_WARNING, error, __VA_ARGS__)
|
||||
#define log_unit_error_errno(unit, error, ...) log_unit_full_errno(unit, LOG_ERR, error, __VA_ARGS__)
|
||||
|
||||
#define log_unit_struct_errno(unit, level, error, ...) \
|
||||
({ \
|
||||
const Unit *_u = (unit); \
|
||||
const int _l = (level); \
|
||||
unit_log_level_test(_u, _l) ? \
|
||||
log_struct_errno(_l, error, __VA_ARGS__, LOG_UNIT_ID(_u)) : \
|
||||
-ERRNO_VALUE(error); \
|
||||
})
|
||||
|
||||
#define log_unit_struct(unit, level, ...) log_unit_struct_errno(unit, level, 0, __VA_ARGS__)
|
||||
|
||||
#define log_unit_struct_iovec_errno(unit, level, error, iovec, n_iovec) \
|
||||
({ \
|
||||
const int _l = (level); \
|
||||
unit_log_level_test(unit, _l) ? \
|
||||
log_struct_iovec_errno(_l, error, iovec, n_iovec) : \
|
||||
-ERRNO_VALUE(error); \
|
||||
})
|
||||
|
||||
#define log_unit_struct_iovec(unit, level, iovec, n_iovec) log_unit_struct_iovec_errno(unit, level, 0, iovec, n_iovec)
|
||||
|
||||
#define LOG_UNIT_MESSAGE(unit, fmt, ...) "MESSAGE=%s: " fmt, (unit)->id, ##__VA_ARGS__
|
||||
#define LOG_UNIT_ID(unit) (unit)->manager->unit_log_format_string, (unit)->id
|
||||
#define LOG_UNIT_INVOCATION_ID(unit) (unit)->manager->invocation_log_format_string, (unit)->invocation_id_string
|
||||
|
@ -7,7 +7,7 @@
|
||||
#
|
||||
# Entries in this file show the compile time defaults. Local configuration
|
||||
# should be created by either modifying this file, or by creating "drop-ins" in
|
||||
# the system.conf.d/ subdirectory. The latter is generally recommended.
|
||||
# the user.conf.d/ subdirectory. The latter is generally recommended.
|
||||
# Defaults can be restored by simply deleting this file and all drop-ins.
|
||||
#
|
||||
# See systemd-user.conf(5) for details.
|
||||
|
@ -588,7 +588,7 @@ static int compose_open_fds(pid_t pid, char **open_fds) {
|
||||
static int get_process_ns(pid_t pid, const char *namespace, ino_t *ns) {
|
||||
const char *p;
|
||||
struct stat stbuf;
|
||||
_cleanup_close_ int proc_ns_dir_fd;
|
||||
_cleanup_close_ int proc_ns_dir_fd = -1;
|
||||
|
||||
p = procfs_file_alloca(pid, "ns");
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#
|
||||
# Entries in this file show the compile time defaults. Local configuration
|
||||
# should be created by either modifying this file, or by creating "drop-ins" in
|
||||
# the system.conf.d/ subdirectory. The latter is generally recommended.
|
||||
# the coredump.conf.d/ subdirectory. The latter is generally recommended.
|
||||
# Defaults can be restored by simply deleting this file and all drop-ins.
|
||||
#
|
||||
# Use 'systemd-analyze cat-config systemd/coredump.conf' to display the full config.
|
||||
|
@ -139,7 +139,7 @@ static int acquire_journal(sd_journal **ret, char **matches) {
|
||||
return r;
|
||||
|
||||
if (DEBUG_LOGGING) {
|
||||
_cleanup_free_ char *filter;
|
||||
_cleanup_free_ char *filter = NULL;
|
||||
|
||||
filter = journal_make_match_string(j);
|
||||
log_debug("Journal filter: %s", filter);
|
||||
@ -944,7 +944,7 @@ static int save_core(sd_journal *j, FILE *file, char **path, bool *unlink_temp)
|
||||
|
||||
if (filename) {
|
||||
#if HAVE_COMPRESSION
|
||||
_cleanup_close_ int fdf;
|
||||
_cleanup_close_ int fdf = -1;
|
||||
|
||||
fdf = open(filename, O_RDONLY | O_CLOEXEC);
|
||||
if (fdf < 0) {
|
||||
|
@ -33,7 +33,7 @@ int find_key_file(
|
||||
}
|
||||
|
||||
STRV_FOREACH(i, search_path) {
|
||||
_cleanup_free_ char *joined;
|
||||
_cleanup_free_ char *joined = NULL;
|
||||
|
||||
joined = path_join(*i, key_file);
|
||||
if (!joined)
|
||||
|
@ -29,7 +29,7 @@ static int environment_dirs(char ***ret) {
|
||||
return r;
|
||||
|
||||
if (DEBUG_LOGGING) {
|
||||
_cleanup_free_ char *t;
|
||||
_cleanup_free_ char *t = NULL;
|
||||
|
||||
t = strv_join(dirs, "\n\t");
|
||||
log_debug("Looking for environment.d files in (higher priority first):\n\t%s", strna(t));
|
||||
|
@ -460,7 +460,7 @@ static int add_mount(
|
||||
return r;
|
||||
|
||||
if (!isempty(fstype) && !streq(fstype, "auto")) {
|
||||
_cleanup_free_ char *t;
|
||||
_cleanup_free_ char *t = NULL;
|
||||
|
||||
t = specifier_escape(fstype);
|
||||
if (!t)
|
||||
|
@ -105,6 +105,7 @@ static int open_parent_block_device(dev_t devnum, int *ret_fd) {
|
||||
}
|
||||
|
||||
static int add_cryptsetup(const char *id, const char *what, bool rw, bool require, char **device) {
|
||||
#if HAVE_LIBCRYPTSETUP
|
||||
_cleanup_free_ char *e = NULL, *n = NULL, *d = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
int r;
|
||||
@ -182,6 +183,9 @@ static int add_cryptsetup(const char *id, const char *what, bool rw, bool requir
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "Partition is encrypted, but the project was compiled without libcryptsetup support");
|
||||
#endif
|
||||
}
|
||||
|
||||
static int add_mount(
|
||||
|
@ -3362,4 +3362,4 @@ static int run(int argc, char *argv[]) {
|
||||
return dispatch_verb(argc, argv, verbs, NULL);
|
||||
}
|
||||
|
||||
DEFINE_MAIN_FUNCTION(run);
|
||||
DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE(run);
|
||||
|
@ -7,7 +7,7 @@
|
||||
#
|
||||
# Entries in this file show the compile time defaults. Local configuration
|
||||
# should be created by either modifying this file, or by creating "drop-ins" in
|
||||
# the system.conf.d/ subdirectory. The latter is generally recommended.
|
||||
# the homed.conf.d/ subdirectory. The latter is generally recommended.
|
||||
# Defaults can be restored by simply deleting this file and all drop-ins.
|
||||
#
|
||||
# Use 'systemd-analyze cat-config systemd/homed.conf' to display the full config.
|
||||
|
@ -155,17 +155,10 @@ static int print_status_info(StatusInfo *i) {
|
||||
}
|
||||
|
||||
if (!isempty(i->os_pretty_name)) {
|
||||
_cleanup_free_ char *formatted = NULL;
|
||||
const char *t = i->os_pretty_name;
|
||||
|
||||
if (i->home_url) {
|
||||
if (terminal_urlify(i->home_url, i->os_pretty_name, &formatted) >= 0)
|
||||
t = formatted;
|
||||
}
|
||||
|
||||
r = table_add_many(table,
|
||||
TABLE_STRING, "Operating System:",
|
||||
TABLE_STRING, t);
|
||||
TABLE_STRING, i->os_pretty_name,
|
||||
TABLE_SET_URL, i->home_url);
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ static int request_parse_range(
|
||||
|
||||
colon2 = strchr(colon + 1, ':');
|
||||
if (colon2) {
|
||||
_cleanup_free_ char *t;
|
||||
_cleanup_free_ char *t = NULL;
|
||||
|
||||
t = strndup(colon + 1, colon2 - colon - 1);
|
||||
if (!t)
|
||||
|
@ -40,7 +40,7 @@ static int open_output(RemoteServer *s, Writer *w, const char* host) {
|
||||
break;
|
||||
|
||||
case JOURNAL_WRITE_SPLIT_HOST: {
|
||||
_cleanup_free_ char *name;
|
||||
_cleanup_free_ char *name = NULL;
|
||||
|
||||
assert(host);
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#
|
||||
# Entries in this file show the compile time defaults. Local configuration
|
||||
# should be created by either modifying this file, or by creating "drop-ins" in
|
||||
# the system.conf.d/ subdirectory. The latter is generally recommended.
|
||||
# the journal-remote.conf.d/ subdirectory. The latter is generally recommended.
|
||||
# Defaults can be restored by simply deleting this file and all drop-ins.
|
||||
#
|
||||
# See journal-remote.conf(5) for details.
|
||||
|
@ -7,7 +7,7 @@
|
||||
#
|
||||
# Entries in this file show the compile time defaults. Local configuration
|
||||
# should be created by either modifying this file, or by creating "drop-ins" in
|
||||
# the system.conf.d/ subdirectory. The latter is generally recommended.
|
||||
# the journal-upload.conf.d/ subdirectory. The latter is generally recommended.
|
||||
# Defaults can be restored by simply deleting this file and all drop-ins.
|
||||
#
|
||||
# See journal-upload.conf(5) for details.
|
||||
|
@ -1158,7 +1158,7 @@ static int add_matches(sd_journal *j, char **args) {
|
||||
|
||||
if (S_ISREG(st.st_mode) && (0111 & st.st_mode)) {
|
||||
if (executable_is_script(p, &interpreter) > 0) {
|
||||
_cleanup_free_ char *comm;
|
||||
_cleanup_free_ char *comm = NULL;
|
||||
|
||||
comm = strndup(basename(p), 15);
|
||||
if (!comm)
|
||||
@ -1537,7 +1537,7 @@ static int get_possible_units(
|
||||
char **patterns,
|
||||
Set **units) {
|
||||
|
||||
_cleanup_set_free_free_ Set *found;
|
||||
_cleanup_set_free_free_ Set *found = NULL;
|
||||
const char *field;
|
||||
int r;
|
||||
|
||||
@ -2179,7 +2179,7 @@ int main(int argc, char *argv[]) {
|
||||
case ACTION_LIST_CATALOG:
|
||||
case ACTION_DUMP_CATALOG:
|
||||
case ACTION_UPDATE_CATALOG: {
|
||||
_cleanup_free_ char *database;
|
||||
_cleanup_free_ char *database = NULL;
|
||||
|
||||
database = path_join(arg_root, CATALOG_DATABASE);
|
||||
if (!database) {
|
||||
@ -2433,7 +2433,7 @@ int main(int argc, char *argv[]) {
|
||||
goto finish;
|
||||
|
||||
if (DEBUG_LOGGING) {
|
||||
_cleanup_free_ char *filter;
|
||||
_cleanup_free_ char *filter = NULL;
|
||||
|
||||
filter = journal_make_match_string(j);
|
||||
if (!filter)
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "escape.h"
|
||||
#include "fd-util.h"
|
||||
#include "format-util.h"
|
||||
#include "fs-util.h"
|
||||
#include "io-util.h"
|
||||
#include "journald-kmsg.h"
|
||||
#include "journald-server.h"
|
||||
@ -376,8 +377,8 @@ int server_open_dev_kmsg(Server *s) {
|
||||
|
||||
s->dev_kmsg_fd = open("/dev/kmsg", mode);
|
||||
if (s->dev_kmsg_fd < 0) {
|
||||
log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
|
||||
"Failed to open /dev/kmsg, ignoring: %m");
|
||||
log_full_errno(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
|
||||
errno, "Failed to open /dev/kmsg, ignoring: %m");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -436,8 +437,8 @@ int server_open_kernel_seqnum(Server *s) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = posix_fallocate(fd, 0, sizeof(uint64_t));
|
||||
if (r != 0) {
|
||||
r = posix_fallocate_loop(fd, 0, sizeof(uint64_t));
|
||||
if (r < 0) {
|
||||
log_error_errno(r, "Failed to allocate sequential number file, ignoring: %m");
|
||||
return 0;
|
||||
}
|
||||
|
@ -39,6 +39,12 @@
|
||||
|
||||
#define STDOUT_STREAMS_MAX 4096
|
||||
|
||||
/* During the "setup" protocol phase of the stream logic let's define a different maximum line length than
|
||||
* during the actual operational phase. We want to allow users to specify very short line lengths after all,
|
||||
* but the unit name we embed in the setup protocol might be longer than that. Hence, during the setup phase
|
||||
* let's enforce a line length matching the maximum unit name length (255) */
|
||||
#define STDOUT_STREAM_SETUP_PROTOCOL_LINE_MAX (UNIT_NAME_MAX-1U)
|
||||
|
||||
typedef enum StdoutStreamState {
|
||||
STDOUT_STREAM_IDENTIFIER,
|
||||
STDOUT_STREAM_UNIT_ID,
|
||||
@ -47,7 +53,7 @@ typedef enum StdoutStreamState {
|
||||
STDOUT_STREAM_FORWARD_TO_SYSLOG,
|
||||
STDOUT_STREAM_FORWARD_TO_KMSG,
|
||||
STDOUT_STREAM_FORWARD_TO_CONSOLE,
|
||||
STDOUT_STREAM_RUNNING
|
||||
STDOUT_STREAM_RUNNING,
|
||||
} StdoutStreamState;
|
||||
|
||||
/* The different types of log record terminators: a real \n was read, a NUL character was read, the maximum line length
|
||||
@ -189,7 +195,7 @@ static int stdout_stream_save(StdoutStream *s) {
|
||||
s->id_field + STRLEN("_STREAM_ID="));
|
||||
|
||||
if (!isempty(s->identifier)) {
|
||||
_cleanup_free_ char *escaped;
|
||||
_cleanup_free_ char *escaped = NULL;
|
||||
|
||||
escaped = cescape(s->identifier);
|
||||
if (!escaped) {
|
||||
@ -201,7 +207,7 @@ static int stdout_stream_save(StdoutStream *s) {
|
||||
}
|
||||
|
||||
if (!isempty(s->unit_id)) {
|
||||
_cleanup_free_ char *escaped;
|
||||
_cleanup_free_ char *escaped = NULL;
|
||||
|
||||
escaped = cescape(s->unit_id);
|
||||
if (!escaped) {
|
||||
@ -468,6 +474,18 @@ static int stdout_stream_found(
|
||||
return r;
|
||||
}
|
||||
|
||||
static size_t stdout_stream_line_max(StdoutStream *s) {
|
||||
assert(s);
|
||||
|
||||
/* During the "setup" phase of our protocol, let's ensure we use a line length where a full unit name
|
||||
* can fit in */
|
||||
if (s->state != STDOUT_STREAM_RUNNING)
|
||||
return STDOUT_STREAM_SETUP_PROTOCOL_LINE_MAX;
|
||||
|
||||
/* After the protocol's "setup" phase is complete, let's use whatever the user configured */
|
||||
return s->server->line_max;
|
||||
}
|
||||
|
||||
static int stdout_stream_scan(
|
||||
StdoutStream *s,
|
||||
char *p,
|
||||
@ -475,19 +493,22 @@ static int stdout_stream_scan(
|
||||
LineBreak force_flush,
|
||||
size_t *ret_consumed) {
|
||||
|
||||
size_t consumed = 0;
|
||||
size_t consumed = 0, line_max;
|
||||
int r;
|
||||
|
||||
assert(s);
|
||||
assert(p);
|
||||
|
||||
line_max = stdout_stream_line_max(s);
|
||||
|
||||
for (;;) {
|
||||
LineBreak line_break;
|
||||
size_t skip, found;
|
||||
char *end1, *end2;
|
||||
size_t tmp_remaining = MIN(remaining, line_max);
|
||||
|
||||
end1 = memchr(p, '\n', remaining);
|
||||
end2 = memchr(p, 0, end1 ? (size_t) (end1 - p) : remaining);
|
||||
end1 = memchr(p, '\n', tmp_remaining);
|
||||
end2 = memchr(p, 0, end1 ? (size_t) (end1 - p) : tmp_remaining);
|
||||
|
||||
if (end2) {
|
||||
/* We found a NUL terminator */
|
||||
@ -499,9 +520,9 @@ static int stdout_stream_scan(
|
||||
found = end1 - p;
|
||||
skip = found + 1;
|
||||
line_break = LINE_BREAK_NEWLINE;
|
||||
} else if (remaining >= s->server->line_max) {
|
||||
} else if (remaining >= line_max) {
|
||||
/* Force a line break after the maximum line length */
|
||||
found = skip = s->server->line_max;
|
||||
found = skip = line_max;
|
||||
line_break = LINE_BREAK_LINE_MAX;
|
||||
} else
|
||||
break;
|
||||
@ -563,7 +584,7 @@ static int stdout_stream_process(sd_event_source *es, int fd, uint32_t revents,
|
||||
|
||||
/* Try to make use of the allocated buffer in full, but never read more than the configured line size. Also,
|
||||
* always leave room for a terminating NUL we might need to add. */
|
||||
limit = MIN(s->allocated - 1, s->server->line_max);
|
||||
limit = MIN(s->allocated - 1, MAX(s->server->line_max, STDOUT_STREAM_SETUP_PROTOCOL_LINE_MAX));
|
||||
assert(s->length <= limit);
|
||||
iovec = IOVEC_MAKE(s->buffer + s->length, limit - s->length);
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#
|
||||
# Entries in this file show the compile time defaults. Local configuration
|
||||
# should be created by either modifying this file, or by creating "drop-ins" in
|
||||
# the system.conf.d/ subdirectory. The latter is generally recommended.
|
||||
# the journald.conf.d/ subdirectory. The latter is generally recommended.
|
||||
# Defaults can be restored by simply deleting this file and all drop-ins.
|
||||
#
|
||||
# Use 'systemd-analyze cat-config systemd/journald.conf' to display the full config.
|
||||
|
@ -36,7 +36,11 @@ MACHINE_ID=$KERNEL_INSTALL_MACHINE_ID
|
||||
|
||||
BOOT_ROOT=${ENTRY_DIR_ABS%/$MACHINE_ID/$KERNEL_VERSION}
|
||||
BOOT_MNT=$(stat -c %m $BOOT_ROOT)
|
||||
ENTRY_DIR=${ENTRY_DIR_ABS#$BOOT_MNT}
|
||||
if [[ $BOOT_MNT == '/' ]]; then
|
||||
ENTRY_DIR=$ENTRY_DIR_ABS
|
||||
else
|
||||
ENTRY_DIR=${ENTRY_DIR_ABS#$BOOT_MNT}
|
||||
fi
|
||||
|
||||
if [[ $COMMAND == remove ]]; then
|
||||
rm -f "$BOOT_ROOT/loader/entries/$MACHINE_ID-$KERNEL_VERSION.conf"
|
||||
|
@ -17,6 +17,7 @@
|
||||
static int option_append(uint8_t options[], size_t size, size_t *offset,
|
||||
uint8_t code, size_t optlen, const void *optval) {
|
||||
assert(options);
|
||||
assert(size > 0);
|
||||
assert(offset);
|
||||
|
||||
if (code != SD_DHCP_OPTION_END)
|
||||
@ -165,7 +166,7 @@ int dhcp_option_append(DHCPMessage *message, size_t size, size_t *offset,
|
||||
} else if (r == -ENOBUFS && use_sname) {
|
||||
/* did not fit, but we have more buffers to try
|
||||
close the file array and move the offset to its end */
|
||||
r = option_append(message->options, size, offset, SD_DHCP_OPTION_END, 0, NULL);
|
||||
r = option_append(message->file, sizeof(message->file), &file_offset, SD_DHCP_OPTION_END, 0, NULL);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
@ -23,7 +23,7 @@ int dhcp6_network_bind_udp_socket(int index, struct in6_addr *local_address) {
|
||||
}
|
||||
|
||||
static void fuzz_client(const uint8_t *data, size_t size, bool is_information_request_enabled) {
|
||||
_cleanup_(sd_event_unrefp) sd_event *e;
|
||||
_cleanup_(sd_event_unrefp) sd_event *e = NULL;
|
||||
_cleanup_(sd_dhcp6_client_unrefp) sd_dhcp6_client *client = NULL;
|
||||
struct in6_addr address = { { { 0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01 } } };
|
||||
|
||||
|
@ -307,6 +307,8 @@ tests += [
|
||||
|
||||
[['src/libsystemd/sd-device/test-sd-device.c']],
|
||||
|
||||
[['src/libsystemd/sd-device/test-device-util.c']],
|
||||
|
||||
[['src/libsystemd/sd-device/test-sd-device-monitor.c']],
|
||||
]
|
||||
|
||||
|
@ -69,7 +69,7 @@ struct sd_device {
|
||||
|
||||
char *id_filename;
|
||||
|
||||
uint64_t usec_initialized;
|
||||
usec_t usec_initialized;
|
||||
|
||||
mode_t devmode;
|
||||
uid_t devuid;
|
||||
|
@ -1,6 +1,8 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
#include "sd-device.h"
|
||||
|
||||
#define FOREACH_DEVICE_PROPERTY(device, key, value) \
|
||||
for (key = sd_device_get_property_first(device, &(value)); \
|
||||
key; \
|
||||
|
@ -178,13 +178,12 @@ int device_set_syspath(sd_device *device, const char *_syspath, bool verify) {
|
||||
|
||||
/* all 'devices' require an 'uevent' file */
|
||||
path = strjoina(syspath, "/uevent");
|
||||
r = access(path, F_OK);
|
||||
if (r < 0) {
|
||||
if (access(path, F_OK) < 0) {
|
||||
if (errno == ENOENT)
|
||||
/* this is not a valid device */
|
||||
return -ENODEV;
|
||||
|
||||
return log_debug_errno(errno, "sd-device: %s does not have an uevent file: %m", syspath);
|
||||
return log_debug_errno(errno, "sd-device: cannot access uevent file for %s: %m", syspath);
|
||||
}
|
||||
} else {
|
||||
/* everything else just needs to be a directory */
|
||||
@ -246,72 +245,69 @@ _public_ int sd_device_new_from_devnum(sd_device **ret, char type, dev_t devnum)
|
||||
}
|
||||
|
||||
_public_ int sd_device_new_from_subsystem_sysname(sd_device **ret, const char *subsystem, const char *sysname) {
|
||||
char *name, *syspath;
|
||||
size_t len = 0;
|
||||
char syspath[PATH_MAX], *name;
|
||||
|
||||
assert_return(ret, -EINVAL);
|
||||
assert_return(subsystem, -EINVAL);
|
||||
assert_return(sysname, -EINVAL);
|
||||
assert_return(strlen(sysname) < PATH_MAX - strlen("/sys/bus/"), -ENAMETOOLONG);
|
||||
|
||||
if (streq(subsystem, "subsystem")) {
|
||||
syspath = strjoina("/sys/subsystem/", sysname);
|
||||
if (access(syspath, F_OK) >= 0)
|
||||
if (snprintf_ok(syspath, sizeof syspath, "/sys/subsystem/%s", sysname) &&
|
||||
access(syspath, F_OK) >= 0)
|
||||
return sd_device_new_from_syspath(ret, syspath);
|
||||
|
||||
syspath = strjoina("/sys/bus/", sysname);
|
||||
if (access(syspath, F_OK) >= 0)
|
||||
if (snprintf_ok(syspath, sizeof syspath, "/sys/bus/%s", sysname) &&
|
||||
access(syspath, F_OK) >= 0)
|
||||
return sd_device_new_from_syspath(ret, syspath);
|
||||
|
||||
syspath = strjoina("/sys/class/", sysname);
|
||||
if (access(syspath, F_OK) >= 0)
|
||||
if (snprintf_ok(syspath, sizeof syspath, "/sys/class/%s", sysname) &&
|
||||
access(syspath, F_OK) >= 0)
|
||||
return sd_device_new_from_syspath(ret, syspath);
|
||||
|
||||
} else if (streq(subsystem, "module")) {
|
||||
syspath = strjoina("/sys/module/", sysname);
|
||||
if (access(syspath, F_OK) >= 0)
|
||||
if (snprintf_ok(syspath, sizeof syspath, "/sys/module/%s", sysname) &&
|
||||
access(syspath, F_OK) >= 0)
|
||||
return sd_device_new_from_syspath(ret, syspath);
|
||||
|
||||
} else if (streq(subsystem, "drivers")) {
|
||||
char subsys[PATH_MAX];
|
||||
char *driver;
|
||||
const char *subsys, *sep;
|
||||
|
||||
strscpy(subsys, sizeof(subsys), sysname);
|
||||
driver = strchr(subsys, ':');
|
||||
if (driver) {
|
||||
driver[0] = '\0';
|
||||
driver++;
|
||||
sep = strchr(sysname, ':');
|
||||
if (sep && sep[1] != '\0') { /* Require ":" and something non-empty after that. */
|
||||
subsys = memdupa_suffix0(sysname, sep - sysname);
|
||||
|
||||
syspath = strjoina("/sys/subsystem/", subsys, "/drivers/", driver);
|
||||
if (access(syspath, F_OK) >= 0)
|
||||
if (snprintf_ok(syspath, sizeof syspath, "/sys/subsystem/%s/drivers/%s", subsys, sep + 1) &&
|
||||
access(syspath, F_OK) >= 0)
|
||||
return sd_device_new_from_syspath(ret, syspath);
|
||||
|
||||
syspath = strjoina("/sys/bus/", subsys, "/drivers/", driver);
|
||||
if (access(syspath, F_OK) >= 0)
|
||||
if (snprintf_ok(syspath, sizeof syspath, "/sys/bus/%s/drivers/%s", subsys, sep + 1) &&
|
||||
access(syspath, F_OK) >= 0)
|
||||
return sd_device_new_from_syspath(ret, syspath);
|
||||
}
|
||||
}
|
||||
|
||||
/* translate sysname back to sysfs filename */
|
||||
name = strdupa(sysname);
|
||||
while (name[len] != '\0') {
|
||||
if (name[len] == '/')
|
||||
name[len] = '!';
|
||||
|
||||
len++;
|
||||
}
|
||||
for (size_t i = 0; name[i]; i++)
|
||||
if (name[i] == '/')
|
||||
name[i] = '!';
|
||||
|
||||
syspath = strjoina("/sys/subsystem/", subsystem, "/devices/", name);
|
||||
if (access(syspath, F_OK) >= 0)
|
||||
if (snprintf_ok(syspath, sizeof syspath, "/sys/subsystem/%s/devices/%s", subsystem, name) &&
|
||||
access(syspath, F_OK) >= 0)
|
||||
return sd_device_new_from_syspath(ret, syspath);
|
||||
|
||||
syspath = strjoina("/sys/bus/", subsystem, "/devices/", name);
|
||||
if (access(syspath, F_OK) >= 0)
|
||||
if (snprintf_ok(syspath, sizeof syspath, "/sys/bus/%s/devices/%s", subsystem, name) &&
|
||||
access(syspath, F_OK) >= 0)
|
||||
return sd_device_new_from_syspath(ret, syspath);
|
||||
|
||||
syspath = strjoina("/sys/class/", subsystem, "/", name);
|
||||
if (access(syspath, F_OK) >= 0)
|
||||
if (snprintf_ok(syspath, sizeof syspath, "/sys/class/%s/%s", subsystem, name) &&
|
||||
access(syspath, F_OK) >= 0)
|
||||
return sd_device_new_from_syspath(ret, syspath);
|
||||
|
||||
syspath = strjoina("/sys/firmware/", subsystem, "/", sysname);
|
||||
if (access(syspath, F_OK) >= 0)
|
||||
if (snprintf_ok(syspath, sizeof syspath, "/sys/firmware/%s/%s", subsystem, sysname) &&
|
||||
access(syspath, F_OK) >= 0)
|
||||
return sd_device_new_from_syspath(ret, syspath);
|
||||
|
||||
return -ENODEV;
|
||||
@ -625,7 +621,7 @@ _public_ int sd_device_new_from_device_id(sd_device **ret, const char *id) {
|
||||
struct ifreq ifr = {};
|
||||
int ifindex;
|
||||
|
||||
r = ifr.ifr_ifindex = parse_ifindex(&id[1]);
|
||||
r = ifr.ifr_ifindex = parse_ifindex(id + 1);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@ -654,18 +650,15 @@ _public_ int sd_device_new_from_device_id(sd_device **ret, const char *id) {
|
||||
}
|
||||
|
||||
case '+': {
|
||||
char subsys[PATH_MAX];
|
||||
char *sysname;
|
||||
const char *subsys, *sep;
|
||||
|
||||
(void) strscpy(subsys, sizeof(subsys), id + 1);
|
||||
sysname = strchr(subsys, ':');
|
||||
if (!sysname)
|
||||
sep = strchr(id + 1, ':');
|
||||
if (!sep || sep - id - 1 > NAME_MAX)
|
||||
return -EINVAL;
|
||||
|
||||
sysname[0] = '\0';
|
||||
sysname++;
|
||||
subsys = memdupa_suffix0(id + 1, sep - id - 1);
|
||||
|
||||
return sd_device_new_from_subsystem_sysname(ret, subsys, sysname);
|
||||
return sd_device_new_from_subsystem_sysname(ret, subsys, sep + 1);
|
||||
}
|
||||
|
||||
default:
|
||||
@ -1444,10 +1437,10 @@ _public_ int sd_device_get_usec_since_initialized(sd_device *device, uint64_t *u
|
||||
if (!device->is_initialized)
|
||||
return -EBUSY;
|
||||
|
||||
if (!device->usec_initialized)
|
||||
if (device->usec_initialized == 0)
|
||||
return -ENODATA;
|
||||
|
||||
now_ts = now(clock_boottime_or_monotonic());
|
||||
now_ts = now(CLOCK_MONOTONIC);
|
||||
|
||||
if (now_ts < device->usec_initialized)
|
||||
return -EIO;
|
||||
@ -1895,10 +1888,11 @@ _public_ int sd_device_get_sysattr_value(sd_device *device, const char *sysattr,
|
||||
return r;
|
||||
|
||||
path = prefix_roota(syspath, sysattr);
|
||||
r = lstat(path, &statbuf);
|
||||
if (r < 0) {
|
||||
if (lstat(path, &statbuf) < 0) {
|
||||
int k;
|
||||
|
||||
r = -errno;
|
||||
|
||||
/* remember that we could not access the sysattr */
|
||||
k = device_cache_sysattr_value(device, sysattr, NULL);
|
||||
if (k < 0)
|
||||
|
30
src/libsystemd/sd-device/test-device-util.c
Normal file
30
src/libsystemd/sd-device/test-device-util.c
Normal file
@ -0,0 +1,30 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include "device-util.h"
|
||||
#include "tests.h"
|
||||
|
||||
static void test_log_device_full(void) {
|
||||
int r;
|
||||
|
||||
log_info("/* %s */", __func__);
|
||||
|
||||
for (int level = LOG_ERR; level <= LOG_DEBUG; level++) {
|
||||
log_device_full(NULL, level, "test level=%d: %m", level);
|
||||
|
||||
r = log_device_full_errno(NULL, level, EUCLEAN, "test level=%d errno=EUCLEAN: %m", level);
|
||||
assert_se(r == -EUCLEAN);
|
||||
|
||||
r = log_device_full_errno(NULL, level, 0, "test level=%d errno=0: %m", level);
|
||||
assert_se(r == 0);
|
||||
|
||||
r = log_device_full_errno(NULL, level, SYNTHETIC_ERRNO(ENODATA), "test level=%d errno=S(ENODATA): %m", level);
|
||||
assert_se(r == -ENODATA);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
test_setup_logging(LOG_INFO);
|
||||
|
||||
test_log_device_full();
|
||||
return 0;
|
||||
}
|
@ -707,9 +707,9 @@ static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size)
|
||||
/* Note that the glibc fallocate() fallback is very
|
||||
inefficient, hence we try to minimize the allocation area
|
||||
as we can. */
|
||||
r = posix_fallocate(f->fd, old_size, new_size - old_size);
|
||||
if (r != 0)
|
||||
return -r;
|
||||
r = posix_fallocate_loop(f->fd, old_size, new_size - old_size);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
f->header->arena_size = htole64(new_size - old_header_size);
|
||||
|
||||
|
@ -88,7 +88,7 @@ static void patch_realtime(
|
||||
}
|
||||
|
||||
static int journal_file_empty(int dir_fd, const char *name) {
|
||||
_cleanup_close_ int fd;
|
||||
_cleanup_close_ int fd = -1;
|
||||
struct stat st;
|
||||
le64_t n_entries;
|
||||
ssize_t n;
|
||||
|
@ -1860,7 +1860,7 @@ static int add_current_paths(sd_journal *j) {
|
||||
* treat them as fatal. */
|
||||
|
||||
ORDERED_HASHMAP_FOREACH(f, j->files) {
|
||||
_cleanup_free_ char *dir;
|
||||
_cleanup_free_ char *dir = NULL;
|
||||
int r;
|
||||
|
||||
dir = dirname_malloc(f->path);
|
||||
|
@ -775,7 +775,7 @@ _public_ int sd_get_sessions(char ***sessions) {
|
||||
}
|
||||
|
||||
_public_ int sd_get_uids(uid_t **users) {
|
||||
_cleanup_closedir_ DIR *d;
|
||||
_cleanup_closedir_ DIR *d = NULL;
|
||||
struct dirent *de;
|
||||
int r = 0;
|
||||
unsigned n = 0;
|
||||
|
@ -447,7 +447,7 @@ int sd_rtnl_message_new_neigh(sd_netlink *rtnl, sd_netlink_message **ret, uint16
|
||||
return r;
|
||||
|
||||
if (nlmsg_type == RTM_NEWNEIGH)
|
||||
(*ret)->hdr->nlmsg_flags |= NLM_F_CREATE | NLM_F_APPEND;
|
||||
(*ret)->hdr->nlmsg_flags |= NLM_F_CREATE | NLM_F_REPLACE;
|
||||
|
||||
ndm = NLMSG_DATA((*ret)->hdr);
|
||||
|
||||
|
@ -535,7 +535,7 @@ int vconsole_convert_to_x11(Context *c) {
|
||||
|
||||
int find_converted_keymap(const char *x11_layout, const char *x11_variant, char **new_keymap) {
|
||||
const char *dir;
|
||||
_cleanup_free_ char *n;
|
||||
_cleanup_free_ char *n = NULL;
|
||||
|
||||
if (x11_variant)
|
||||
n = strjoin(x11_layout, "-", x11_variant);
|
||||
|
@ -457,7 +457,7 @@ static int method_set_locale(sd_bus_message *m, void *userdata, sd_bus_error *er
|
||||
(void) locale_update_system_manager(c, sd_bus_message_get_bus(m));
|
||||
|
||||
if (settings) {
|
||||
_cleanup_free_ char *line;
|
||||
_cleanup_free_ char *line = NULL;
|
||||
|
||||
line = strv_join(settings, ", ");
|
||||
log_info("Changed locale to %s.", strnull(line));
|
||||
|
@ -485,7 +485,7 @@ int config_parse_n_autovts(
|
||||
static int vt_is_busy(unsigned vtnr) {
|
||||
struct vt_stat vt_stat;
|
||||
int r;
|
||||
_cleanup_close_ int fd;
|
||||
_cleanup_close_ int fd = -1;
|
||||
|
||||
assert(vtnr >= 1);
|
||||
|
||||
|
@ -1371,7 +1371,7 @@ static int attach_device(Manager *m, const char *seat, const char *sysfs) {
|
||||
}
|
||||
|
||||
static int flush_devices(Manager *m) {
|
||||
_cleanup_closedir_ DIR *d;
|
||||
_cleanup_closedir_ DIR *d = NULL;
|
||||
|
||||
assert(m);
|
||||
|
||||
@ -2068,7 +2068,7 @@ static int update_schedule_file(Manager *m) {
|
||||
m->scheduled_shutdown_type);
|
||||
|
||||
if (!isempty(m->wall_message)) {
|
||||
_cleanup_free_ char *t;
|
||||
_cleanup_free_ char *t = NULL;
|
||||
|
||||
t = cescape(m->wall_message);
|
||||
if (!t) {
|
||||
|
@ -266,7 +266,7 @@ int session_save(Session *s) {
|
||||
fprintf(f, "DISPLAY=%s\n", s->display);
|
||||
|
||||
if (s->remote_host) {
|
||||
_cleanup_free_ char *escaped;
|
||||
_cleanup_free_ char *escaped = NULL;
|
||||
|
||||
escaped = cescape(s->remote_host);
|
||||
if (!escaped) {
|
||||
@ -278,7 +278,7 @@ int session_save(Session *s) {
|
||||
}
|
||||
|
||||
if (s->remote_user) {
|
||||
_cleanup_free_ char *escaped;
|
||||
_cleanup_free_ char *escaped = NULL;
|
||||
|
||||
escaped = cescape(s->remote_user);
|
||||
if (!escaped) {
|
||||
@ -290,7 +290,7 @@ int session_save(Session *s) {
|
||||
}
|
||||
|
||||
if (s->service) {
|
||||
_cleanup_free_ char *escaped;
|
||||
_cleanup_free_ char *escaped = NULL;
|
||||
|
||||
escaped = cescape(s->service);
|
||||
if (!escaped) {
|
||||
@ -302,7 +302,7 @@ int session_save(Session *s) {
|
||||
}
|
||||
|
||||
if (s->desktop) {
|
||||
_cleanup_free_ char *escaped;
|
||||
_cleanup_free_ char *escaped = NULL;
|
||||
|
||||
escaped = cescape(s->desktop);
|
||||
if (!escaped) {
|
||||
|
@ -268,8 +268,8 @@ static int manager_enumerate_seats(Manager *m) {
|
||||
s = hashmap_get(m->seats, de->d_name);
|
||||
if (!s) {
|
||||
if (unlinkat(dirfd(d), de->d_name, 0) < 0)
|
||||
log_warning("Failed to remove /run/systemd/seats/%s: %m",
|
||||
de->d_name);
|
||||
log_warning_errno(errno, "Failed to remove /run/systemd/seats/%s: %m",
|
||||
de->d_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user