From 5838f7a39c5a536d40e5c4357209a04f061ec501 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Wed, 18 May 2016 09:57:07 +0200 Subject: [PATCH] Made PIDs 4 bytes instead of 2. --- lib/shared_memory.cpp | 6 +++--- lib/shared_memory.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/shared_memory.cpp b/lib/shared_memory.cpp index 0c25526b..574ec71a 100644 --- a/lib/shared_memory.cpp +++ b/lib/shared_memory.cpp @@ -881,9 +881,9 @@ namespace IPC { amount = id + 1; VERYHIGH_MSG("Shared memory %s is now at count %u", baseName.c_str(), amount); } - unsigned short tmpPID = *((unsigned short *)(it->mapped + 1 + offset + payLen - 2)); + uint32_t tmpPID = *((uint32_t *)(it->mapped + 1 + offset + payLen - 4)); if (!Util::Procs::isRunning(tmpPID) && !(*counter == 126 || *counter == 127)){ - WARN_MSG("process disappeared, timing out. (pid %d)", tmpPID); + WARN_MSG("process disappeared, timing out. (pid %lu)", tmpPID); *counter = 126; //if process is already dead, instant timeout. } callback(it->mapped + offset + 1, payLen, id); @@ -1068,7 +1068,7 @@ namespace IPC { offsetOnPage = offset; if (hasCounter) { myPage.mapped[offset] = 1; - *((unsigned short *)(myPage.mapped + 1 + offset + len - 2)) = getpid(); + *((uint32_t *)(myPage.mapped + 1 + offset + len - 4)) = getpid(); } break; } diff --git a/lib/shared_memory.h b/lib/shared_memory.h index ba291e55..1f350575 100644 --- a/lib/shared_memory.h +++ b/lib/shared_memory.h @@ -11,7 +11,7 @@ #include #endif -#define STAT_EX_SIZE 175 +#define STAT_EX_SIZE 177 #define PLAY_EX_SIZE 2+6*SIMUL_TRACKS namespace IPC { @@ -52,7 +52,7 @@ namespace IPC { /// - 20 byte - connector (name of the connector the peer is using) /// - 4 byte - CRC32 of user agent (or zero if none) /// - 1 byte sync (was seen by controller yes/no) - /// - (implicit 2 bytes: PID) + /// - (implicit 4 bytes: PID) char * data; };