procsignal.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*-------------------------------------------------------------------------
  2. *
  3. * procsignal.h
  4. * Routines for interprocess signalling
  5. *
  6. *
  7. * Portions Copyright (c) 1996-2016, 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 signalling 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. /* Recovery conflict reasons */
  34. PROCSIG_RECOVERY_CONFLICT_DATABASE,
  35. PROCSIG_RECOVERY_CONFLICT_TABLESPACE,
  36. PROCSIG_RECOVERY_CONFLICT_LOCK,
  37. PROCSIG_RECOVERY_CONFLICT_SNAPSHOT,
  38. PROCSIG_RECOVERY_CONFLICT_BUFFERPIN,
  39. PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK,
  40. NUM_PROCSIGNALS /* Must be last! */
  41. } ProcSignalReason;
  42. /*
  43. * prototypes for functions in procsignal.c
  44. */
  45. extern Size ProcSignalShmemSize(void);
  46. extern void ProcSignalShmemInit(void);
  47. extern void ProcSignalInit(int pss_idx);
  48. extern int SendProcSignal(pid_t pid, ProcSignalReason reason,
  49. BackendId backendId);
  50. extern void procsignal_sigusr1_handler(SIGNAL_ARGS);
  51. #endif /* PROCSIGNAL_H */