finding process blocking on a system call
Hello linux-experts,
I want to find whether a process blocks in a system
call due to the unavailability of the resource that is accessed in it. For eg, if a semaphore key is not available to the process while executing the system calls like read, write etc, it will wait in the TASK_INTERRUPTIBLE state.
Now, I don't want the process to simply sleep,
waiting for the semaphore. I want it to be added into the runqueue again. And also, I want to determine this in the kernel module. How can I do this? Can anyone help me regarding this?
I am intercepting system calls in kernel 2.4.28.
Thanks,
selva
__________________________________
Do you Yahoo!?
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250
Quoted 14 lines · selvakumar nagendran
Hello linux-experts,
I want to find whether a process blocks in a system
call due to the unavailability of the resource that is accessed in it. For eg, if a semaphore key is not available to the process while executing the system calls like read, write etc, it will wait in theTASK_INTERRUPTIBLEstate.
Now, I don't want the process to simply sleep,
waiting for the semaphore. I want it to be added into the runqueue again. And also, I want to determine this in the kernel module. How can I do this? Can anyone help me regarding this?
I am intercepting system calls in kernel 2.4.28.
Quoted 3 lines
Thanks,
selva
This is a very bad idea, as the process will expect the syscall to be complete when it runs again. Just use the non-blocking versions of the syscall (file/network IO all have non-blocking versions), and handle the EWOULDBLOCK return value in your userspace application.
Daniel