init
This commit is contained in:
65
pg_include/postmaster/autovacuum.h
Executable file
65
pg_include/postmaster/autovacuum.h
Executable file
@@ -0,0 +1,65 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* autovacuum.h
|
||||
* header file for integrated autovacuum daemon
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/postmaster/autovacuum.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef AUTOVACUUM_H
|
||||
#define AUTOVACUUM_H
|
||||
|
||||
|
||||
/* GUC variables */
|
||||
extern bool autovacuum_start_daemon;
|
||||
extern int autovacuum_max_workers;
|
||||
extern int autovacuum_naptime;
|
||||
extern int autovacuum_vac_thresh;
|
||||
extern double autovacuum_vac_scale;
|
||||
extern int autovacuum_anl_thresh;
|
||||
extern double autovacuum_anl_scale;
|
||||
extern int autovacuum_freeze_max_age;
|
||||
extern int autovacuum_vac_cost_delay;
|
||||
extern int autovacuum_vac_cost_limit;
|
||||
|
||||
/* autovacuum launcher PID, only valid when worker is shutting down */
|
||||
extern int AutovacuumLauncherPid;
|
||||
|
||||
extern int Log_autovacuum_min_duration;
|
||||
|
||||
/* Status inquiry functions */
|
||||
extern bool AutoVacuumingActive(void);
|
||||
extern bool IsAutoVacuumLauncherProcess(void);
|
||||
extern bool IsAutoVacuumWorkerProcess(void);
|
||||
|
||||
#define IsAnyAutoVacuumProcess() \
|
||||
(IsAutoVacuumLauncherProcess() || IsAutoVacuumWorkerProcess())
|
||||
|
||||
/* Functions to start autovacuum process, called from postmaster */
|
||||
extern void autovac_init(void);
|
||||
extern int StartAutoVacLauncher(void);
|
||||
extern int StartAutoVacWorker(void);
|
||||
|
||||
/* called from postmaster when a worker could not be forked */
|
||||
extern void AutoVacWorkerFailed(void);
|
||||
|
||||
/* autovacuum cost-delay balancer */
|
||||
extern void AutoVacuumUpdateDelay(void);
|
||||
|
||||
#ifdef EXEC_BACKEND
|
||||
extern void AutoVacLauncherMain(int argc, char *argv[]);
|
||||
extern void AutoVacWorkerMain(int argc, char *argv[]);
|
||||
extern void AutovacuumWorkerIAm(void);
|
||||
extern void AutovacuumLauncherIAm(void);
|
||||
#endif
|
||||
|
||||
/* shared memory stuff */
|
||||
extern Size AutoVacuumShmemSize(void);
|
||||
extern void AutoVacuumShmemInit(void);
|
||||
|
||||
#endif /* AUTOVACUUM_H */
|
||||
43
pg_include/postmaster/bgwriter.h
Executable file
43
pg_include/postmaster/bgwriter.h
Executable file
@@ -0,0 +1,43 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* bgwriter.h
|
||||
* Exports from postmaster/bgwriter.c and postmaster/checkpointer.c.
|
||||
*
|
||||
* The bgwriter process used to handle checkpointing duties too. Now
|
||||
* there is a separate process, but we did not bother to split this header.
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
*
|
||||
* src/include/postmaster/bgwriter.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef _BGWRITER_H
|
||||
#define _BGWRITER_H
|
||||
|
||||
#include "storage/block.h"
|
||||
#include "storage/relfilenode.h"
|
||||
|
||||
|
||||
/* GUC options */
|
||||
extern int BgWriterDelay;
|
||||
extern int CheckPointTimeout;
|
||||
extern int CheckPointWarning;
|
||||
extern double CheckPointCompletionTarget;
|
||||
|
||||
extern void BackgroundWriterMain(void);
|
||||
extern void CheckpointerMain(void);
|
||||
|
||||
extern void RequestCheckpoint(int flags);
|
||||
extern void CheckpointWriteDelay(int flags, double progress);
|
||||
|
||||
extern bool ForwardFsyncRequest(RelFileNode rnode, ForkNumber forknum,
|
||||
BlockNumber segno);
|
||||
extern void AbsorbFsyncRequests(void);
|
||||
|
||||
extern Size CheckpointerShmemSize(void);
|
||||
extern void CheckpointerShmemInit(void);
|
||||
|
||||
extern bool FirstCallSinceLastCheckpoint(void);
|
||||
|
||||
#endif /* _BGWRITER_H */
|
||||
17
pg_include/postmaster/fork_process.h
Executable file
17
pg_include/postmaster/fork_process.h
Executable file
@@ -0,0 +1,17 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* fork_process.h
|
||||
* Exports from postmaster/fork_process.c.
|
||||
*
|
||||
* Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
*
|
||||
* src/include/postmaster/fork_process.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef FORK_PROCESS_H
|
||||
#define FORK_PROCESS_H
|
||||
|
||||
extern pid_t fork_process(void);
|
||||
|
||||
#endif /* FORK_PROCESS_H */
|
||||
26
pg_include/postmaster/pgarch.h
Executable file
26
pg_include/postmaster/pgarch.h
Executable file
@@ -0,0 +1,26 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* pgarch.h
|
||||
* Exports from postmaster/pgarch.c.
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/postmaster/pgarch.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef _PGARCH_H
|
||||
#define _PGARCH_H
|
||||
|
||||
/* ----------
|
||||
* Functions called from postmaster
|
||||
* ----------
|
||||
*/
|
||||
extern int pgarch_start(void);
|
||||
|
||||
#ifdef EXEC_BACKEND
|
||||
extern void PgArchiverMain(int argc, char *argv[]);
|
||||
#endif
|
||||
|
||||
#endif /* _PGARCH_H */
|
||||
62
pg_include/postmaster/postmaster.h
Executable file
62
pg_include/postmaster/postmaster.h
Executable file
@@ -0,0 +1,62 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* postmaster.h
|
||||
* Exports from postmaster/postmaster.c.
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/postmaster/postmaster.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef _POSTMASTER_H
|
||||
#define _POSTMASTER_H
|
||||
|
||||
/* GUC options */
|
||||
extern bool EnableSSL;
|
||||
extern int ReservedBackends;
|
||||
extern int PostPortNumber;
|
||||
extern int Unix_socket_permissions;
|
||||
extern char *Unix_socket_group;
|
||||
extern char *UnixSocketDir;
|
||||
extern char *ListenAddresses;
|
||||
extern bool ClientAuthInProgress;
|
||||
extern int PreAuthDelay;
|
||||
extern int AuthenticationTimeout;
|
||||
extern bool Log_connections;
|
||||
extern bool log_hostname;
|
||||
extern bool enable_bonjour;
|
||||
extern char *bonjour_name;
|
||||
extern bool restart_after_crash;
|
||||
|
||||
#ifdef WIN32
|
||||
extern HANDLE PostmasterHandle;
|
||||
#else
|
||||
extern int postmaster_alive_fds[2];
|
||||
|
||||
/*
|
||||
* Constants that represent which of postmaster_alive_fds is held by
|
||||
* postmaster, and which is used in children to check for postmaster death.
|
||||
*/
|
||||
#define POSTMASTER_FD_WATCH 0 /* used in children to check for
|
||||
* postmaster death */
|
||||
#define POSTMASTER_FD_OWN 1 /* kept open by postmaster only */
|
||||
#endif
|
||||
|
||||
extern const char *progname;
|
||||
|
||||
extern int PostmasterMain(int argc, char *argv[]);
|
||||
extern void ClosePostmasterPorts(bool am_syslogger);
|
||||
|
||||
extern int MaxLivePostmasterChildren(void);
|
||||
|
||||
#ifdef EXEC_BACKEND
|
||||
extern pid_t postmaster_forkexec(int argc, char *argv[]);
|
||||
extern int SubPostmasterMain(int argc, char *argv[]);
|
||||
|
||||
extern Size ShmemBackendArraySize(void);
|
||||
extern void ShmemBackendArrayAllocation(void);
|
||||
#endif
|
||||
|
||||
#endif /* _POSTMASTER_H */
|
||||
22
pg_include/postmaster/startup.h
Executable file
22
pg_include/postmaster/startup.h
Executable file
@@ -0,0 +1,22 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* startup.h
|
||||
* Exports from postmaster/startup.c.
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
*
|
||||
* src/include/postmaster/startup.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef _STARTUP_H
|
||||
#define _STARTUP_H
|
||||
|
||||
extern void HandleStartupProcInterrupts(void);
|
||||
extern void StartupProcessMain(void);
|
||||
extern void PreRestoreCommand(void);
|
||||
extern void PostRestoreCommand(void);
|
||||
extern bool IsPromoteTriggered(void);
|
||||
extern void ResetPromoteTriggered(void);
|
||||
|
||||
#endif /* _STARTUP_H */
|
||||
90
pg_include/postmaster/syslogger.h
Executable file
90
pg_include/postmaster/syslogger.h
Executable file
@@ -0,0 +1,90 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* syslogger.h
|
||||
* Exports from postmaster/syslogger.c.
|
||||
*
|
||||
* Copyright (c) 2004-2012, PostgreSQL Global Development Group
|
||||
*
|
||||
* src/include/postmaster/syslogger.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef _SYSLOGGER_H
|
||||
#define _SYSLOGGER_H
|
||||
|
||||
#include <limits.h> /* for PIPE_BUF */
|
||||
|
||||
|
||||
/*
|
||||
* Primitive protocol structure for writing to syslogger pipe(s). The idea
|
||||
* here is to divide long messages into chunks that are not more than
|
||||
* PIPE_BUF bytes long, which according to POSIX spec must be written into
|
||||
* the pipe atomically. The pipe reader then uses the protocol headers to
|
||||
* reassemble the parts of a message into a single string. The reader can
|
||||
* also cope with non-protocol data coming down the pipe, though we cannot
|
||||
* guarantee long strings won't get split apart.
|
||||
*
|
||||
* We use non-nul bytes in is_last to make the protocol a tiny bit
|
||||
* more robust against finding a false double nul byte prologue. But
|
||||
* we still might find it in the len and/or pid bytes unless we're careful.
|
||||
*/
|
||||
|
||||
#ifdef PIPE_BUF
|
||||
/* Are there any systems with PIPE_BUF > 64K? Unlikely, but ... */
|
||||
#if PIPE_BUF > 65536
|
||||
#define PIPE_CHUNK_SIZE 65536
|
||||
#else
|
||||
#define PIPE_CHUNK_SIZE ((int) PIPE_BUF)
|
||||
#endif
|
||||
#else /* not defined */
|
||||
/* POSIX says the value of PIPE_BUF must be at least 512, so use that */
|
||||
#define PIPE_CHUNK_SIZE 512
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char nuls[2]; /* always \0\0 */
|
||||
uint16 len; /* size of this chunk (counts data only) */
|
||||
int32 pid; /* writer's pid */
|
||||
char is_last; /* last chunk of message? 't' or 'f' ('T' or
|
||||
* 'F' for CSV case) */
|
||||
char data[1]; /* data payload starts here */
|
||||
} PipeProtoHeader;
|
||||
|
||||
typedef union
|
||||
{
|
||||
PipeProtoHeader proto;
|
||||
char filler[PIPE_CHUNK_SIZE];
|
||||
} PipeProtoChunk;
|
||||
|
||||
#define PIPE_HEADER_SIZE offsetof(PipeProtoHeader, data)
|
||||
#define PIPE_MAX_PAYLOAD ((int) (PIPE_CHUNK_SIZE - PIPE_HEADER_SIZE))
|
||||
|
||||
|
||||
/* GUC options */
|
||||
extern bool Logging_collector;
|
||||
extern int Log_RotationAge;
|
||||
extern int Log_RotationSize;
|
||||
extern PGDLLIMPORT char *Log_directory;
|
||||
extern PGDLLIMPORT char *Log_filename;
|
||||
extern bool Log_truncate_on_rotation;
|
||||
extern int Log_file_mode;
|
||||
|
||||
extern bool am_syslogger;
|
||||
|
||||
#ifndef WIN32
|
||||
extern int syslogPipe[2];
|
||||
#else
|
||||
extern HANDLE syslogPipe[2];
|
||||
#endif
|
||||
|
||||
|
||||
extern int SysLogger_Start(void);
|
||||
|
||||
extern void write_syslogger_file(const char *buffer, int count, int dest);
|
||||
|
||||
#ifdef EXEC_BACKEND
|
||||
extern void SysLoggerMain(int argc, char *argv[]);
|
||||
#endif
|
||||
|
||||
#endif /* _SYSLOGGER_H */
|
||||
20
pg_include/postmaster/walwriter.h
Executable file
20
pg_include/postmaster/walwriter.h
Executable file
@@ -0,0 +1,20 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* walwriter.h
|
||||
* Exports from postmaster/walwriter.c.
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
*
|
||||
* src/include/postmaster/walwriter.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef _WALWRITER_H
|
||||
#define _WALWRITER_H
|
||||
|
||||
/* GUC options */
|
||||
extern int WalWriterDelay;
|
||||
|
||||
extern void WalWriterMain(void);
|
||||
|
||||
#endif /* _WALWRITER_H */
|
||||
Reference in New Issue
Block a user