2
0

procsignal.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*-------------------------------------------------------------------------
  2. *
  3. * procsignal.h
  4. * Routines for interprocess signaling
  5. *
  6. *
  7. * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
  8. * Portions Copyright (c) 1994, Regents of the University of California
  9. *
  10. * src/include/storage/procsignal.h
  11. *
  12. *-------------------------------------------------------------------------
  13. */
  14. #ifndef PROCSIGNAL_H
  15. #define PROCSIGNAL_H
  16. #include "storage/backendid.h"
  17. /*
  18. * Reasons for signaling a Postgres child process (a backend or an auxiliary
  19. * process, like checkpointer). We can cope with concurrent signals for different
  20. * reasons. However, if the same reason is signaled multiple times in quick
  21. * succession, the process is likely to observe only one notification of it.
  22. * This is okay for the present uses.
  23. *
  24. * Also, because of race conditions, it's important that all the signals be
  25. * defined so that no harm is done if a process mistakenly receives one.
  26. */
  27. typedef enum
  28. {
  29. PROCSIG_CATCHUP_INTERRUPT, /* sinval catchup interrupt */
  30. PROCSIG_NOTIFY_INTERRUPT, /* listen/notify interrupt */
  31. PROCSIG_PARALLEL_MESSAGE, /* message from cooperating parallel backend */
  32. PROCSIG_WALSND_INIT_STOPPING, /* ask walsenders to prepare for shutdown */
  33. PROCSIG_BARRIER, /* global barrier interrupt */
  34. PROCSIG_LOG_MEMORY_CONTEXT, /* ask backend to log the memory contexts */
  35. /* Recovery conflict reasons */
  36. PROCSIG_RECOVERY_CONFLICT_DATABASE,
  37. PROCSIG_RECOVERY_CONFLICT_TABLESPACE,
  38. PROCSIG_RECOVERY_CONFLICT_LOCK,
  39. PROCSIG_RECOVERY_CONFLICT_SNAPSHOT,
  40. PROCSIG_RECOVERY_CONFLICT_BUFFERPIN,
  41. PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK,
  42. NUM_PROCSIGNALS /* Must be last! */
  43. } ProcSignalReason;
  44. typedef enum
  45. {
  46. PROCSIGNAL_BARRIER_SMGRRELEASE /* ask smgr to close files */
  47. } ProcSignalBarrierType;
  48. /*
  49. * prototypes for functions in procsignal.c
  50. */
  51. extern Size ProcSignalShmemSize(void);
  52. extern void ProcSignalShmemInit(void);
  53. extern void ProcSignalInit(int pss_idx);
  54. extern int SendProcSignal(pid_t pid, ProcSignalReason reason,
  55. BackendId backendId);
  56. extern uint64 EmitProcSignalBarrier(ProcSignalBarrierType type);
  57. extern void WaitForProcSignalBarrier(uint64 generation);
  58. extern void ProcessProcSignalBarrier(void);
  59. extern void procsignal_sigusr1_handler(SIGNAL_ARGS);
  60. #endif /* PROCSIGNAL_H */