postmaster.h 2.5 KB

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