meson.build文件中有这么一段。最后会将progs的第一个元素转换成大写:prog[0].to_upper();这个是将其转换为宏定义。在程序使用时使用比如:static const char* const sulogin_cmdline[] = {SULOGIN, NULL}; ;这个会为代码阅读搜索带来麻烦。
# if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
# /usr/sbin, /sbin, and fall back to the default from middle column.
progs = [['quotaon', '/usr/sbin/quotaon' ],
['quotacheck', '/usr/sbin/quotacheck' ],
['kmod', '/usr/bin/kmod' ],
['kexec', '/usr/sbin/kexec' ],
['sulogin', '/usr/sbin/sulogin' ],
['mount', '/usr/bin/mount', 'MOUNT_PATH'],
['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
]
foreach prog : progs
path = get_option(prog[0] + '-path')
if path != ''
message('Using @1@ for @0@'.format(prog[0], path))
else
exe = find_program(prog[0],
'/usr/sbin/' + prog[0],
'/sbin/' + prog[0],
required: false)
path = exe.found() ? exe.path() : prog[1]
endif
name = prog.length() >2 ? prog[2] : prog[0].to_upper()
conf.set_quoted(name, path)
substs.set(name, path)
endforeach
suloginsulogin - single-user login
用法:sulogin [options] [tty]
如果系统进入单用户模式时(比如进入emergency mode),由init、systemd 带起来sulogin。
会提示用户输入密码,进入系统维护窗口(或者键入Ctrl-D,继续正常的启动,就不会进入单用户,紧急模式)。
如果root用户被锁定,并且带有选项:–force,不需要密码就可以之间进入系统。
sulogin will be connected to the current terminal, or to the optional tty device that can be specified on the command line (typically /dev/console).
When the user exits from the single-user shell, or presses control-D at the prompt, the system will continue to boot.
选项-e, --force If the default method of obtaining the root password from the system via getpwnam(3) fails, then examine /etc/passwd and /etc/shadow to get the password. If these files are damaged or nonexistent, or when root account is locked by ‘!’ or ‘*’ at the begin of the password then sulogin will start a root shell without asking for a password. Only use the -e option if you are sure the console is physically protected against unauthorized access.
-p, --login-shell Specifying this option causes sulogin to start the shell process as a login shell.
-t, --timeout seconds Specify the maximum amount of time to wait for user input. By default, sulogin will wait forever.
-h, --help Display help text and exit.
-V, --version Display version information and exit.
使用到的环境变量是:SUSHELL or sushell,指明要启动什么shell。If the environment variable is not set, it will try to execute root’s shell from /etc/passwd. If that fails, it will fall back to /bin/sh.
https://www.kernel.org/pub/linux/utils/util-linux/
[root@10 ~]# rpm -q --queryformat=“%{NAME}: %{OPTFLAGS}\n” util-linux-2.32.1-35.el8.x86_64
util-linux: -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