>I've occasionally thought about abandoning the PID test, in favor of
>relying completely on the shmem-existence test. If the shmem segment
>named in the lockfile doesn't exist or has zero processes connected to
>it, we could safely assume that the original postmaster is gone.
>(If it has processes connected, we must abort anyway, to cover the case
>where the postmaster crashed but backends remain alive.) The risk here
>is that we are then *completely* at the mercy of the OS having
>a correct
>emulation of the SysV shmem semantics, in particular the ability to
>detect whether a shmem segment has other processes connected to it.
>I'm not sure whether this is true on all the supported platforms.
>(This being the win32 list: what about Windows?)
You can try to attach to a segment if it exists. Or create a new one. It
goes away automatically when the last process referring it goes away.
(we're just doing named mmap of the pagefile). Not sure if the shmem
emualation is 100% complete on that, but it sure can be made so.
//Magnus