Hi Bill,
thanks for further details. 
My question came up while I'm in contact with a module author and we are trying to get 
the fresh ported 2.0 modules up on Netware and Win32. I found apr_file_inherit_set() 
in the headers and suggested using this instead of chown() in the hope that APR will 
do the right thing on every platform, but we both didnt find the implemetation; so I 
posted my question. 

Below I forward his answer to your last post:

> Actually, the confusion may stem from the fact of looking at /arch/win32/
> which are noops ...  Only Unix toggles the 'close handle on fork' option

I don't look at W32 stuff. My modules were designed for Apache 1.3 
prefork model. Thats the based line of compatiblity, cause 1.3 
module authors had to know it.  Probably one of the major reasons 
modules authors are not moving quickly to 2.0 is because there is 
no one memory/process model, making it difficult write a portable 
module.

> ... because Win32 can create handles for inheritence, but we have no method
> of actually *sending* the handles to the client, we've forgone that implementation
> so far.  It does no good to have a dozen log handles when we can't reconnect
> them in the child process; they are just wasted resources.

My concern is NOT about open file handles (and other system 
resouces like mutexes and share memory) at the time of a fork(). 
In my thinking, there is no clear/clean way to create a file and 
close it in the parent process with the correct file ownership 
permissions such that a child process could open that file again 
when it needs to.

I have to #ifdef __unix__ the code around a chown() in the 
ap_hook_post_config() that executes during the parent process for 
files that will be later might be accessed by a child process. 
apr_file_inherit_set() would appear to be the clean way to do it 
for open file handles, but not for the files themselves and 
unixd.h does not have any equivalent (except for global mutexes).


-- 
Anthony C Howe                            +33 6 11 89 73 78
http://www.snert.com/     ICQ: 7116561      AIM: Sir Wumpus
"Will the real email please stand up..."


Reply via email to