Google luky.org euqset.org

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

Re: Process blocking behaviour


On Thu, 2005-01-06 at 22:58 -0800, selvakumar nagendran wrote:
> Hello linux-experts,
>    
>   I am intercepting system calls in Linux kernel
> 2.4.28.
>   
>   Pseudo-code:
>   ------------
>     saved_old_syscall =
> sys_call_table[sycallno(read)];
>     sys_call_table[read] = my_sys_call;
>     
>   my_sys_call(file descriptor)
>   -------------
>      Call saved_old_syscall(file descriptor).
>     
>      Now at this point, I want to determine whether
> the system call blocks waiting for the file descriptor
> resource. How can I do that? Should I modify the
> kernel code only for this?
> 
>    Can I check its state after the call as
>      if (task_current_state == INTERRUPTIBLE
>             || UNINTERRUPTIBLE) to do this?

No, you can't, because by the time the syscall returns to you, it's
blocked, scheduled, unblocked, and been rescheduled.  It's too late.  I
don't think you can do what you want, without modifying all the syscalls
directly.

Besides, most blocks are for data, not on something like a semaphore.
What you really want is priority-inheritance semaphores, not
modification of syscalls.  I seem to remember someone working on such a
beast, and the RTOS versions of Linux presumably have something like
this, so you could check around.

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


$B$3$N>pJs$,$"$J$?$NC5$7$F$$?$b$N$+$I$&$+A*Br$7$F$/$@$5$!#(B
yes/$B$^$5$K$3$l$@!*(B   no/$B0c$&$J$!(B   part/$B0lIt8+$D$+$C$?(B   try/$B$3$l$G;n$7$F$_$k(B

$B$"$J$?$,C5$7$F$$?>pJs$O$I$N$h$&$J$3$H$+!"$4<+M3$K5-F~2<$5$!#FC$K!V$^$5$K$3$l$@!*!W$H8@$&>l9g$O5-F~$r$*4j$$7$^$9!#(B
$BNc(B:$B!VJ#?t$N%^%7%s$+$i(BCATV$B7PM3$G(Bipmasquerade$B$rMxMQ$7$F(BWeb$B$r;2>H$7$?$>l9g$N@_Dj$K$D$$F!W(B
References: