]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Remove kernel line discipline driver code for clk and chu, deprecate
authorDave Hart <hart@ntp.org>
Sun, 20 Mar 2011 20:39:43 +0000 (20:39 +0000)
committerDave Hart <hart@ntp.org>
Sun, 20 Mar 2011 20:39:43 +0000 (20:39 +0000)
  related LDISC_ flags, and remove associated ntpd code to decode the
  timestamps, remove clktest line discipline test program.

bk: 4d86660fzxhG6UGWKI1sOXE56ecG-w

26 files changed:
.point-changed-filelist
ChangeLog
clockstuff/Makefile.am
clockstuff/README
clockstuff/clktest-opts.c [deleted file]
clockstuff/clktest-opts.def [deleted file]
clockstuff/clktest-opts.h [deleted file]
clockstuff/clktest.c [deleted file]
configure.ac
include/ntp_tty.h
include/ntpd.h
kernel/Makefile.am
kernel/README [deleted file]
kernel/chuinit.c [deleted file]
kernel/clkinit.c [deleted file]
kernel/sys/Makefile.am
kernel/sys/chudefs.h [deleted file]
kernel/sys/clkdefs.h [deleted file]
kernel/tty_chu.c [deleted file]
kernel/tty_chu_STREAMS.c [deleted file]
kernel/tty_clk.c [deleted file]
kernel/tty_clk_STREAMS.c [deleted file]
ntpd/ntp_refclock.c
ntpd/refclock_datum.c
ntpd/refclock_leitch.c
ntpd/refclock_oncore.c

index c1e4ceda2ad929e429663773494bd654419379d9..70db8387367272fc895a92d789ab0aa522553ed0 100644 (file)
@@ -1,6 +1,4 @@
 ChangeLog
-clockstuff/clktest-opts.c
-clockstuff/clktest-opts.h
 ntpd/ntpd-opts.c
 ntpd/ntpd-opts.h
 ntpd/ntpd-opts.texi
index 1146f401111cccc37f5579c95f632822448873af..372ec07abeca563c56e1f7cb3bfa0a822b07f45f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+* Remove kernel line discipline driver code for clk and chu, deprecate
+  related LDISC_ flags, and remove associated ntpd code to decode the
+  timestamps, remove clktest line discipline test program.
 * Add "ntpq -c iostats" similar to "ntpdc -c iostats".
 * Compare entire timestamp to reject duplicates in refclock_pps().
 (4.2.7p140) 2011/03/17 Released by Harlan Stenn <stenn@ntp.org>
index 19578feae7d588465b7a50674819fff474f04d55..0d6d2699834774e4b949bfdf5e0c727236fabe3b 100644 (file)
@@ -1,39 +1,17 @@
-noinst_PROGRAMS = @PROPDELAY@ @CHUTEST@ @CLKTEST@
-EXTRA_PROGRAMS = propdelay chutest clktest
-
-BUILT_SOURCES =        clktest-opts.c clktest-opts.h
-EXTRA_DIST = clktest-opts.def
-
-clktest_SOURCES = clktest.c clktest-opts.c clktest-opts.h
+noinst_PROGRAMS = @PROPDELAY@ @CHUTEST@
+EXTRA_PROGRAMS = propdelay chutest
 
 AM_CFLAGS = $(CFLAGS_NTP)
 
 AM_CPPFLAGS  = $(NTP_INCS)
-AM_CPPFLAGS += $(LIBOPTS_CFLAGS)
 AM_CPPFLAGS += $(CPPFLAGS_NTP)
 
 LDADD = ../libntp/libntp.a $(LDADD_LIBNTP) $(PTHREAD_LIBS)
 propdelay_LDADD = $(LIBM) $(LDADD)
 
-run_ag=                cd $(srcdir) && env PATH="$(abs_builddir):$(PATH)"      \
-               autogen -L ../sntp/include --writable
-std_def_list =                                                 \
-       $(top_srcdir)/sntp/include/debug-opt.def                \
-       $(top_srcdir)/sntp/include/autogen-version.def          \
-       $(top_srcdir)/sntp/include/copyright.def                \
-       $(top_srcdir)/sntp/include/homerc.def                   \
-       $(top_srcdir)/sntp/include/version.def                  \
-       $(NULL)
-
-$(srcdir)/clktest-opts.h: $(srcdir)/clktest-opts.c
-       @: do-nothing action to avoid default SCCS get, .h built with .c
-       
-$(srcdir)/clktest-opts.c: $(srcdir)/clktest-opts.def $(std_def_list)
-       $(run_ag) clktest-opts.def
-
+BUILT_SOURCES =
 CLEANFILES =
 
 include $(top_srcdir)/sntp/check-libntp.mf
-include $(top_srcdir)/check-libopts.mf
 include $(top_srcdir)/depsver.mf
 include $(top_srcdir)/includes.mf
index c7f972773aecceb357c5bf4232c8a99838b1be76..14089a9bb14df3133483f1953ffbba504243b04b 100644 (file)
@@ -1,19 +1,14 @@
 README file for directory ./clockstuff of the NTP Version 4 distribution
 
 This directory contains the sources for utility programs designed to
-support radio clocks. The chutest.c and clktest.c are desgined to
-test the chu_clk and tty_clk line disciplines and STREAMS modules in
-the ../kernel directory.
+support radio clocks.  chutest.c is desgined to test the depredated
+chu_clk line discipline or STREAMS module and can also test a CHU
+modem in raw mode.
 
