Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Aug 2001 02:36:28 +0200
From:      Pascal Pederiva <freebsd@paped.com>
To:        freebsd-stable@FreeBSD.ORG
Subject:   PATCH: syscons.c sysctl for PC-Reboot Keys
Message-ID:  <20010805023628.A21784@home.local>

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

--PEIAKu/WMn1b1Hv9
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,

in case someone also has the desire to be able to turn the syscons
CTRL-ALT-DELETE Reboot on and off without a kernel re-compile,
this patch is for you.

It adds a sysctl variable named : hw.syscons.pc_style_reboot
which enables (>0) or disables (0) reboot using CTRL-ALT-DELETE.

The setting can also be added to /boot/loader.conf as in :
hw.syscons.pc_style_reboot="0"		# Disable CTRL-ALT-DEL Reboot

Guess it would be nice to have this in the official sources.

The provided diff is against RELENG_4 as of 4.8.2001 - or
src/sys/dev/syscons/syscons.c,v 1.336.2.10.

It should work for -current as well as pc98/pc98/syscons.c, although
I have not verified that.

Possible <freebsd-hackers@FreeBSD.ORG> would be the place for this
 - but I haven't subscribed there (yet) - let me know.

Regards,
Pascal



--PEIAKu/WMn1b1Hv9
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="syscons.diff"

Index: syscons.c
===================================================================
RCS file: /samba/FREEBSD_CVS/src/sys/dev/syscons/syscons.c,v
retrieving revision 1.336.2.10
diff -c -r1.336.2.10 syscons.c
*** syscons.c	2001/08/01 10:42:31	1.336.2.10
--- syscons.c	2001/08/05 00:06:34
***************
*** 126,131 ****
--- 126,139 ----
  
  static	int		debugger;
  
+ #ifndef SC_DISABLE_REBOOT
+ int pc_style_reboot = 1;
+         
+ SYSCTL_NODE(_hw, OID_AUTO, syscons, CTLFLAG_RW, 0, "");
+ SYSCTL_INT(_hw_syscons, OID_AUTO, pc_style_reboot, CTLFLAG_RW,
+            &pc_style_reboot, 0,"CTRL-ALT-DELETE Reboot Enable");
+ #endif
+ 
  /* prototypes */
  static int scvidprobe(int unit, int flags, int cons);
  static int sckbdprobe(int unit, int flags, int cons);
***************
*** 2470,2475 ****
--- 2478,2487 ----
      int row;
      int i;
  
+ #ifndef SC_DISABLE_REBOOT
+     TUNABLE_INT_FETCH("hw.syscons.pc_style_reboot",&pc_style_reboot);
+ #endif
+ 
      /* one time initialization */
      if (init_done == COLD)
  	sc_get_bios_values(&bios_value);
***************
*** 3112,3130 ****
  
  	    case RBT:
  #ifndef SC_DISABLE_REBOOT
! 		shutdown_nice(0);
  #endif
  		break;
  
  	    case HALT:
  #ifndef SC_DISABLE_REBOOT
! 		shutdown_nice(RB_HALT);
  #endif
  		break;
  
  	    case PDWN:
  #ifndef SC_DISABLE_REBOOT
! 		shutdown_nice(RB_HALT|RB_POWEROFF);
  #endif
  		break;
  
--- 3124,3145 ----
  
  	    case RBT:
  #ifndef SC_DISABLE_REBOOT
! 	        if(pc_style_reboot)
! 		  shutdown_nice(0);
  #endif
  		break;
  
  	    case HALT:
  #ifndef SC_DISABLE_REBOOT
! 	        if(pc_style_reboot)
! 		  shutdown_nice(RB_HALT);
  #endif
  		break;
  
  	    case PDWN:
  #ifndef SC_DISABLE_REBOOT
! 	        if(pc_style_reboot)
! 		  shutdown_nice(RB_HALT|RB_POWEROFF);
  #endif
  		break;
  

--PEIAKu/WMn1b1Hv9--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010805023628.A21784>