12.07.2015 Views

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CNMAGIC (9) <strong>NetBSD</strong> <strong>Kernel</strong> Developer’s <strong>Manual</strong> CNMAGIC (9)Determine whether a given dev is the system console. This macro tests to see if dev is the sameas cn_tab->cn_dev but can be overridden in MI header files.void cn_check_magic(dev_t dev , int k , cnm_state_t ∗cnms)All input should be passed through cn_check_magic() so the state machine remains in a consistentstate. cn_check_magic() calls cn_isconsole() with dev to determine if this is theconsole. If that returns true then it runs the input value k through the state machine. If the statemachine completes a match of the current console magic sequence cn_trap() is called. Someinput may need to be translated to state machine values such as the serial line BREAK sequence.void cn_destroy_magic(cnm_state_t ∗cnms)This should be called once what cnms points to is no longer needed.int cn_set_magic(char ∗magic)cn_set_magic() encodes a nul terminated string arbitrary string into values that can be usedby the state machine and installs it as the global magic sequence. The escape sequence is charactervalue 0x27 and can be used to encode special values:0x27 The literal value 0x27.0x01 Serial BREAK sequence.0x02 Nul character.Returns 0 on success or a non-zero error value.int cn_get_magic(char ∗magic , int len)Extract the current magic sequence from the state machine and return up to len bytes of it in thebuffer pointed to by magic. Ituses the same encoding accepted by cn_set_magic(). Returns0 on success or a non-zero error value.SEE ALSOsysctl(8)HISTORYThe <strong>NetBSD</strong> console magic key sequence management framework first appeared in <strong>NetBSD</strong> 1.6.AUTHORSThe <strong>NetBSD</strong> console magic key sequence management framework was designed and implemented byEduardo Horvath 〈eeh@<strong>NetBSD</strong>.org〉.<strong>NetBSD</strong> 3.0 November 11, 2000 2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!