aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/xntpd/kernel/README
blob: cf69b137286ba0b8c07ff2dba23400384e6c6ec0 (plain) (blame)
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
87
88
89
90
This directory contains code for two line disciplines which may
work with BSD-style terminal drivers.  While I'll try to cover
installation details for the more useful one here as best I can,
you really should know what you are doing before attempting to
put one of these in your kernel since the details seem to vary
from BSD variant to BSD variant.

Tty_clk.c contains a generic clock support line discipline.
The terminal driver is actually run in raw mode, giving you an
eight bit data path.  Instead of delivering the data
character-by-character, however, the line discipline collects
characters until one of two magic characters (your current erase
and kill characters.  Don't throw up) is received.  A timestamp
is then taken (by calling microtime()), inserted in the input
buffer after the magic character, and the whole mess made available
for input by the application.  Both select() and SIGIO are supported
by the discipline.

Tty_chu.c is a special purpose line discipline for receiving
the CHU time code.  It understands enough about the format of the
code CHU transmits to filter out errors, and delivers an entire
ten character code group to the application all at once, including
a timestamp for each character.  The structure the code group is
delivered in is defined in chudefs.h.  Note that this line discipline
is old and could use some rewriting for better portability.  Please
drop me a line if you are interested in using this.

To install the clock line discipline, do something like the following:

(1) Copy tty_clk.c into /sys/sys

(2) Edit /sys/sys/tty_conf.c.  You will want to include some facsimile
    of the following lines:

#include "clk.h"
#if NCLK > 0
int	clkopen(), clkclose(), clkwrite(), clkinput(), clkioctl();
#endif

#if NCLK > 0
	{ clkopen, clkclose, ttread, clkwrite, clkioctl,
	  clkinput, nodev, nulldev, ttstart, nullmodem,	/* 10- CLKLDISC */
	  ttselect },
#else
	{ nodev, nodev, nodev, nodev, nodev,
	  nodev, nodev, nodev, nodev, nodev,
	  nodev					    },
#endif

    In Ultrix 4.2a and 4.3 the file to edit is /sys/data/tty_conf_data.c.
    The lines should be

#if NCLK > 0
	clkopen, clkclose, ttread, clkwrite, clkioctl,          /* 10 */
	clkinput, nodev, nulldev, ttstart, nulldev,
#else
	nodev, nodev, nodev, nodev, nodev,
	nodev, nodev, nodev, nodev, nodev,
#endif

    Note that if your kernel doesn't include the ??select() entry in
    the structure (i.e. there are only 10 entry points in the structure)
    just leave it out.  Also note that the number you give the line
    discipline (10 in my kernel) will be specific to your kernel and
    will depend on what is in there already. The entries sould be in
    order with no missing space; that is, if there are only seven
    disciplines already defined and you want to use 10 for good reason,
    you should define a dummy 9th entry like this

	nodev, nodev, nodev, nodev, nodev,                      /* 9 */
	nodev, nodev, nodev, nodev, nodev,

(3) Edit /sys/h/ioctl.h and include a line (somewhere near where other
    line disciplines are defined) like:

#define	CLKLDISC	10		/* clock line discipline */

    The `10' should match what you used in /sys/sys/tty_conf.c.

(4) Edit /sys/conf/files and add a line which looks like:

sys/tty_clk.c		optional clk

(5) Edit the configuration file for the machine you want to use
    the clock line discipline on to include the following:

pseudo-device	clk 4

(6) Run config, then make clean, then make depend, then make vmunix.
    Then reboot the new kernel.