]> granicus.if.org Git - postgresql/blob - src/include/postmaster/postmaster.h
Centralize definition of integer limits.
[postgresql] / src / include / postmaster / postmaster.h
1 /*-------------------------------------------------------------------------
2  *
3  * postmaster.h
4  *        Exports from postmaster/postmaster.c.
5  *
6  * Portions Copyright (c) 1996-2015, 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 */
17 extern bool EnableSSL;
18 extern int      ReservedBackends;
19 extern int      PostPortNumber;
20 extern int      Unix_socket_permissions;
21 extern char *Unix_socket_group;
22 extern char *Unix_socket_directories;
23 extern char *ListenAddresses;
24 extern bool ClientAuthInProgress;
25 extern int      PreAuthDelay;
26 extern int      AuthenticationTimeout;
27 extern bool Log_connections;
28 extern bool log_hostname;
29 extern bool enable_bonjour;
30 extern char *bonjour_name;
31 extern bool restart_after_crash;
32
33 #ifdef WIN32
34 extern HANDLE PostmasterHandle;
35 #else
36 extern 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
47 extern const char *progname;
48
49 extern void PostmasterMain(int argc, char *argv[]) pg_attribute_noreturn;
50 extern void ClosePostmasterPorts(bool am_syslogger);
51
52 extern int      MaxLivePostmasterChildren(void);
53
54 extern int      GetNumShmemAttachedBgworkers(void);
55 extern bool PostmasterMarkPIDForWorkerNotify(int);
56
57 #ifdef EXEC_BACKEND
58 extern pid_t postmaster_forkexec(int argc, char *argv[]);
59 extern void SubPostmasterMain(int argc, char *argv[]) pg_attribute_noreturn;
60
61 extern Size ShmemBackendArraySize(void);
62 extern void ShmemBackendArrayAllocation(void);
63 #endif
64
65 /*
66  * Note: MAX_BACKENDS is limited to 2^23-1 because inval.c stores the
67  * backend ID as a 3-byte signed integer.  Even if that limitation were
68  * removed, we still could not exceed INT_MAX/4 because some places compute
69  * 4*MaxBackends without any overflow check.  This is rechecked in the relevant
70  * GUC check hooks and in RegisterBackgroundWorker().
71  */
72 #define MAX_BACKENDS    0x7fffff
73
74 #endif   /* _POSTMASTER_H */