[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Need to find out what process was running most recently



Hi,

In my driver I store pointers to the task_struct structures of several user processes. When some event occurs, I need a way to tell which one of these processes was running most recently. Can it be done  by looking at some  task_struct fields?  Below are the details : 

I am writing a driver for the VME bus . The driver has a mmap entry point that let user processes mmap() portion of the VME space. I have to plan for when these accesses will end in a bus error.  I want to make sure that user processes that generates VME bus error are killed.  The problem I have is that VME writes accesses are write posted in a transmit FIFO of the VME controller. In the case where a write-posted VME cycle ends in a bus error, and interrupt is raised to tell the CPU of that event. Also, the vme fault address is stored in the controller. In my interrupt handler I need to send a termination signal to the offending process. But by the time I get the interrupt, I can't assume that the  currently  running process is the offending process, because of the FIFO effect.

So the problem is that I have to go thru all the processes  which mmaping includes th e   fault y  address. So far so good (I keep a list of all these mmapings in my driver). But there is a problem when several processes mmap the same fault address. In that case I need a way to tell what process was running most recently, so that I can kill it. That is what we do under Solaris, and it works fine.

Any ideas?

Thanks a lot,

-jean-francois  simon