You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Randy Terbush <ra...@zyzzyva.com> on 1997/06/22 22:11:31 UTC

[PATCH] scoreboard manipulation

A small cleanup that comes from Harrie Hazewinkel's SNMP changes.

Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.c,v
retrieving revision 1.157
diff -c -c -r1.157 http_main.c
*** http_main.c	1997/06/21 22:27:11	1.157
--- http_main.c	1997/06/22 20:12:32
***************
*** 1058,1063 ****
--- 1058,1074 ----
  
  #endif /* MULTITHREAD */
  
+ void put_scoreboard_info(int child_num, short_score new_score_rec)
+ { 
+ #ifndef SCOREBOARD_FILE
+     memcpy(&scoreboard_image->servers[child_num], &new_score_rec,
+ 	   sizeof(short_score));
+ #else 
+     lseek(scoreboard_fd, (long)child_num * sizeof(short_score), 0);
+     force_write(scoreboard_fd, (char*)&new_score_rec, sizeof(short_score));
+ #endif
+ }
+ 
  int update_child_status (int child_num, int status, request_rec *r)
  {
      int old_status;
***************
*** 1102,1113 ****
      }
  #endif
  
! #ifndef SCOREBOARD_FILE
!     memcpy(&scoreboard_image->servers[child_num], &new_score_rec, sizeof new_score_rec);
! #else
!     lseek (scoreboard_fd, (long)child_num * sizeof(short_score), 0);
!     force_write (scoreboard_fd, (char*)&new_score_rec, sizeof(short_score));
! #endif
  
      return old_status;
  }
--- 1113,1119 ----
      }
  #endif
  
!     put_scoreboard_info(child_num, new_score_rec);
  
      return old_status;
  }
***************
*** 1181,1193 ****
  
      times(&new_score_rec.times);
  
! 
! #ifndef SCOREBOARD_FILE
!     memcpy(&scoreboard_image->servers[child_num], &new_score_rec, sizeof(short_score));
! #else
!     lseek (scoreboard_fd, (long)child_num * sizeof(short_score), 0);
!     force_write (scoreboard_fd, (char*)&new_score_rec, sizeof(short_score));
! #endif
  }
  #endif
  
--- 1187,1193 ----
  
      times(&new_score_rec.times);
  
!     put_scoreboard_info(child_num, new_score_rec); 
  }
  #endif
  



Re: [PATCH] scoreboard manipulation

Posted by Dean Gaudet <dg...@arctic.org>.
+1 for HEAD.  A nice cleanup. 

Dean

On Sun, 22 Jun 1997, Randy Terbush wrote:

> 
> A small cleanup that comes from Harrie Hazewinkel's SNMP changes.
> 
> Index: http_main.c
> ===================================================================
> RCS file: /export/home/cvs/apache/src/http_main.c,v
> retrieving revision 1.157
> diff -c -c -r1.157 http_main.c
> *** http_main.c	1997/06/21 22:27:11	1.157
> --- http_main.c	1997/06/22 20:12:32
> ***************
> *** 1058,1063 ****
> --- 1058,1074 ----
>   
>   #endif /* MULTITHREAD */
>   
> + void put_scoreboard_info(int child_num, short_score new_score_rec)
> + { 
> + #ifndef SCOREBOARD_FILE
> +     memcpy(&scoreboard_image->servers[child_num], &new_score_rec,
> + 	   sizeof(short_score));
> + #else 
> +     lseek(scoreboard_fd, (long)child_num * sizeof(short_score), 0);
> +     force_write(scoreboard_fd, (char*)&new_score_rec, sizeof(short_score));
> + #endif
> + }
> + 
>   int update_child_status (int child_num, int status, request_rec *r)
>   {
>       int old_status;
> ***************
> *** 1102,1113 ****
>       }
>   #endif
>   
> ! #ifndef SCOREBOARD_FILE
> !     memcpy(&scoreboard_image->servers[child_num], &new_score_rec, sizeof new_score_rec);
> ! #else
> !     lseek (scoreboard_fd, (long)child_num * sizeof(short_score), 0);
> !     force_write (scoreboard_fd, (char*)&new_score_rec, sizeof(short_score));
> ! #endif
>   
>       return old_status;
>   }
> --- 1113,1119 ----
>       }
>   #endif
>   
> !     put_scoreboard_info(child_num, new_score_rec);
>   
>       return old_status;
>   }
> ***************
> *** 1181,1193 ****
>   
>       times(&new_score_rec.times);
>   
> ! 
> ! #ifndef SCOREBOARD_FILE
> !     memcpy(&scoreboard_image->servers[child_num], &new_score_rec, sizeof(short_score));
> ! #else
> !     lseek (scoreboard_fd, (long)child_num * sizeof(short_score), 0);
> !     force_write (scoreboard_fd, (char*)&new_score_rec, sizeof(short_score));
> ! #endif
>   }
>   #endif
>   
> --- 1187,1193 ----
>   
>       times(&new_score_rec.times);
>   
> !     put_scoreboard_info(child_num, new_score_rec); 
>   }
>   #endif
>   
> 
> 
>