PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
backend_startup.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  BackendStartupData
 

Typedefs

typedef enum CAC_state CAC_state
 
typedef struct BackendStartupData BackendStartupData
 

Enumerations

enum  CAC_state {
  CAC_OK , CAC_STARTUP , CAC_SHUTDOWN , CAC_RECOVERY ,
  CAC_NOTCONSISTENT , CAC_TOOMANY
}
 

Functions

void BackendMain (char *startup_data, size_t startup_data_len) pg_attribute_noreturn()
 

Variables

PGDLLIMPORT bool Trace_connection_negotiation
 

Typedef Documentation

◆ BackendStartupData

◆ CAC_state

typedef enum CAC_state CAC_state

Enumeration Type Documentation

◆ CAC_state

enum CAC_state
Enumerator
CAC_OK 
CAC_STARTUP 
CAC_SHUTDOWN 
CAC_RECOVERY 
CAC_NOTCONSISTENT 
CAC_TOOMANY 

Definition at line 26 of file backend_startup.h.

27{
28 CAC_OK,
34} CAC_state;
CAC_state
@ CAC_TOOMANY
@ CAC_OK
@ CAC_RECOVERY
@ CAC_NOTCONSISTENT
@ CAC_STARTUP
@ CAC_SHUTDOWN

Function Documentation

◆ BackendMain()

void BackendMain ( char *  startup_data,
size_t  startup_data_len 
)

Definition at line 59 of file backend_startup.c.

60{
61 BackendStartupData *bsdata = (BackendStartupData *) startup_data;
62
63 Assert(startup_data_len == sizeof(BackendStartupData));
64 Assert(MyClientSocket != NULL);
65
66#ifdef EXEC_BACKEND
67
68 /*
69 * Need to reinitialize the SSL library in the backend, since the context
70 * structures contain function pointers and cannot be passed through the
71 * parameter file.
72 *
73 * If for some reason reload fails (maybe the user installed broken key
74 * files), soldier on without SSL; that's better than all connections
75 * becoming impossible.
76 *
77 * XXX should we do this in all child processes? For the moment it's
78 * enough to do it in backend children.
79 */
80#ifdef USE_SSL
81 if (EnableSSL)
82 {
83 if (secure_initialize(false) == 0)
84 LoadedSSL = true;
85 else
87 (errmsg("SSL configuration could not be loaded in child process")));
88 }
89#endif
90#endif
91
92 /* Perform additional initialization and collect startup packet */
94
95 /*
96 * Create a per-backend PGPROC struct in shared memory. We must do this
97 * before we can use LWLocks or access any shared memory.
98 */
100
101 /*
102 * Make sure we aren't in PostmasterContext anymore. (We can't delete it
103 * just yet, though, because InitPostgres will need the HBA data.)
104 */
106
108}
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:812
int errmsg(const char *fmt,...)
Definition: elog.c:1070
#define LOG
Definition: elog.h:31
#define ereport(elevel,...)
Definition: elog.h:149
struct ClientSocket * MyClientSocket
Definition: globals.c:49
struct Port * MyProcPort
Definition: globals.c:50
MemoryContext TopMemoryContext
Definition: mcxt.c:149
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition: palloc.h:124
void PostgresMain(const char *dbname, const char *username)
Definition: postgres.c:4146
bool EnableSSL
Definition: postmaster.c:230
PGDLLIMPORT bool LoadedSSL
void InitProcess(void)
Definition: proc.c:341
CAC_state canAcceptConnections
char * user_name
Definition: libpq-be.h:152
char * database_name
Definition: libpq-be.h:151

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

Variable Documentation

◆ Trace_connection_negotiation

PGDLLIMPORT bool Trace_connection_negotiation
extern

Definition at line 43 of file backend_startup.c.

Referenced by ProcessSSLStartup(), and ProcessStartupPacket().