postmaster.h 2.8 KB

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