Hi Linus, Alan, this patch has proven to be stable an useable. It hasn't changed since 2.2.13. The patch affects kd_mksound and kd_nosound which are responsible for generating sound. The default behaviour won't be changed but it's now possible for a LKM to hook into these calls and change the way the system bell rings. Changes in struct timer_list made a separate patch for 2.4.0 necessary. Please incorporante into next release of 2.{2,4} if appropriate; TIA, cu. : Christian
--- drivers/char/vt.c.orig Mon Aug 9 21:04:39 1999 +++ drivers/char/vt.c Sun Jan 23 17:10:28 2000 @@ -92,18 +92,20 @@ || (defined(__mips__) && !defined(CONFIG_SGI)) static void -kd_nosound(unsigned long ignored) +_kd_nosound(unsigned long ignored) { /* disable counter 2 */ outb(inb_p(0x61)&0xFC, 0x61); return; } -void +void (*kd_nosound)(unsigned long ignored) = _kd_nosound; + +static void _kd_mksound(unsigned int hz, unsigned int ticks) { static struct timer_list sound_timer = { NULL, NULL, 0, 0, - kd_nosound }; + _kd_nosound }; unsigned int count = 0; --- kernel/ksyms.c.orig Wed Oct 20 02:14:02 1999 +++ kernel/ksyms.c Sun Jan 23 17:10:28 2000 @@ -62,6 +62,9 @@ extern void free_dma(unsigned int dmanr); extern spinlock_t dma_spin_lock; +extern void (*kd_nosound)(unsigned long ignored); +extern void (*kd_mksound)(unsigned int count, unsigned int ticks); + #ifdef CONFIG_MODVERSIONS const struct module_symbol __export_Using_Versions __attribute__((section("__ksymtab"))) = { @@ -341,6 +344,8 @@ EXPORT_SYMBOL(register_reboot_notifier); EXPORT_SYMBOL(unregister_reboot_notifier); EXPORT_SYMBOL(_ctype); +EXPORT_SYMBOL(kd_nosound); +EXPORT_SYMBOL(kd_mksound); EXPORT_SYMBOL(secure_tcp_sequence_number); EXPORT_SYMBOL(get_random_bytes); EXPORT_SYMBOL(securebits); --- include/linux/vt_kern.h.orig Fri Oct 22 01:48:41 1999 +++ include/linux/vt_kern.h Sun Jan 23 17:10:28 2000 @@ -30,7 +30,7 @@ struct wait_queue *paste_wait; } *vt_cons[MAX_NR_CONSOLES]; -void (*kd_mksound)(unsigned int hz, unsigned int ticks); +extern void (*kd_mksound)(unsigned int hz, unsigned int ticks); /* console.c */
--- linux-2.4.0-pristine/drivers/char/vt.c Thu Jan 4 22:00:55 2001 +++ linux-2.4.0/drivers/char/vt.c Sun Jan 28 21:01:37 2001 @@ -98,17 +98,19 @@ || (defined(__arm__) && defined(CONFIG_HOST_FOOTBRIDGE)) static void -kd_nosound(unsigned long ignored) +_kd_nosound(unsigned long ignored) { /* disable counter 2 */ outb(inb_p(0x61)&0xFC, 0x61); return; } -void +void (*kd_nosound)(unsigned long ignored) = _kd_nosound; + +static void _kd_mksound(unsigned int hz, unsigned int ticks) { - static struct timer_list sound_timer = { function: kd_nosound }; + static struct timer_list sound_timer = { function: _kd_nosound }; unsigned int count = 0; unsigned long flags; --- linux-2.4.0-pristine/include/linux/vt_kern.h Thu Jan 4 23:51:24 2001 +++ linux-2.4.0/include/linux/vt_kern.h Sun Jan 28 21:00:32 2001 @@ -30,7 +30,7 @@ wait_queue_head_t paste_wait; } *vt_cons[MAX_NR_CONSOLES]; -void (*kd_mksound)(unsigned int hz, unsigned int ticks); +extern void (*kd_mksound)(unsigned int hz, unsigned int ticks); /* console.c */ --- linux-2.4.0-pristine/kernel/ksyms.c Wed Jan 3 01:45:37 2001 +++ linux-2.4.0/kernel/ksyms.c Sun Jan 28 21:00:32 2001 @@ -62,6 +62,9 @@ extern void free_dma(unsigned int dmanr); extern spinlock_t dma_spin_lock; +extern void (*kd_nosound)(unsigned long ignored); +extern void (*kd_mksound)(unsigned int count, unsigned int ticks); + #ifdef CONFIG_MODVERSIONS const struct module_symbol __export_Using_Versions __attribute__((section("__ksymtab"))) = { @@ -455,6 +458,8 @@ EXPORT_SYMBOL(machine_halt); EXPORT_SYMBOL(machine_power_off); EXPORT_SYMBOL(_ctype); +EXPORT_SYMBOL(kd_nosound); +EXPORT_SYMBOL(kd_mksound); EXPORT_SYMBOL(secure_tcp_sequence_number); EXPORT_SYMBOL(get_random_bytes); EXPORT_SYMBOL(securebits);