mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael Sisto" <rafael.sisto@gmail.com>
To: "Linux kernel" <linux-kernel@vger.kernel.org>
Subject: create a file in kernel mode. help please!
Date: Sat, 19 Jan 2008 02:17:46 -0300	[thread overview]
Message-ID: <ee3dc96c0801182117t6e40b46fr1b2d5826e22a7124@mail.gmail.com> (raw)
In-Reply-To: <ee3dc96c0801182116q3d54148dl6773d76ff3160d91@mail.gmail.com>

Hi there,
obviously this is a newbie question, but I couldn't find any
documentation on how to do it.. I tried several ways but couldnt do
it.
I designed a system call, so a user will call it, and a new file will
be created ('/tmp/filexx'). After that, I have another system call,
that will map the file into the maps of the user process. The idea is
the same as IPC...

I managed to create the file with this function (in the first system call):
        fd = filp_open(path, O_CREAT | O_RDWR , 777);

After that, the user will call another system call, and it will map
this file to the process maps.
something like this:
         filp_open(route, O_RDWR,0 );
         do_mmap(fp, 0, tamano, PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_SHARED, 0);

After I call the second system call, the user tries to access the
memory, but gets the message "Bus Error".
I tried to manually create a file with vi, and then use the second
system call, and worked perfectly. I could use the shared memory
without problems.

The problems seems to be in the first system call (with filp_open),
when I try to create a new file... Can somebody suggest me something,
on how I could fix this issue?? It is very important because it is for
a college projects.

Greetings, and thanks in advance for the answers.
Rafael Sisto - Uruguay.-

       reply	other threads:[~2008-01-19  5:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ee3dc96c0801182116q3d54148dl6773d76ff3160d91@mail.gmail.com>
2008-01-19  5:17 ` Rafael Sisto [this message]
2008-01-21  8:21   ` Joe
2008-01-21 12:44     ` Rafael Sisto
2008-01-23 18:02   ` Jan Kara

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=ee3dc96c0801182117t6e40b46fr1b2d5826e22a7124@mail.gmail.com \
    --to=rafael.sisto@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®