Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Jun 2000 20:50:15 +0100 (BST)
From:      dwmalone@maths.tcd.ie
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   kern/19273: Halt key for syscons.
Message-ID:  <200006142050.aa81880@walton.maths.tcd.ie>

next in thread | raw e-mail | index | archive | help

>Number:         19273
>Category:       kern
>Synopsis:       Syscons has no key for halting the machine.
>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:   Wed Jun 14 13:00:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     David Malone
>Release:        FreeBSD 3.4-STABLE i386
>Organization:
School of Mathematics, Trinity College, Dublin 2, Ireland.
>Environment:

Any version of FreeBSD.

>Description:

The version of syscons in 4.X and 5.X provides a selection of keys
for triggering a reboot, a panic, break to the debugger, activate
the screen saver and suspend a machine using APM. However there is
no way to halt a machine, which is useful in these days of having
to hold the power button in for 10 seconds before the machine goes
off.

>How-To-Repeat:

N/A

>Fix:
	
The following patch seems to work fine and just copies the way the
control-alt-del action works. I couldn't test the pc98 bit, but it
should be simple enough not to cause any prbolems.

Index: sys/dev/kbd/kbd.c
===================================================================
RCS file: /cvs/FreeBSD-CVS/src/sys/dev/kbd/kbd.c,v
retrieving revision 1.19
diff -u -r1.19 kbd.c
--- sys/dev/kbd/kbd.c	2000/05/26 02:03:00	1.19
+++ sys/dev/kbd/kbd.c	2000/06/14 18:30:41
@@ -1144,6 +1144,7 @@
 			/* NON-LOCKING KEYS */
 			case SPSC: case RBT:  case SUSP: case STBY:
 			case DBG:  case NEXT: case PREV: case PNC:
+			case HALT:
 				*accents = 0;
 				break;
 			case BTAB:
Index: sys/dev/syscons/syscons.c
===================================================================
RCS file: /cvs/FreeBSD-CVS/src/sys/dev/syscons/syscons.c,v
retrieving revision 1.341
diff -u -r1.341 syscons.c
--- sys/dev/syscons/syscons.c	2000/05/01 10:53:12	1.341
+++ sys/dev/syscons/syscons.c	2000/06/14 18:27:44
@@ -3105,6 +3105,13 @@
 #endif
 		break;
 
+	    case HALT:
+#ifndef SC_DISABLE_REBOOT
+		halt_nice();
+#endif
+		break;
+		
+		
 #if NAPM > 0
 	    case SUSP:
 		apm_suspend(PMST_SUSPEND);
Index: sys/kern/kern_shutdown.c
===================================================================
RCS file: /cvs/FreeBSD-CVS/src/sys/kern/kern_shutdown.c,v
retrieving revision 1.74
diff -u -r1.74 kern_shutdown.c
--- sys/kern/kern_shutdown.c	2000/05/05 09:58:21	1.74
+++ sys/kern/kern_shutdown.c	2000/06/14 18:25:35
@@ -162,6 +162,18 @@
 	}
 	return;
 }
+void
+halt_nice()
+{
+	/* Send a signal to init(8) and have it shutdown the world */
+	if (initproc != NULL) {
+		psignal(initproc, SIGUSR1);
+	} else {
+		/* No init(8) running, so simply reboot */
+		boot(RB_NOSYNC|RB_HALT);
+	}
+	return;
+}
 static int	waittime = -1;
 static struct pcb dumppcb;
 
Index: sys/pc98/pc98/syscons.c
===================================================================
RCS file: /cvs/FreeBSD-CVS/src/sys/pc98/pc98/syscons.c,v
retrieving revision 1.146
diff -u -r1.146 syscons.c
--- sys/pc98/pc98/syscons.c	2000/04/27 13:34:29	1.146
+++ sys/pc98/pc98/syscons.c	2000/06/14 18:31:25
@@ -3124,6 +3124,12 @@
 #endif
 		break;
 
+	    case HALT:
+#ifndef SC_DISABLE_REBOOT
+		halt_nice();
+#endif
+		break;
+
 #if NAPM > 0
 	    case SUSP:
 		apm_suspend(PMST_SUSPEND);
