Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.1 KiB

  1. //============== DAE: OS/2 Database Access Engine ===================
  2. //============== pib.h: Process Information Block ===================
  3. /* JET API flags
  4. /**/
  5. #define FPIBVersion( ppib ) (!((ppib)->grbit & (JET_bitCIMCommitted | JET_bitCIMDirty)))
  6. #define FPIBCommitted( ppib ) ((ppib)->grbit & JET_bitCIMCommitted)
  7. #define FPIBDirty( ppib ) ((ppib)->grbit & JET_bitCIMDirty)
  8. #define FPIBAggregateTransaction( ppib ) ((ppib)->grbit & JET_bitAggregateTransaction)
  9. //
  10. // Process Information Block
  11. //
  12. struct _pib
  13. {
  14. /* most used field has offset 0
  15. /**/
  16. TRX trx; // trx id
  17. BOOL fUserSession; // user session
  18. /* JET API fields
  19. /**/
  20. JET_SESID sesid; // JET session id
  21. JET_GRBIT grbit; // session flags
  22. struct _pib *ppibNext; // PIB list
  23. LEVEL level; // transaction level of this session
  24. struct _dab *pdabList; // list of open DAB's of this thread
  25. USHORT rgcdbOpen[dbidUserMax]; // counter for open databases
  26. struct _fucb *pfucb; // list of active fucb of this thread
  27. /* logging/recovery fields
  28. /**/
  29. PROCID procid; // thread id
  30. LGPOS lgposStart; // log time
  31. LEVEL levelStart; // transaction level when first begin transaction operation
  32. INT clgOpenT; // count of deferred open transactions
  33. SIG sigWaitLogFlush;
  34. LONG lWaitLogFlush;
  35. struct _pib *ppibNextWaitFlush;
  36. struct _pib *ppibPrevWaitFlush;
  37. LGPOS *plgposCommit;
  38. /* PIB flags
  39. /**/
  40. BOOL fAfterFirstBT:1; // for redo only
  41. BOOL fLogDisabled:1; // temporary turn off the logging
  42. BOOL fLGWaiting:1; // waiting for log to flush
  43. BOOL fDeferFreeNodeSpace:1; // session has deferred node free space
  44. /* version store fields
  45. /**/
  46. struct _bucket volatile *pbucket;
  47. struct _rc *prcLast; // last node of this proc's RC list
  48. INT ibOldestRCE;
  49. #ifdef WIN16
  50. struct _pha *phaUser; // pointer to User Handle Array
  51. #endif /* WIN16 */
  52. };
  53. #define PpibMEMAlloc() (PIB*)PbMEMAlloc(iresPIB)
  54. #ifdef DEBUG /* Debug check for illegal use of freed pib */
  55. #define MEMReleasePpib(ppib) { MEMRelease(iresPIB, (BYTE*)(ppib)); ppib = ppibNil; }
  56. #else
  57. #define MEMReleasePpib(ppib) { MEMRelease(iresPIB, (BYTE*)(ppib)); }
  58. #endif
  59. /* CheckPIB macro.
  60. /**/
  61. #ifdef WIN16
  62. #define CheckPIB(ppib) \
  63. { \
  64. Assert( fRecovering || OffsetOf(ppib) == ppib->procid ); \
  65. rghfUser = ppib->phaUser->rghfDatabase; \
  66. hfLog = ppib->phaUser->hfLog; \
  67. }
  68. #else /* !WIN16 */
  69. #define CheckPIB(ppib) \
  70. Assert( ( fRecovering || OffsetOf(ppib) == ppib->procid ) && \
  71. (ppib)->level < levelMax )
  72. #endif /* !WIN16 */
  73. #define FPIBDeferFreeNodeSpace( ppib ) ( (ppib)->fDeferFreeNodeSpace )
  74. #define PIBSetDeferFreeNodeSpace( ppib ) ( (ppib)->fDeferFreeNodeSpace = fTrue )
  75. #define PIBResetDeferFreeNodeSpace( ppib ) ( (ppib)->fDeferFreeNodeSpace = fFalse )
  76. #define FPIBActive( ppib ) ( (ppib)->level != levelNil )
  77. #define SesidOfPib( ppib ) ( (ppib)->sesid )
  78. /* prototypes
  79. /**/
  80. ERR ErrPIBBeginSession( PIB **pppib );
  81. VOID PIBEndSession( PIB *ppib );
  82. #ifdef DEBUG
  83. VOID PIBPurge( VOID );
  84. #else
  85. #define PIBPurge()
  86. #endif