-
Notifications
You must be signed in to change notification settings - Fork 23
pcn message handling
A message type is defined by a set of macros.
REGISTER_KMSG_HANDLER(PCN_KMSG_TYPE_TASK_MIGRATE, clone_request);
expanding the macro (in kernel/popcorn/types.h)
#define REGISTER_KMSG_HANDLER(x, y) \
pcn_kmsg_register_callback(x, handle_##y) (
the ##
in the #define
macro does string concatenation, so it really is calling
pcn_kmsg_register_callback(PCN_KMSG_TYPE_TASK_MIGRATE, handle_clone_request);
pcn_kmsg_register_callback
defined here -- https://github.com/ssrg-vt/popcorn-kernel/blob/48ff7e48d20b74dde12b497d7fb962513a64107f/kernel/popcorn/pcn_kmsg.c#L30
it just maintains an array static pcn_kmsg_cbftn pcn_kmsg_cbftns[PCN_KMSG_TYPE_MAX]
-- which corresponds message types to callback handler
Then when a message is processed by pcn_kmsg_process
, it looks up the callback corresponding to the message type https://github.com/ssrg-vt/popcorn-kernel/blob/48ff7e48d20b74dde12b497d7fb962513a64107f/kernel/popcorn/pcn_kmsg.c#L49
pcn_kmsg_process
is called directly by the message layer / socket recv handler
https://github.com/ssrg-vt/popcorn-kernel/blob/48ff7e48d20b74dde12b497d7fb962513a64107f/msg_layer/socket.c#L117