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/28 20:52:05 UTC

Re: [PATCH] locating mutex lockfile

Dirk, are you using FCNTL locking?

The comments in the patch regarding FCNTL locking not working 
are out of date obviously. Marc fixed that problem before 1.2 general.

Regarding Jim's comments about making it server root relative, when 
I did this, it was my feeling that it would be less likely that the 
lockfile was on an NFS partition rather than the server root. It 
would be easy to argue against this though. It might not hurt to 
make sure that the location is not an NFS filesystem, but I am not 
sure where we would fall back to.

> Randy,
> 
> I just cut/pasted it in and that one certainly does the 
> trick on the current from-cvs file for me on FreeBSD.
> 
> Dw.
> 
> 
> ----- Begin Included Message -----
> 
> >From new-httpd-owner@apache.org Sat Jun 28 20:24:08 1997
> To: new-httpd@apache.org
> Subject: [PATCH] locating mutex lockfile
> Date: Sat, 28 Jun 1997 13:24:40 -0500
> From: Randy Terbush <ra...@zyzzyva.com>
> 
> 
> This was my original patch pre-1.2. If it looks like an acceptable 
> solution, I'll remake it against the current sources.
> 
> 
> ------- Forwarded Message
> 
> Subject: [PATCH] locating mutex lockfile in PID file directory
> X-uri: http://www.zyzzyva.com/
> Mime-Version: 1.0
> Content-Type: text/plain; charset=us-ascii
> Date: Wed, 22 Jan 1997 12:03:46 -0600
> From: Randy Terbush <ra...@zyzzyva.com>
> Sender: new-httpd-owner@hyperreal.com
> Reply-To: new-httpd@hyperreal.com
> Precedence: bulk
> 
> 
> 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')
>       {
> 
> 
> ------- End of Forwarded Message
> 
> 
> 
> 
> 
> ----- End Included Message -----