|
From: Tom H. <th...@cy...> - 2004-07-28 22:59:38
|
In message <1090865863.5743.16.camel@localhost>
Jeremy Fitzhardinge <je...@go...> wrote:
> There's a few syscalls in which POST should be called on error exit
> (nanosleep, for example, needs to return the amount of unslept time on
> interrupt). I've been thinking that we should change may_block in
> sys_info into a bitfield, and encode a little more in there - like
> whether the syscall wants POST called on failure.
>
> (Another reason for this would be to allow conditional may_block-ness.
> Change PRE() to return a boolean, and add a flag into sys_info saying
> use the result of PRE rather than a fixed value for blockness. We could
> just change all the PREs to return the appropriate thing, or just use
> the existing value in the table.)
What I've done is to turn may_block into a flags word. There are
currently two flags define - MayBlock and PostOnFail. The latter
indicates that the POST routine should be called on a failure.
I've also added sys_flags to the thread state. The flags word for
the active system call is copied into that before the PRE routine
is called, and all subsequent tests are done on that flags word
rather than the one in the static table.
This means that a PRE routine can alter sys_flags in the thread
state if necessary, either to change the blocking flag, or to
indicate that POST needs to be called on fail.
Tha flags had to be put in the thread state rather than just
returned from the PRE routine because we need to get at them
when the syscall has completed, which is in a separate routine
and may be some time later for a blocking call.
The patch is attached - it also fixes the nanosleep issue you
mentioned. Unless somebody spots a problem I'll commit this and
then use it to fix the shmat bug.
Tom
--
Tom Hughes (th...@cy...)
Software Engineer, Cyberscience Corporation
http://www.cyberscience.com/
|