1/*-------------------------------------------------------------------------
2 *
3 * postmaster.h
4 * Exports from postmaster/postmaster.c.
5 *
6 * Portions Copyright (c) 1996-2019, 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/* GUC options */
17extern bool EnableSSL;
18extern int ReservedBackends;
19extern PGDLLIMPORT int PostPortNumber;
20extern int Unix_socket_permissions;
21extern char *Unix_socket_group;
22extern char *Unix_socket_directories;
23extern char *ListenAddresses;
24extern bool ClientAuthInProgress;
25extern int PreAuthDelay;
26extern int AuthenticationTimeout;
27extern bool Log_connections;
28extern bool log_hostname;
29extern bool enable_bonjour;
30extern char *bonjour_name;
31extern bool restart_after_crash;
32
33#ifdef WIN32
34extern HANDLE PostmasterHandle;
35#else
36extern int postmaster_alive_fds[2];
37
38/*
39 * Constants that represent which of postmaster_alive_fds is held by
40 * postmaster, and which is used in children to check for postmaster death.
41 */
42#define POSTMASTER_FD_WATCH 0 /* used in children to check for
43 * postmaster death */
44#define POSTMASTER_FD_OWN 1 /* kept open by postmaster only */
45#endif
46
47extern PGDLLIMPORT const char *progname;
48
49extern void PostmasterMain(int argc, char *argv[]) pg_attribute_noreturn();
50extern void ClosePostmasterPorts(bool am_syslogger);
51extern void InitProcessGlobals(void);
52
53extern int MaxLivePostmasterChildren(void);
54
55extern int GetNumShmemAttachedBgworkers(void);
56extern bool PostmasterMarkPIDForWorkerNotify(int);
57
58#ifdef EXEC_BACKEND
59extern pid_t postmaster_forkexec(int argc, char *argv[]);
60extern void SubPostmasterMain(int argc, char *argv[]) pg_attribute_noreturn();
61
62extern Size ShmemBackendArraySize(void);
63extern void ShmemBackendArrayAllocation(void);
64#endif
65
66/*
67 * Note: MAX_BACKENDS is limited to 2^18-1 because that's the width reserved
68 * for buffer references in buf_internals.h. This limitation could be lifted
69 * by using a 64bit state; but it's unlikely to be worthwhile as 2^18-1
70 * backends exceed currently realistic configurations. Even if that limitation
71 * were removed, we still could not a) exceed 2^23-1 because inval.c stores
72 * the backend ID as a 3-byte signed integer, b) INT_MAX/4 because some places
73 * compute 4*MaxBackends without any overflow check. This is rechecked in the
74 * relevant GUC check hooks and in RegisterBackgroundWorker().
75 */
76#define MAX_BACKENDS 0x3FFFF
77
78#endif /* _POSTMASTER_H */
79