summaryrefslogtreecommitdiffstats
path: root/usr.sbin/xntpd/kernel/README.streams
blob: 26c2825b50dfe291bc3224966278cda6bcfe7981 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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.

OpenPOWER on IntegriCloud