Diff for /src/usr.sbin/timed/timed/master.c between versions 1.3 and 1.4

version 1.3, 2003/11/03 19:31:43 version 1.4, 2004/03/13 21:08:38
Line 72  extern void logwtmp(char *, char *, char Line 72  extern void logwtmp(char *, char *, char
  * takes the appropriate action.   * takes the appropriate action.
  */   */
 int  int
 master()  master(void)
 {  {
         struct hosttbl *htp;          struct hosttbl *htp;
         long pollingtime;          long pollingtime;
Line 356  loop: Line 356  loop:
  * change the system date on the master   * change the system date on the master
  */   */
 static void  static void
 mchgdate(msg)  mchgdate(struct tsp *msg)
         struct tsp *msg;  
 {  {
         char tname[MAXHOSTNAMELEN];          char tname[MAXHOSTNAMELEN];
         char olddate[32];          char olddate[32];
Line 403  mchgdate(msg) Line 402  mchgdate(msg)
  * synchronize all of the slaves   * synchronize all of the slaves
  */   */
 void  void
 synch(mydelta)  synch(long mydelta)
         long mydelta;  
 {  {
         struct hosttbl *htp;          struct hosttbl *htp;
         int measure_status;          int measure_status;
Line 490  synch(mydelta) Line 488  synch(mydelta)
  * has received the command to set the network time   * has received the command to set the network time
  */   */
 void  void
 spreadtime()  spreadtime(void)
 {  {
         struct hosttbl *htp;          struct hosttbl *htp;
         struct tsp to;          struct tsp to;
Line 526  spreadtime() Line 524  spreadtime()
 }  }
   
 void  void
 prthp(delta)  prthp(clock_t delta)
         clock_t delta;  
 {  {
         static time_t next_time;          static time_t next_time;
         time_t this_time;          time_t this_time;
Line 565  static struct hosttbl *lasthfree = &host Line 562  static struct hosttbl *lasthfree = &host
   
   
 struct hosttbl *                        /* answer or 0 */  struct hosttbl *                        /* answer or 0 */
 findhost(name)  findhost(char *name)
         char *name;  
 {  {
         int i, j;          int i, j;
         struct hosttbl *htp;          struct hosttbl *htp;
Line 592  findhost(name) Line 588  findhost(name)
  * add a host to the list of controlled machines if not already there   * add a host to the list of controlled machines if not already there
  */   */
 struct hosttbl *  struct hosttbl *
 addmach(name, addr, ntp)  addmach(char *name, struct sockaddr_in *addr, struct netinfo *ntp)
         char *name;  
         struct sockaddr_in *addr;  
         struct netinfo *ntp;  
 {  {
         struct hosttbl *ret, *p, *b, *f;          struct hosttbl *ret, *p, *b, *f;
   
Line 681  addmach(name, addr, ntp) Line 674  addmach(name, addr, ntp)
  * remove the machine with the given index in the host table.   * remove the machine with the given index in the host table.
  */   */
 struct hosttbl *  struct hosttbl *
 remmach(htp)  remmach(struct hosttbl *htp)
         struct hosttbl *htp;  
 {  {
         struct hosttbl *lprv, *hnxt, *f, *b;          struct hosttbl *lprv, *hnxt, *f, *b;
   
Line 733  remmach(htp) Line 725  remmach(htp)
  * given network.   * given network.
  */   */
 void  void
 rmnetmachs(ntp)  rmnetmachs(struct netinfo *ntp)
         struct netinfo *ntp;  
 {  {
         struct hosttbl *htp;          struct hosttbl *htp;
   
Line 749  rmnetmachs(ntp) Line 740  rmnetmachs(ntp)
 }  }
   
 void  void
 masterup(net)  masterup(struct netinfo *net)
         struct netinfo *net;  
 {  {
   
         xmit(TSP_MASTERUP, 0, &net->dest_addr);          xmit(TSP_MASTERUP, 0, &net->dest_addr);
   
         /*          /*
Line 763  masterup(net) Line 754  masterup(net)
 }  }
   
 void  void
 newslave(msg)  newslave(struct tsp *msg)
         struct tsp *msg;  
 {  {
         struct hosttbl *htp;          struct hosttbl *htp;
         struct tsp *answer, to;          struct tsp *answer, to;
Line 807  newslave(msg) Line 797  newslave(msg)
  * react to a TSP_QUIT:   * react to a TSP_QUIT:
  */   */
 void  void
 doquit(msg)  doquit(struct tsp *msg)
         struct tsp *msg;  
 {  {
   
         if (fromnet->status == MASTER) {          if (fromnet->status == MASTER) {
                 if (!good_host_name(msg->tsp_name)) {                  if (!good_host_name(msg->tsp_name)) {
                         if (fromnet->quit_count <= 0) {                          if (fromnet->quit_count <= 0) {
Line 839  doquit(msg) Line 829  doquit(msg)
 }  }
   
 void  void
 traceon()  traceon(void)
 {  {
   
         if (!fd) {          if (!fd) {
                 fd = fopen(_PATH_TIMEDLOG, "w");                  fd = fopen(_PATH_TIMEDLOG, "w");
                 if (!fd) {                  if (!fd) {
Line 857  traceon() Line 848  traceon()
   
   
 void  void
 traceoff(msg)  traceoff(char *msg)
         char *msg;  
 {  {
   
         get_goodgroup(1);          get_goodgroup(1);
         setstatus();          setstatus();
         prthp(CLK_TCK);          prthp(CLK_TCK);
Line 879  traceoff(msg) Line 870  traceoff(msg)
   
 #ifdef sgi  #ifdef sgi
 void  void
 logwtmp(otime, ntime)  logwtmp(struct timeval *otime, struct timeval *ntime)
         struct timeval *otime, *ntime;  
 {  {
         static struct utmp wtmp[2] = {          static struct utmp wtmp[2] = {
                 {"","",OTIME_MSG,0,OLD_TIME,0,0,0},                  {"","",OTIME_MSG,0,OLD_TIME,0,0,0},

Removed from v.1.3  
changed lines
  Added in v.1.4