home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / unix_c / usenet / newsxd.tar / newsxd / version.c < prev   
Text File  |  1990-08-31  |  10KB  |  179 lines

  1. /*
  2.  * #include <legal/bs.h>
  3.  >
  4.  > Copyright (c) 1989 Washington University in Saint Louis, Missouri and
  5.  > Chris Myers. All rights reserved.
  6.  >
  7.  > Permission is hereby granted to copy, reproduce, redistribute or
  8.  > otherwise use this software as long as: (1) there is no monetary
  9.  > profit gained specifically from the use or reproduction of this
  10.  > software, (2) it is not sold, rented, traded, or otherwise marketed,
  11.  > (3) the above copyright notice and this paragraph is included
  12.  > prominently in any copy made, and (4) that the name of the University
  13.  > is not used to endorse or promote products derived from this software
  14.  > without the specific prior written permission of the University.
  15.  > THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  16.  > IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  17.  > WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  18.  >
  19.  * newsxd: a daemon for controlling the transmission of news
  20.  *
  21.  * Written by
  22.  * Chris Myers                              Internet: chris@wugate.wustl.edu
  23.  * Software Engineer                            UUCP: ...!uunet!wugate!chris
  24.  * Office of the Network Coordinator              BITNET: chris@wunet.bitnet
  25.  * Washington University in Saint Louis
  26.  *
  27.  * HISTORY:
  28.  * Version 0.1:   first written in perl.  A grand experiment that just didn't
  29.  *                work very reliably (no reflection on the quality of perl, it
  30.  *                just wasn't meant to do this kind of thing).
  31.  *
  32.  * Version 1.0:   first C version
  33.  *
  34.  *         1.1:   added per-host locking
  35.  *         1.2:   added maxload qualifier
  36.  *         1.2.1: added time to live qualifier
  37.  *
  38.  *                SOURCE CODE INADVERTANTLY DESTROYED (SIGH)
  39.  *                Oh well, it needed rewriting anyway. :-)
  40.  *
  41.  * Version 2.0:   here we go again. No per-host locking right now :-(
  42.  *                Removed all static limits on the number of transmission
  43.  *                classes and hosts.  Everything is now malloc'ed.
  44.  *         2.0.1: added penalty time to time-to-live qualifier to allow other
  45.  *                hosts to get news transmitters started.
  46.  *         2.1:   Added the capability to specify a different transmission
  47.  *                program (and parameters) for each transmission class.  This
  48.  *                was the motive for the name change from nntpxd to newsxd.
  49.  *         2.1.1: fixed bug caused by defunct transmitters which finally
  50.  *                overran the ttl (did not do proper cleanup).
  51.  *         2.1.2: added patches for Pyramid and BSD 4.3 support from Warren
  52.  *                Lavallee and Jim Lowe.
  53.  *         2.1.3: fixed bugs in calculating the ttl penalty and start/stop
  54.  *                time ranges
  55.  *         2.1.4: fixed bug in read_config where the loop went 1 past the end
  56.  *                of the options for a transmission class.  This could cause
  57.  *                the last parameter on a longer preceeding class line to be
  58.  *                carried over to the subsequent classes.
  59.  *         2.1.5: somehow the default value for nntplogs slipped away from the
  60.  *                code.  Put it back in where it belongs.
  61.  *         2.1.6: added inter-host startup interval for classes so that newsxd
  62.  *                doesn't start up too many daemons at once
  63.  *         2.1.7: fix stupid bug created in earlier patch where I set argptr[x]
  64.  *                to NULL (what it was supposed to be) and then blithly reset it
  65.  *                to something else -- preventing EXECing the program specified
  66.  *                in an XMIT option.  ARGH.
  67.  *         2.1.8: ARGH! Left out the code to make sure a transmitter for each
  68.  *                host wasn't started up more often than <interval> seconds.
  69.  *         2.2:   Cut down on the size of the wishlist by adding a bunch of
  70.  *                features (and hopefully no more bugs):
  71.  *                - syslog logging
  72.  *                - lots of range/value checking on inputs
  73.  *                - sort host/class names when inserting into list
  74.  *                - move all configuration parameters into newsxd.h
  75.  *                - add more error messages
  76.  *                - document code even more
  77.  *                - allow reconfiguration without killing outstanding xmitters
  78.  *                - add a 'nobatchfile' switch
  79.  *                - allocation of alternate xmitter parameters is now dynamic
  80.  *                - Per-host delta-nice values for transmitters
  81.  *                - make code more readable
  82.  *                - write a manpage
  83.  *         2.3:   Add SIGUSR1, SIGUSR2 to {en,dis}able debugging while running
  84.  *                Shift the order of syslog initialization and switch to daemon
  85.  *                Fix a "go past end of the array sometimes" bug in getclass().
  86.  *                add "reason" to status display to show why xmitter not running
  87.  *                in xmit options, %f=flags,%w=workfile,%b=batchfile,%h=hostname
  88.  *                make transmission of news to hosts 'fair'
  89.  *                minimize a race in run_queue if SIGQUIT causes reconfiguration
  90.  *                change start/stop times to use UUCP-style permissible times
  91.  *         2.3.1: fix bug in incr xmitsernum when only one service class in use
  92.  *                enable fair transmission code even if maxxmits > class members
  93.  *                change use of strpbrk to strchr and make strchr #define'd
  94.  *         2.4:   add per-host flags
  95.  *                added check for multiply-defined host/class in add{host,class}
  96.  *                zero classptr->members in addclass to allow reconfiguration
  97.  *         2.4.1: classptr->members++ in addhost was in the wrong spot
  98.  *                buffer declaration for FAKESYSLOG had trailing ; should be ,
  99.  *                log a reinitialization message after getting SIGHUP
  100.  *                add -v switch to show version and logging
  101.  *                if debugging == ON in daemon mode, don't dump status to stderr
  102.  *                was closing pidfile with close() rather than fclose()
  103.  *                change comments in xmit_done() to show sig==0 is NOHANG
  104.  *                validtime() was mangling the valid times string
  105.  *                parsetime() sometimes said a good time was not valid
  106.  *                addhost() now resorts host list on reconfiguration
  107.  *         2.4.2: modify xmit_done() to almost always use WNOHANG on wait calls
  108.  *                add_host() was improperly decrementing classptr->members
  109.  *                When debugging changes, log "On"/"Off" not the value (0/-1)
  110.  *                get rid of remaining code for obsolete "nntpxmit" keyword
  111.  *                finish updating comments, changing "nntpxmit" to "transmitter"
  112.  *         2.5:   sigsetmask(0) to allow SIGCHLD in xmit_done(); don't lose kids
  113.  *                modify "Why Not Running" messages slightly for readability
  114.  *                xmit_done() now loops to catch all completed transmitters
  115.  *                run_queue() now checks for MIA transmitters and cleans 'em up
  116.  *                if no classes defined, dump_config() now returns immediately
  117.  *                break the source apart into several files from one big'un
  118.  *                class options are default, w/host options overriding
  119.  *                   [ttl, interval, nice, maxload]
  120.  *                run_queue() was setting whynotrunning wrong for active xmits
  121.  *                moved ttl penalty check into "host gave up chance" code to
  122.  *                   prevent a penalized host from blocking others
  123.  *                added SIGIO to idle newsxd until SIGHUP is received
  124.  *                added class slots
  125.  *                added faster pid->host mapping data structure
  126.  *                added SIGTRAP to dump internal data structures for debugging
  127.  *         2.5.1: apply "lint" fixes from Andrew Partan <asp@uunet.uu.net>
  128.  *                close and reopen logfiles on SIGHUP <asp@uunet.uu.net>
  129.  *                put Why Not reasons in static array, use everywhere
  130.  *                process.c: in fork()ed child, call _exit() not exit()
  131.  *                check for duplicate newsxd running
  132.  *                add support for per-class transmitter debugging flags
  133.  *                fix an open file leak in config.c:read_config()
  134.  *                add SIGIOT to kill all transmitters and idle newsxd
  135.  *                add setuid(geteuid()), setgid(getegid()) in main()
  136.  *                fix some potential null-ptr dereferencing problems in config.c
  137.  *                fix array-index overrun problem in config.c <asp@uunet.uu.net>
  138.  *                remove pidfile and statusfile on shutdown unless debug|DEBUG
  139.  *                flock() the work file before EXECing the transmitter
  140.  *                support CNEWS-style locking to prevent races on the work file
  141.  *                restore default signal action after fork() for transmitter
  142.  *
  143.  * SPECIAL THANKS TO:
  144.  *
  145.  * Alpha tester:  John Coolidge <coolidge@brutus.cs.uiuc.edu>
  146.  *
  147.  * Beta testers:  Warren Lavallee <warren@schizo.samsung.com>
  148.  *                Don Thomson <thomson@macc.wisc.edu>
  149.  *                Michael A. Cooper <mcooper@usc.edu>
  150.  *                Jim Lowe <james@csd4.csd.uwm.edu>
  151.  *                David C. Lawrence <tale@pawl.rpi.edu>
  152.  *                John Coolidge <coolidge@brutus.cs.uiuc.edu>
  153.  *                Lloyd W. Taylor <lloyd@aplcen.apl.jhu.edu>
  154.  *                Dave Alden <alden@shape.mps.ohio-state.edu>
  155.  *                Greg Hackney <root@texbell.sbc.com>
  156.  *                Rick Adams <rick@uunet.uu.net>
  157.  *                Andrew Partan <asp@uunet.uu.net>
  158.  *
  159.  * This software has been tested on the following systems:
  160.  *
  161.  * DECstation 3100, Ultrix 3.1
  162.  * DEC VAX 8810, Ultrix 3.1
  163.  * Sun 3/60, SunOS 4.0.1
  164.  * Sun 3/180, SunOS 4.0.3
  165.  * Pyramid DualPort OSx
  166.  * DEC MicroVAX-II, BSD 4.3 UNIX
  167.  * DEC MicroVAX-II, Mt Xinu MORE/BSD 4.3
  168.  *
  169.  * Wishlist:
  170.  *
  171.  * - add logging of transmitter resource usage
  172.  * - Exponential backoff for failed transmission attempts
  173.  * - Per-host locking, using shlock-style locks
  174.  * - ability to specify min. # of articles queued before xmission starts
  175.  * - add per-class workfile and batchfile definitions
  176.  * - add per-host maximum delay between transmitter startups
  177.  *
  178.  */
  179.