From owner-freebsd-stable Sat Aug 4 17:36:36 2001 Delivered-To: freebsd-stable@freebsd.org Received: from home.paped.com (unknown [194.209.224.2]) by hub.freebsd.org (Postfix) with ESMTP id 4235937B401 for ; Sat, 4 Aug 2001 17:36:30 -0700 (PDT) (envelope-from freebsd@paped.com) Received: from paped.com (home.local [192.168.1.1]) by home.paped.com (8.11.5/8.11.4) with ESMTP id f750aS800449 for ; Sun, 5 Aug 2001 02:36:28 +0200 (CEST) (envelope-from freebsd@paped.com) Received: (from freebsd@localhost) by paped.com (8.11.5/8.9.3) id f750aSs21800; Sun, 5 Aug 2001 02:36:28 +0200 (CEST) (envelope-from freebsd) Date: Sun, 5 Aug 2001 02:36:28 +0200 From: Pascal Pederiva To: freebsd-stable@FreeBSD.ORG Subject: PATCH: syscons.c sysctl for PC-Reboot Keys Message-ID: <20010805023628.A21784@home.local> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="PEIAKu/WMn1b1Hv9" Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --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 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