-These files have been modified to work with either the line disciplines
-or the STREAMS modules. Be sure to define -DSTREAM if appropriate.
-
-These are random bits of things written to help with clocks.  You can
-make things in here by typing one or more of:
+You can make things in here by typing one or more of:
 
        make propdelay (or `make')
        make chutest
-       make clktest
 
 Propdelay computes high frequency propagation delays, given the
 longitude and latitude of the transmitter and receiver.  Use
@@ -24,8 +19,3 @@ Chutest can be used to input and process data from a CHU modem
 attached to a serial port.  It will use the CHU line discipline
 (if installed), or raw mode otherwise.  This was used to test
 out the initial reduction algorithms, and may not be up to date.
-
-Clktest can be used to test the clock line discipline (CLKLDISC,
-it must be available), and to take a look at radio clocks attached to a
-serial port.
-
diff --git a/clockstuff/clktest-opts.c b/clockstuff/clktest-opts.c
deleted file mode 100644 (file)
index ec3bf84..0000000
+++ /dev/null
@@ -1,641 +0,0 @@
-/*  
- *  EDIT THIS FILE WITH CAUTION  (clktest-opts.c)
- *  
- *  It has been AutoGen-ed  March 17, 2011 at 11:17:11 AM by AutoGen 5.11.6
- *  From the definitions    clktest-opts.def
- *  and the template file   options
- *
- * Generated from AutoOpts 34:0:9 templates.
- *
- *  AutoOpts is a copyrighted work.  This source file is not encumbered
- *  by AutoOpts licensing, but is provided under the licensing terms chosen
- *  by the clktest author or copyright holder.  AutoOpts is
- *  licensed under the terms of the LGPL.  The redistributable library
- *  (``libopts'') is licensed under the terms of either the LGPL or, at the
- *  users discretion, the BSD license.  See the AutoOpts and/or libopts sources
- *  for details.
- *
- * This source file is copyrighted and licensed under the following terms:
- *
- * clktest copyright (c) 1970-2011 David L. Mills and/or others - all rights reserved
- *
- * see html/copyright.html
- */
-
-#include <sys/types.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-extern FILE * option_usage_fp;
-#define OPTION_CODE_COMPILE 1
-#include "clktest-opts.h"
-
-#ifdef  __cplusplus
-extern "C" {
-#endif
-
-/* TRANSLATORS: choose the translation for option names wisely because you
-                cannot ever change your mind. */
-tSCC zCopyright[] =
-       "clktest copyright (c) 1970-2011 David L. Mills and/or others, all rights reserved"
-/* extracted from copyright.def near line 8 */
-;
-tSCC zCopyrightNotice[24] =
-"see html/copyright.html";
-
-extern tUsageProc optionUsage;
-
-/*
- *  global included definitions
- */
-extern int speed;
-extern int ttflags;
-
-#ifndef NULL
-#  define NULL 0
-#endif
-#ifndef EXIT_SUCCESS
-#  define  EXIT_SUCCESS 0
-#endif
-#ifndef EXIT_FAILURE
-#  define  EXIT_FAILURE 1
-#endif
-
-/*
- *  Speed option description:
- */
-static char const zSpeedText[] =
-        "Set the rate according to the speed";
-static char const zSpeed_NAME[]              = "SPEED";
-static char const zSpeed_Name[]              = "speed";
-#define SPEED_FLAGS       (OPTST_DISABLED \
-        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
-
-/*
- *  Debug option description:
- */
-static char const zDebugText[] =
-        "Turn on debugging output";
-static char const zDebug_NAME[]              = "DEBUG";
-static char const zDebug_Name[]              = "debug";
-#define DEBUG_FLAGS       (OPTST_DISABLED)
-
-/*
- *  Crmod option description:
- */
-static char const zCrmodText[] =
-        "Turn on CRMOD flag";
-static char const zCrmod_NAME[]              = "CRMOD";
-static char const zCrmod_Name[]              = "crmod";
-#define CRMOD_FLAGS       (OPTST_DISABLED)
-
-/*
- *  Command option description with
- *  "Must also have options" and "Incompatible options":
- */
-static char const zCommandText[] =
-        "";
-static char const zCommand_NAME[]            = "COMMAND";
-static char const zCommand_Name[]            = "command";
-static const int
-    aCommandMustList[] = {
-    INDEX_OPT_TIMEOUT, NO_EQUIVALENT };
-#define COMMAND_FLAGS       (OPTST_DISABLED \
-        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
-
-/*
- *  Timeout option description:
- */
-static char const zTimeoutText[] =
-        "Limit wait for command completion";
-static char const zTimeout_NAME[]            = "TIMEOUT";
-static char const zTimeout_Name[]            = "timeout";
-#define TIMEOUT_FLAGS       (OPTST_DISABLED \
-        | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
-
-/*
- *  Help/More_Help/Version option descriptions:
- */
-static char const zHelpText[]          = "Display extended usage information and exit";
-static char const zHelp_Name[]         = "help";
-#ifdef HAVE_WORKING_FORK
-#define OPTST_MORE_HELP_FLAGS   (OPTST_IMM | OPTST_NO_INIT)
-static char const zMore_Help_Name[]    = "more-help";
-static char const zMore_HelpText[]     = "Extended usage information passed thru pager";
-#else
-#define OPTST_MORE_HELP_FLAGS   (OPTST_OMITTED | OPTST_NO_INIT)
-#define zMore_Help_Name   NULL
-#define zMore_HelpText    NULL
-#endif
-#ifdef NO_OPTIONAL_OPT_ARGS
-#  define OPTST_VERSION_FLAGS   OPTST_IMM | OPTST_NO_INIT
-#else
-#  define OPTST_VERSION_FLAGS   OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
-                                OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT
-#endif
-
-static char const zVersionText[]       = "Output version information and exit";
-static char const zVersion_Name[]      = "version";
-static char const zSave_OptsText[]     = "Save the option state to a config file";
-static char const zSave_Opts_Name[]    = "save-opts";
-static char const zLoad_OptsText[]     = "Load options from a config file";
-static char const zLoad_Opts_NAME[]    = "LOAD_OPTS";
-static char const zNotLoad_Opts_Name[] = "no-load-opts";
-static char const zNotLoad_Opts_Pfx[]  = "no";
-#define zLoad_Opts_Name   (zNotLoad_Opts_Name + 3)
-/*
- *  Declare option callback procedures
- */
-#if defined(TEST_CLKTEST_OPTS)
-/*
- *  Under test, omit argument processing, or call optionStackArg,
- *  if multiple copies are allowed.
- */
-static tOptProc
-    doOptTimeout, doUsageOpt;
-
-/*
- *  #define map the "normal" callout procs to the test ones...
- */
-#define SPEED_OPT_PROC optionStackArg
-#define CRMOD_OPT_PROC optionStackArg
-
-
-#else /* NOT defined TEST_CLKTEST_OPTS */
-/*
- *  When not under test, there are different procs to use
- */
-extern tOptProc
-    optionBooleanVal,    optionNestedVal,     optionNumericVal,
-    optionPagedUsage,    optionPrintVersion,  optionResetOpt,
-    optionStackArg,      optionTimeVal,       optionUnstackArg,
-    optionVersionStderr;
-static tOptProc
-    doOptCrmod, doOptSpeed, doOptTimeout, doUsageOpt;
-
-/*
- *  #define map the "normal" callout procs
- */
-#define SPEED_OPT_PROC doOptSpeed
-#define CRMOD_OPT_PROC doOptCrmod
-
-#define SPEED_OPT_PROC doOptSpeed
-#define CRMOD_OPT_PROC doOptCrmod
-#endif /* defined(TEST_CLKTEST_OPTS) */
-#ifdef TEST_CLKTEST_OPTS
-# define DOVERPROC optionVersionStderr
-#else
-# define DOVERPROC optionPrintVersion
-#endif /* TEST_CLKTEST_OPTS */
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- *
- *  Define the Clktest Option Descriptions.
- */
-static tOptDesc optDesc[ OPTION_CT ] = {
-  {  /* entry idx, value */ 0, VALUE_OPT_SPEED,
-     /* equiv idx, value */ 0, VALUE_OPT_SPEED,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ SPEED_FLAGS, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL, NULL,
-     /* option proc      */ SPEED_OPT_PROC,
-     /* desc, NAME, name */ zSpeedText, zSpeed_NAME, zSpeed_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ 1, VALUE_OPT_DEBUG,
-     /* equiv idx, value */ 1, VALUE_OPT_DEBUG,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ DEBUG_FLAGS, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL, NULL,
-     /* option proc      */ NULL,
-     /* desc, NAME, name */ zDebugText, zDebug_NAME, zDebug_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ 2, VALUE_OPT_CRMOD,
-     /* equiv idx, value */ 2, VALUE_OPT_CRMOD,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ CRMOD_FLAGS, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL, NULL,
-     /* option proc      */ CRMOD_OPT_PROC,
-     /* desc, NAME, name */ zCrmodText, zCrmod_NAME, zCrmod_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ 3, VALUE_OPT_COMMAND,
-     /* equiv idx, value */ 3, VALUE_OPT_COMMAND,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ COMMAND_FLAGS, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ aCommandMustList, NULL,
-     /* option proc      */ NULL,
-     /* desc, NAME, name */ zCommandText, zCommand_NAME, zCommand_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ 4, VALUE_OPT_TIMEOUT,
-     /* equiv idx, value */ 4, VALUE_OPT_TIMEOUT,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ TIMEOUT_FLAGS, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL, NULL,
-     /* option proc      */ doOptTimeout,
-     /* desc, NAME, name */ zTimeoutText, zTimeout_NAME, zTimeout_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
-     /* equiv idx value  */ NO_EQUIVALENT, 0,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ OPTST_VERSION_FLAGS, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL, NULL,
-     /* option proc      */ DOVERPROC,
-     /* desc, NAME, name */ zVersionText, NULL, zVersion_Name,
-     /* disablement strs */ NULL, NULL },
-
-
-
-  {  /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
-     /* equiv idx value  */ NO_EQUIVALENT, 0,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ OPTST_IMM | OPTST_NO_INIT, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL, NULL,
-     /* option proc      */ doUsageOpt,
-     /* desc, NAME, name */ zHelpText, NULL, zHelp_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
-     /* equiv idx value  */ NO_EQUIVALENT, 0,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ OPTST_MORE_HELP_FLAGS, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL,  NULL,
-     /* option proc      */ optionPagedUsage,
-     /* desc, NAME, name */ zMore_HelpText, NULL, zMore_Help_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ INDEX_OPT_SAVE_OPTS, VALUE_OPT_SAVE_OPTS,
-     /* equiv idx value  */ NO_EQUIVALENT, 0,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
-                          | OPTST_ARG_OPTIONAL | OPTST_NO_INIT, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL,  NULL,
-     /* option proc      */ NULL,
-     /* desc, NAME, name */ zSave_OptsText, NULL, zSave_Opts_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ INDEX_OPT_LOAD_OPTS, VALUE_OPT_LOAD_OPTS,
-     /* equiv idx value  */ NO_EQUIVALENT, 0,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, NOLIMIT, 0,
-     /* opt state flags  */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
-                         | OPTST_DISABLE_IMM, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL, NULL,
-     /* option proc      */ optionLoadOpt,
-     /* desc, NAME, name */ zLoad_OptsText, zLoad_Opts_NAME, zLoad_Opts_Name,
-     /* disablement strs */ zNotLoad_Opts_Name, zNotLoad_Opts_Pfx }
-};
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- *
- *  Define the Clktest Option Environment
- */
-static char const zPROGNAME[8] = "CLKTEST";
-static char const zUsageTitle[129] =
-"clktest - test the clock line discipline - Ver. 4.2.7p140\n\
-USAGE:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... <tty_device>\n";
-static char const zRcName[7] = ".ntprc";
-static char const * const apzHomeList[3] = {
-    "$HOME",
-    ".",
-    NULL };
-
-static char const zBugsAddr[34]    = "http://bugs.ntp.org, bugs@ntp.org";
-#define zExplain NULL
-static char const zDetail[164] = "\n\
-Clktest can be used to test the clock line discipline (CLKLDISC, it must\n\
-be available), and to take a look at radio clocks attached to a serial\n\
-port.\n";
-static char const zFullVersion[] = CLKTEST_FULL_VERSION;
-/* extracted from optcode.tlib near line 504 */
-
-#if defined(ENABLE_NLS)
-# define OPTPROC_BASE OPTPROC_TRANSLATE
-  static tOptionXlateProc translate_option_strings;
-#else
-# define OPTPROC_BASE OPTPROC_NONE
-# define translate_option_strings NULL
-#endif /* ENABLE_NLS */
-
-
-#define clktest_full_usage NULL
-#define clktest_short_usage NULL
-#ifndef  PKGDATADIR
-# define PKGDATADIR ""
-#endif
-
-#ifndef  WITH_PACKAGER
-# define clktest_packager_info NULL
-#else
-static char const clktest_packager_info[] =
-    "Packaged by " WITH_PACKAGER
-
-# ifdef WITH_PACKAGER_VERSION
-        " ("WITH_PACKAGER_VERSION")"
-# endif
-
-# ifdef WITH_PACKAGER_BUG_REPORTS
-    "\nReport clktest bugs to " WITH_PACKAGER_BUG_REPORTS
-# endif
-    "\n";
-#endif
-
-tOptions clktestOptions = {
-    OPTIONS_STRUCT_VERSION,
-    0, NULL,                    /* original argc + argv    */
-    ( OPTPROC_BASE
-    + OPTPROC_ERRSTOP
-    + OPTPROC_SHORTOPT
-    + OPTPROC_LONGOPT
-    + OPTPROC_NO_REQ_OPT
-    + OPTPROC_ENVIRON
-    + OPTPROC_ARGS_REQ
-    + OPTPROC_MISUSE ),
-    0, NULL,                    /* current option index, current option */
-    NULL,         NULL,         zPROGNAME,
-    zRcName,      zCopyright,   zCopyrightNotice,
-    zFullVersion, apzHomeList,  zUsageTitle,
-    zExplain,     zDetail,      optDesc,
-    zBugsAddr,                  /* address to send bugs to */
-    NULL, NULL,                 /* extensions/saved state  */
-    optionUsage, /* usage procedure */
-    translate_option_strings,   /* translation procedure */
-    /*
-     *  Indexes to special options
-     */
-    { INDEX_OPT_MORE_HELP, /* more-help option index */
-      INDEX_OPT_SAVE_OPTS, /* save option index */
-      NO_EQUIVALENT, /* '-#' option index */
-      NO_EQUIVALENT /* index of default opt */
-    },
-    10 /* full option count */, 5 /* user option count */,
-    clktest_full_usage, clktest_short_usage,
-    NULL, NULL,
-    PKGDATADIR, clktest_packager_info
-};
-
-/*
- *  Create the static procedure(s) declared above.
- */
-static void
-doUsageOpt(
-    tOptions*   pOptions,
-    tOptDesc*   pOptDesc )
-{
-    (void)pOptions;
-    USAGE(EXIT_SUCCESS);
-}
-
-#if ! defined(TEST_CLKTEST_OPTS)
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- *
- *   For the speed option.
- */
-static void
-doOptSpeed(tOptions* pOptions, tOptDesc* pOptDesc)
-{
-    /* extracted from clktest-opts.def, line 98 */
-    /*
-     * speed table
-     */
-    static struct speeds {
-            const unsigned int bps;
-            const unsigned int rate;
-    } *spd, speedtab[] = {
-        { 300,          B300 },
-        { 1200,         B1200 },
-        { 2400,         B2400 },
-        { 4800,         B4800 },
-        { 9600,         B9600 },
-        { 19200,        EXTA },
-        { 38400,        EXTB },
-        { 0,            0 }
-    };
-    unsigned long tmp;
-
-    if (!atouint(pOptDesc->pzLastArg, &tmp)) {
-        fprintf(stderr, "%s error:  not a number:  ``%s''\n",
-                pOptions->pzProgName, pOptDesc->pzLastArg );
-        USAGE( EXIT_FAILURE );
-    }
-
-    for (spd = speedtab;;) {
-        if (tmp == spd->bps)
-            break;
-        spd++;
-        if (spd->bps == 0) {
-            fprintf(stderr, "%s: speed %lu is unsupported\n",
-                    pOptions->pzProgName, tmp);
-            USAGE( EXIT_FAILURE );
-        }
-    }
-
-    speed = spd->rate;
-}
-#endif /* defined(TEST_CLKTEST_OPTS) */
-
-#if ! defined(TEST_CLKTEST_OPTS)
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- *
- *   For the crmod option.
- */
-static void
-doOptCrmod(tOptions* pOptions, tOptDesc* pOptDesc)
-{
-    /* extracted from clktest-opts.def, line 152 */
-    ttflags |= CRMOD;
-}
-#endif /* defined(TEST_CLKTEST_OPTS) */
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- *
- *   For the timeout option.
- */
-static void
-doOptTimeout(tOptions* pOptions, tOptDesc* pOptDesc)
-{
-    static const struct {long const rmin, rmax;} rng[1] = {
-        { 1, 600 } };
-    long val;
-    int  ix;
-    char * pzEnd;
-
-    if (pOptions <= OPTPROC_EMIT_LIMIT)
-        goto emit_ranges;
-
-    errno = 0;
-    val = strtol(pOptDesc->optArg.argString, &pzEnd, 0);
-    if ((pOptDesc->optArg.argString == pzEnd) || (errno != 0))
-        goto bad_value;
-
-    if (*pzEnd != '\0')
-        goto bad_value;
-    for (ix = 0; ix < 1; ix++) {
-        if (val < rng[ix].rmin)
-            continue;  /* ranges need not be ordered. */
-        if (val == rng[ix].rmin)
-            goto valid_return;
-        if (rng[ix].rmax == LONG_MIN)
-            continue;
-        if (val <= rng[ix].rmax)
-            goto valid_return;
-    }
-
-  bad_value:
-
-    option_usage_fp = stderr;
-
-  emit_ranges:
-    optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
-    return;
-
-  valid_return:
-    if ((pOptDesc->fOptState & OPTST_ALLOC_ARG) != 0) {
-        free((void *)pOptDesc->optArg.argString);
-        pOptDesc->fOptState &= ~OPTST_ALLOC_ARG;
-    }
-    pOptDesc->optArg.argInt = val;
-}
-/* extracted from optmain.tlib near line 107 */
-
-#if defined(TEST_CLKTEST_OPTS) /* TEST MAIN PROCEDURE: */
-
-extern void optionPutShell(tOptions*);
-
-int
-main(int argc, char** argv)
-{
-    int res = EXIT_SUCCESS;
-    (void)optionProcess(&clktestOptions, argc, argv);
-    optionPutShell(&clktestOptions);
-    res = ferror(stdout);
-    if (res != 0)
-        fputs("output error writing to stdout\n", stderr);
-    return res;
-}
-#endif  /* defined TEST_CLKTEST_OPTS */
-/* extracted from optcode.tlib near line 657 */
-
-#if ENABLE_NLS
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <autoopts/usage-txt.h>
-
-static char* AO_gettext(char const* pz);
-static void  coerce_it(void** s);
-
-static char*
-AO_gettext(char const* pz)
-{
-    char* pzRes;
-    if (pz == NULL)
-        return NULL;
-    pzRes = _(pz);
-    if (pzRes == pz)
-        return pzRes;
-    pzRes = strdup(pzRes);
-    if (pzRes == NULL) {
-        fputs(_("No memory for duping translated strings\n"), stderr);
-        exit(EXIT_FAILURE);
-    }
-    return pzRes;
-}
-
-static void coerce_it(void** s) { *s = AO_gettext(*s); }
-#define COERSION(_f) \
-  coerce_it((void*)&(clktestOptions._f))
-
-/*
- *  This invokes the translation code (e.g. gettext(3)).
- */
-static void
-translate_option_strings(void)
-{
-    /*
-     *  Guard against re-translation.  It won't work.  The strings will have
-     *  been changed by the first pass through this code.  One shot only.
-     */
-    if (option_usage_text.field_ct != 0) {
-        /*
-         *  Do the translations.  The first pointer follows the field count
-         *  field.  The field count field is the size of a pointer.
-         */
-        tOptDesc* pOD = clktestOptions.pOptDesc;
-        char**    ppz = (char**)(void*)&(option_usage_text);
-        int       ix  = option_usage_text.field_ct;
-
-        do {
-            ppz++;
-            *ppz = AO_gettext(*ppz);
-        } while (--ix > 0);
-
-        COERSION(pzCopyright);
-        COERSION(pzCopyNotice);
-        COERSION(pzFullVersion);
-        COERSION(pzUsageTitle);
-        COERSION(pzExplain);
-        COERSION(pzDetail);
-        COERSION(pzPackager);
-        option_usage_text.field_ct = 0;
-
-        for (ix = clktestOptions.optCt; ix > 0; ix--, pOD++)
-            coerce_it((void*)&(pOD->pzText));
-    }
-
-    if ((clktestOptions.fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
-        tOptDesc* pOD = clktestOptions.pOptDesc;
-        int       ix;
-
-        for (ix = clktestOptions.optCt; ix > 0; ix--, pOD++) {
-            coerce_it((void*)&(pOD->pz_Name));
-            coerce_it((void*)&(pOD->pz_DisableName));
-            coerce_it((void*)&(pOD->pz_DisablePfx));
-        }
-        /* prevent re-translation */
-        clktestOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT;
-    }
-}
-
-#endif /* ENABLE_NLS */
-
-#ifdef  __cplusplus
-}
-#endif
-/* clktest-opts.c ends here */
diff --git a/clockstuff/clktest-opts.def b/clockstuff/clktest-opts.def
deleted file mode 100644 (file)
index 68dc47f..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-/* -*- Mode: Text -*- */
-
-autogen definitions options;
-
-prog-name      = "clktest";
-prog-title     = "test the clock line discipline";
-argument       = '<tty_device>';
-
-#include copyright.def
-#include homerc.def
-#include autogen-version.def
-
-detail = <<- _EODetail_
-       Clktest can be used to test the clock line discipline (CLKLDISC,
-       it must be available), and to take a look at radio clocks attached
-       to a serial port.
-       _EODetail_;
-
-test-main;
-
-#ifdef CLKLDISC
-flag = {
-    name      = magic2;
-    value     = a;
-    arg-type  = number;
-    arg-name  = kill-code;
-    arg-range = '0->255';
-    descrip   = "The 'kill' character (default: '\\r')";
-    ifdef     = CLKLDISC;
-    doc = <<-  _EndOfDoc_
-       "CLKLDISC" is actually never defined, or you will have compile issues.
-       _EndOfDoc_;
-};
-
-flag = {
-    name      = magic1;
-    value     = c;
-    arg-type  = number;
-    arg-name  = erase-code;
-    arg-range = '0->255';
-    descrip   = "The 'erase' character (default: '\\r')";
-    ifdef     = CLKLDISC;
-    doc = <<-  _EndOfDoc_
-       Or maybe the kill or maybe something else.
-       _EndOfDoc_;
-};
-#endif CLKLDISC
-
-#ifdef STREAM
-extern = <<- _EOExtern_
-       #ifdef STREAM
-       extern char magic[32];
-       #endif
-       _EOExtern_;
-
-include = <<- _EOInclude_
-       #ifdef STREAM
-       char magic[32] = "";
-       #endif
-       _EOInclude_;
-
-flag = {
-    name      = magic1;
-    value     = c;
-    arg-type  = string;
-    arg-name  = erase-code;
-    descrip   = "Magic characters for streams";
-    ifdef     = STREAM;
-    doc = <<-  _EndOfDoc_
-       Or maybe the kill or maybe something else.
-       _EndOfDoc_;
-
-    flag-code = <<- _EOCode_
-           unsigned long tmp;
-
-           if (!atouint(pOptDesc->pzLastArg, &tmp)) {
-               fprintf(stderr, "%s error:  not a number:  ``%s''\n",
-                       pOptions->pzProgName, pOptDesc->pzLastArg );
-               USAGE( EXIT_FAILURE );
-           }
-       _EOCode_;
-};
-#endif
-
-include       = 'extern int speed;';
-flag = {
-    name      = speed;
-    value     = b;
-    arg-type  = string;
-    arg-name  = bps;
-    descrip   = "Set the rate according to the speed";
-    doc = <<-  _EndOfDoc_
-       Be careful with this option.  It will cause an infinite loop, unless
-       all speeds are unsupported.
-       _EndOfDoc_;
-
-    flag-code = <<- _EOCode_
-           /*
-            * speed table
-            */
-           static struct speeds {
-                   const unsigned int bps;
-                   const unsigned int rate;
-           } *spd, speedtab[] = {
-               { 300,          B300 },
-               { 1200,         B1200 },
-               { 2400,         B2400 },
-               { 4800,         B4800 },
-               { 9600,         B9600 },
-               { 19200,        EXTA },
-               { 38400,        EXTB },
-               { 0,            0 }
-           };
-           unsigned long tmp;
-
-           if (!atouint(pOptDesc->pzLastArg, &tmp)) {
-               fprintf(stderr, "%s error:  not a number:  ``%s''\n",
-                       pOptions->pzProgName, pOptDesc->pzLastArg );
-               USAGE( EXIT_FAILURE );
-           }
-
-           for (spd = speedtab;;) {
-               if (tmp == spd->bps)
-                   break;
-               spd++;
-               if (spd->bps == 0) {
-                   fprintf(stderr, "%s: speed %lu is unsupported\n",
-                           pOptions->pzProgName, tmp);
-                   USAGE( EXIT_FAILURE );
-               }
-           }
-
-           speed = spd->rate;
-       _EOCode_;
-};
-
-
-flag = {
-    name      = debug;
-    value     = d;
-    descrip   = "Turn on debugging output";
-    doc = <<-  _EndOfDoc_
-       This option is not really used.
-       _EndOfDoc_;
-};
-
-include       = 'extern int ttflags;';
-flag = {
-    name      = crmod;
-    value     = f;
-    descrip   = "Turn on CRMOD flag";
-    flag-code = '    ttflags |= CRMOD;';
-    doc = <<-  _EndOfDoc_
-       
-       _EndOfDoc_;
-};
-
-flag = {
-    name      = command;
-    value     = s;
-    arg-type  = string;
-    arg-name  = cmd-name;
-    descrip   = "";
-    flags-must= timeout;
-    doc = <<-  _EndOfDoc_
-       
-       _EndOfDoc_;
-};
-
-flag = {
-    name      = timeout;
-    value     = t;
-    arg-type  = number;
-    arg-name  = seconds;
-    arg-range = '1->600'; /* one second to ten minutes */
-    descrip   = "Limit wait for command completion";
-    doc = <<-  _EndOfDoc_
-       
-       _EndOfDoc_;
-};
diff --git a/clockstuff/clktest-opts.h b/clockstuff/clktest-opts.h
deleted file mode 100644 (file)
index 8b94dd2..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-/*  
- *  EDIT THIS FILE WITH CAUTION  (clktest-opts.h)
- *  
- *  It has been AutoGen-ed  March 17, 2011 at 11:17:11 AM by AutoGen 5.11.6
- *  From the definitions    clktest-opts.def
- *  and the template file   options
- *
- * Generated from AutoOpts 34:0:9 templates.
- *
- *  AutoOpts is a copyrighted work.  This header file is not encumbered
- *  by AutoOpts licensing, but is provided under the licensing terms chosen
- *  by the clktest author or copyright holder.  AutoOpts is
- *  licensed under the terms of the LGPL.  The redistributable library
- *  (``libopts'') is licensed under the terms of either the LGPL or, at the
- *  users discretion, the BSD license.  See the AutoOpts and/or libopts sources
- *  for details.
- *
- * This source file is copyrighted and licensed under the following terms:
- *
- * clktest copyright (c) 1970-2011 David L. Mills and/or others - all rights reserved
- *
- * see html/copyright.html
- */
-/*
- *  This file contains the programmatic interface to the Automated
- *  Options generated for the clktest program.
- *  These macros are documented in the AutoGen info file in the
- *  "AutoOpts" chapter.  Please refer to that doc for usage help.
- */
-#ifndef AUTOOPTS_CLKTEST_OPTS_H_GUARD
-#define AUTOOPTS_CLKTEST_OPTS_H_GUARD 1
-#include "config.h"
-#include <autoopts/options.h>
-
-/*
- *  Ensure that the library used for compiling this generated header is at
- *  least as new as the version current when the header template was released
- *  (not counting patch version increments).  Also ensure that the oldest
- *  tolerable version is at least as old as what was current when the header
- *  template was released.
- */
-#define AO_TEMPLATE_VERSION 139264
-#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
- || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
-# error option template version mismatches autoopts/options.h header
-  Choke Me.
-#endif
-
-/*
- *  Enumeration of each option:
- */
-typedef enum {
-    INDEX_OPT_SPEED       =  0,
-    INDEX_OPT_DEBUG       =  1,
-    INDEX_OPT_CRMOD       =  2,
-    INDEX_OPT_COMMAND     =  3,
-    INDEX_OPT_TIMEOUT     =  4,
-    INDEX_OPT_VERSION     =  5,
-    INDEX_OPT_HELP        =  6,
-    INDEX_OPT_MORE_HELP   =  7,
-    INDEX_OPT_SAVE_OPTS   =  8,
-    INDEX_OPT_LOAD_OPTS   =  9
-} teOptIndex;
-
-#define OPTION_CT    10
-#define CLKTEST_VERSION       "4.2.7p140"
-#define CLKTEST_FULL_VERSION  "clktest - test the clock line discipline - Ver. 4.2.7p140"
-
-/*
- *  Interface defines for all options.  Replace "n" with the UPPER_CASED
- *  option name (as in the teOptIndex enumeration above).
- *  e.g. HAVE_OPT(SPEED)
- */
-#define         DESC(n) (clktestOptions.pOptDesc[INDEX_OPT_## n])
-#define     HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
-#define      OPT_ARG(n) (DESC(n).optArg.argString)
-#define    STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
-#define    COUNT_OPT(n) (DESC(n).optOccCt)
-#define    ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
-#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
-#define  ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
-#define  STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
-#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
-#define    CLEAR_OPT(n) STMTS( \
-                DESC(n).fOptState &= OPTST_PERSISTENT_MASK;   \
-                if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
-                    DESC(n).fOptState |= OPTST_DISABLED; \
-                DESC(n).optCookie = NULL )
-
-/* * * * * *
- *
- *  Enumeration of clktest exit codes
- */
-typedef enum {
-    CLKTEST_EXIT_SUCCESS = 0,
-    CLKTEST_EXIT_FAILURE = 1
-} clktest_exit_code_t;
-
-/*
- *  Make sure there are no #define name conflicts with the option names
- */
-#ifndef     NO_OPTION_NAME_WARNINGS
-# ifdef    SPEED
-#  warning undefining SPEED due to option name conflict
-#  undef   SPEED
-# endif
-# ifdef    DEBUG
-#  warning undefining DEBUG due to option name conflict
-#  undef   DEBUG
-# endif
-# ifdef    CRMOD
-#  warning undefining CRMOD due to option name conflict
-#  undef   CRMOD
-# endif
-# ifdef    COMMAND
-#  warning undefining COMMAND due to option name conflict
-#  undef   COMMAND
-# endif
-# ifdef    TIMEOUT
-#  warning undefining TIMEOUT due to option name conflict
-#  undef   TIMEOUT
-# endif
-#else  /* NO_OPTION_NAME_WARNINGS */
-# undef SPEED
-# undef DEBUG
-# undef CRMOD
-# undef COMMAND
-# undef TIMEOUT
-#endif  /*  NO_OPTION_NAME_WARNINGS */
-
-/* * * * * *
- *
- *  Interface defines for specific options.
- */
-#define VALUE_OPT_SPEED          'b'
-#define VALUE_OPT_DEBUG          'd'
-#define VALUE_OPT_CRMOD          'f'
-#define VALUE_OPT_COMMAND        's'
-#define VALUE_OPT_TIMEOUT        't'
-
-#define OPT_VALUE_TIMEOUT        (DESC(TIMEOUT).optArg.argInt)
-#define VALUE_OPT_HELP          '?'
-#define VALUE_OPT_MORE_HELP     '!'
-#define VALUE_OPT_VERSION       INDEX_OPT_VERSION
-#define VALUE_OPT_SAVE_OPTS     '>'
-#define VALUE_OPT_LOAD_OPTS     '<'
-#define SET_OPT_SAVE_OPTS(a)   STMTS( \
-        DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
-        DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
-        DESC(SAVE_OPTS).optArg.argString = (char const*)(a) )
-/*
- *  Interface defines not associated with particular options
- */
-#define ERRSKIP_OPTERR  STMTS(clktestOptions.fOptSet &= ~OPTPROC_ERRSTOP)
-#define ERRSTOP_OPTERR  STMTS(clktestOptions.fOptSet |= OPTPROC_ERRSTOP)
-#define RESTART_OPT(n)  STMTS( \
-                clktestOptions.curOptIdx = (n); \
-                clktestOptions.pzCurOpt  = NULL)
-#define START_OPT       RESTART_OPT(1)
-#define USAGE(c)        (*clktestOptions.pUsageProc)(&clktestOptions, c)
-/* extracted from opthead.tlib near line 435 */
-
-/* * * * * *
- *
- *  Declare the clktest option descriptor.
- */
-#ifdef  __cplusplus
-extern "C" {
-#endif
-
-extern tOptions   clktestOptions;
-
-#if defined(ENABLE_NLS)
-# ifndef _
-#   include <stdio.h>
-    static inline char* aoGetsText(char const* pz) {
-        if (pz == NULL) return NULL;
-        return (char*)gettext(pz);
-    }
-#   define _(s)  aoGetsText(s)
-# endif /* _() */
-
-# define OPT_NO_XLAT_CFG_NAMES  STMTS(clktestOptions.fOptSet |= \
-                                    OPTPROC_NXLAT_OPT_CFG;)
-# define OPT_NO_XLAT_OPT_NAMES  STMTS(clktestOptions.fOptSet |= \
-                                    OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
-
-# define OPT_XLAT_CFG_NAMES     STMTS(clktestOptions.fOptSet &= \
-                                  ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
-# define OPT_XLAT_OPT_NAMES     STMTS(clktestOptions.fOptSet &= \
-                                  ~OPTPROC_NXLAT_OPT;)
-
-#else   /* ENABLE_NLS */
-# define OPT_NO_XLAT_CFG_NAMES
-# define OPT_NO_XLAT_OPT_NAMES
-
-# define OPT_XLAT_CFG_NAMES
-# define OPT_XLAT_OPT_NAMES
-
-# ifndef _
-#   define _(_s)  _s
-# endif
-#endif  /* ENABLE_NLS */
-
-#ifdef  __cplusplus
-}
-#endif
-#endif /* AUTOOPTS_CLKTEST_OPTS_H_GUARD */
-/* clktest-opts.h ends here */
diff --git a/clockstuff/clktest.c b/clockstuff/clktest.c
deleted file mode 100644 (file)
index f254edb..0000000
+++ /dev/null
@@ -1,445 +0,0 @@
-/* clktest.c,v 3.1 1993/07/06 01:05:23 jbj Exp
- * clktest - test the clock line discipline
- *
- * usage: clktest -b bps -f -t timeo -s cmd -c char1 -a char2 /dev/whatever
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-#include <stdio.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <signal.h>
-#include <netinet/in.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-#include <sys/file.h>
-#ifdef HAVE_SGTTY_H
-#include <sgtty.h>
-#endif
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#ifdef CLKLDISC
-# define DEFMAGIC      '\r'
-#endif
-
-#ifdef CLKLDISC
-# ifdef STREAM
-#  include <stropts.h>
-#  ifdef HAVE_SYS_CLKDEFS_H
-#   include <sys/clkdefs.h>
-#  endif
-#  undef  DEFMAGIC
-#  define DEFMAGIC     "\r"
-# endif
-#endif
-
-#include "ntp_fp.h"
-#include "ntp.h"
-#include "ntp_unixtime.h"
-#include "clktest-opts.h"
-
-#define        STREQ(a, b)     (*(a) == *(b) && strcmp((a), (b)) == 0)
-
-#if defined(ULT_2_0_SUCKS)
-#ifndef sigmask
-#define        sigmask(m)      (1<<(m))
-#endif
-#endif
-
-#ifndef STREAM
-# ifndef CLKLDISC
-    CLOCK_LINE_DISCIPLINE_NEEDED_BY_THIS_PROGRAM;
-# endif
-#else
-# ifdef CLKLDISC
-    ONLY_ONE_CLOCK_LINE_DISCIPLINE_FOR_THIS_PROGRAM;
-# endif
-#endif
-
-/*
- * Mask for blocking SIGIO and SIGALRM
- */
-#define        BLOCKSIGMASK    (sigmask(SIGIO)|sigmask(SIGALRM))
-
-#define progname clktestOptions.pzProgName
-
-struct timeval timeout = { 0 };
-char *cmd = NULL;
-int cmdlen;
-
-#ifdef CLKLDISC
-u_long magic1 = DEFMAGIC;
-u_long magic2 = DEFMAGIC;
-#endif
-
-int speed = B9600;
-int ttflags = RAW|EVENP|ODDP;
-
-volatile int wasalarmed;
-volatile int iosig;
-
-struct timeval lasttv;
-
-int alarming();
-int ioready();
-
-/*
- * main - parse arguments and handle options
- */
-int
-main(
-       int argc,
-       char *argv[]
-       )
-{
-       int fd;
-       struct sgttyb ttyb;
-       struct itimerval itimer;
-
-#ifdef STREAM
-       magic[0] = 0;
-#endif
-
-       {
-           int ct = optionProcess( &clktestOptions, argc, argv );
-           if (HAVE_OPT(COMMAND) && (strlen(OPT_ARG(COMMAND)) == 0)) {
-               fputs( "The command option string must not be empty\n", stderr );
-               USAGE( EXIT_FAILURE );
-           }
-
-           if ((argc -= ct) != 1) {
-               fputs( "Missing tty device name\n", stderr );
-               USAGE( EXIT_FAILURE );
-           }
-           argv += ct;
-       }
-#ifdef STREAM
-       if (!strlen(magic))
-           strcpy(magic,DEFMAGIC);
-#endif
-
-       fd = open(*argv, HAVE_OPT(TIMEOUT) ? O_RDWR : O_RDONLY, 0777);
-       if (fd == -1) {
-               fprintf(stderr, "%s: open(%s): ", progname, *argv);
-               perror("");
-               exit(1);
-       }
-
-       if (ioctl(fd, TIOCEXCL, (char *)0) < 0) {
-               (void) fprintf(stderr, "%s: ioctl(TIOCEXCL): ", progname);
-               perror("");
-               exit(1);
-       }
-
-       /*
-        * If we have the clock discipline, set the port to raw.  Otherwise
-        * we run cooked.
-        */
-       ttyb.sg_ispeed = ttyb.sg_ospeed = speed;
-#ifdef CLKLDISC
-       ttyb.sg_erase = (char)magic1;
-       ttyb.sg_kill = (char)magic2;
-#endif
-       ttyb.sg_flags = (short)ttflags;
-       if (ioctl(fd, TIOCSETP, (char *)&ttyb) < 0) {
-               (void) fprintf(stderr, "%s: ioctl(TIOCSETP): ", progname);
-               perror("");
-               exit(1);
-       }
-
-       if (fcntl(fd, F_SETOWN, getpid()) == -1) {
-               (void) fprintf(stderr, "%s: fcntl(F_SETOWN): ", progname);
-               perror("");
-               exit(1);
-       }
-
-#ifdef CLKLDISC
-       {
-               int ldisc;
-               ldisc = CLKLDISC;
-               if (ioctl(fd, TIOCSETD, (char *)&ldisc) < 0) {
-                       (void) fprintf(stderr, "%s: ioctl(TIOCSETD): ", progname);
-                       perror("");
-                       exit(1);
-               }
-       }
-#endif
-#ifdef STREAM
-       if (ioctl(fd, I_POP, 0) >=0 ) ;
-       if (ioctl(fd, I_PUSH, "clk") < 0) {
-               (void) fprintf(stderr, "%s: ioctl(I_PUSH): ", progname);
-               perror("");
-               exit(1);
-       }
-       if (ioctl(fd, CLK_SETSTR, magic) < 0) {
-               (void) fprintf(stderr, "%s: ioctl(CLK_SETSTR): ", progname);
-               perror("");
-               exit(1);
-       }
-#endif
-
-
-       (void) gettimeofday(&lasttv, (struct timezone *)0);
-       if (HAVE_OPT(TIMEOUT)) {
-               /*
-                * set non-blocking, async I/O on the descriptor
-                */
-               iosig = 0;
-               (void) signal(SIGIO, ioready);
-               if (fcntl(fd, F_SETFL, FNDELAY|FASYNC) < 0) {
-                       (void) fprintf(stderr, "%s: fcntl(F_SETFL): ",
-                                      progname);
-                       perror("");
-                       exit(1);
-               }
-
-               /*
-                * Set up the alarm interrupt.
-                */
-               wasalarmed = 0;
-               (void) signal(SIGALRM, alarming);
-               timeout.tv_sec = OPT_VALUE_TIMEOUT;
-               itimer.it_interval = itimer.it_value = timeout;
-               setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0);
-               doboth(fd);
-       }
-       doioonly(fd);
-}
-
-
-/*
- * doboth - handle both I/O and alarms via SIGIO
- */
-int
-doboth(
-       int fd
-       )
-{
-       int n;
-       int sawalarm;
-       int sawiosig;
-       int omask;
-       fd_set fds;
-       struct timeval tvzero;
-
-       sawalarm = 0;
-       sawiosig = 0;
-       FD_ZERO(&fds);
-       for (;;) {
-               omask = sigblock(BLOCKSIGMASK);
-               if (wasalarmed) {               /* alarmed? */
-                       sawalarm = 1;
-                       wasalarmed = 0;
-               }
-               if (iosig) {
-                       sawiosig = 1;
-                       iosig = 0;
-               }
-
-               if (!sawalarm && !sawiosig) {
-                       /*
-                        * Nothing to do.  Wait for something.
-                        */
-                       sigpause(omask);
-                       if (wasalarmed) {               /* alarmed? */
-                               sawalarm = 1;
-                               wasalarmed = 0;
-                       }
-                       if (iosig) {
-                               sawiosig = 1;
-                               iosig = 0;
-                       }
-               }
-               (void)sigsetmask(omask);
-
-               if (sawiosig) {
-
-                       do {
-                               tvzero.tv_sec = tvzero.tv_usec = 0;
-                               FD_SET(fd, &fds);
-                               n = select(fd+1, &fds, (fd_set *)0,
-                                          (fd_set *)0, &tvzero);
-                               if (n > 0)
-                                   doio(fd);
-                       } while (n > 0);
-
-                       if (n == -1) {
-                               (void) fprintf(stderr, "%s: select: ",
-                                              progname);
-                               perror("");
-                               exit(1);
-                       }
-                       sawiosig = 0;
-               }
-               if (sawalarm) {
-                       doalarm(fd);
-                       sawalarm = 0;
-               }
-       }
-}
-
-
-/*
- * doioonly - do I/O.  This avoids the use of signals
- */
-int
-doioonly(
-       int fd
-       )
-{
-       int n;
-       fd_set fds;
-
-       FD_ZERO(&fds);
-       for (;;) {
-               FD_SET(fd, &fds);
-               n = select(fd+1, &fds, (fd_set *)0, (fd_set *)0,
-                          (struct timeval *)0);
-               if (n > 0)
-                   doio(fd);
-       }
-}
-
-
-/*
- * doio - read a buffer full of stuff and print it out
- */
-int
-doio(
-       int fd
-       )
-{
-       register char *rp, *rpend;
-       register char *cp;
-       register int i;
-       char raw[512];
-       struct timeval tv, tvd;
-       int rlen;
-       int ind;
-       char cooked[2049];
-       static char *digits = "0123456789abcdef";
-
-       rlen = read(fd, raw, sizeof(raw));
-       if (rlen < 0) {
-               (void) fprintf(stderr, "%s: read(): ", progname);
-               perror("");
-               return;
-       }
-       if (rlen == 0) {
-               (void) printf("Zero length read\n");
-               return;
-       }
-
-       cp = cooked;
-       rp = raw;
-       rpend = &raw[rlen];
-       ind = 0;
-
-       while (rp < rpend) {
-               ind = 1;
-               if (isprint(*rp))
-                   *cp++ = *rp;
-               else {
-                       *cp++ = '<';
-                       *cp++ = digits[((*rp)>>4) & 0xf];
-                       *cp++ = digits[*rp & 0xf];
-                       *cp++ = '>';
-               }
-               if (
-#ifdef CLKLDISC
-                       (*rp == (char)magic1 || *rp == (char)magic2)
-#else
-                       ( strchr( magic, *rp) != NULL )
-#endif
-                       ) {
-                       rp++;
-                       ind = 0;
-                       *cp = '\0';
-                       if ((rpend - rp) < sizeof(struct timeval)) {
-                               (void)printf(
-                                       "Too little data (%d): %s\n",
-                                       rpend-rp, cooked);
-                               return;
-                       }
-
-                       tv.tv_sec = 0;
-                       for (i = 0; i < 4; i++) {
-                               tv.tv_sec <<= 8;
-                               tv.tv_sec |= ((long)*rp++) & 0xff;
-                       }
-                       tv.tv_usec = 0;
-                       for (i = 0; i < 4; i++) {
-                               tv.tv_usec <<= 8;
-                               tv.tv_usec |= ((long)*rp++) & 0xff;
-                       }
-
-                       tvd.tv_sec = tv.tv_sec - lasttv.tv_sec;
-                       tvd.tv_usec = tv.tv_usec - lasttv.tv_usec;
-                       if (tvd.tv_usec < 0) {
-                               tvd.tv_usec += 1000000;
-                               tvd.tv_sec--;
-                       }
-
-                       (void)printf("%lu.%06lu %lu.%06lu %s\n",
-                                    tv.tv_sec, tv.tv_usec, tvd.tv_sec, tvd.tv_usec,
-                                    cooked);
-                       lasttv = tv;
-               } else {
-                       rp++;
-               }
-       }
-
-       if (ind) {
-               *cp = '\0';
-               (void)printf("Incomplete data: %s\n", cooked);
-       }
-}
-
-
-/*
- * doalarm - send a string out the port, if we have one.
- */
-int
-doalarm(
-       int fd
-       )
-{
-       int n;
-
-       if (! HAVE_OPT(COMMAND))
-           return;
-
-       n = write(fd, cmd, cmdlen);
-
-       if (n < 0) {
-               (void) fprintf(stderr, "%s: write(): ", progname);
-               perror("");
-       } else if (n < cmdlen) {
-               (void) printf("Short write (%d bytes, should be %d)\n",
-                             n, cmdlen);
-       }
-}
-
-
-/*
- * alarming - receive alarm interupt
- */
-void
-alarming(void)
-{
-       wasalarmed = 1;
-}
-
-/*
- * ioready - handle SIGIO interrupt
- */
-void
-ioready(void)
-{
-       iosig = 1;
-}
index f8da73100fddd4dd934d03079d9766554b0985cc..7d5fa41274f776726cbbda3903d6bd05aade5f76 100644 (file)
@@ -280,9 +280,7 @@ case "$ac_cv_header_netinfo_ni_h" in
  yes)
     AC_DEFINE([HAVE_NETINFO], [1], [NetInfo support?])
 esac
-AC_CHECK_HEADERS([sun/audioio.h sys/audioio.h])
-AC_CHECK_HEADERS([sys/chudefs.h])
-AC_CHECK_HEADERS([sys/clkdefs.h sys/file.h])
+AC_CHECK_HEADERS([sun/audioio.h sys/audioio.h sys/file.h])
 case "$host" in
  *-*-sunos4*)
     ;;
@@ -300,11 +298,6 @@ case "$ac_cv_header_sched_h" in
     AC_CHECK_HEADERS([sys/sched.h])
     ;;
 esac
-case "$host" in
- *-*-sco*)
-    AC_CHECK_HEADERS([sys/sio.h])
-    ;;
-esac
 # HMS: Check sys/shm.h after some others
 AC_CHECK_HEADERS([sys/select.h sys/signal.h sys/sockio.h])
 # HMS: Checked sys/socket.h earlier
@@ -1344,58 +1337,6 @@ case "$ans" in
 esac
 AC_MSG_RESULT([$ans])
 
-case "$ac_cv_header_sys_sio_h" in
- yes)
-    AC_CACHE_CHECK(
-       [sys/sio.h for TIOCDCDTIMESTAMP],
-       [ntp_cv_hdr_def_tiocdcdtimestamp],
-       [AC_EGREP_CPP(
-           [yes],
-           [
-               #include <sys/sio.h>
-
-               #ifdef TIOCDCDTIMESTAMP
-                   yes
-               #endif
-           ],
-           [ntp_cv_hdr_def_tiocdcdtimestamp=yes],
-           [ntp_cv_hdr_def_tiocdcdtimestamp=no]
-       )]
-    )
-esac
-
-AC_CACHE_CHECK(
-    [if we have the tty_clk line discipline/streams module],
-    [ntp_cv_tty_clk],
-    [
-       case "$ac_cv_header_sys_clkdefs_h$ntp_cv_hdr_def_tiocdcdtimestamp" in
-        *yes*)
-           ntp_cv_tty_clk=yes
-           ;;
-        *)
-           ntp_cv_tty_clk=no
-           ;;
-       esac
-    ]
-)
-case "$ntp_cv_tty_clk" in
- yes)
-    AC_DEFINE([TTYCLK], [1],
-       [Do we have the tty_clk line discipline/streams module?])
-esac
-
-AC_MSG_CHECKING([for the ppsclock streams module])
-case "$ntp_cv_struct_ppsclockev" in
- yes)
-    ans=yes
-    AC_DEFINE([PPS], [1],
-       [Do we have the ppsclock streams module?])
-    ;;
- *)
-    ans=no
-esac
-AC_MSG_RESULT([$ans])
-
 AC_CACHE_CHECK(
     [availability of ntp_{adj,get}time()],
     [ntp_cv_var_ntp_syscalls],
@@ -2887,7 +2828,6 @@ AC_MSG_RESULT($ntp_refclock)
 dnl Things that can be made in clockstuff
 AC_SUBST([PROPDELAY], [propdelay])
 AC_SUBST([CHUTEST]) dnl needs work to compile
-AC_SUBST([CLKTEST]) dnl needs work to compile
 
 AC_SUBST([MAKE_ADJTIMED])
 AC_MSG_CHECKING([if we want HP-UX adjtimed support])
index ec7448683d88077af4cebc0a9b781b4ee5f2acbc..6dc48b6c71f19d6feb5c481570f9306cf82943b1 100644 (file)
 #endif
 
 /*
- * Line discipline flags. These require line discipline or streams
- * modules to be installed/loaded in the kernel. If specified, but not
- * installed, the code runs as if unspecified.
+ * Line discipline flags.  The depredated ones required line discipline
+ * or streams modules to be installed/loaded in the kernel and are now
+ * ignored.  Leave the LDISC_CLK and other deprecated symbols defined
+ * until 2013 or 2014 to avoid complicating the use of newer drivers on
+ * older ntpd, which is often as easy as dropping in the refclock *.c.
  */
 #define LDISC_STD      0x000   /* standard */
-#define LDISC_CLK      0x001   /* tty_clk \n intercept */
-#define LDISC_CLKPPS   0x002   /* tty_clk \377 intercept */
-#define LDISC_ACTS     0x004   /* tty_clk #* intercept */
+#define LDISC_CLK      0x001   /* depredated tty_clk \n */
+#define LDISC_CLKPPS   0x002   /* depredated tty_clk \377 */
+#define LDISC_ACTS     0x004   /* depredated tty_clk #* */
 #define LDISC_CHU      0x008   /* depredated */
-#define LDISC_PPS      0x010   /* ppsclock, ppsapi */
+#define LDISC_PPS      0x010   /* depredated */
 #define LDISC_RAW      0x020   /* raw binary */
 #define LDISC_ECHO     0x040   /* enable echo */
 #define        LDISC_REMOTE    0x080   /* remote mode */
index 84930809b6b7d40b45f9cf0a66d4f21ab13adecb..3beff08522a083ef8be9b2f922549c4e75a38a44 100644 (file)
@@ -488,13 +488,6 @@ extern u_long      sys_declined;           /* declined */
 extern u_long  sys_limitrejected;      /* rate exceeded */
 extern u_long  sys_kodsent;            /* KoD sent */
 
-/* ntp_refclock.c */
-#ifdef REFCLOCK
-#ifdef PPS
-extern int     fdpps;                  /* pps file descriptor */
-#endif /* PPS */
-#endif
-
 /* ntp_request.c */
 extern keyid_t info_auth_keyid;        /* keyid used to authenticate requests */
 extern u_long  auth_timereset;
index b89793c8618c7654efe832ace3a0c29828556864..081839c48c8fa867ac1eab348dffa09bebcc2147 100644 (file)
@@ -1,2 +1 @@
 SUBDIRS = sys
-EXTRA_DIST = chuinit.c clkinit.c tty_chu.c tty_chu_STREAMS.c tty_clk.c tty_clk_STREAMS.c
diff --git a/kernel/README b/kernel/README
deleted file mode 100644 (file)
index 253d04e..0000000
+++ /dev/null
@@ -1,200 +0,0 @@
-Installing Line Disciplines and Streams Modules
-
-Description
-
-Most radio and modem clocks used for a primary (stratum-1) NTP server
-utilize serial ports operating at speeds of 9600 baud or greater. The
-timing jitter contributed by the serial port hardware and software
-discipline can accumulate to several milliseconds on a typical Unix
-workstation. In order to reduce these errors, a set of special line
-disciplines can be configured in the operating system process. These
-disciplines intercept special characters or signals provided by the
-radio or modem clock and save a local timestamp for later processing.
-
-The disciplines can be compiled in the kernel in older BSD-derived
-systems, or installed as System V streams modules and either compiled in
-the kernel or dynamically loaded when required. In either case, they
-require reconfiguration of the Unix kernel and provisions in the NTP
-daemon xntpd. The streams modules can be pushed and popped from the
-streams stack using conventional System V streams program primitives.
-Note that not all Unix kernels support line disciplines and of those
-that do, not all support System V streams. The disciplines here are
-known to work correctly with SunOS 4.x kernels, but have not been tested
-for other kernels.
-
-There are two line disciplines included in the distribution. Support for
-each is enabled by adding flags to the DEFS_LOCAL line of the build
-configuration file ./Config.local. This can be done automatically by the
-autoconfiguration build procedures, or can be inserted/deleted after the
-process has completed.
-
-tty_clk (CLK)
-
-     This discipline intercepts characters received from the serial port
-     and passes unchanged all except a set of designated characters to
-     the generic serial port discipline. For each of the exception
-     characters, the character is inserted in the receiver buffer
-     followed by a timestamp in Unix timeval format. Both select() and
-     SIGIO are supported by the discipline. The -DCLK flag is used to
-     compile support for this disipline in the NTP daemon. This flag is
-     included if the clkdefs.h file is found in the /sys/sys directory,
-     or it can be added (or deleted) manually.
-
-tty_chu (CHU)
-
-     This discipline is a special purpose line discipline for receiving
-     a special timecode broadcast by Canadian time and frequency
-     standard station CHU. The radio signal is first demodulated by the
-     300-baud modem included in the gadget box, then processed by the
-     discipline and finally processed by the Scratchbuilt CHU Receiver
-     discipline (type 7). This discipline should be used in raw mode.
-     The -DCHU flag is used to compile support for this disipline in the
-     NTP daemon. This flag is included if the chudefs.h file is found in
-     the /sys/sys directory, or it can be added (or deleted) manually.
-
-There are two sets of line disciplines. The tty_clk.c and chu_clk.c are
-designed for use with older BSD systems and are compiled in the kernel.
-The tty_clk_STREAMS.c and chu_clk_STREAMS.c are designed for use with
-System V streams, in which case they can be either compiled in the
-kernel or dynamically loaded. Since these disciplines are small,
-unobtrusive, and to nothing unless specifically enabled by an
-application program, it probably doesn't matter which method is choosen.
-
-Compiling with the Kernel
-
-The following procedures are for the tty_clk line discipline; for the
-chu_clk, change "tty" to "chu".
-1.   Copy tty_clk.c into /sys/os and clkdefs.h into /sys/sys.
-
-2.   For SunOS 4.x systems, edit /sys/os/tty_conf.c using 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 CLK */
-            ttselect },
-     #else
-          { nodev, nodev, nodev, nodev, nodev,
-            nodev, nodev, nodev, nodev, nodev,
-            nodev },
-     #endif
-
-     For Ultrix 4.x systems, edit /sys/data/tty_conf_data.c using 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, /* 10 CLK */
-          clkinput, nodev, nulldev, ttstart, nulldev,
-     #else
-          nodev, nodev, nodev, nodev, nodev,
-          nodev, nodev, nodev, nodev, nodev,
-     #endif
-
-     If the kernel doesn't include the ??select() entry in the structure
-     (i.e., there are only ten entry points in the structure) just leave
-     it out. Also note that the number you give the line discipline (10
-     in most kernels) will be specific to that 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 CLK */
-     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 as the number in the preceding
-     step.
-
-4.   Edit /sys/conf/files and add a line which looks like:
-
-     sys/tty_clk.c     optional clk
-
-5.   Edit the kernel configuration file to include the following:
-
-     pseudo-device  tty 4  # TTY clock support
-6.   Run config, then make clean, then make depend, then make vmunix,
-     then reboot the new kernel.
-
-Installing as a streams module
-
-The following procedures are for the tty_clk_STREAMS line discipline;
-for the tty_chu_STREAMS, change "clk" to "chu".
-
-1.   Copy your choice to /sys/os, removing the "_STREAMS" in the
-     filename.
-
-2.   Copy the clkdefs.h file to /usr/include/sys, then construct a soft
-     link to /sys/sys.
-
-3.   Append to /sys/conf.common/files.cmn:
-
-     os/tty_tty.c  optional tty
-
-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 "tty.h"
-     ...
-     #if NTTY > 0
-     extern struct streamtab ttyinfo;
-     #endif
-     ...
-     #if NTTY > 0
-          { "tty", &ttyinfo },
-     #endif
-
-5.   Edit /sys/[arch]/conf/[k-name] (substituting the architecture and
-     kernel name) to stick in:
-
-     pseudo-device  tty 4  # TTY clock support
-
-     You can change "4" to anything you like. It will limit the number
-     of instantiations of the tty discipline you can use at the same
-     time.
-
-6.   Run config, then make clean, then make depend, then make vmunix,
-     then reboot the new kernel.
-
-Both disciplines can be dynamically loaded using streams procedures
-specific to the kernel. Before using the chu_clk discipline, all other
-streams modules that may already be on the stack should be popped, then
-the discipline should be pushed on the stack.
-
-How to Use the tty_clk Line Discipline
-
-The tty_clk line discipline defines a new ioctl(), CLK_SETSTR, which
-takes a pointer to a string of no more than CLK_MAXSTRSIZE characters.
-Until the first CLK_SETSTR is performed, the discipline will simply pass
-through characters. Once it is passed a string by CLK_SETSTR, any
-character in that string will be immediately followed by a timestamp in
-Unix timeval format. 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 used, as it is the string
-terminator. Passing an empty string to CLK_SETSTR turns off stamping.
-Passing NULL will produce undefined results.
-
-How to Use the tty_chu Line Discipline
-The tty_chu line discipline translates data received from the CHU modem
-and returns chucode structures, as defined in chudefs.h, and expected by
-the Scratchbuilt CHU Receiver reference clock  driver. 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.
-
-David L. Mills (mills@udel.edu)
diff --git a/kernel/chuinit.c b/kernel/chuinit.c
deleted file mode 100644 (file)
index 270c3d5..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
-**     dynamically loadable chu driver
-**
-**     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/kernel/clkinit.c b/kernel/clkinit.c
deleted file mode 100644 (file)
index 716ca81..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
-**     dynamically loadable clk driver
-**
-**     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);
-     }
-}
index 9e92dc8ef9f7426a8bce375be39c220aad534c3b..72923448af22dc4441e8e46d4b4b53286c022c87 100644 (file)
@@ -1,2 +1,2 @@
-noinst_HEADERS = bsd_audioirig.h chudefs.h clkdefs.h i8253.h parsestreams.h \
+noinst_HEADERS = bsd_audioirig.h i8253.h parsestreams.h \
  pcl720.h ppsclock.h timex.h tpro.h tt560_api.h
diff --git a/kernel/sys/chudefs.h b/kernel/sys/chudefs.h
deleted file mode 100644 (file)
index f5549f5..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Definitions for the CHU line discipline v2.0
- */
-
-/*
- * The CHU time code consists of 10 BCD digits and is repeated
- * twice for a total of 10 characters.  A time is taken after
- * the arrival of each character.  The following structure is
- * used to return this stuff.
- */
-#define        NCHUCHARS       (10)
-
-struct chucode {
-       u_char codechars[NCHUCHARS];    /* code characters */
-       u_char ncodechars;              /* number of code characters */
-       u_char chutype;                 /* packet type */
-       struct timeval codetimes[NCHUCHARS];    /* arrival times */
-};
-
-#define CHU_TIME 0             /* second half is equal to first half */
-#define CHU_YEAR 1             /* second half is one's complement */
-
diff --git a/kernel/sys/clkdefs.h b/kernel/sys/clkdefs.h
deleted file mode 100644 (file)
index afbc77a..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Defines for the "clk" timestamping STREAMS module
- */
-
-#if defined(sun)
-#include <sys/ioccom.h>
-#else
-#include <sys/ioctl.h>
-#endif
-
-/*
- * First, we need to define the maximum size of the set of
- * characters to timestamp. 32 is MORE than enough.
- */
-
-#define CLK_MAXSTRSIZE 32
-struct clk_tstamp_charset {            /* XXX to use _IOW not _IOWN */
-       char    val[CLK_MAXSTRSIZE];
-};
-
-/*
- * ioctl(fd, CLK_SETSTR, (char*)c );
- *
- * will tell the driver that any char in the null-terminated
- * string c should be timestamped. It is possible, though
- * unlikely that this ioctl number could collide with an
- * existing one on your system. If so, change the 'K'
- * to some other letter. However, once you've compiled
- * the kernel with this include file, you should NOT
- * change this file.
- */
-
-#if defined(__STDC__)                  /* XXX avoid __STDC__=0 on SOLARIS */
-#define CLK_SETSTR _IOW('K', 01, struct clk_tstamp_charset)
-#else
-#define CLK_SETSTR _IOW(K, 01, struct clk_tstamp_charset)
-#endif
-
diff --git a/kernel/tty_chu.c b/kernel/tty_chu.c
deleted file mode 100644 (file)
index 4615875..0000000
+++ /dev/null
@@ -1,276 +0,0 @@
-/* tty_chu.c,v 3.1 1993/07/06 01:07:30 jbj Exp
- * tty_chu.c - CHU line driver
- */
-
-#include "chu.h"
-#if NCHU > 0
-
-#include "../h/param.h"
-#include "../h/types.h"
-#include "../h/systm.h"
-#include "../h/dir.h"
-#include "../h/user.h"
-#include "../h/ioctl.h"
-#include "../h/tty.h"
-#include "../h/proc.h"
-#include "../h/file.h"
-#include "../h/conf.h"
-#include "../h/buf.h"
-#include "../h/uio.h"
-
-#include "../h/chudefs.h"
-
-/*
- * Line discipline for receiving CHU time codes.
- * Does elementary noise elimination, takes time stamps after
- * the arrival of each character, returns a buffer full of the
- * received 10 character code and the associated time stamps.
- */
-#define        NUMCHUBUFS      3
-
-struct chudata {
-       u_char used;            /* Set to 1 when structure in use */
-       u_char lastindex;       /* least recently used buffer */
-       u_char curindex;        /* buffer to use */
-       u_char sleeping;        /* set to 1 when we're sleeping on a buffer */
-       struct chucode chubuf[NUMCHUBUFS];
-} chu_data[NCHU];
-
-/*
- * Number of microseconds we allow between
- * character arrivals.  The speed is 300 baud
- * so this should be somewhat more than 30 msec
- */
-#define        CHUMAXUSEC      (50*1000)       /* 50 msec */
-
-int chu_debug = 0;
-
-/*
- * Open as CHU time discipline.  Called when discipline changed
- * with ioctl, and changes the interpretation of the information
- * in the tty structure.
- */
-/*ARGSUSED*/
-chuopen(dev, tp)
-       dev_t dev;
-       register struct tty *tp;
-{
-       register struct chudata *chu;
-
-       /*
-        * Don't allow multiple opens.  This will also protect us
-        * from someone opening /dev/tty
-        */
-       if (tp->t_line == CHULDISC)
-               return (EBUSY);
-       ttywflush(tp);
-       for (chu = chu_data; chu < &chu_data[NCHU]; chu++)
-               if (!chu->used)
-                       break;
-       if (chu >= &chu[NCHU])
-               return (EBUSY);
-       chu->used++;
-       chu->lastindex = chu->curindex = 0;
-       chu->sleeping = 0;
-       chu->chubuf[0].ncodechars = 0;
-       tp->T_LINEP = (caddr_t) chu;
-       return (0);
-}
-
-/*
- * Break down... called when discipline changed or from device
- * close routine.
- */
-chuclose(tp)
-       register struct tty *tp;
-{
-       register int s = spl5();
-
-       ((struct chudata *) tp->T_LINEP)->used = 0;
-       tp->t_cp = 0;
-       tp->t_inbuf = 0;
-       tp->t_rawq.c_cc = 0;            /* clear queues -- paranoid */
-       tp->t_canq.c_cc = 0;
-       tp->t_line = 0;                 /* paranoid: avoid races */
-       splx(s);
-}
-
-/*
- * Read a CHU buffer.  Sleep on the current buffer
- */
-churead(tp, uio)
-       register struct tty *tp;
-       struct uio *uio;
-{
-       register struct chudata *chu;
-       register struct chucode *chucode;
-       register int s;
-
-       if ((tp->t_state&TS_CARR_ON)==0)
-               return (EIO);
-
-       chu = (struct chudata *) (tp->T_LINEP);
-
-       s = spl5();
-       chucode = &(chu->chubuf[chu->lastindex]);
-       while (chu->curindex == chu->lastindex) {
-               chu->sleeping = 1;
-               sleep((caddr_t)chucode, TTIPRI);
-       }
-       chu->sleeping = 0;
-       if (++(chu->lastindex) >= NUMCHUBUFS)
-               chu->lastindex = 0;
-       splx(s);
-
-       return (uiomove((caddr_t)chucode, sizeof(*chucode), UIO_READ, uio));
-}
-
-/*
- * Low level character input routine.
- * If the character looks okay, grab a time stamp.  If the stuff in
- * the buffer is too old, dump it and start fresh.  If the character is
- * non-BCDish, everything in the buffer too.
- */
-chuinput(c, tp)
-       register int c;
-       register struct tty *tp;
-{
-       register struct chudata *chu = (struct chudata *) tp->T_LINEP;
-       register struct chucode *chuc;
-       register int i;
-       long sec, usec;
-       struct timeval tv;
-
-       /*
-        * Do a check on the BSDness of the character.  This delays
-        * the time stamp a bit but saves a fair amount of overhead
-        * when the static is bad.
-        */
-       if (((c) & 0xf) > 9 || (((c)>>4) & 0xf) > 9) {
-               chuc = &(chu->chubuf[chu->curindex]);
-               chuc->ncodechars = 0;   /* blow all previous away */
-               return;
-       }
-
-       /*
-        * Call microtime() to get the current time of day
-        */
-       microtime(&tv);
-
-       /*
-        * Compute the difference in this character's time stamp
-        * and the last.  If it exceeds the margin, blow away all
-        * the characters currently in the buffer.
-        */
-       chuc = &(chu->chubuf[chu->curindex]);
-       i = (int)chuc->ncodechars;
-       if (i > 0) {
-               sec = tv.tv_sec - chuc->codetimes[i-1].tv_sec;
-               usec = tv.tv_usec - chuc->codetimes[i-1].tv_usec;
-               if (usec < 0) {
-                       sec -= 1;
-                       usec += 1000000;
-               }
-               if (sec != 0 || usec > CHUMAXUSEC) {
-                       i = 0;
-                       chuc->ncodechars = 0;
-               }
-       }
-
-       /*
-        * Store the character.  If we're done, have to tell someone
-        */
-       chuc->codechars[i] = (u_char)c;
-       chuc->codetimes[i] = tv;
-
-       if (++i < NCHUCHARS) {
-               /*
-                * Not much to do here.  Save the count and wait
-                * for another character.
-                */
-               chuc->ncodechars = (u_char)i;
-       } else {
-               /*
-                * Mark this buffer full and point at next.  If the
-                * next buffer is full we overwrite it by bumping the
-                * next pointer.
-                */
-               chuc->ncodechars = NCHUCHARS;
-               if (++(chu->curindex) >= NUMCHUBUFS)
-                       chu->curindex = 0;
-               if (chu->curindex == chu->lastindex)
-                       if (++(chu->lastindex) >= NUMCHUBUFS)
-                               chu->lastindex = 0;
-               chu->chubuf[chu->curindex].ncodechars = 0;
-
-               /*
-                * Wake up anyone sleeping on this.  Also wake up
-                * selectors and/or deliver a SIGIO as required.
-                */
-               if (tp->t_rsel) {
-                       selwakeup(tp->t_rsel, tp->t_state&TS_RCOLL);
-                       tp->t_state &= ~TS_RCOLL;
-                       tp->t_rsel = 0;
-               }
-               if (tp->t_state & TS_ASYNC)
-                       gsignal(tp->t_pgrp, SIGIO);
-               if (chu->sleeping)
-                       (void) wakeup((caddr_t)chuc);
-       }
-}
-
-/*
- * Handle ioctls.  We reject all tty-style except those that
- * change the line discipline.
- */
-chuioctl(tp, cmd, data, flag)
-       struct tty *tp;
-       int cmd;
-       caddr_t data;
-       int flag;
-{
-
-       if ((cmd>>8) != 't')
-               return (-1);
-       switch (cmd) {
-       case TIOCSETD:
-       case TIOCGETD:
-       case TIOCGETP:
-       case TIOCGETC:
-               return (-1);
-       }
-       return (ENOTTY);        /* not quite appropriate */
-}
-
-
-chuselect(dev, rw)
-       dev_t dev;
-       int rw;
-{
-       register struct tty *tp = &cdevsw[major(dev)].d_ttys[minor(dev)];
-       struct chudata *chu;
-       int s = spl5();
-
-       chu = (struct chudata *) (tp->T_LINEP);
-
-       switch (rw) {
-
-       case FREAD:
-               if (chu->curindex != chu->lastindex)
-                       goto win;
-               if (tp->t_rsel && tp->t_rsel->p_wchan == (caddr_t)&selwait)
-                       tp->t_state |= TS_RCOLL;
-               else
-                       tp->t_rsel = u.u_procp;
-               break;
-
-       case FWRITE:
-               goto win;
-       }
-       splx(s);
-       return (0);
-win:
-       splx(s);
-       return (1);
-}
-#endif NCHU
diff --git a/kernel/tty_chu_STREAMS.c b/kernel/tty_chu_STREAMS.c
deleted file mode 100644 (file)
index f46e25d..0000000
+++ /dev/null
@@ -1,603 +0,0 @@
-/*
- * CHU STREAMS module for SunOS
- *
- * Version 2.6
- *
- * Copyright 1991-1994, Nick Sayer
- *
- * Special thanks to Greg Onufer for his debug assists.
- * Special thanks to Matthias Urlichs for the 4.1.x loadable driver support
- *   code.
- * Special wet-noodle whippings to Sun for not properly documenting
- *   ANYTHING that makes this stuff at all possible.
- *
- * Should be PUSHed directly on top of a serial I/O channel.
- * Provides complete chucode structures to user space.
- *
- * COMPILATION:
- *
- *
- * To make a SunOS 4.1.x compatable loadable module (from the ntp kernel
- * directory):
- *
- * % cc -c -I../include -DLOADABLE tty_chu_STREAMS.c
- *
- * The resulting .o file is the loadable module. Modload it
- * thusly:
- *
- * % modload tty_chu_STREAMS.o -entry _chuinit
- *
- * When none of the instances are pushed in a STREAM, you can
- * modunload the driver in the usual manner if you wish.
- *
- * As an alternative to loading it dynamically you can compile it
- * directly into the kernel by hacking str_conf.c. See the README
- * file for more details on doing it the old fashioned way.
- *
- *
- * To make a Solaris 2.x compatable module (from the ntp kernel
- * directory):
- *
- * % {gcc,cc} -c -I../include -DSOLARIS2 tty_chu_STREAMS.c
- * % ld -r -o /usr/kernel/strmod/chu tty_chu_STREAMS.o
- * % chmod 755 /usr/kernel/strmod/chu
- *
- * The OS will load it for you automagically when it is first pushed.
- *
- * If you get syntax errors from <sys/timer.h> (really references
- * to types that weren't typedef'd in gcc's version of types.h),
- * add -D_SYS_TIMER_H to blot out the miscreants.
- *
- * Under Solaris 2.2 and previous, do not attempt to modunload the
- * module unless you're SURE it's not in use. I haven't tried it, but
- * I've been told it won't do the right thing. Under Solaris 2.3 (and
- * presumably future revs) an attempt to unload the module when it's in
- * use will properly refuse with a "busy" message.
- *
- *
- * HISTORY:
- *
- * v2.6 - Mutexed the per-instance chucode just to be safe.
- * v2.5 - Fixed show-stopper bug in Solaris 2.x - qprocson().
- * v2.4 - Added dynamic allocation support for Solaris 2.x.
- * v2.3 - Added support for Solaris 2.x.
- * v2.2 - Added SERVICE IMMEDIATE hack.
- * v2.1 - Added 'sixth byte' heuristics.
- * v2.0 - first version with an actual version number.
- *        Added support for new CHU 'second 31' data format.
- *        Deleted PEDANTIC and ANAL_RETENTIVE.
- *
- */
-
-#ifdef SOLARIS2
-# ifndef NCHU
-#  define NCHU 1
-# endif
-# define _KERNEL
-#elif defined(LOADABLE)
-# ifndef NCHU
-#  define NCHU 3
-#  define KERNEL
-# endif
-#else
-# include "chu.h"
-#endif
-
-#if NCHU > 0
-
-/*
- * Number of microseconds we allow between
- * character arrivals.  The speed is 300 baud
- * so this should be somewhat more than 30 msec
- */
-#define        CHUMAXUSEC      (60*1000)       /* 60 msec */
-
-#include <sys/types.h>
-#include <sys/stream.h>
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/errno.h>
-#include <sys/user.h>
-#include <syslog.h>
-#include <sys/tty.h>
-
-#include <sys/chudefs.h>
-
-#ifdef SOLARIS2
-
-#include <sys/ksynch.h>
-#include <sys/kmem.h>
-#include <sys/cmn_err.h>
-#include <sys/conf.h>
-#include <sys/strtty.h>
-#include <sys/modctl.h>
-#include <sys/ddi.h>
-#include <sys/sunddi.h>
-
-#endif
-
-#ifdef LOADABLE
-
-#include <sys/kernel.h>
-#include <sys/conf.h>
-#include <sys/buf.h>
-#include <sundev/mbvar.h>
-#include <sun/autoconf.h>
-#include <sun/vddrv.h>
-
-#endif
-
-
-static struct module_info rminfo = { 0, "chu", 0, INFPSZ, 0, 0 };
-static struct module_info wminfo = { 0, "chu", 0, INFPSZ, 0, 0 };
-static int chuopen(), churput(), chuwput(), chuclose();
-
-static struct qinit rinit = { churput, NULL, chuopen, chuclose, NULL,
-       &rminfo, NULL };
-
-static struct qinit winit = { chuwput, NULL, NULL, NULL, NULL,
-       &wminfo, NULL };
-
-struct streamtab chuinfo = { &rinit, &winit, NULL, NULL };
-
-/*
- * Here's our private data type and structs
- */
-struct priv_data 
-{
-#ifdef SOLARIS2
-  kmutex_t chucode_mutex;
-#else
-  char in_use;
-#endif
-  struct chucode chu_struct;
-};
-
-#ifndef SOLARIS2
-struct priv_data our_priv_data[NCHU];
-#endif
-
-#ifdef SOLARIS2
-
-static struct fmodsw fsw =
-{
-  "chu",
-  &chuinfo,
-  D_NEW | D_MP
-};
-
-extern struct mod_ops mod_strmodops;
-
-static struct modlstrmod modlstrmod =
-{
-  &mod_strmodops,
-  "CHU timecode decoder v2.6",
-  &fsw
-};
-
-static struct modlinkage modlinkage =
-{
-  MODREV_1,
-  (void*) &modlstrmod,
-  NULL
-};
-
-int _init()
-{
-  return mod_install(&modlinkage);
-}
-
-int _info(foo)
-struct modinfo *foo;
-{
-  return mod_info(&modlinkage,foo);
-}
-
-int _fini()
-{
-  return mod_remove(&modlinkage);
-}
-
-#endif /* SOLARIS2 */
-
-#ifdef LOADABLE
-
-# ifdef sun
-
-static struct vdldrv vd =
-{
-    VDMAGIC_PSEUDO,
-    "chu",
-    NULL, NULL, NULL, 0, 0, NULL, NULL, 0, 0,
-};
-
-static struct fmodsw *chu_fmod;
-
-/*ARGSUSED*/
-chuinit (fc, vdp, vdi, vds)
-    unsigned int fc;
-    struct vddrv *vdp;
-    addr_t vdi;
-    struct vdstat *vds;
-{
-    switch (fc) {
-    case VDLOAD:
-        {
-            int dev, i;
-
-            /* Find free entry in fmodsw */
-            for (dev = 0; dev < fmodcnt; dev++) {
-                if (fmodsw[dev].f_str == NULL)
-                    break;
-            }
-            if (dev == fmodcnt)
-                return (ENODEV);
-            chu_fmod = &fmodsw[dev];
-
-           /* If you think a kernel would have strcpy() you're mistaken. */
-            for (i = 0; i <= FMNAMESZ; i++)
-                chu_fmod->f_name[i] = wminfo.mi_idname[i];
-
-            chu_fmod->f_str = &chuinfo;
-        }
-        vdp->vdd_vdtab = (struct vdlinkage *) & vd;
-
-       {
-           int i;
-
-           for (i=0; i<NCHU; i++)
-               our_priv_data[i].in_use=0;
-       }
-
-        return 0;
-    case VDUNLOAD:
-        {
-            int dev;
-
-            for (dev = 0; dev < NCHU; dev++)
-                if (our_priv_data[dev].in_use) {
-                    /* One of the modules is still open */
-                    return (EBUSY);
-                }
-        }
-        chu_fmod->f_name[0] = '\0';
-        chu_fmod->f_str = NULL;
-        return 0;
-    case VDSTAT:
-        return 0;
-    default:
-        return EIO;
-    }
-}
-
-# endif /* sun */
-
-#endif /* LOADABLE */
-
-#if !defined(LOADABLE) && !defined(SOLARIS2)
-
-char chu_first_open=1;
-
-#endif
-
-/*ARGSUSED*/
-static int chuopen(q, dev, flag, sflag)
-queue_t *q;
-dev_t dev;
-int flag;
-int sflag;
-{
-  int i;
-
-#if !defined(LOADABLE) && !defined(SOLARIS2)
-  if (chu_first_open)
-  {
-    chu_first_open=0;
-
-    for(i=0;i<NCHU;i++)
-      our_priv_data[i].in_use=0;
-  }
-#endif
-
-#ifdef SOLARIS2
-  /* According to the docs, calling with KM_SLEEP can never
-     fail */
-
-  q->q_ptr = kmem_alloc( sizeof(struct priv_data), KM_SLEEP );
-  ((struct priv_data *) q->q_ptr)->chu_struct.ncodechars = 0;
-
-  mutex_init(&((struct priv_data *) q->q_ptr)->chucode_mutex,"Chucode Mutex",MUTEX_DRIVER,NULL);
-  qprocson(q);
-
-  if (!putnextctl1(WR(q), M_CTL, MC_SERVICEIMM))
-  {
-    qprocsoff(q);
-    mutex_destroy(&((struct priv_data *)q->q_ptr)->chucode_mutex);
-    kmem_free(q->q_ptr, sizeof(struct chucode) );
-    return (EFAULT);
-  }
-
-  return 0;
-
-#else
-  for(i=0;i<NCHU;i++)
-    if (!our_priv_data[i].in_use)
-    {
-      ((struct priv_data *) (q->q_ptr))=&(our_priv_data[i]);
-      our_priv_data[i].in_use++;
-      our_priv_data[i].chu_struct.ncodechars = 0;
-      if (!putctl1(WR(q)->q_next, M_CTL, MC_SERVICEIMM))
-      {
-        our_priv_data[i].in_use=0;
-        u.u_error = EFAULT;
-       return (OPENFAIL);
-      }
-      return 0;
-    }
-
-  u.u_error = EBUSY;
-  return (OPENFAIL);
-#endif
-
-}
-
-/*ARGSUSED*/
-static int chuclose(q, flag)
-queue_t *q;
-int flag;
-{
-#ifdef SOLARIS2
-  qprocsoff(q);
-  mutex_destroy(&((struct priv_data *)q->q_ptr)->chucode_mutex);
-  kmem_free(q->q_ptr, sizeof(struct chucode) );
-#else
-  ((struct priv_data *) (q->q_ptr))->in_use=0;
-#endif
-  return (0);
-}
-
-/*
- * Now the crux of the biscuit.
- *
- * We will be passed data from the man downstairs. If it's not a data
- * packet, it must be important, so pass it along unmunged. If, however,
- * it is a data packet, we're gonna do special stuff to it. We're going
- * to pass each character we get to the old line discipline code we
- * include below for just such an occasion. When the old ldisc code
- * gets a full chucode struct, we'll hand it back upstairs.
- *
- * chuinput takes a single character and q (as quickly as possible).
- * passback takes a pointer to a chucode struct and q and sends it upstream.
- */
-
-void chuinput();
-void passback();
-
-static int churput(q, mp)
-queue_t *q;
-mblk_t *mp;
-{
-  mblk_t *bp;
-
-  switch(mp->b_datap->db_type)
-  {
-    case M_DATA:
-      for(bp=mp; bp!=NULL; bp=bp->b_cont)
-      {
-       while(bp->b_rptr < bp->b_wptr)
-         chuinput( ((u_char)*(bp->b_rptr++)) , q );
-      }
-      freemsg(mp);
-    break;
-    default:
-      putnext(q,mp);
-    break;
-  }
-
-}
-
-/*
- * Writing to a chu device doesn't make sense, but we'll pass them
- * through in case they're important.
- */
-
-static int chuwput(q, mp)
-queue_t *q;
-mblk_t *mp;
-{
-  putnext(q,mp);
-}
-
-/*
- * Take a pointer to a filled chucode struct and a queue and
- * send the chucode stuff upstream
- */
-
-void passback(outdata,q)
-struct chucode *outdata;
-queue_t *q;
-{
-  mblk_t *mp;
-  int j;
-
-  mp=(mblk_t*) allocb(sizeof(struct chucode),BPRI_LO);
-
-  if (mp==NULL)
-  {
-#ifdef SOLARIS2
-    cmn_err(CE_WARN,"chu module couldn't allocate message block");
-#else
-    log(LOG_ERR,"chu: cannot allocate message");
-#endif
-    return;
-  }
-
-  for(j=0;j<sizeof(struct chucode); j++)
-    *mp->b_wptr++ = *( ((char*)outdata) + j );
-
-  putnext(q,mp);
-}
-
-/*
- * This routine was copied nearly verbatim from the old line discipline.
- */
-void chuinput(c,q)
-register u_char c;
-queue_t *q;
-{
-  register struct chucode *chuc;
-  register int i;
-  long sec, usec;
-  struct timeval tv;
-
-  /*
-   * Quick, Batman, get a timestamp! We need to do this
-   * right away. The time between the end of the stop bit
-   * and this point is critical, and should be as nearly
-   * constant and as short as possible. (Un)fortunately,
-   * the Sun's clock granularity is so big this isn't a
-   * major problem.
-   *
-   * uniqtime() is totally undocumented, but there you are.
-   */
-  uniqtime(&tv);
-
-#ifdef SOLARIS2
-  mutex_enter(&((struct priv_data *)q->q_ptr)->chucode_mutex);
-#endif
-
-  /*
-   * Now, locate the chu struct once so we don't have to do it
-   * over and over.
-   */
-  chuc=&(((struct priv_data *) (q->q_ptr))->chu_struct);
-
-       /*
-        * Compute the difference in this character's time stamp
-        * and the last.  If it exceeds the margin, blow away all
-        * the characters currently in the buffer.
-        */
-  i = (int)chuc->ncodechars;
-  if (i > 0)
-  {
-    sec = tv.tv_sec - chuc->codetimes[i-1].tv_sec;
-    usec = tv.tv_usec - chuc->codetimes[i-1].tv_usec;
-    if (usec < 0)
-    {
-      sec -= 1;
-      usec += 1000000;
-    }
-    if (sec != 0 || usec > CHUMAXUSEC)
-    {
-      i = 0;
-      chuc->ncodechars = 0;
-    }
-  }
-
-  /*
-   * Store the character.
-   */
-  chuc->codechars[i] = (u_char)c;
-  chuc->codetimes[i] = tv;
-
-  /*
-   * Now we perform the 'sixth byte' heuristics.
-   *
-   * This is a long story.
-   *
-   * We used to be able to count on the first byte of the code
-   * having a '6' in the LSD. This prevented most code framing
-   * errors (garbage before the first byte wouldn't typically
-   * have a 6 in the LSD). That's no longer the case.
-   *
-   * We can get around this, however, by noting that the 6th byte
-   * must be either equal to or one's complement of the first.
-   * If we get a sixth byte that ISN'T like that, then it may
-   * well be that the first byte is garbage. The right thing
-   * to do is to left-shift the whole buffer one count and
-   * continue to wait for the sixth byte.
-   */
-  if (i == NCHUCHARS/2)
-  {
-    register u_char temp_byte;
-
-    temp_byte=chuc->codechars[i] ^ chuc->codechars[0];
-
-    if ( (temp_byte) && (temp_byte!=0xff) )
-    {
-      register int t;
-      /*
-       * No match. Left-shift the buffer and try again
-       */
-      for(t=0;t<=NCHUCHARS/2;t++)
-      {
-       chuc->codechars[t]=chuc->codechars[t+1];
-       chuc->codetimes[t]=chuc->codetimes[t+1];
-      }
-
-      i--; /* This is because of the ++i immediately following */
-    }
-  }
-
-  /*
-   * We done yet?
-   */
-  if (++i < NCHUCHARS)
-  {
-    /*
-     * We're not done. Not much to do here. Save the count and wait
-     * for another character.
-     */
-    chuc->ncodechars = (u_char)i;
-  }
-  else
-  {
-    /*
-     * We are done. Mark this buffer full and pass it along.
-     */
-    chuc->ncodechars = NCHUCHARS;
-
-    /*
-     * Now we have a choice. Either the front half and back half
-     * have to match, or be one's complement of each other.
-     *
-     * So let's try the first byte and see
-     */
-
-    if(chuc->codechars[0] == chuc->codechars[NCHUCHARS/2])
-    {
-      chuc->chutype = CHU_TIME;
-      for( i=0; i<(NCHUCHARS/2); i++)
-        if (chuc->codechars[i] != chuc->codechars[i+(NCHUCHARS/2)])
-        {
-          chuc->ncodechars = 0;
-#ifdef SOLARIS2
-          mutex_exit(&((struct priv_data *)q->q_ptr)->chucode_mutex);
-#endif
-          return;
-        }
-    }
-    else
-    {
-      chuc->chutype = CHU_YEAR;
-      for( i=0; i<(NCHUCHARS/2); i++)
-        if (((chuc->codechars[i] ^ chuc->codechars[i+(NCHUCHARS/2)]) & 0xff)
-         != 0xff )
-        {
-          chuc->ncodechars = 0;
-#ifdef SOLARIS2
-          mutex_exit(&((struct priv_data *)q->q_ptr)->chucode_mutex);
-#endif
-          return;
-        }
-    }
-
-    passback(chuc,q); /* We're done! */
-    chuc->ncodechars = 0; /* Start all over again! */
-  }
-#ifdef SOLARIS2
-  mutex_exit(&((struct priv_data *)q->q_ptr)->chucode_mutex);
-#endif
-}
-
-#endif /* NCHU > 0 */
diff --git a/kernel/tty_clk.c b/kernel/tty_clk.c
deleted file mode 100644 (file)
index 0720610..0000000
+++ /dev/null
@@ -1,317 +0,0 @@
-/* tty_clk.c,v 3.1 1993/07/06 01:07:33 jbj Exp
- * tty_clk.c - Generic line driver for receiving radio clock timecodes
- */
-
-#include "clk.h"
-#if NCLK > 0
-
-#include "../h/param.h"
-#include "../h/types.h"
-#include "../h/systm.h"
-#include "../h/dir.h"
-#include "../h/user.h"
-#include "../h/ioctl.h"
-#include "../h/tty.h"
-#include "../h/proc.h"
-#include "../h/file.h"
-#include "../h/conf.h"
-#include "../h/buf.h"
-#include "../h/uio.h"
-#include "../h/clist.h"
-
-/*
- * This line discipline is intended to provide well performing
- * generic support for the reception and time stamping of radio clock
- * timecodes.  Most radio clock devices return a string where a
- * particular character in the code (usually a \r) is on-time
- * synchronized with the clock.  The idea here is to collect characters
- * until (one of) the synchronization character(s) (we allow two) is seen.
- * When the magic character arrives we take a timestamp by calling
- * microtime() and insert the eight bytes of struct timeval into the
- * buffer after the magic character.  We then wake up anyone waiting
- * for the buffer and return the whole mess on the next read.
- *
- * To use this the calling program is expected to first open the
- * port, and then to set the port into raw mode with the speed
- * set appropriately with a TIOCSETP ioctl(), with the erase and kill
- * characters set to those to be considered magic (yes, I know this
- * is gross, but they were so convenient).  If only one character is
- * magic you can set then both the same, or perhaps to the alternate
- * parity versions of said character.  After getting all this set,
- * change the line discipline to CLKLDISC and you are on your way.
- *
- * The only other bit of magic we do in here is to flush the receive
- * buffers on writes if the CRMOD flag is set (hack, hack).
- */
-
-/*
- * We run this very much like a raw mode terminal, with the exception
- * that we store up characters locally until we hit one of the
- * magic ones and then dump it into the rawq all at once.  We keep
- * the buffered data in clists since we can then often move it to
- * the rawq without copying.  For sanity we limit the number of
- * characters between specials, and the total number of characters
- * before we flush the rawq, as follows.
- */
-#define        CLKLINESIZE     (256)
-#define        NCLKCHARS       (CLKLINESIZE*4)
-
-struct clkdata {
-       int inuse;
-       struct clist clkbuf;
-};
-#define        clk_cc  clkbuf.c_cc
-#define        clk_cf  clkbuf.c_cf
-#define        clk_cl  clkbuf.c_cl
-
-struct clkdata clk_data[NCLK];
-
-/*
- * Routine for flushing the internal clist
- */
-#define        clk_bflush(clk)         (ndflush(&((clk)->clkbuf), (clk)->clk_cc))
-
-int clk_debug = 0;
-
-/*ARGSUSED*/
-clkopen(dev, tp)
-       dev_t dev;
-       register struct tty *tp;
-{
-       register struct clkdata *clk;
-
-       /*
-        * Don't allow multiple opens.  This will also protect us
-        * from someone opening /dev/tty
-        */
-       if (tp->t_line == CLKLDISC)
-               return (EBUSY);
-       ttywflush(tp);
-       for (clk = clk_data; clk < &clk_data[NCLK]; clk++)
-               if (!clk->inuse)
-                       break;
-       if (clk >= &clk_data[NCLK])
-               return (EBUSY);
-       clk->inuse++;
-       clk->clk_cc = 0;
-       clk->clk_cf = clk->clk_cl = NULL;
-       tp->T_LINEP = (caddr_t) clk;
-       return (0);
-}
-
-
-/*
- * Break down... called when discipline changed or from device
- * close routine.
- */
-clkclose(tp)
-       register struct tty *tp;
-{
-       register struct clkdata *clk;
-       register int s = spltty();
-
-       clk = (struct clkdata *)tp->T_LINEP;
-       if (clk->clk_cc > 0)
-               clk_bflush(clk);
-       clk->inuse = 0;
-       tp->t_line = 0;                 /* paranoid: avoid races */
-       splx(s);
-}
-
-
-/*
- * Receive a write request.  We pass these requests on to the terminal
- * driver, except that if the CRMOD bit is set in the flags we
- * first flush the input queues.
- */
-clkwrite(tp, uio)
-       register struct tty *tp;
-       struct uio *uio;
-{
-       if (tp->t_flags & CRMOD) {
-               register struct clkdata *clk;
-               int s;
-
-               s = spltty();
-               if (tp->t_rawq.c_cc > 0)
-                       ndflush(&tp->t_rawq, tp->t_rawq.c_cc);
-               clk = (struct clkdata *) tp->T_LINEP;
-               if (clk->clk_cc > 0)
-                       clk_bflush(clk);
-               (void)splx(s);
-       }
-       ttwrite(tp, uio);
-}
-
-
-/*
- * Low level character input routine.
- * If the character looks okay, grab a time stamp.  If the stuff in
- * the buffer is too old, dump it and start fresh.  If the character is
- * non-BCDish, everything in the buffer too.
- */
-clkinput(c, tp)
-       register int c;
-       register struct tty *tp;
-{
-       register struct clkdata *clk;
-       register int i;
-       register long s;
-       struct timeval tv;
-
-       /*
-        * Check to see whether this isn't the magic character.  If not,
-        * save the character and return.
-        */
-#ifdef ultrix
-       if (c != tp->t_cc[VERASE] && c != tp->t_cc[VKILL]) {
-#else
-       if (c != tp->t_erase && c != tp->t_kill) {
-#endif
-               clk = (struct clkdata *) tp->T_LINEP;
-               if (clk->clk_cc >= CLKLINESIZE)
-                       clk_bflush(clk);
-               if (putc(c, &clk->clkbuf) == -1) {
-                       /*
-                        * Hopeless, no clists.  Flush what we have
-                        * and hope things improve.
-                        */
-                       clk_bflush(clk);
-               }
-               return;
-       }
-
-       /*
-        * Here we have a magic character.  Get a timestamp and store
-        * everything.
-        */
-       microtime(&tv);
-       clk = (struct clkdata *) tp->T_LINEP;
-
-       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)
-                       goto flushout;
-               s <<= 8;
-       }
-
-       s = tv.tv_usec;
-       for (i = 0; i < sizeof(long); i++) {
-               if (putc((s >> 24) & 0xff, &clk->clkbuf) == -1)
-                       goto flushout;
-               s <<= 8;
-       }
-#endif
-
-       /*
-        * If the length of the rawq exceeds our sanity limit, dump
-        * all the old crap in there before copying this in.
-        */
-       if (tp->t_rawq.c_cc > NCLKCHARS)
-               ndflush(&tp->t_rawq, tp->t_rawq.c_cc);
-       
-       /*
-        * Now copy the buffer in.  There is a special case optimization
-        * here.  If there is nothing on the rawq at present we can
-        * just copy the clists we own over.  Otherwise we must concatenate
-        * the present data on the end.
-        */
-       s = (long)spltty();
-       if (tp->t_rawq.c_cc <= 0) {
-               tp->t_rawq = clk->clkbuf;
-               clk->clk_cc = 0;
-               clk->clk_cl = clk->clk_cf = NULL;
-               (void) splx((int)s);
-       } else {
-               (void) splx((int)s);
-               catq(&clk->clkbuf, &tp->t_rawq);
-               clk_bflush(clk);
-       }
-
-       /*
-        * Tell the world
-        */
-       ttwakeup(tp);
-       return;
-
-flushout:
-       /*
-        * It would be nice if this never happened.  Flush the
-        * internal clists and hope someone else frees some of them
-        */
-       clk_bflush(clk);
-       return;
-}
-
-
-/*
- * Handle ioctls.  We reject most tty-style except those that
- * change the line discipline and a couple of others..
- */
-clkioctl(tp, cmd, data, flag)
-       struct tty *tp;
-       int cmd;
-       caddr_t data;
-       int flag;
-{
-       int flags;
-       struct sgttyb *sg;
-
-       if ((cmd>>8) != 't')
-               return (-1);
-       switch (cmd) {
-       case TIOCSETD:
-       case TIOCGETD:
-       case TIOCGETP:
-       case TIOCGETC:
-       case TIOCOUTQ:
-               return (-1);
-
-       case TIOCSETP:
-               /*
-                * He likely wants to set new magic characters in.
-                * Do this part.
-                */
-               sg = (struct sgttyb *)data;
-#ifdef ultrix
-               tp->t_cc[VERASE] = sg->sg_erase;
-               tp->t_cc[VKILL] = sg->sg_kill;
-#else
-               tp->t_erase = sg->sg_erase;
-               tp->t_kill = sg->sg_kill;
-#endif
-               return (0);
-
-       case TIOCFLUSH:
-               flags = *(int *)data;
-               if (flags == 0 || (flags & FREAD)) {
-                       register struct clkdata *clk;
-
-                       clk = (struct clkdata *) tp->T_LINEP;
-                       if (clk->clk_cc > 0)
-                               clk_bflush(clk);
-               }
-               return (-1);
-       
-       default:
-               break;
-       }
-       return (ENOTTY);        /* not quite appropriate */
-}
-#endif NCLK
diff --git a/kernel/tty_clk_STREAMS.c b/kernel/tty_clk_STREAMS.c
deleted file mode 100644 (file)
index 13b0a25..0000000
+++ /dev/null
@@ -1,266 +0,0 @@
-/* tty_clk_STREAMS.c,v 3.1 1993/07/06 01:07:34 jbj Exp
- * Timestamp STREAMS module for SunOS 4.1
- *
- * Copyright 1991, Nick Sayer
- *
- * Special thanks to Greg Onufer for his debug assists.
- *
- * Should be PUSHed directly on top of a serial I/O channel.
- * For any character in a user-designated set, adds a kernel
- * timestamp to that character.
- *
- * BUGS:
- *
- * Only so many characters can be timestamped. This number, however,
- * is adjustable.
- *
- * The null character ($00) cannot be timestamped.
- *
- * The M_DATA messages passed upstream will not be the same
- * size as when they arrive from downstream, even if no
- * timestamp character is in the message. This, however,
- * should not affect anything.
- *
- */
-
-#include "clk.h"
-#if NCLK > 0
-/*
- * How big should the messages we pass upstream be?
- */
-#define MESSAGE_SIZE 128
-
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stream.h>
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/kernel.h>
-#include <sys/user.h>
-#include <sys/errno.h>
-#include <sys/syslog.h>
-
-#include <sys/clkdefs.h>
-
-static struct module_info rminfo = { 0, "clk", 0, INFPSZ, 0, 0 };
-static struct module_info wminfo = { 0, "clk", 0, INFPSZ, 0, 0 };
-static int clkopen(), clkrput(), clkwput(), clkclose();
-
-static struct qinit rinit = { clkrput, NULL, clkopen, clkclose, NULL,
-       &rminfo, NULL };
-
-static struct qinit winit = { clkwput, NULL, NULL, NULL, NULL,
-       &wminfo, NULL };
-
-struct streamtab clkinfo = { &rinit, &winit, NULL, NULL };
-
-struct priv_data_type
-{
-  char in_use;
-  char string[CLK_MAXSTRSIZE];
-} priv_data[NCLK];
-
-char first_open=1;
-
-/*
- * God only knows why, but linking with strchr() fails
- * on my system, so here's a renamed copy.
- */
-
-u_char *str_chr(s,c)
-u_char *s;
-int c;
-{
-  while (*s)
-    if(*s++ == c)
-      return (s-1);
-  return NULL;
-}
-
-/*ARGSUSED*/
-static int clkopen(q, dev, flag, sflag)
-queue_t *q;
-dev_t dev;
-int flag;
-int sflag;
-{
-  int i;
-
-/* Damn it! We can't even have the global data struct properly
-   initialized! So we have a mark to tell us to init the global
-   data on the first open */
-
-  if (first_open)
-  {
-    first_open=0;
-
-    for(i=0;i<NCLK;i++)
-      priv_data[i].in_use=0;
-  }
-
-  for(i=0;i<NCLK;i++)
-    if(!priv_data[i].in_use)
-    {
-      priv_data[i].in_use++;
-      ((struct priv_data_type *) (q->q_ptr))=priv_data+i;
-      priv_data[i].string[0]=0;
-      return (0);
-    }
-  u.u_error = EBUSY;
-  return (OPENFAIL);
-}
-
-/*ARGSUSED*/
-static int clkclose(q, flag)
-queue_t *q;
-int flag;
-{
-  ((struct priv_data_type *) (q->q_ptr))->in_use=0;
-
-  return (0);
-}
-
-/*
- * Now the crux of the biscuit.
- *
- * If it's an M_DATA package, we take each character and pass
- * it to clkchar.
- */
-
-void clkchar();
-
-static int clkrput(q, mp)
-queue_t *q;
-mblk_t *mp;
-{
-  mblk_t *bp;
-
-  switch(mp->b_datap->db_type)
-  {
-    case M_DATA:
-      clkchar(0,q,2);
-      for(bp=mp; bp!=NULL; bp=bp->b_cont)
-      {
-       while(bp->b_rptr < bp->b_wptr)
-         clkchar( ((u_char)*(bp->b_rptr++)) , q , 0 );
-      }
-      clkchar(0,q,1);
-      freemsg(mp);
-    break;
-    default:
-      putnext(q,mp);
-    break;
-  }
-
-}
-
-/*
- * If it's a matching M_IOCTL, handle it.
- */
-
-static int clkwput(q, mp)
-queue_t *q;
-mblk_t *mp;
-{
-  struct iocblk *iocp;
-
-  switch(mp->b_datap->db_type)
-  {
-    case M_IOCTL:
-      iocp=(struct iocblk*) mp->b_rptr;
-      if (iocp->ioc_cmd==CLK_SETSTR)
-      {
-        strncpy( ((struct priv_data_type *) (RD(q)->q_ptr))->string,
-         (char *) mp->b_cont->b_rptr,CLK_MAXSTRSIZE);
-        /* make sure it's null terminated */
-       ((struct priv_data_type *) (RD(q)->q_ptr))->string[CLK_MAXSTRSIZE-1]=0;
-       mp->b_datap->db_type = M_IOCACK;
-       qreply(q,mp);
-      }
-      else
-       putnext(q,mp);
-    break;
-    default:
-      putnext(q,mp);
-    break;
-  }
-}
-
-/*
- * Now clkchar. It takes a character, a queue pointer and an action
- * flag and depending on the flag either:
- *
- * 0 - adds the character to the current message. If there's a
- * timestamp to be done, do that too. If the message is less than
- * 8 chars from being full, link in a new one, and set it up for
- * the next call.
- *
- * 1 - sends the whole mess to Valhala.
- *
- * 2 - set things up.
- *
- * Yeah, it's an ugly hack. Complaints may be filed with /dev/null.
- */
-
-
-void clkchar(c,q,f)
-       register u_char c;
-       queue_t *q;
-       char f;
-{
-  static char error;
-  static mblk_t *message,*mp;
-  struct timeval tv;
-
-/* Get a timestamp ASAP! */
-  uniqtime(&tv);
-
-  switch(f)
-  {
-    case 1:
-      if (!error)
-        putnext(q,message);
-    break;
-    case 2:
-      mp=message= (mblk_t*) allocb(MESSAGE_SIZE,BPRI_LO);
-      error=(message==NULL);
-      if (error)
-       log(LOG_ERR,"clk: cannot allocate message - data lost");
-    break;
-    case 0:
-      if (error) /* If we had an error, forget it. */
-       return;
-
-      *mp->b_wptr++=c; /* Put the char away first.
-
-      /* If it's in the special string, append a struct timeval */
-
-      if (str_chr( ((struct priv_data_type *) (q->q_ptr))->string ,
-        c )!=NULL)
-      {
-         int i;
-
-         for (i=0;i<sizeof(struct timeval);i++)
-           *mp->b_wptr++= *( ((char*)&tv) + i );
-      }
-
-      /* If we don't have space for a complete struct timeval, and a
-         char, it's time for a new mp block */
-
-      if (((mp->b_wptr-mp->b_rptr)+sizeof(struct timeval)+2)>MESSAGE_SIZE)
-      {
-         mp->b_cont= (mblk_t*) allocb(MESSAGE_SIZE,BPRI_LO);
-         error=(mp->b_cont==NULL);
-         if (error)
-         {
-           log(LOG_ERR,"clk: cannot allocate message - data lost");
-           freemsg(message);
-          }
-          mp=mp->b_cont;
-      }
-
-    break;
-  }
-}
-
-#endif
index 026ad8d755734e9a28ee34781ffda23c3bbac720..72ae82446c245e249de7f0315e811107c742b14b 100644 (file)
 
 #ifdef REFCLOCK
 
-#ifdef TTYCLK
-# ifdef HAVE_SYS_CLKDEFS_H
-#  include <sys/clkdefs.h>
-#  include <stropts.h>
-# endif
-# ifdef HAVE_SYS_SIO_H
-#  include <sys/sio.h>
-# endif
-#endif /* TTYCLK */
-
 #ifdef KERNEL_PLL
 #include "ntp_syscall.h"
 #endif /* KERNEL_PLL */
@@ -50,8 +40,8 @@
  * clock data on through the filters.  Routines refclock_peer() and
  * refclock_unpeer() are called to initialize and terminate reference
  * clock associations.  A set of utility routines is included to open
- * serial devices, process sample data, edit input lines to extract
- * embedded timestamps and to perform various debugging functions.
+ * serial devices, process sample data, and to perform various debugging
+ * functions.
  *
  * The main interface used by these routines is the refclockproc
  * structure, which contains for most drivers the decimal equivalants
 #define FUDGEFAC       .1      /* fudge correction factor */
 #define LF             0x0a    /* ASCII LF */
 
-#ifdef PPS
-int    fdpps;                  /* ppsclock legacy */
-#endif /* PPS */
-
 int    cal_enable;             /* enable refclock calibrate */
 
 /*
@@ -623,9 +609,7 @@ refclock_gtlin(
  * followed by a NULL character ('\0'), which is not included in the
  * count.
  *
- * If a timestamp is present in the timecode, as produced by the tty_clk
- * STREAMS module, it returns that as the timestamp; otherwise, it
- * returns the buffer timestamp.
+ * *tsptr receives a copy of the buffer timestamp.
  */
 int
 refclock_gtraw(
@@ -636,45 +620,14 @@ refclock_gtraw(
        )
 {
        char    *dpt, *dpend, *dp;
-       l_fp    trtmp, tstmp;
        int     i;
 
-       /*
-        * Check for the presence of a timestamp left by the tty_clock
-        * module and, if present, use that instead of the buffer
-        * timestamp captured by the I/O routines. We recognize a
-        * timestamp by noting its value is earlier than the buffer
-        * timestamp, but not more than one second earlier.
-        */
        dpt = (char *)rbufp->recv_buffer;
        dpend = dpt + rbufp->recv_length;
-       trtmp = rbufp->recv_time;
-       if (dpend >= dpt + 8) {
-               if (buftvtots(dpend - 8, &tstmp)) {
-                       L_SUB(&trtmp, &tstmp);
-                       if (trtmp.l_ui == 0) {
-#ifdef DEBUG
-                               if (debug > 1) {
-                                       printf(
-                                           "refclock_gtlin: fd %d ldisc %s",
-                                           rbufp->fd, lfptoa(&trtmp,
-                                           6));
-                                       get_systime(&trtmp);
-                                       L_SUB(&trtmp, &tstmp);
-                                       printf(" sigio %s\n",
-                                           lfptoa(&trtmp, 6));
-                               }
-#endif
-                               dpend -= 8;
-                               trtmp = tstmp;
-                       } else
-                               trtmp = rbufp->recv_time;
-               }
-       }
 
        /*
         * Copy the raw buffer to the user string. The string is padded
-        * with a NULL, which is not included in the character count.
+        * with a NUL, which is not included in the character count.
         */
        if (dpend - dpt > bmax - 1)
                dpend = dpt + bmax - 1;
@@ -682,12 +635,10 @@ refclock_gtraw(
                *dp++ = *dpt;
        *dp = '\0';
        i = dp - lineptr;
-#ifdef DEBUG
-       if (debug > 1)
-               printf("refclock_gtraw: fd %d time %s timecode %d %s\n",
-                   rbufp->fd, ulfptoa(&trtmp, 6), i, lineptr);
-#endif
-       *tsptr = trtmp;
+       *tsptr = rbufp->recv_time;
+       DPRINTF(2, ("refclock_gtraw: fd %d time %s timecode %d %s\n",
+                   rbufp->fd, ulfptoa(&rbufp->recv_time, 6), i,
+                   lineptr));
        return (i);
 }
 
@@ -777,9 +728,6 @@ refclock_setup(
 {
        int     i;
        TTY     ttyb, *ttyp;
-#ifdef PPS
-       fdpps = fd;             /* ppsclock legacy */
-#endif /* PPS */
 
        /*
         * By default, the serial line port is initialized in canonical
@@ -985,53 +933,8 @@ refclock_ioctl(
        /*
         * simply return TRUE if no UNIX line discipline is supported
         */
-#if defined(HAVE_TERMIOS) || defined(HAVE_SYSV_TTYS) || defined(HAVE_BSD_TTYS)
+       DPRINTF(1, ("refclock_ioctl: fd %d flags 0x%x\n", fd, lflags));
 
-#ifdef DEBUG
-       if (debug)
-               printf("refclock_ioctl: fd %d flags 0x%x\n", fd,
-                   lflags);
-#endif
-#ifdef TTYCLK
-
-       /*
-        * The TTYCLK option provides timestamping at the driver level.
-        * It requires the tty_clk streams module and System V STREAMS
-        * support. If not available, don't complain.
-        */
-       if (lflags & (LDISC_CLK | LDISC_CLKPPS | LDISC_ACTS)) {
-               int rval = 0;
-
-               if (ioctl(fd, I_PUSH, "clk") < 0) {
-                       SAVE_ERRNO(
-                               msyslog(LOG_ERR,
-                                       "refclock_ioctl fd %d I_PUSH: %m",
-                                       fd);
-                       )
-                       return FALSE;
-#ifdef CLK_SETSTR
-               } else {
-                       char *str;
-
-                       if (lflags & LDISC_CLKPPS)
-                               str = "\377";
-                       else if (lflags & LDISC_ACTS)
-                               str = "*";
-                       else
-                               str = "\n";
-                       if (ioctl(fd, CLK_SETSTR, str) < 0) {
-                               SAVE_ERRNO(
-                                       msyslog(LOG_ERR,
-                                               "refclock_ioctl fd %d CLK_SETSTR: %m",
-                                               fd);
-                               )
-                               return FALSE;
-                       }
-#endif /*CLK_SETSTR */
-               }
-       }
-#endif /* TTYCLK */
-#endif /* HAVE_TERMIOS || HAVE_SYSV_TTYS || HAVE_BSD_TTYS */
        return TRUE;
 }
 #endif /* !defined(SYS_VXWORKS) && !defined(SYS_WINNT) */
index d2de8fde42024ea29e5cfff0d960b98ff66484ff..e9b73f487e4729229f249aca3e78e8fe2ac759e1 100644 (file)
@@ -29,9 +29,6 @@
 
 #if defined(STREAM)
 #include <stropts.h>
-#if defined(WWVBCLK)
-#include <sys/clkdefs.h>
-#endif /* WWVBCLK */
 #endif /* STREAM */
 
 #include "ntp_stdlib.h"
index 7a00dd6d1d30d71a3e60cf5db45099c9154120a1..07e1429754579f61795dceef6ad70a50d46967f9 100644 (file)
@@ -8,21 +8,13 @@
 
 #if defined(REFCLOCK) && defined(CLOCK_LEITCH)
 
+#include <stdio.h>
+#include <ctype.h>
+
 #include "ntpd.h"
 #include "ntp_io.h"
 #include "ntp_refclock.h"
 #include "ntp_unixtime.h"
-
-#include <stdio.h>
-#include <ctype.h>
-
-#ifdef STREAM
-#include <stropts.h>
-#if defined(LEITCHCLK)
-#include <sys/clkdefs.h>
-#endif /* LEITCHCLK */
-#endif /* STREAM */
-
 #include "ntp_stdlib.h"
 
 
@@ -303,9 +295,6 @@ leitch_start(
 #if defined(HAVE_TERMIOS)
        /*
         * POSIX serial line parameters (termios interface)
-        *
-        * The LEITCHCLK option provides timestamping at the driver level. 
-        * It requires the tty_clk streams module.
         */
        {       struct termios ttyb, *ttyp;
 
@@ -332,27 +321,12 @@ leitch_start(
        }
        }
 #endif /* HAVE_TERMIOS */
-#ifdef STREAM
-#if defined(LEITCHCLK)
-       if (ioctl(fd232, I_PUSH, "clk") < 0)
-           msyslog(LOG_ERR,
-                   "leitch_start: ioctl(%s, I_PUSH, clk): %m", leitchdev);
-       if (ioctl(fd232, CLK_SETSTR, "\n") < 0)
-           msyslog(LOG_ERR,
-                   "leitch_start: ioctl(%s, CLK_SETSTR): %m", leitchdev);
-#endif /* LEITCHCLK */
-#endif /* STREAM */
 #if defined(HAVE_BSD_TTYS)
        /*
         * 4.3bsd serial line parameters (sgttyb interface)
-        *
-        * The LEITCHCLK option provides timestamping at the driver level. 
-        * It requires the tty_clk line discipline and 4.3bsd or later.
         */
-       {       struct sgttyb ttyb;
-#if defined(LEITCHCLK)
-       int ldisc = CLKLDISC;
-#endif /* LEITCHCLK */
+       {
+               struct sgttyb ttyb;
 
        if (ioctl(fd232, TIOCGETP, &ttyb) < 0) {
                msyslog(LOG_ERR,
@@ -360,25 +334,13 @@ leitch_start(
                goto screwed;
        }
        ttyb.sg_ispeed = ttyb.sg_ospeed = SPEED232;
-#if defined(LEITCHCLK)
-       ttyb.sg_erase = ttyb.sg_kill = '\r';
-       ttyb.sg_flags = RAW;
-#else
        ttyb.sg_erase = ttyb.sg_kill = '\0';
        ttyb.sg_flags = EVENP|ODDP|CRMOD;
-#endif /* LEITCHCLK */
        if (ioctl(fd232, TIOCSETP, &ttyb) < 0) {
                msyslog(LOG_ERR,
                        "leitch_start: ioctl(%s, TIOCSETP): %m", leitchdev);
                goto screwed;
        }
-#if defined(LEITCHCLK)
-       if (ioctl(fd232, TIOCSETD, &ldisc) < 0) {
-               msyslog(LOG_ERR,
-                       "leitch_start: ioctl(%s, TIOCSETD): %m",leitchdev);
-               goto screwed;
-       }
-#endif /* LEITCHCLK */
        }
 #endif /* HAVE_BSD_TTYS */
 
index 13a8af5953b884882d28914e5cc5d72727db399a..dd57f8cd37205943032d1367ab6679f9204fa03b 100644 (file)
 # include "ppsapi_timepps.h"
 #endif
 
-#ifdef HAVE_SYS_SIO_H
-# include <sys/sio.h>
-#endif
-
 struct Bl {
        int     dt_ls;
        int     dt_lsf;