diff options
| author | Stefan Boberg <[email protected]> | 2021-10-28 13:15:59 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-10-28 13:15:59 +0200 |
| commit | 2d0e0052f37c7dfaab82f58bf8546d48d38bfc0f (patch) | |
| tree | a628eec1e624291d607f95f64f2f8bc2ab23616c /zenutil | |
| parent | cas: minor improvement to CasLogFile::Open error handling (diff) | |
| parent | Lockfile implementation (#24) (diff) | |
| download | zen-2d0e0052f37c7dfaab82f58bf8546d48d38bfc0f.tar.xz zen-2d0e0052f37c7dfaab82f58bf8546d48d38bfc0f.zip | |
Merge remote-tracking branch 'origin/main' into gc
Diffstat (limited to 'zenutil')
| -rw-r--r-- | zenutil/include/zenutil/zenserverprocess.h | 13 | ||||
| -rw-r--r-- | zenutil/zenserverprocess.cpp | 6 |
2 files changed, 15 insertions, 4 deletions
diff --git a/zenutil/include/zenutil/zenserverprocess.h b/zenutil/include/zenutil/zenserverprocess.h index bc4b135f0..8a4f9604d 100644 --- a/zenutil/include/zenutil/zenserverprocess.h +++ b/zenutil/include/zenutil/zenserverprocess.h @@ -94,13 +94,17 @@ public: struct ZenServerEntry { + // NOTE: any changes to this should consider backwards compatibility + // which means you should not rearrange members only potentially + // add something to the end or use a different mechanism for + // additional state. For example, you can use the session ID + // to introduce additional named objects std::atomic<uint32_t> Pid; std::atomic<uint16_t> ListenPort; std::atomic<uint16_t> Flags; uint8_t SessionId[12]; - std::atomic<uint32_t> SponsorPids[32]; + std::atomic<uint32_t> SponsorPids[8]; uint8_t Padding[12]; - uint8_t Padding2[96]; enum class FlagsEnum : uint16_t { @@ -113,10 +117,11 @@ public: Oid GetSessionId() const { return Oid::FromMemory(SessionId); } void Reset(); void SignalShutdownRequest(); + void SignalReady(); bool AddSponsorProcess(uint32_t Pid); }; - static_assert(sizeof(ZenServerEntry) == 256); + static_assert(sizeof(ZenServerEntry) == 64); void Initialize(); [[nodiscard]] bool InitializeReadOnly(); @@ -129,7 +134,7 @@ public: private: void* m_hMapFile = nullptr; ZenServerEntry* m_Data = nullptr; - int m_MaxEntryCount = 131072 / sizeof(ZenServerEntry); + int m_MaxEntryCount = 65536 / sizeof(ZenServerEntry); ZenServerEntry* m_OurEntry = nullptr; bool m_IsReadOnly = true; }; diff --git a/zenutil/zenserverprocess.cpp b/zenutil/zenserverprocess.cpp index 55b592ab1..4098954a8 100644 --- a/zenutil/zenserverprocess.cpp +++ b/zenutil/zenserverprocess.cpp @@ -269,6 +269,12 @@ ZenServerState::ZenServerEntry::SignalShutdownRequest() Flags |= uint16_t(FlagsEnum::kShutdownPlease); } +void +ZenServerState::ZenServerEntry::SignalReady() +{ + Flags |= uint16_t(FlagsEnum::kIsReady); +} + bool ZenServerState::ZenServerEntry::AddSponsorProcess(uint32_t PidToAdd) { |