Index: sys/sys/kbio.h
===================================================================
RCS file: /cvs/FreeBSD-CVS/src/sys/sys/kbio.h,v
retrieving revision 1.5
diff -u -r1.5 kbio.h
--- sys/sys/kbio.h	1999/12/29 04:24:43	1.5
+++ sys/sys/kbio.h	2000/06/14 18:26:40
@@ -171,6 +171,7 @@
 #define RCTRA		0x9e		/* right ctrl key / alt lock	*/
 #define LALTA		0x9f		/* left alt key / alt lock	*/
 #define RALTA		0xa0		/* right alt key / alt lock	*/
+#define HALT		0xa1		/* halt machine */
 
 #define F(x)		((x)+F_FN-1)
 #define	S(x)		((x)+F_SCR-1)
Index: sys/sys/systm.h
===================================================================
RCS file: /cvs/FreeBSD-CVS/src/sys/sys/systm.h,v
retrieving revision 1.116
diff -u -r1.116 systm.h
--- sys/sys/systm.h	2000/06/05 18:30:55	1.116
+++ sys/sys/systm.h	2000/06/14 18:37:07
@@ -185,6 +185,7 @@
 
 /* Finalize the world. */
 void	shutdown_nice __P((void));
+void	halt_nice __P((void));
 
 /*
  * Kernel to clock driver interface.
Index: usr.sbin/kbdcontrol/kbdcontrol.c
===================================================================
RCS file: /cvs/FreeBSD-CVS/src/usr.sbin/kbdcontrol/kbdcontrol.c,v
retrieving revision 1.30
diff -u -r1.30 kbdcontrol.c
--- usr.sbin/kbdcontrol/kbdcontrol.c	1999/12/10 04:24:26	1.30
+++ usr.sbin/kbdcontrol/kbdcontrol.c	2000/06/14 18:34:34
@@ -197,6 +197,8 @@
 		return LALTA | 0x100;
 	case TRALTA:
 		return RALTA | 0x100;
+	case THALT:
+		return HALT | 0x100;
 	case TACC:
 		if (ACC(number) > L_ACC)
 			return -1;
@@ -428,6 +430,9 @@
 	case RALTA | 0x100:
 		fprintf(fp, " ralta ");
 		break;
+	case HALT | 0x100:
+		fprintf(fp, " halt  ");
+		break;
 	default:
 		if (value & 0x100) {
 		 	if (val >= F_FN && val <= L_FN)
@@ -620,6 +625,9 @@
 			break;
 		case RALTA:
 			printf("RALTA, ");
+			break;
+		case HALT:
+			printf(" HALT, ");
 			break;
 		default:
 	 		if (value >= F_FN && value <= L_FN)
Index: usr.sbin/kbdcontrol/lex.h
===================================================================
RCS file: /cvs/FreeBSD-CVS/src/usr.sbin/kbdcontrol/lex.h,v
retrieving revision 1.9
diff -u -r1.9 lex.h
--- usr.sbin/kbdcontrol/lex.h	1999/12/10 04:24:27	1.9
+++ usr.sbin/kbdcontrol/lex.h	2000/06/14 18:33:02
@@ -61,6 +61,7 @@
 #define TRCTRA		286
 #define TLALTA		287
 #define TRALTA		288
+#define THALT		289
 
 extern int number;
 extern char letter;
Index: usr.sbin/kbdcontrol/lex.l
===================================================================
RCS file: /cvs/FreeBSD-CVS/src/usr.sbin/kbdcontrol/lex.l,v
retrieving revision 1.11
diff -u -r1.11 lex.l
--- usr.sbin/kbdcontrol/lex.l	1999/12/10 04:24:27	1.11
+++ usr.sbin/kbdcontrol/lex.l	2000/06/14 18:32:39
@@ -68,6 +68,7 @@
 rctrla		{ return TRCTRA; }
 lalta|alta	{ return TLALTA; }
 ralta		{ return TRALTA; }
+halt		{ return THALT; }
 
 NUL|nul		{ number = 0; return TNUM; }
 SOH|soh		{ number = 1; return TNUM; }

>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?200006142050.aa81880>