PostgreSQL Source Code git master
Loading...
Searching...
No Matches
backend_startup.h File Reference
#include "utils/timestamp.h"
Include dependency graph for backend_startup.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  BackendStartupData
 
struct  ConnectionTiming
 

Typedefs

typedef enum CAC_state CAC_state
 
typedef struct BackendStartupData BackendStartupData
 
typedef enum LogConnectionOption LogConnectionOption
 
typedef struct ConnectionTiming ConnectionTiming
 

Enumerations

enum  CAC_state {
  CAC_OK , CAC_STARTUP , CAC_SHUTDOWN , CAC_RECOVERY ,
  CAC_NOTHOTSTANDBY , CAC_TOOMANY
}
 
enum  LogConnectionOption {
  LOG_CONNECTION_RECEIPT = (1 << 0) , LOG_CONNECTION_AUTHENTICATION = (1 << 1) , LOG_CONNECTION_AUTHORIZATION = (1 << 2) , LOG_CONNECTION_SETUP_DURATIONS = (1 << 3) ,
  LOG_CONNECTION_ON , LOG_CONNECTION_ALL
}
 

Functions

pg_noreturn void BackendMain (const void *startup_data, size_t startup_data_len)
 

Variables

PGDLLIMPORT bool Trace_connection_negotiation
 
PGDLLIMPORT uint32 log_connections
 
PGDLLIMPORT charlog_connections_string
 
PGDLLIMPORT struct ConnectionTiming conn_timing
 

Typedef Documentation

◆ BackendStartupData

◆ CAC_state

◆ ConnectionTiming

◆ LogConnectionOption

Enumeration Type Documentation

◆ CAC_state

Enumerator
CAC_OK 
CAC_STARTUP 
CAC_SHUTDOWN 
CAC_RECOVERY 
CAC_NOTHOTSTANDBY 
CAC_TOOMANY 

Definition at line 33 of file backend_startup.h.

34{
35 CAC_OK,
41} CAC_state;
CAC_state
@ CAC_TOOMANY
@ CAC_OK
@ CAC_RECOVERY
@ CAC_NOTHOTSTANDBY
@ CAC_STARTUP
@ CAC_SHUTDOWN

◆ LogConnectionOption

Enumerator
LOG_CONNECTION_RECEIPT 
LOG_CONNECTION_AUTHENTICATION 
LOG_CONNECTION_AUTHORIZATION 
LOG_CONNECTION_SETUP_DURATIONS 
LOG_CONNECTION_ON 
LOG_CONNECTION_ALL 

Definition at line 74 of file backend_startup.h.

Function Documentation

◆ BackendMain()

pg_noreturn void BackendMain ( const void startup_data,
size_t  startup_data_len 
)
extern

Definition at line 76 of file backend_startup.c.

77{
79
82
83#ifdef EXEC_BACKEND
84
85 /*
86 * Need to reinitialize the SSL library in the backend, since the context
87 * structures contain function pointers and cannot be passed through the
88 * parameter file.
89 *
90 * If for some reason reload fails (maybe the user installed broken key
91 * files), soldier on without SSL; that's better than all connections
92 * becoming impossible.
93 *
94 * XXX should we do this in all child processes? For the moment it's
95 * enough to do it in backend children.
96 */
97#ifdef USE_SSL
98 if (EnableSSL)
99 {
100 if (secure_initialize(false) == 0)
101 LoadedSSL = true;
102 else
103 ereport(LOG,
104 (errmsg("SSL configuration could not be loaded in child process")));
105 }
106#endif
107#endif
108
109 /* Perform additional initialization and collect startup packet */
110 BackendInitialize(MyClientSocket, bsdata->canAcceptConnections);
111
112 /*
113 * Create a per-backend PGPROC struct in shared memory. We must do this
114 * before we can use LWLocks or access any shared memory.
115 */
116 InitProcess();
117
118 /*
119 * Make sure we aren't in PostmasterContext anymore. (We can't delete it
120 * just yet, though, because InitPostgres will need the HBA data.)
121 */
123
125}
static void BackendInitialize(ClientSocket *client_sock, CAC_state cac)
int secure_initialize(bool isServerStart)
Definition be-secure.c:75
#define Assert(condition)
Definition c.h:873
int errmsg(const char *fmt,...)
Definition elog.c:1080
#define LOG
Definition elog.h:31
#define ereport(elevel,...)
Definition elog.h:150
struct ClientSocket * MyClientSocket
Definition globals.c:50
struct Port * MyProcPort
Definition globals.c:51
MemoryContext TopMemoryContext
Definition mcxt.c:166
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition palloc.h:124
void PostgresMain(const char *dbname, const char *username)
Definition postgres.c:4193
bool EnableSSL
Definition postmaster.c:238
PGDLLIMPORT bool LoadedSSL
static int fb(int x)
void InitProcess(void)
Definition proc.c:395
char * user_name
Definition libpq-be.h:151
char * database_name
Definition libpq-be.h:150

References Assert, BackendInitialize(), Port::database_name, EnableSSL, ereport, errmsg(), fb(), InitProcess(), LoadedSSL, LOG, MemoryContextSwitchTo(), MyClientSocket, MyProcPort, PostgresMain(), secure_initialize(), TopMemoryContext, and Port::user_name.

Variable Documentation

◆ conn_timing

PGDLLIMPORT struct ConnectionTiming conn_timing
extern

Definition at line 58 of file backend_startup.c.

58{.ready_for_use = TIMESTAMP_MINUS_INFINITY};
#define TIMESTAMP_MINUS_INFINITY
Definition timestamp.h:150

Referenced by PerformAuthentication(), PostgresMain(), and postmaster_child_launch().

◆ log_connections

◆ log_connections_string

PGDLLIMPORT char* log_connections_string
extern

Definition at line 48 of file backend_startup.c.

◆ Trace_connection_negotiation

PGDLLIMPORT bool Trace_connection_negotiation
extern

Definition at line 46 of file backend_startup.c.

Referenced by ProcessSSLStartup(), and ProcessStartupPacket().