All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Gryniewicz <dang@fprintf.net>
To: selvakumar nagendran <kernelselva@yahoo.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Process blocking behaviour
Date: Fri, 07 Jan 2005 12:29:36 -0500	[thread overview]
Message-ID: <1105118976.25618.5.camel@athena.fprintf.net> (raw)
In-Reply-To: <20050107065809.60035.qmail@web60604.mail.yahoo.com>

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

      reply	other threads:[~2005-01-07 17:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-07  6:58 Process blocking behaviour selvakumar nagendran
2005-01-07 17:29 ` Daniel Gryniewicz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1105118976.25618.5.camel@athena.fprintf.net \
    --to=dang@fprintf.net \
    --cc=kernelselva@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.