diff options
author | wollman <wollman@FreeBSD.org> | 1994-09-29 23:04:24 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1994-09-29 23:04:24 +0000 |
commit | 96f7e86b724c797f2b44beaaf956cf14550e57df (patch) | |
tree | 65fc9d6eb6e84f9e629426ab09186ab1373f9bcb /usr.sbin/xntpd/kernel | |
parent | 1185c9048d38483a3f99f3065590713d8bcda610 (diff) | |
download | FreeBSD-src-96f7e86b724c797f2b44beaaf956cf14550e57df.zip FreeBSD-src-96f7e86b724c797f2b44beaaf956cf14550e57df.tar.gz |
xntp 3.4e from Dave Mills @ UDel
Diffstat (limited to 'usr.sbin/xntpd/kernel')
-rw-r--r-- | usr.sbin/xntpd/kernel/Makefile.tmpl | 25 | ||||
-rw-r--r-- | usr.sbin/xntpd/kernel/chuinit.c | 76 | ||||
-rw-r--r-- | usr.sbin/xntpd/kernel/clkinit.c | 76 | ||||
-rw-r--r-- | usr.sbin/xntpd/kernel/tty_clk.c | 14 | ||||
-rw-r--r-- | usr.sbin/xntpd/kernel/tty_clk_STREAMS.c | 1 |
5 files changed, 190 insertions, 2 deletions
diff --git a/usr.sbin/xntpd/kernel/Makefile.tmpl b/usr.sbin/xntpd/kernel/Makefile.tmpl index c40f810..8b40f4a 100644 --- a/usr.sbin/xntpd/kernel/Makefile.tmpl +++ b/usr.sbin/xntpd/kernel/Makefile.tmpl @@ -13,9 +13,10 @@ CLOCKDEFS= DEFS= DEFS_OPT= DEFS_LOCAL= -# +CLK_VDOBJS=clkinit.o tty_clk_STREAMS.o +CHU_VDOBJS=chuinit.o tty_chu_STREAMS.o INCL=-I../include -CFLAGS= $(COPTS) $(DEFS) $(DEFS_LOCAL) $(INCL) +CFLAGS= $(COPTS) $(DEFS) $(DEFS_LOCAL) $(INCL) -DKERNEL CC= $(COMPILER) # @@ -30,6 +31,26 @@ all: print "### The parse refclock implementation has their own support in"; \ print "### parse/*."; } }' +loadable: clk.o chu.o + +clk.o: ${CLK_VDOBJS} + ld -r ${OBJS} -o clk.o + +clk.h: + echo "#define NCLK 2" > clk.h + +tty_clk_STREAMS.o: clk.h tty_clk_STREAMS.c + cc ${CFLAGS} tty_clk_STREAMS.c -c tty_clk_STREAMS.o + +chu.o: ${CHU_VDOBJS} + ld -r ${OBJS} -o chu.o + +chu.h: + echo "#define NCHU 2" > chu.h + +tty_chu_STREAMS.o: chu.h tty_chu_STREAMS.c + cc ${CFLAGS} tty_chu_STREAMS.c -c tty_chu_STREAMS.o + clean: -@rm -f *~ *.o *.out *.ln make.log Makefile.bak \ lintlib.errs lint.errs diff --git a/usr.sbin/xntpd/kernel/chuinit.c b/usr.sbin/xntpd/kernel/chuinit.c new file mode 100644 index 0000000..5fd96fd --- /dev/null +++ b/usr.sbin/xntpd/kernel/chuinit.c @@ -0,0 +1,76 @@ +/* +** dynamically loadable chu driver +** +** $Header: /usr/src/etc/xntp3.3ww/kernel/RCS/chuinit.c,v 1.1 1994/06/15 22:14:38 rob Exp $ +** +** william robertson <rob@agate.berkeley.edu> +*/ + +#include <sys/types.h> +#include <sys/conf.h> +#include <sys/errno.h> +#include <sys/stream.h> +#include <sys/syslog.h> + +#include <sun/openprom.h> +#include <sun/vddrv.h> + +extern int findmod(); /* os/str_io.c */ + +extern struct streamtab chuinfo; + +struct vdldrv vd = { + VDMAGIC_USER, + "chu" + }; + + +int +xxxinit(function_code, vdp, vdi, vds) +unsigned int function_code; +struct vddrv *vdp; +addr_t vdi; +struct vdstat *vds; +{ + register int i = 0; + register int j; + + switch (function_code) { + case VDLOAD: + + if (findmod("chu") >= 0) { + log(LOG_ERR, "chu stream module already loaded\n"); + return (EADDRINUSE); + } + + i = findmod("\0"); + + if (i == -1 || fmodsw[i].f_name[0] != '\0') + return(-1); + + for (j = 0; vd.Drv_name[j] != '\0'; j++) /* XXX check bounds */ + fmodsw[i].f_name[j] = vd.Drv_name[j]; + + fmodsw[i].f_name[j] = '\0'; + fmodsw[i].f_str = &chuinfo; + + vdp->vdd_vdtab = (struct vdlinkage *) &vd; + + return(0); + + case VDUNLOAD: + if ((i = findmod(vd.Drv_name)) == -1) + return(-1); + + fmodsw[i].f_name[0] = '\0'; + fmodsw[i].f_str = 0; + + return(0); + + case VDSTAT: + return(0); + + default: + return(EIO); + } +} diff --git a/usr.sbin/xntpd/kernel/clkinit.c b/usr.sbin/xntpd/kernel/clkinit.c new file mode 100644 index 0000000..e15b114 --- /dev/null +++ b/usr.sbin/xntpd/kernel/clkinit.c @@ -0,0 +1,76 @@ +/* +** dynamically loadable clk driver +** +** $Header: /usr/src/etc/xntp3.3ww/kernel/RCS/clkinit.c,v 1.1 1994/06/15 22:14:38 rob Exp $ +** +** william robertson <rob@agate.berkeley.edu> +*/ + +#include <sys/types.h> +#include <sys/conf.h> +#include <sys/errno.h> +#include <sys/stream.h> +#include <sys/syslog.h> + +#include <sun/openprom.h> +#include <sun/vddrv.h> + +extern int findmod(); /* os/str_io.c */ + +extern struct streamtab clkinfo; + +struct vdldrv vd = { + VDMAGIC_USER, + "clk" + }; + + +int +xxxinit(function_code, vdp, vdi, vds) +unsigned int function_code; +struct vddrv *vdp; +addr_t vdi; +struct vdstat *vds; +{ + register int i = 0; + register int j; + + switch (function_code) { + case VDLOAD: + + if (findmod("clk") >= 0) { + log(LOG_ERR, "clk stream module already loaded\n"); + return (EADDRINUSE); + } + + i = findmod("\0"); + + if (i == -1 || fmodsw[i].f_name[0] != '\0') + return(-1); + + for (j = 0; vd.Drv_name[j] != '\0'; j++) /* XXX check bounds */ + fmodsw[i].f_name[j] = vd.Drv_name[j]; + + fmodsw[i].f_name[j] = '\0'; + fmodsw[i].f_str = &clkinfo; + + vdp->vdd_vdtab = (struct vdlinkage *) &vd; + + return(0); + + case VDUNLOAD: + if ((i = findmod(vd.Drv_name)) == -1) + return(-1); + + fmodsw[i].f_name[0] = '\0'; + fmodsw[i].f_str = 0; + + return(0); + + case VDSTAT: + return(0); + + default: + return(EIO); + } +} diff --git a/usr.sbin/xntpd/kernel/tty_clk.c b/usr.sbin/xntpd/kernel/tty_clk.c index d1b4bbe..0720610 100644 --- a/usr.sbin/xntpd/kernel/tty_clk.c +++ b/usr.sbin/xntpd/kernel/tty_clk.c @@ -191,6 +191,19 @@ clkinput(c, tp) if (putc(c, &clk->clkbuf) == -1) goto flushout; +#ifdef CLKLDISC + /* + * STREAMS people started writing timestamps this way. + * It's not my fault, I am just going along with the flow... + */ + for (i = 0; i < sizeof(struct timeval); i++) + if (putc(*( ((char*)&tv) + i ), &clk->clkbuf) == -1) + goto flushout; +#else + /* + * This is a machine independant way of puting longs into + * the datastream. It has fallen into disuse... + */ s = tv.tv_sec; for (i = 0; i < sizeof(long); i++) { if (putc((s >> 24) & 0xff, &clk->clkbuf) == -1) @@ -204,6 +217,7 @@ clkinput(c, tp) goto flushout; s <<= 8; } +#endif /* * If the length of the rawq exceeds our sanity limit, dump diff --git a/usr.sbin/xntpd/kernel/tty_clk_STREAMS.c b/usr.sbin/xntpd/kernel/tty_clk_STREAMS.c index a69a757..13b0a25 100644 --- a/usr.sbin/xntpd/kernel/tty_clk_STREAMS.c +++ b/usr.sbin/xntpd/kernel/tty_clk_STREAMS.c @@ -38,6 +38,7 @@ #include <sys/kernel.h> #include <sys/user.h> #include <sys/errno.h> +#include <sys/syslog.h> #include <sys/clkdefs.h> |