Subject: Beep on halt
To: None <tech-kern@netbsd.org>
From: Julio Merino <jmmv@menta.net>
List: tech-kern
Date: 10/19/2002 18:17:28
This is a multi-part message in MIME format.

--Multipart_Sat__19_Oct_2002_18:17:28_+0200_081d5a00
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Hello

I have added a new (small, very small) feature to the kernel. It makes the
kernel beep when it halts, i.e., after saying "The operating system has
halted.". (If you are not interested in this, at least keep reading as I
have some questions ;-)

Well, why is this useful? Imagine you have a server, that does not have a
screen (I'm sure you have one hehe). When I need to halt my server (that
does not allow a power off), I have to wait some time until I can notice
that the disks have spin down; this is somewhat boring and not safe, as
it may happen that the kernel is not completely stopped when I decide to
cut the power. With this new feature, I only have to wait until I listen
the beeps, and then, close the computer.

The patch adds a new option, SYSBEEP_ON_HALT, that takes a number as the
argument. This argument specifies how many times to beep when the system
has halted. Frequency and times are not tunnable... This is only useful
for i386 (now).

A different proposal could be to leave it beeping forever until you press
a key or stop the computer. (Don't know how to read keys while beeping).

So, here are my questions:

1) The sysbeep function takes an argument, specifying how long is the tone,
   but it seems not to take effect. If I call sysbeep once, the system
   keeps beeping forever (this can be also a good idea, but I think this is
   not the correct behavior of the function). I've had to add the two
   delays so that beeps can be differenciated. Is sysbeep() broken?

2) Is it there any chance for this to get in kernel? ;) If you like this,
   I will send-pr it (after a bit of polishment). If not... well, at least
   review the code, please.

Thank you!

-- 
Julio Merino (http://jmmv.dyndns.org/) <jmmv@menta.net>

--Multipart_Sat__19_Oct_2002_18:17:28_+0200_081d5a00
Content-Type: application/octet-stream;
 name="patch.diff"
Content-Disposition: attachment;
 filename="patch.diff"
Content-Transfer-Encoding: base64

SW5kZXg6IGNvbmYvR0VORVJJQwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ClJDUyBmaWxlOiAvY3Zzcm9vdC9zeXNzcmMv
c3lzL2FyY2gvaTM4Ni9jb25mL0dFT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