From oliver@freeware.de  Thu Aug  2 13:23:02 2001
Return-Path: <oliver@freeware.de>
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 <FreeBSD-gnats-submit@freebsd.org>; 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 <FreeBSD-gnats-submit@freebsd.org>; 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
Cc:
Subject: reaction on ctrl-alt-del 
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         29395
>Category:       kern
>Synopsis:       reaction on ctrl-alt-del - poweroff, halt, reboot
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 02 13:30:01 PDT 2001
>Closed-Date:    Sat Jul 12 16:14:27 PDT 2003
>Last-Modified:  Sat Jul 12 16:14:27 PDT 2003
>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:

From: David Malone <dwmalone@maths.tcd.ie>
To: oliver@freeware.de
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: kern/29395: reaction on ctrl-alt-del
Date: Fri, 3 Aug 2001 10:32:06 +0100

 On Thu, Aug 02, 2001 at 10:22:17PM +0200, oliver@freeware.de wrote:
 > >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.
 
 You should already be able to do this using the "kbdcontrol" command
 to change the mapping of ctl-alt-del. You should be able to do this
 by changeing "boot" to "pdwn" in the keymap file
 
 	kbdcontrol -d | sed -e s/boot/pdwn/g > mykeymap
 	kbdcontrol -l mykeymap
 
 You could then get this new map loaded at boot time by putting it
 in /usr/share/syscons/keymaps and putting:
 
 	keymap="mykeymap"
 
 in /etc/rc.conf. You can get more details about keymaps with "man
 kbdcontrol" and "man 5 kdbmap".
 
 	David.
State-Changed-From-To: open->feedback 
State-Changed-By: iedowse 
State-Changed-When: Sat Nov 30 19:48:59 PST 2002 
State-Changed-Why:  

Is using kbdcontrol to change the mapping an acceptible solution 
for you? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=29395 
State-Changed-From-To: feedback->closed 
State-Changed-By: kris 
State-Changed-When: Sat Jul 12 16:14:17 PDT 2003 
State-Changed-Why:  
Feedback timeout 

http://www.freebsd.org/cgi/query-pr.cgi?pr=29395 
>Unformatted:
