Hi, Thanks about the info about ps. This raises two new questions: 1) The following code is a very basic kernel module (based on my previous code, removing somethings). I do not understand something: I call /* sleep for a millisecond */ msleep(1); printk("calling do_exit\n"); msleep(60000);
In my understanding, after 1 millisecond, it should have been available to the scheduler, and after returning to the line after msleep(1), it should print "calling do_exit". However, I see no such log message. Any ideas why ? can something be added to enable this ? 2)How can I create a kernel thread so that it will be in TASK_INTERRUPTIBLE state ? there must be a way, since I see many kernel threads where ps shows "S" in the status coumn. struct task_struct *task; int thread_function(void *data) { int exit_sig = SIGKILL; printk("in %s\n",__func__); /* sleep for a millisecond */ msleep(1); printk("calling do_exit\n"); msleep(60000); do_exit(exit_sig); return 0; } static int kernel_init(void) { printk("in kernel_init\n"); task = kthread_create(thread_function,NULL,"MY_KERNEL_THREAD"); return 0; } static void kernel_exit(void) { printk("in kernel_exit\n"); kthread_stop(task); } module_init(kernel_init); module_exit(kernel_exit); rgs Kevin _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies