It was returning the pointer to the end of the reserved area.
Added debugging.
theSize = aSize;
theReserved = 0;
+ debugs(54, 3, HERE << "created " << theName << " segment: " << theSize);
+
attach();
}
theSize = s.st_size;
}
+ debugs(54, 3, HERE << "opened " << theName << " segment: " << theSize);
+
attach();
}
{
assert(chunkSize <= theSize);
assert(theReserved <= theSize - chunkSize);
+ void *result = reinterpret_cast<char*>(mem()) + theReserved;
theReserved += chunkSize;
- return reinterpret_cast<char*>(mem()) + theReserved;
+ return result;
}
/// Generate name for shared memory segment. Replaces all slashes with dots.