Date: Thu, 2 Aug 2001 22:22:17 +0200 (CEST) From: oliver@freeware.de To: FreeBSD-gnats-submit@freebsd.org Subject: kern/29395: reaction on ctrl-alt-del Message-ID: <200108022022.f72KMH501636@kiwi.sixpack.de>
next in thread | raw e-mail | index | archive | help
>Number: 29395 >Category: kern >Synopsis: reaction on ctrl-alt-del - poweroff, halt, reboot >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Aug 02 13:30:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Oliver Schneider >Release: FreeBSD 4.3-STABLE i386 >Organization: none >Environment: System: FreeBSD kiwi.sixpack.de 4.3-STABLE FreeBSD 4.3-STABLE #6: Sun Jul 22 17:57:36 CEST 2001 root@kiwi.sixpack.de:/mnt/omega/pub/FreeBSD/source/sys/compile/KIWI i386 >Description: I wrote a few lines with two new kernel options. My Desktop machine now turns power off after pressing ctrl-alt-del. Nice feature "from" Linux, where it is solved some dirty outside the kernel with /etc/inittab imo. Halt is maybe nice on headless machines. >How-To-Repeat: >Fix: no bug, no fix! I added/modfied few lines to implement the feature. I patched it from /usr/src/sys. Best regards Oliver #include <sys/param.h> #include <sys/systm.h> @@ -71,6 +72,16 @@ #define PANIC_REBOOT_WAIT_TIME 15 /* default to 15 seconds */ #endif +#ifdef SHUTDOWN_POWEROFF +#define SHUTDOWN_EVENT SIGUSR2 /* Poweroff */ +#endif +#ifdef SHUTDOWN_HALT +#define SHUTDOWN_EVENT SIGUSR1 /* Halt */ +#endif +#ifndef SHUTDOWN_EVENT +#define SHUTDOWN_EVENT SIGINT /* if not defined, we reboot */ +#endif + /* * Note that stdarg.h and the ANSI style va_start macro is used for both * ANSI and traditional C compilers. @@ -160,7 +171,7 @@ /* Send a signal to init(8) and have it shutdown the world */ if (initproc != NULL) { - psignal(initproc, SIGINT); + psignal(initproc, SHUTDOWN_EVENT); } else { /* No init(8) running, so simply reboot */ boot(RB_NOSYNC); --- i386/conf/LINT.orig Sun Jul 1 18:50:22 2001 +++ i386/conf/LINT Sun Jul 1 18:51:50 2001 @@ -2440,6 +2440,8 @@ options SC_DEBUG_LEVEL options SC_RENDER_DEBUG options SHOW_BUSYBUFS # List buffers that prevent root unmount +options SHUTDOWN_POWEROFF # Poweroff after ctrl-alt-del +options SHUTDOWN_HALT # Halt after ctrl-alt-del options SIMPLELOCK_DEBUG options SI_DEBUG options SLIP_IFF_OPTS --- conf/options.orig Sun Jul 1 18:45:32 2001 +++ conf/options Sun Jul 1 18:59:31 2001 @@ -87,6 +87,8 @@ SHMMIN opt_sysvipc.h SHMMNI opt_sysvipc.h SHMSEG opt_sysvipc.h +SHUTDOWN_POWEROFF opt_kern_shutdown.h +SHUTDOWN_HALT opt_kern_shutdown.h SEMMAP opt_sysvipc.h SEMMNI opt_sysvipc.h SEMMNS opt_sysvipc.h >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200108022022.f72KMH501636>