create a file in kernel mode. help please!

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Linux kernel <linux-kernel@...>
Date: Saturday, January 19, 2008 - 1:17 am

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.-
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
create a file in kernel mode. help please!, Rafael Sisto, (Sat Jan 19, 1:17 am)
Re: create a file in kernel mode. help please!, Jan Kara, (Wed Jan 23, 2:02 pm)
Re: create a file in kernel mode. help please!, Rafael Sisto, (Mon Jan 21, 8:44 am)