Made PIDs 4 bytes instead of 2.

This commit is contained in:
Thulinma 2016-05-18 09:57:07 +02:00
parent d7b88cfabd
commit 5838f7a39c
2 changed files with 5 additions and 5 deletions

View file

@ -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;
}

View file

@ -11,7 +11,7 @@
#include <semaphore.h>
#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;
};