How to block a process in kernel
Hi guys, I'm writing a simple module which can tell a user process if something happens in kernel. Specifically, inside my module, I declare a symbol:
void *pointer = NULL;
Now, I want to tell some process in userspace when this pointer is not NULL. I did that by doing the following:
In user space
devfd = open("/dev/my_dev",O_RDWR);
//my_dev is a fake character device I created
ioctl(devfd,CHECK_POINTER);
In kernel space
switch CONSTANT
{
...
case CHECK_POINTER: while(pointer==NULL){}
return 0;
}
My intention is letting the kernel blocks ioctl while pointer is NULL and returns immediately when pointer is not NULL. However, this way makes my computer hangs. Do you guys have any better idea to block ioctl.