Peter Eisentraut <peter_e@gmx.net> writes:
> Maybe we could name the socket file .s.PGSQL.port.pid and make
> .s.PGSQL.port a symlink. Then you can find out whether the postmaster
> that created the file is still running.
Or just create a lockfile /tmp/.s.PGSQL.port#.lock, ie, same name as
socket file with ".lock" added (containing postmaster's PID). Then we
could share code with the data-directory-lockfile case.
> Actually, this turns out to be similar to what you wrote in
> http://www.postgresql.org/mhonarc/pgsql-hackers/1998-08/msg00835.html
Well, we've talked before about moving the socket files to someplace
safer than /tmp. The problem is to find another place that's not
platform-dependent --- else you've got a major configuration headache.
> But we really should be fixing the IPC interlock with IPC_EXCL, but the
> code changes look to be non-trivial.
AFAIR the previous thread, it wasn't that bad, it was just a matter of
someone taking the time to do it. Maybe I'll have a go at it...
regards, tom lane