From: Alex Rousskov Date: Tue, 12 Apr 2011 18:47:31 +0000 (-0600) Subject: Fixed Ipc::Mem::Segment::reserve(). X-Git-Tag: take06~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=446485d517c31d6468f8611f0bd240239516818e;p=thirdparty%2Fsquid.git Fixed Ipc::Mem::Segment::reserve(). It was returning the pointer to the end of the reserved area. Added debugging. --- diff --git a/src/ipc/mem/Segment.cc b/src/ipc/mem/Segment.cc index 3de370bf71..1bd100a525 100644 --- a/src/ipc/mem/Segment.cc +++ b/src/ipc/mem/Segment.cc @@ -51,6 +51,8 @@ Ipc::Mem::Segment::create(const int aSize) theSize = aSize; theReserved = 0; + debugs(54, 3, HERE << "created " << theName << " segment: " << theSize); + attach(); } @@ -80,6 +82,8 @@ Ipc::Mem::Segment::open() theSize = s.st_size; } + debugs(54, 3, HERE << "opened " << theName << " segment: " << theSize); + attach(); } @@ -118,8 +122,9 @@ Ipc::Mem::Segment::reserve(size_t chunkSize) { assert(chunkSize <= theSize); assert(theReserved <= theSize - chunkSize); + void *result = reinterpret_cast(mem()) + theReserved; theReserved += chunkSize; - return reinterpret_cast(mem()) + theReserved; + return result; } /// Generate name for shared memory segment. Replaces all slashes with dots.