| Summary: | reaction on ctrl-alt-del - poweroff, halt, reboot | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | oliver <oliver> | ||||
| Component: | kern | Assignee: | freebsd-bugs (Nobody) <bugs> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | 4.3-STABLE | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
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 Is using kbdcontrol to change the mapping an acceptible solution for you? State Changed From-To: feedback->closed Feedback timeout |
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. 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);