Forgive me if this is really elementary. Within mod_perl, I would like to know the pid of the master Apache daemon, *after* it forks and goes into the background, but without knowing the location of httpd.conf or knowing the pidfile beforehand. Storing $$ during startup gives me the pid before forking (i.e., on an idle Linux system it's usually 2 lower than the pid of the actual daemon). Checking $$ in the children is of course not useful.
It seems like I could do one of the following: 1. Just ask some secret Apache routine to give me the number. I haven't found such a routine. 2. Find a way to access Apache globals such as char *ap_pid_fname, then read the file. This would be fine. 3. Snag the PidFile directive during startup time. But I haven't found a way to do any of those so far. Most access to pids seems centered on child pids, while the master pid seems totally unavailable. (Apache::Scoreboard, for example.) Does anyone know of a nice way to do this? Thanks, Jon