If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below. ** If you are logged in, most ads will not be displayed. **

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);

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.

The best way that I know of to signal a user-mode from kernel-mode is to use signalling. That is equivilent to a user-mode interrupt. You hook a signal and when someone taps that signal for your process, your registered callback function is called.

This taken (cut) from some project I did a couple of years. It is probably missing some stuff, but should be enough to get you going.