mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-19 09:44:30 +01:00
87 lines
2.6 KiB
Plaintext
87 lines
2.6 KiB
Plaintext
Some kernels don't support additional user defined line disciplines.
|
|
Especially notable in this regard is SunOS and System V. They
|
|
provide similar support in the form of "Streams". Accordingly,
|
|
included in this directory is a pair of STREAMS modules to
|
|
replace the line disciplines that provide clock support for
|
|
xntpd. Notice that the "clkdefs.h" file is not used in the
|
|
original line discipline, but the "chudefs.h" file is the
|
|
same one used in the original line discipline.
|
|
|
|
TO INSTALL A NEW STREAMS DRIVER:
|
|
|
|
1. Copy your choice to /sys/os, removing the "_STREAMS" in the
|
|
filename.
|
|
|
|
2. Copy the appropriate *defs.h file to /usr/include/sys,
|
|
then link it (with ln) to /sys/sys.
|
|
|
|
In the following steps, substitute "clk" for "chu" if you're
|
|
installing the clk driver.
|
|
|
|
3. Append to /sys/conf.common/files.cmn:
|
|
|
|
os/tty_chu.c optional chu
|
|
|
|
4. Edit /sys/sun/str_conf.c. You'll want to add lines in three
|
|
places. It'll be sort of clear where when you see the file.
|
|
|
|
.
|
|
.
|
|
.
|
|
#include "chu.h"
|
|
.
|
|
.
|
|
.
|
|
#if NCHU > 0
|
|
extern struct streamtab chuinfo;
|
|
#endif
|
|
.
|
|
.
|
|
.
|
|
#if NCHU > 0
|
|
{ "chu", &chuinfo },
|
|
#endif
|
|
.
|
|
.
|
|
.
|
|
|
|
At this point, the kernel-making "config [k-name] ; cd ../[k-name] ; make"
|
|
should produce a kernel just as it did before. If it fouls up,
|
|
something's wrong.
|
|
|
|
5. Edit /sys/[arch]/conf/[k-name] (substituting the architecture and
|
|
kernel name) to stick in:
|
|
|
|
pseudo-device chu4 # CHU clock support
|
|
|
|
You can change 4 to anything you like. It will limit the number
|
|
of instantiations of the chu driver you can use at the same time.
|
|
|
|
6. Make a new kernel and boot it.
|
|
|
|
HOW TO USE THE CHU STREAMS DRIVER:
|
|
|
|
The driver should act exactly like the line discipline.
|
|
After setting the raw mode, and exclusive access (if you want),
|
|
pop off all the extra streams, then push the chu module
|
|
on. From then on, any reads from the file in question
|
|
will return chucode structures as defined in chudefs.h.
|
|
Depending on the settings of PEDANTIC and ANAL_RETENTIVE
|
|
used when compiling the kernel, some checking of the
|
|
data may or may not be necessary.
|
|
|
|
HOW TO USE THE CLK STREAMS DRIVER:
|
|
|
|
First, it should be noted that a new ioctl() has been defined.
|
|
The CLK_SETSTR ioctl takes a pointer to a string of no more
|
|
than CLK_MAXSTRSIZE characters. Until the first CLK_SETSTR
|
|
is performed, the driver will simply pass through characters.
|
|
Once it is passed a string, then any character in that string
|
|
will be immediately followed by a struct timeval. You can
|
|
change the string whenever you want by doing another
|
|
CLK_SETSTR. The character must be an exact, 8 bit match.
|
|
The character '\000' cannot, unfortunately, be stamped.
|
|
Passing an empty string to CLK_SETSTR turns off stamping.
|
|
Passing NULL will produce undefined results.
|
|
|