int kct_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) { if (nlh->nlmsg_type != KCT_SET_PID) { pr_warn("%s: Wrong command received.\n", __func__); return -EINVAL; } pr_debug("%s: KCT_SET_PID received: %d\n", __func__, PORTID(skb)); monitor_pid = PORTID(skb); wake_up(&kct_wq); return 0; }
/** * Daemon responsible to empty the FIFO of events inside the Netlink */ static int kct_daemon(void *unused) { struct sk_buff *skb = NULL; pr_debug("%s: started!\n", __func__); while (!kthread_should_stop()) { pr_debug("%s: loop.\n", __func__); if (skb_queue_len(&kct_skb_queue) && monitor_pid) { skb = skb_dequeue(&kct_skb_queue); if (skb) { /* pid might not have been set in kct_log_event; * ensure it's ok now **/ PORTID(skb) = monitor_pid; netlink_unicast(kct_nl_sk, skb, monitor_pid, 1); } } else { wait_event_interruptible(kct_wq, (skb_queue_len(&kct_skb_queue) && monitor_pid) || kthread_should_stop()); } } pr_debug("%s: daemon terminated.\n", __func__); skb_queue_purge(&kct_skb_queue); return 0; }
HasReceptor(ReceptorRegistry* rr) : ReceptorRegistry(), upper_() { rr->addToReceptorRegistry(PORTID().name, &upper_); }
HasReceptor(const HasReceptor& other) : ReceptorRegistry(), upper_() { addToReceptorRegistry(PORTID().name, &upper_); }
HasReceptor() : ReceptorRegistry(), upper_() { addToReceptorRegistry(PORTID().name, &upper_); }
HasDeliverer(DelivererRegistry* dr) : DelivererRegistry(), deliverer_() { dr->addToDelivererRegistry(PORTID().name, &deliverer_); }
HasDeliverer( const HasDeliverer& other) : DelivererRegistry(), deliverer_() { addToDelivererRegistry(PORTID().name, &deliverer_); }
HasDeliverer() : DelivererRegistry(), deliverer_() { addToDelivererRegistry(PORTID().name, &deliverer_); }