httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@ast.cam.ac.uk (David Robinson)
Subject Re: patch 20 death
Date Fri, 08 Dec 1995 18:50:00 GMT
>David, you had a patch to do scoreboard work in memory instead of
>via a file. Would you like to start work on getting it into
>Apache.

Yes.

>Also, are there any consistency checks that the parent process could
>do to detect a scoreboard failure, and SIGHUP itself.

Sorry, here is the patch I promised.
*** http_main.c~	Wed Nov 22 15:37:44 1995
--- http_main.c	Fri Dec  8 18:23:59 1995
***************
*** 334,346 ****
      
      do {
  	rv = write (fd, buffer, bufsz);
! 	if (rv > 0) {
! 	    buffer += rv;
! 	    bufsz -= rv;
  	}
      } while (rv > 0 && bufsz > 0);
  
!     return rv < 0? rv : orig_sz - bufsz;
  }
  
  static int force_read (int fd, char *buffer, int bufsz)
--- 334,354 ----
      
      do {
  	rv = write (fd, buffer, bufsz);
! 	if (rv == -1 && errno == EINTR) continue;
! 	if (rv == -1)
! 	{
! 	    perror("write");
! 	    fprintf(stderr, "httpd: error writing scoreboard file\n");
! 	    exit(1);
  	}
+ 	buffer += rv;
+ 	bufsz -= rv;
      } while (rv > 0 && bufsz > 0);
  
!     if (bufsz != 0)
! 	log_error("httpd: warning: short write in force_write", server_conf);
! 
!     return orig_sz - bufsz;
  }
  
  static int force_read (int fd, char *buffer, int bufsz)
***************
*** 349,361 ****
      
      do {
  	rv = read (fd, buffer, bufsz);
  	if (rv > 0) {
  	    buffer += rv;
  	    bufsz -= rv;
  	}
      } while (rv > 0 && bufsz > 0);
      
!     return rv < 0? rv : orig_sz - bufsz;
  }
  
  void reinit_scoreboard (pool *p)
--- 357,379 ----
      
      do {
  	rv = read (fd, buffer, bufsz);
+ 	if (rv == -1 && errno == EINTR) continue;
+ 	if (rv == -1)
+ 	{
+ 	    perror("read");
+ 	    fprintf(stderr, "httpd: error reading scoreboard file\n");
+ 	    exit(1);
+ 	}
  	if (rv > 0) {
  	    buffer += rv;
  	    bufsz -= rv;
  	}
      } while (rv > 0 && bufsz > 0);
+ 
+     if (bufsz != 0)
+ 	log_error("httpd: warning: short read in force_read", server_conf);
      
!     return orig_sz - bufsz;
  }
  
  void reinit_scoreboard (pool *p)

Mime
View raw message