Refactor fork()-related code. We need to do various housekeeping tasks
Neil Conway <neilc@samurai.com>
Refactor fork()-related code. We need to do various housekeeping tasks before we can invoke fork() -- flush stdio buffers, save and restore the profiling timer on Linux with LINUX_PROFILE, and handle BeOS stuff. This patch moves that code into a single function, fork_process(), instead of duplicating it at the various callsites of fork(). This patch doesn't address the EXEC_BACKEND case; there is room for further cleanup there.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/port/beos/support.c | modified | +1 −1 |
| src/backend/postmaster/fork_process.c | added | +80 −0 |
| src/backend/postmaster/Makefile | modified | +2 −2 |
| src/backend/postmaster/pgarch.c | modified | +3 −18 |
| src/backend/postmaster/postmaster.c | modified | +11 −109 |
| src/backend/postmaster/syslogger.c | modified | +3 −21 |
| src/include/postmaster/fork_process.h | added | +8 −0 |