]> git.ipfire.org Git - thirdparty/systemd.git/commit
core: convert PID 1 parse_argv to OPTION macros
authorZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Thu, 14 May 2026 08:38:35 +0000 (10:38 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Fri, 15 May 2026 07:26:41 +0000 (09:26 +0200)
commit5597a78df2618e64ccdda4dcd2e7e4942903f2ca
treeab97c584a3b1d2ce2e1e60e1d6ccedeb9d5dd5b4
parent2289ac82d4150174212e716b696b7bddb4f240d7
core: convert PID 1 parse_argv to OPTION macros

parse_argv() uses FOREACH_OPTION (not _OR_RETURN) so we can preserve the
existing PID 1 tolerance: an unknown option, or one of the sysvinit-style
-b/-s/-z catch-alls, returns 0 instead of -EINVAL when getpid_cached() == 1.

The docs documented --crash-vt=, but the code implemented "crash-chvt",
as introduced in b9e74c399458a1146894ce371e7d85c60658110c.
The output from --help is now modified to match code.

getopt-defs.h is intentionally left in place since
proc_cmdline_filter_pid1_args() in src/basic/proc-cmdline.c still uses
its COMMON_/SYSTEMD_/SHUTDOWN_GETOPT_* macros to walk the kernel
command line.

Previously, opterr=0 was used to suppress error messages about option
parsing in PID1. They are now logged at debug level (if debug logging
is enabled.)

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
src/core/main.c