Linux kernel waitqueues - printk not showing in message log

I notice some strange behavior in the kernel module. When I run the following code (with expectations). After finalizing (), printk () does not appear in the kernel log. Also line 5 prints only once. Any ideas what is going on?

DEFINE_WAIT(wait);
DECLARE_WAIT_QUEUE_HEAD(wait_q);
flags |= O_NONBLOCK;
while (( err = kthread->sock->ops->accept(kthread->sock, kthread->sock_send, flags) ) < 0){
    printk("%s: before prepare_to_wait err = -%d\n", __func__,err);
    prepare_to_wait(&wait_q, &wait, TASK_INTERRUPTIBLE);
    if(kthread_should_stop()){
        printk("%s: killing thread\n", __func__);
        msleep(1000);   
        finish_wait(&wait_q, &wait);
        goto close_and_out;
    }
    schedule();
}
finish_wait(&wait_q, &wait);
printk("after finish wait: This doesn't show up in kernel logs...\n");
+3
source share
1 answer

Add priority to the log message:

Like: printk (KERN_ALERT your message); Also there will be no “comma” between KERN_ALERT and your message try with different levels, if not KERN_ALERT.

Rgds, Softy

+2
source

All Articles