Subject: Re: Console Magic redux
To: None <>
From: Chris G. Demetriou <>
List: tech-kern
Date: 11/14/2000 08:41:12 writes:
> int
> cn_isconsole(dev_t dev);
> This routine takes a dev_t and returns non-zero if that is the console device.
> It can be overridden in MD header files if needed.

Where exactly would this be used?

typically code for drivers which are capable of being the console also
keep a flag around to note that fact.  I'd think that accessing a
global (via a macro) to test this fairly often would be a lose --
esp. if the alternative is checking a flag in a flags word defined in
the softc, that may be needed for other work anyway.

> void
> cn_check_magic(dev_t dev, int k, cnm_state_t);
> It uses cn_isconsole() to determine if this device is the console or on part
> of the console input stream.  If so, it checks the key sequence (k) to see if
> it matches the the magic sequence.  If there is a match, it calls cn_trap().

I guess i'm not sure why this needs to be invoked for anything but the
console device, to begin with.

> kern.cnmagic sysctl variable will be added.  This takes a
> string.  cn_set_magic() will be used to convert kern.cnmagic to an internal
> representation.

is there any reason to skimp on letters, in the user-visible name
here?  to me, it unnecessarily obscures the usage of the variable.

If i understand what you're proposing properly, it's kind of annoying
for users who want to use BREAK to have to set it using ESC C-A...  i
mean, that's probably the most common value desired (since it's the
current default), and it seems a shame to make it ... quite so weird.