From owner-freebsd-bugs Thu Aug 2 13:30:26 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 5DD5B37B406 for ; Thu, 2 Aug 2001 13:30:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f72KU3i01426; Thu, 2 Aug 2001 13:30:03 -0700 (PDT) (envelope-from gnats) Received: from mailout05.sul.t-online.de (mailout05.sul.t-online.com [194.25.134.82]) by hub.freebsd.org (Postfix) with ESMTP id 6416037B401 for ; Thu, 2 Aug 2001 13:23:01 -0700 (PDT) (envelope-from oliver@freeware.de) Received: from fwd03.sul.t-online.de by mailout05.sul.t-online.de with smtp id 15SOzj-0001d9-04; Thu, 02 Aug 2001 22:22:59 +0200 Received: from kim.sixpack.de (520030847883-0001@[217.80.167.243]) by fmrl03.sul.t-online.com with esmtp id 15SOzW-0q2uvYC; Thu, 2 Aug 2001 22:22:46 +0200 Received: from kiwi.sixpack.de (kiwi.sixpack.de [192.168.2.32]) by kim.sixpack.de (8.11.3/8.11.1) with ESMTP id f72KMHR56710 for ; Thu, 2 Aug 2001 22:22:17 +0200 (CEST) (envelope-from oliver@sixpack.de) Received: (from oliver@localhost) by kiwi.sixpack.de (8.11.3/8.9.3) id f72KMH501636; Thu, 2 Aug 2001 22:22:17 +0200 (CEST) (envelope-from oliver) Message-Id: <200108022022.f72KMH501636@kiwi.sixpack.de> Date: Thu, 2 Aug 2001 22:22:17 +0200 (CEST) From: oliver@freeware.de Reply-To: oliver@freeware.de To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: kern/29395: reaction on ctrl-alt-del Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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 #include @@ -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