Heikki Linnakangas <hlinnaka@iki.fi> writes:
> Here's a patch to implement that. Seems to work. There is a small window
> between launching postmaster and installing the signal handler, though,
> where CTRL-C on pg_ctl will not abort the server launch. I think that's
> acceptable.
Hm ... you could partially forestall that by installing the signal handler
first. But then you have to assume that storing a pid_t variable is
atomic, which perhaps is bad? Though it's hard to credit that any
platform would need multiple instructions to do that. Also, I suppose
there's still a window, since the fork will necessarily occur some time
before you're able to store the child PID into the variable.
Another possible idea is to block SIGINT from before the fork till after
you've set the variable. But that seems overly complicated, and perhaps
not without problems of its own. So on the whole I concur with your
approach.
> Forgot attachment, here it is.
This comment needs copy-editing:
+ * If the user hits interrupts the startup (e.g. with CTRL-C), we'd
Looks good otherwise.
regards, tom lane