99#ifdef USE_INJECTION_POINTS
152#define SizeOfBackendParameters(startup_data_len) (offsetof(BackendParameters, startup_data) + startup_data_len)
181#define PG_PROCTYPE(bktype, description, main_func, shmem_attach) \
182 [bktype] = {description, main_func, shmem_attach},
333 errmsg(
"could not create file \"%s\": %m",
361 argv[0] =
"postgres";
374 (
errmsg(
"could not execute server process \"%s\": %m",
417 sa.nLength =
sizeof(
sa);
428 (
errmsg(
"could not create backend parameter file mapping: error code %lu",
436 (
errmsg(
"could not map backend parameter memory: error code %lu",
453 (
errmsg(
"subprocess command line too long")));
471 (
errmsg(
"CreateProcess() call failed: %m (error code %lu)",
479 pi.hProcess,
pi.dwProcessId,
488 (
errmsg_internal(
"could not terminate unstarted process: error code %lu",
500 (
errmsg(
"could not unmap view of backend parameter file: error code %lu",
504 (
errmsg(
"could not close handle to backend parameter file: error code %lu",
519 (
errmsg_internal(
"could not terminate process that failed to reserve memory: error code %lu",
526 (
errmsg(
"giving up after too many tries to reserve shared memory"),
527 errhint(
"This might be caused by ASLR or antivirus software.")));
541 (
errmsg_internal(
"could not terminate unstartable process: error code %lu",
550 (
errmsg_internal(
"could not resume thread of unstarted process: error code %lu",
562 return pi.dwProcessId;
600 elog(
FATAL,
"invalid subpostmaster invocation");
606 if (
strncmp(argv[1],
"--forkchild=", 12) != 0)
607 elog(
FATAL,
"invalid subpostmaster invocation (--forkchild argument missing)");
691#define write_inheritable_socket(dest, src, childpid) ((*(dest) = (src)), true)
692#define read_inheritable_socket(dest, src) (*(dest) = *(src))
721 param->MyPMChildSlot = child_slot;
729#ifdef USE_INJECTION_POINTS
801 (
errmsg_internal(
"could not duplicate handle to be written to backend parameter file: error code %lu",
820 dest->origsocket = src;
827 (
errmsg(
"could not duplicate socket %d for use in backend: error code %d",
846 *
dest = src->origsocket;
859 write_stderr(
"could not create inherited socket: error code %d\n",
888 write_stderr(
"could not open backend variables file \"%s\": %m\n",
id);
892 if (
fread(¶m,
sizeof(param), 1, fp) != 1)
894 write_stderr(
"could not read from backend variables file \"%s\": %m\n",
id);
900 if (param.startup_data_len > 0)
905 write_stderr(
"could not read startup data from backend variables file \"%s\": %m\n",
933 write_stderr(
"could not map view of backend variables: error code %lu\n",
942 if (param.startup_data_len > 0)
952 write_stderr(
"could not unmap view of backend variables: error code %lu\n",
959 write_stderr(
"could not close handle to backend parameter variables: error code %lu\n",
989#ifdef USE_INJECTION_POINTS
TimestampTz GetCurrentTimestamp(void)
ConnectionTiming conn_timing
#define write_stderr(str)
#define Assert(condition)
#define FLEXIBLE_ARRAY_MEMBER
void dsm_detach_all(void)
int errmsg_internal(const char *fmt,...)
int errcode_for_file_access(void)
int errhint(const char *fmt,...)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
int MakePGDirectory(const char *directoryName)
void ReserveExternalFD(void)
FILE * AllocateFile(const char *name, const char *mode)
#define palloc_object(type)
#define PG_TEMP_FILES_DIR
#define PG_TEMP_FILE_PREFIX
struct ClientSocket * MyClientSocket
char pkglib_path[MAXPGPATH]
bool IsPostmasterEnvironment
char my_exec_path[MAXPGPATH]
void InitializeGUCOptions(void)
static child_process_kind child_process_kinds[]
const char * PostmasterChildName(BackendType child_type)
pid_t postmaster_child_launch(BackendType child_type, int child_slot, void *startup_data, size_t startup_data_len, ClientSocket *client_sock)
char ** LWLockTrancheNames
int NamedLWLockTrancheRequests
NamedLWLockTrancheRequest * NamedLWLockTrancheRequestArray
LWLockPadded * MainLWLockArray
void * MemoryContextAlloc(MemoryContext context, Size size)
void pfree(void *pointer)
void * palloc0(Size size)
MemoryContext TopMemoryContext
#define IsExternalConnectionBackend(backend_type)
#define BACKEND_NUM_TYPES
void InitPostmasterChild(void)
void process_shared_preload_libraries(void)
BackendType MyBackendType
void SetDataDir(const char *dir)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
NON_EXEC_STATIC int num_pmchild_slots
NON_EXEC_STATIC volatile PMSignalData * PMSignalState
size_t strlcpy(char *dst, const char *src, size_t siz)
CommandDest whereToSendOutput
int postmaster_alive_fds[2]
void ClosePostmasterPorts(bool am_syslogger)
NON_EXEC_STATIC ProcSignalHeader * ProcSignal
void InitShmemAllocator(PGShmemHeader *seghdr)
HANDLE pgwin32_create_signal_listener(pid_t pid)
HANDLE pgwin32_initial_signal_pipe
PGPROC * PreparedXactProcs
NON_EXEC_STATIC PGPROC * AuxiliaryProcs
NON_EXEC_STATIC slock_t * ProcStructLock
TimestampTz socket_create
void(* main_fn)(const void *startup_data, size_t startup_data_len)
NON_EXEC_STATIC pg_time_t first_syslogger_file_time
void PGSharedMemoryDetach(void)
unsigned long UsedShmemSegID
void PGSharedMemoryReAttach(void)
void * ShmemProtectiveRegion
int pgwin32_ReserveSharedMemoryRegion(HANDLE hChild)
void PGSharedMemoryNoReAttach(void)
void LocalProcessControlFile(bool reset)