From alex@kapran.bitmcnit.bryansk.su  Tue May  1 04:30:09 2001
Return-Path: <alex@kapran.bitmcnit.bryansk.su>
Received: from rbn-gw.bgtu.debryansk.ru (rbn-gw.bgtu.debryansk.ru [62.76.89.2])
	by hub.freebsd.org (Postfix) with ESMTP id CFF3037B423
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  1 May 2001 04:30:06 -0700 (PDT)
	(envelope-from alex@kapran.bitmcnit.bryansk.su)
Received: from server.bitmcnit.bryansk.su (root@bitmcnit.bryansk.su [192.168.121.2])
	by rbn-gw.bgtu.debryansk.ru (8.11.2/8.11.2) with ESMTP id f41BSbm08650
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 1 May 2001 15:28:37 +0400
Received: (from uucp@localhost)
	by server.bitmcnit.bryansk.su (8.9.3/8.9.3) with UUCP id PAA21291
	for FreeBSD-gnats-submit@freebsd.org; Tue, 1 May 2001 15:19:35 +0400
Received: (from alex@localhost)
	by kapran.bitmcnit.bryansk.su (8.11.3/8.11.3) id f41BJB200747;
	Tue, 1 May 2001 15:19:11 +0400 (MSD)
	(envelope-from alex)
Message-Id: <200105011119.f41BJB200747@kapran.bitmcnit.bryansk.su>
Date: Tue, 1 May 2001 15:19:11 +0400 (MSD)
From: Alex Kapranoff <alex@kapran.bitmcnit.bryansk.su>
Reply-To: alex@kapran.bitmcnit.bryansk.su
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: kernel function sysbeep(xxx, 0) does produce sound
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         27008
>Category:       kern
>Synopsis:       kernel function sysbeep(xxx, 0) does produce sound
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 01 04:40:01 PDT 2001
>Closed-Date:    
>Last-Modified:  
>Originator:     Alex Kapranoff
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Inner Mongolia
>Environment:
System: FreeBSD kapran.bitmcnit.bryansk.su 5.0-CURRENT FreeBSD 5.0-CURRENT #5: Tue May 1 14:50:52 MSD 2001 root@kapran.bitmcnit.bryansk.su:/usr/src/sys/compile/KAPRAN i386

	It's a p166/mmx box.

>Description:
	kernel function sysbeep takes two arguments: pitch and
	duration. When the duration == 0, it should obviously not produce
	any sound, but it does (probably due to high interrupt latency
	in -current). So lets make duration == 0 a special case.

>How-To-Repeat:
	% kbdcontrol -b off
	% echo "\a"
>Fix:

I've only tested i386 variant but the patches are identical
except for the alpha case.

diff -ur /sys/alpha/alpha/clock.c ./alpha/alpha/clock.c
--- /sys/alpha/alpha/clock.c	Sat Apr 28 16:55:03 2001
+++ ./alpha/alpha/clock.c	Tue May  1 15:12:06 2001
@@ -636,6 +636,8 @@
 int
 sysbeep(int pitch, int period)
 {
+	if (!period)
+		return (0);
 
 	mtx_lock_spin(&clock_lock);
 
diff -ur /sys/i386/isa/clock.c ./i386/isa/clock.c
--- /sys/i386/isa/clock.c	Sat Apr 28 05:37:44 2001
+++ ./i386/isa/clock.c	Tue May  1 14:04:55 2001
@@ -524,7 +524,12 @@
 int
 sysbeep(int pitch, int period)
 {
-	int x = splclock();
+	int x;
+
+	if (!period)
+		return (0);
+
+	x = splclock();
 
 	if (acquire_timer2(TIMER_SQWAVE|TIMER_16BIT))
 		if (!beeping) {
diff -ur /sys/ia64/ia64/clock.c ./ia64/ia64/clock.c
--- /sys/ia64/ia64/clock.c	Thu Dec 14 22:10:21 2000
+++ ./ia64/ia64/clock.c	Tue May  1 15:12:36 2001
@@ -471,7 +471,12 @@
 int
 sysbeep(int pitch, int period)
 {
-	int x = splhigh();
+	int x;
+
+	if (!period)
+		return (0);
+
+	x = splhigh();
 
 	if (acquire_timer2(TIMER_SQWAVE|TIMER_16BIT))
 		if (!beeping) {
diff -ur /sys/pc98/pc98/clock.c ./pc98/pc98/clock.c
--- /sys/pc98/pc98/clock.c	Sun Apr  1 12:06:08 2001
+++ ./pc98/pc98/clock.c	Tue May  1 15:13:01 2001
@@ -577,7 +577,12 @@
 int
 sysbeep(int pitch, int period)
 {
-	int x = splclock();
+	int x;
+
+	if (!period)
+		return (0);
+
+	x = splclock();
 
 #ifdef PC98
 	if (acquire_timer1(TIMER_SQWAVE|TIMER_16BIT))
>Release-Note:
>Audit-Trail:
>Unformatted:
