PostgreSQL Source Code  git master
postmaster.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * postmaster.h
4  * Exports from postmaster/postmaster.c.
5  *
6  * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  * src/include/postmaster/postmaster.h
10  *
11  *-------------------------------------------------------------------------
12  */
13 #ifndef _POSTMASTER_H
14 #define _POSTMASTER_H
15 
16 #include "miscadmin.h"
17 
18 /* GUC options */
19 extern PGDLLIMPORT bool EnableSSL;
22 extern PGDLLIMPORT int PostPortNumber;
24 extern PGDLLIMPORT char *Unix_socket_group;
26 extern PGDLLIMPORT char *ListenAddresses;
28 extern PGDLLIMPORT int PreAuthDelay;
30 extern PGDLLIMPORT bool Log_connections;
31 extern PGDLLIMPORT bool log_hostname;
32 extern PGDLLIMPORT bool enable_bonjour;
33 extern PGDLLIMPORT char *bonjour_name;
38 
39 #ifdef EXEC_BACKEND
40 extern struct bkend *ShmemBackendArray;
41 #endif
42 
43 #ifdef WIN32
44 extern PGDLLIMPORT HANDLE PostmasterHandle;
45 #else
46 extern PGDLLIMPORT int postmaster_alive_fds[2];
47 
48 /*
49  * Constants that represent which of postmaster_alive_fds is held by
50  * postmaster, and which is used in children to check for postmaster death.
51  */
52 #define POSTMASTER_FD_WATCH 0 /* used in children to check for
53  * postmaster death */
54 #define POSTMASTER_FD_OWN 1 /* kept open by postmaster only */
55 #endif
56 
57 extern PGDLLIMPORT const char *progname;
58 
59 extern PGDLLIMPORT bool redirection_done;
60 extern PGDLLIMPORT bool LoadedSSL;
61 
62 extern void PostmasterMain(int argc, char *argv[]) pg_attribute_noreturn();
63 extern void ClosePostmasterPorts(bool am_syslogger);
64 extern void InitProcessGlobals(void);
65 
66 extern int MaxLivePostmasterChildren(void);
67 
68 extern bool PostmasterMarkPIDForWorkerNotify(int);
69 
70 extern void processCancelRequest(int backendPID, int32 cancelAuthCode);
71 
72 #ifdef EXEC_BACKEND
73 extern Size ShmemBackendArraySize(void);
74 extern void ShmemBackendArrayAllocation(void);
75 
76 #ifdef WIN32
77 extern void pgwin32_register_deadchild_callback(HANDLE procHandle, DWORD procId);
78 #endif
79 #endif
80 
81 /* defined in globals.c */
83 
84 /* prototypes for functions in launch_backend.c */
85 extern pid_t postmaster_child_launch(BackendType child_type,
86  char *startup_data,
87  size_t startup_data_len,
88  struct ClientSocket *client_sock);
89 const char *PostmasterChildName(BackendType child_type);
90 #ifdef EXEC_BACKEND
91 extern void SubPostmasterMain(int argc, char *argv[]) pg_attribute_noreturn();
92 #endif
93 
94 /*
95  * Note: MAX_BACKENDS is limited to 2^18-1 because that's the width reserved
96  * for buffer references in buf_internals.h. This limitation could be lifted
97  * by using a 64bit state; but it's unlikely to be worthwhile as 2^18-1
98  * backends exceed currently realistic configurations. Even if that limitation
99  * were removed, we still could not a) exceed 2^23-1 because inval.c stores
100  * the ProcNumber as a 3-byte signed integer, b) INT_MAX/4 because some places
101  * compute 4*MaxBackends without any overflow check. This is rechecked in the
102  * relevant GUC check hooks and in RegisterBackgroundWorker().
103  */
104 #define MAX_BACKENDS 0x3FFFF
105 
106 #endif /* _POSTMASTER_H */
#define PGDLLIMPORT
Definition: c.h:1316
signed int int32
Definition: c.h:494
#define pg_attribute_noreturn()
Definition: c.h:217
size_t Size
Definition: c.h:605
BackendType
Definition: miscadmin.h:334
PGDLLIMPORT bool enable_bonjour
Definition: postmaster.c:233
PGDLLIMPORT bool log_hostname
Definition: postmaster.c:230
PGDLLIMPORT int PostPortNumber
Definition: postmaster.c:190
PGDLLIMPORT bool send_abort_for_kill
Definition: postmaster.c:238
PGDLLIMPORT int Unix_socket_permissions
Definition: pqcomm.c:106
PGDLLIMPORT char * ListenAddresses
Definition: postmaster.c:196
PGDLLIMPORT bool send_abort_for_crash
Definition: postmaster.c:237
void InitProcessGlobals(void)
Definition: postmaster.c:2032
PGDLLIMPORT int postmaster_alive_fds[2]
Definition: postmaster.c:479
PGDLLIMPORT char * Unix_socket_directories
Definition: postmaster.c:193
PGDLLIMPORT bool redirection_done
Definition: postmaster.c:353
PGDLLIMPORT const char * progname
Definition: main.c:44
PGDLLIMPORT int AuthenticationTimeout
Definition: postmaster.c:228
PGDLLIMPORT bool ClientAuthInProgress
Definition: postmaster.c:350
PGDLLIMPORT char * bonjour_name
Definition: postmaster.c:234
PGDLLIMPORT int SuperuserReservedConnections
Definition: postmaster.c:216
PGDLLIMPORT int PreAuthDelay
Definition: postmaster.c:227
void PostmasterMain(int argc, char *argv[]) pg_attribute_noreturn()
Definition: postmaster.c:489
PGDLLIMPORT char * Unix_socket_group
Definition: pqcomm.c:107
bool PostmasterMarkPIDForWorkerNotify(int)
Definition: postmaster.c:4445
PGDLLIMPORT bool remove_temp_files_after_crash
Definition: postmaster.c:236
PGDLLIMPORT int ReservedConnections
Definition: postmaster.c:217
PGDLLIMPORT bool LoadedSSL
PGDLLIMPORT bool Log_connections
Definition: postmaster.c:231
PGDLLIMPORT bool EnableSSL
Definition: postmaster.c:225
void processCancelRequest(int backendPID, int32 cancelAuthCode)
Definition: postmaster.c:1835
int MaxLivePostmasterChildren(void)
Definition: postmaster.c:4145
const char * PostmasterChildName(BackendType child_type)
void ClosePostmasterPorts(bool am_syslogger)
Definition: postmaster.c:1955
PGDLLIMPORT bool restart_after_crash
Definition: postmaster.c:235
PGDLLIMPORT struct ClientSocket * MyClientSocket
Definition: globals.c:49
pid_t postmaster_child_launch(BackendType child_type, char *startup_data, size_t startup_data_len, struct ClientSocket *client_sock)