#ifndef KERNEL_MSG_H_ #define KERNEL_MSG_H_ #include #include #include #include struct port; struct thread; enum kmsg_status { KMSG_WAIT_RECEIVE, KMSG_WAIT_REPLY, KMSG_REPLY_SENT, KMSG_ASYNC, }; struct msg { spin_lock_t msg_lock; enum kmsg_status msg_status; struct btree_node msg_node; msgid_t msg_id; struct port *msg_sender_port; struct thread *msg_sender_thread; kern_status_t msg_result; kern_msg_type_t msg_type; union { /* msg_type = KERN_MSG_TYPE_DATA */ struct { kern_msg_t msg_req, msg_resp; }; /* msg_type = KERN_MSG_TYPE_EVENT */ struct { kern_msg_event_type_t msg_event; }; }; }; extern void msg_init(void); extern struct msg *msg_alloc(void); extern void msg_free(struct msg *msg); #endif