There is a bit of confusion around the return values and return protocols of the sub-main functions in the backend (PostgresMain etc.). Some functions are declared to return int but never return. It would be useful to make this consistent by either making them return void or making some use of the return value.
PostgresMain() is declared to return int but never returns at all, so why not make it return void? main() in turn reads the exit code and passes it to exit(). Similarly, PostmasterMain() never returns, but is declared to return int. BackendRun() is declared to return int, and that return value is actually obtained from the return value of PostgresMain() (see above), and the return value of BackendRun() is passed to proc_exit(). That appears to be elaborate nonsense, because the only way to get out of PostgresMain() is through calling proc_exit in the first place. PostgresMain() calls proc_exit(WalSenderMain()), but WalSenderMain ends by calling WalSndLoop which in turn ends by calling proc_exit. By contrast, AuxiliaryProcessMain() and all the sub-Main() functions called from there are declared to return void. I suggest that we change PostgresMain(), PostmasterMain(), BackendRun(), WalSenderMain(), and WalSndLoop() to return void as well. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers