Re: Catching a process before it sleeps on file IO?

Simon Patience (sp@albion.engr.sgi.com)
Fri, 10 Dec 1999 08:10:05 -0800 (PST)


Nat Lanza wrote:
|> I'd like to be able to catch certain processes just before they sleep
|> on file IO. Ideally, I could catch only those sleeping on read calls,
|> but catching everything and being able to sort out what's happening in
|> my handler would be okay too.
|>
|> Basically, I have a process flag (call it PF_MONKEY for now), and I'd
|> like to call monkey_about_to_sleep() when a process with PF_MONKEY set
|> goes to sleep waiting for a file read to complete.
|>
|> I've thought about trawling through the fs and block code and tagging
|> all the 'current->state = TASK_UNINTERRUPTIBLE; schedule()' cases, but
|> that seems both error-prone and hideously ugly. Really, the individual
|> filesystem and device drivers shouldn't have to care about PF_MONKEY
|> processes. Is there a better way?

I guess the first question to ask is what are you really trying to do? (As
opposed to how you are trying to do it, which you have described).

Simon.

-- 
  Simon Patience				Phone: (650) 933-4644
  Silicon Graphics, Inc				FAX:   (650) 962-8404
  1600 Amphitheatre Pkwy			Email: sp@sgi.com
  Mountain View, CA 94043-1389

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/