Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755475AbYAWSCT (ORCPT ); Wed, 23 Jan 2008 13:02:19 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752757AbYAWSCK (ORCPT ); Wed, 23 Jan 2008 13:02:10 -0500 Received: from atrey.karlin.mff.cuni.cz ([195.113.31.123]:55690 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752168AbYAWSCJ (ORCPT ); Wed, 23 Jan 2008 13:02:09 -0500 Date: Wed, 23 Jan 2008 19:02:08 +0100 From: Jan Kara To: Rafael Sisto Cc: Linux kernel Subject: Re: create a file in kernel mode. help please! Message-ID: <20080123180208.GD23304@atrey.karlin.mff.cuni.cz> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1766 Lines: 43 Hi, > 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. Hmm, I don't quite get what you are trying to achieve? Why can't user create the file via open(path, O_CREAT...) and then mmap() it? Why do you need a new system call for that? Honza -- Jan Kara SuSE CR Labs -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/