All of lore.kernel.org
 help / color / mirror / Atom feed
From: elezegarcia@gmail.com (Ezequiel García)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Iterating through all the processes in a module
Date: Wed, 22 Feb 2012 12:30:37 -0300	[thread overview]
Message-ID: <CALF0-+WnYPqCk+YSuQqpZUpJNhSo=a2wYvWFqLZyAM8qpaVNeA@mail.gmail.com> (raw)
In-Reply-To: <CAPNxggbWfMioMGPokZ4qK0rtFThDJuJPaeA_LCH_tkUuz8OA3A@mail.gmail.com>

Hi Arokux,

On 2/22/12, Arokux B. <arokux@gmail.com> wrote:
> Having my code as a module I can trigger its execution (load a module)
> and disable it (unload a module). How can I achieve this if the code
> is inside the kernel? One possibility I see is adding an entry in the
> procfs.

I think you want to have the kernel execute some code of yours just for learning
purposes right?
So, your question could be put like this:
Where are the "doors" for me -userspace- to enter to the kernel?

In that case, I believe the "canonical" answer is: system calls.
If you have a copy of Love's book you could look there, or you could
just search through the
code and look how system calls are implemented and add own of your own.
Perhaps you could even modify one. You can search all syscalls definitions with:

grep "SYSCALL_DEFINE" `find . -name "*.c"`

Actually, that's the path I would take if I were to try this. You can
pick a simple syscall
like "getcwd", defined in fs/dcache.c and just add my test code there. That way
every time you call pwd in your shell, you get your code called (you
can check with
strace).

Hope this helps,
Ezequiel.

  parent reply	other threads:[~2012-02-22 15:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-07 17:45 Iterating through all the processes in a module Arokux B.
2012-02-07 19:17 ` Greg KH
2012-02-22 13:07   ` Arokux B.
2012-02-22 14:53     ` Greg KH
2012-02-23 11:12       ` Srivatsa Bhat
2012-02-22 15:30     ` Ezequiel García [this message]
2012-02-22 16:43       ` Javier Martinez Canillas
2012-02-23 11:07         ` Arokux B.

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='CALF0-+WnYPqCk+YSuQqpZUpJNhSo=a2wYvWFqLZyAM8qpaVNeA@mail.gmail.com' \
    --to=elezegarcia@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.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.