With APR on Windows, creating shared memory or a cross-process mutex with a "file" name parameter results in a resource being created with a "Global" prefix, which in turn restricts the call to Administrator (or more accurately, a thread with the specific privilege
to make that call; let's just call that "Administrator" for simplicity). (I think this is just for shared memory???)
A typical way to encounter this is that some dude in httpd-land decides that mod_lua should start creating APR shared memory at startup and a filename should always be specified, and suddenly httpd running as you on Windows can no longer use mod_lua. Any number of other httpd modules try do something similar (though I haven't investigated if there's a way to configure around it); additionally, APR's testshm won't work as a regular user.
The attached patch uses "Local" as the prefix if the calling thread doesn't have the necessary privilege to create one under the global namespace. But this function is also used for attach-type operations,
Has anyone investigated this before?
I suspect that the internal support routine res_name_from_file() (affected by the patch) and callers need to be refactored so that
a. proc mutexes aren't affected
b. when trying to attach to shared memory from a caller without the privilege, first try with the Local prefix (which is probably where it is) and then try with the Global prefix (in case the shm was created by a process with the privilege)
Unless someone has hints, I'll proceed in that manner.
Born in Roswell... married an alien...