Re: [linux-pm] [PATCH] Block on access to temporarily unavailable pci device

Alan Cox
2006-10-18T16:04:10Z

Ar Mer, 2006-10-18 am 11:52 -0400, ysgrifennodd Alan Stern:
> Don't you want the user process to wait in TASK_INTERRUPTIBLE? It would
> require only a very simple change.

That just makes the problem even worse, to go with the kernel driver
"what the hell do do if.." we get a user space one thats based around
incompatibility with the existing behaviour.

There are much saner ways to sort that out without breaking the API

If its going to be a bounded short wait -> pause
If its might be a long wait -> cached
If its gone for good then error

If the user specified O_NDELAY then -EWOULDBLOCK not wait

That way you don't break anything and you get sensible Unix semantics.
The wait queue Matthew added also means select() can be fitted up to do
the right thing for the O_NDELAY case.

Alan