httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Terbush <ra...@zyzzyva.com>
Subject [PATCH] locating mutex lockfile in PID file directory
Date Wed, 22 Jan 1997 18:03:46 GMT

I have the following patch that attempts to put the mutex lock
file in the same directory as the PID file. I've attempted to
test this on FreeBSD by forcing USE_FCNTL_ACCEPT_MUTEX (or whatever)
and it does not seem to work. I don't see why the children should
not be able to get a lock on this file with one execption and
that is permissions. We are opening as root WR_ONLY with 644 perms.
How could any of the child processes lock this descriptor? I'm
assuming they would need to be able to write the file in order to
lock it.  ??

Comments. If you can test this on a platform that actually uses
this code, it would be helpful.

Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.c,v
retrieving revision 1.108
diff -c -r1.108 http_main.c
*** http_main.c	1997/01/20 04:28:08	1.108
--- http_main.c	1997/01/20 05:29:02
***************
*** 192,207 ****
   */
  void
  accept_mutex_init(pool *p)
!     {
      char lock_fname[256];
  
! #ifdef __MACHTEN__
!     strncpy(lock_fname, "/var/tmp/htlock.XXXXXX", sizeof(lock_fname)-1);
! #else
!     strncpy(lock_fname, "/usr/tmp/htlock.XXXXXX", sizeof(lock_fname)-1);
! #endif
!     lock_fname[sizeof(lock_fname)-1] = '\0';
! 
      if (mktemp(lock_fname) == NULL || lock_fname[0] == '\0')
      {
  	fprintf (stderr, "Cannot assign name to lock file!\n");
--- 192,204 ----
   */
  void
  accept_mutex_init(pool *p)
! {
      char lock_fname[256];
  
!     ap_snprintf(lock_fname, (sizeof(lock_fname)-1), "%s", pid_fname);
!     lock_fname[(rind(lock_fname, '/')) + 1] = '\0';
!     strcat(lock_fname, "htlock.XXXXXX\0");
!     
      if (mktemp(lock_fname) == NULL || lock_fname[0] == '\0')
      {
  	fprintf (stderr, "Cannot assign name to lock file!\n");
***************
*** 254,261 ****
  {
      char lock_fname[256];
  
!     strncpy(lock_fname, "/usr/tmp/htlock.XXXXXX", sizeof(lock_fname)-1);
!     lock_fname[sizeof(lock_fname)-1] = '\0';
      
      if (mktemp(lock_fname) == NULL || lock_fname[0] == '\0')
      {
--- 251,259 ----
  {
      char lock_fname[256];
  
!     ap_snprintf(lock_fname, (sizeof(lock_fname)-1), "%s", pid_fname);
!     lock_fname[(rind(lock_fname, '/')) + 1] = '\0';
!     strcat(lock_fname, "htlock.XXXXXX\0");
      
      if (mktemp(lock_fname) == NULL || lock_fname[0] == '\0')
      {



Mime
View raw message