What will happen if I kill a process which is waiting for the retuan ioctl() syscall?

Douglas Su d0u9.su at outlook.com
Tue Mar 13 07:56:15 EDT 2018


If I have these:

1. I have implemented a simple ioctl() system call which just delay a period and return.
2. Call this ioctl() from a userspace process, of course, this process will be blocked until ioctl() return.
3. Before ioctl() return, use `kill -9 <pid>` command terminates the process.

Question:

1. Can we instantly kill this process?
2. If we can instantly kill this process, does ioctl() still keep delay after killing?
3. If ioctl() still running even after we terminate this process, where does the return value ioctl() will return to?
4. How to keep the device's state consistent when we kill a process when it is invoking a system call?

Best regards.




Douglas


More information about the Kernelnewbies mailing list