You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by "Gregory (Grisha) Trubetskoy" <gr...@ispol.com> on 2003/10/16 23:23:29 UTC

[patch] proc_mutex_flock_child_init() should close the file

In proc_mutex_flock_child_init(), there is no reason to keep the inherited
file descriptor open, it results in unnecessary open files. Unless I'm
missing something it's ok to close it first thing in flock_child_init().
I've tested this on FreeBSD 4.8.

--- locks/unix/proc_mutex.c     6 Aug 2003 23:54:31 -0000       1.35
+++ locks/unix/proc_mutex.c     16 Oct 2003 21:18:48 -0000
@@ -682,6 +682,8 @@
     apr_proc_mutex_t *new_mutex;
     int rv;

+    apr_file_close((*mutex)->interproc);
+
     new_mutex = (apr_proc_mutex_t *)apr_palloc(pool, sizeof(apr_proc_mutex_t));

     memcpy(new_mutex, *mutex, sizeof *new_mutex);


Re: [patch] proc_mutex_flock_child_init() should close the file

Posted by Jeff Trawick <tr...@attglobal.net>.
Gregory (Grisha) Trubetskoy wrote:

> In proc_mutex_flock_child_init(), there is no reason to keep the inherited
> file descriptor open, it results in unnecessary open files. Unless I'm
> missing something it's ok to close it first thing in flock_child_init().

sure, definitely a good thing for it not to be open

but maybe in proc_mutex_flock_create() it should be marked as 
uninheritable?  new child processes wouldn't otherwise know to close the 
file unless they ran the flock_child_init code