From f377bbc32cb8f8725f5e26d4917a373b373d2a3a Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 18 Mar 2023 17:26:09 -0500 Subject: [PATCH] Teach oneit to autodetect console from sysfs when no -c argument. --- scripts/mkroot.sh | 3 +-- toys/other/oneit.c | 32 +++++++++++++++++++++++++------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/scripts/mkroot.sh b/scripts/mkroot.sh index ce037f96..60433240 100755 --- a/scripts/mkroot.sh +++ b/scripts/mkroot.sh @@ -127,11 +127,10 @@ if [ $$ -eq 1 ]; then # Setup networking for QEMU (needs /proc) # Run package scripts (if any) for i in $(ls -1 /etc/rc 2>/dev/null | sort); do . /etc/rc/"$i"; done - [ -z "$CONSOLE" ] && CONSOLE="$( /proc/sys/kernel/printk - exec oneit -c /dev/"${CONSOLE:-console}" $HANDOFF + exec oneit $HANDOFF else # for chroot /bin/sh umount /dev/pts /dev /sys /proc diff --git a/toys/other/oneit.c b/toys/other/oneit.c index 4c8bb1f6..d154f582 100644 --- a/toys/other/oneit.c +++ b/toys/other/oneit.c @@ -65,13 +65,36 @@ static void oneit_signaled(int signal) void oneit_main(void) { int i, pid, pipes[] = {SIGUSR1, SIGUSR2, SIGTERM, SIGINT}; + char *ss = toybuf+5; // Setup signal handlers for signals of interest for (i = 0; i