[Haiku-commits] r29417 - haiku/trunk/src/system/kernel/messaging

anevilyak at BerliOS anevilyak at mail.berlios.de
Fri Mar 6 23:57:37 CET 2009


Author: anevilyak
Date: 2009-03-06 23:57:36 +0100 (Fri, 06 Mar 2009)
New Revision: 29417
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29417&view=rev

Modified:
   haiku/trunk/src/system/kernel/messaging/MessagingService.cpp
Log:
Fix two more problems in the messaging service:

1) When searching the area for a place to allocate the next command, the case of the first command being the same as the last command (as is the case after adding the first message) was not correctly considered. This prevented a given area from ever containing more than one command.
2) The size of a command was incorrectly word-aligned. Rather than aligning to 32-bit boundaries, the size was truncated to between 1-3 bytes, leading to command corruption once multiple messages were in the area, eventually causing registrar to crash while retrieving the messages.

Combined these two changes result in us no longer constantly allocating/destroying areas during heavy node monitor activity.



Modified: haiku/trunk/src/system/kernel/messaging/MessagingService.cpp
===================================================================
--- haiku/trunk/src/system/kernel/messaging/MessagingService.cpp	2009-03-06 22:12:08 UTC (rev 29416)
+++ haiku/trunk/src/system/kernel/messaging/MessagingService.cpp	2009-03-06 22:57:36 UTC (rev 29417)
@@ -183,7 +183,7 @@
 		}
 
 		// find space for the command
-		if (firstCommandOffset < lastCommandOffset) {
+		if (firstCommandOffset <= lastCommandOffset) {
 			// not wrapped
 			// try to allocate after the last command
 			if (size <= fSize - (lastCommandOffset + lastCommandSize)) {
@@ -260,7 +260,7 @@
 	size = command->size;
 	if (size < (int32)sizeof(messaging_command))
 		return NULL;
-	size = (size + 3) & 0x3;	// align
+	size = (size + 3) & ~0x3;	// align
 	if (offset + size > fSize)
 		return NULL;
 




More information about the Haiku-commits mailing list