right, the kernel only knows about ports. basically, when an application wants to send a BMessage, it searches for the port the BHandler watches, Flatten()s the message, and use the write_port() syscall to send it, on the other side, the waiting thread is blocked on read_port() which fills in a buffer with the flattened BMessage, and it Unflattens it from the buffer. // sender code // something like this :) BMessenger::SendMessage(BMessage *a_message) { char *buffer; size_t size; buffer = new char[size = a_message->FlattenedSize()]; a_message->Flatten(buffer, size); write_port(fPort, a_message->What(), buffer, size); delete buffer; } As for kernel notification, I suspect the use of semaphores... not sure though. En réponse à Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>: > > * Node Monitoring: > > Basically the two functions watch_node() and stop_watching(), but > > who > > does the actual work? Is there a Node Monitor (the BeBook mentions > > something like this)? ...? > > That's handled by the notify_listener() function - the file system > calls that function (a kernel function), and it will somehow trigger > the notification of all watching messengers. > AFAIK the kernel has no knowledge about BMessages, so it must be > handled by some upper layer - I guess it's either the app_server or the > > registrar, but I dunno. > > > * BQuery: > > Static queries can be mapped to the fs_*_query() functions in > > libroot > > and thus are certainly related more closely to the kernel. > > But how is the additional functionality for live queries provided? > > > Who > > does this? Are live queries somehow related to node monitoring? > > That's similar to the above - a file system uses the > send_notification() function (note, that its parameters aren't > documented anywhere, and we will have to find out in BFS how it is > supposed to work), and the kernel will most probably trigger some upper > > layer to send out the notification messages. > Looking at the disassembled kernel sources (no, no I wouldn't do that > :), notify_listener() calls send_notification() itself (also > sys_mount() does this), so it appears that send_notification() is the > "work horse" of that thing. At the end of the function, it does a > write_port_etc(), but I haven't had a look which port it is using for > this. For queries, there is a fs_open_live_query() function which also > > takes a port ID as argument - unfortunately, I couldn't find a server > or library which would call this function, which means that there is > some other function used for this. > > Adios... > Axel. > > > >