From owner-freebsd-questions@FreeBSD.ORG Thu Apr 6 06:56:56 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 83CB716A400 for ; Thu, 6 Apr 2006 06:56:56 +0000 (UTC) (envelope-from wojtek@tensor.3miasto.net) Received: from chylonia.3miasto.net (chylonia.3miasto.net [213.192.74.6]) by mx1.FreeBSD.org (Postfix) with ESMTP id CD7C643D45 for ; Thu, 6 Apr 2006 06:56:55 +0000 (GMT) (envelope-from wojtek@tensor.3miasto.net) Received: from chylonia.3miasto.net (localhost [127.0.0.1]) by chylonia.3miasto.net (8.13.4/8.13.4) with ESMTP id k366ukPW033657; Thu, 6 Apr 2006 08:56:46 +0200 (CEST) (envelope-from wojtek@tensor.3miasto.net) Received: from localhost (wojtek@localhost) by chylonia.3miasto.net (8.13.4/8.13.4/Submit) with ESMTP id k366ukes033654; Thu, 6 Apr 2006 08:56:46 +0200 (CEST) (envelope-from wojtek@tensor.3miasto.net) X-Authentication-Warning: chylonia.3miasto.net: wojtek owned process doing -bs Date: Thu, 6 Apr 2006 08:56:46 +0200 (CEST) From: Wojciech Puchar X-X-Sender: wojtek@chylonia.3miasto.net To: Dan Nelson In-Reply-To: <20060405214304.GG32089@dan.emsphone.com> Message-ID: <20060406085436.T33354@chylonia.3miasto.net> References: <20060405231726.W81334@chylonia.3miasto.net> <20060405214304.GG32089@dan.emsphone.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-questions@freebsd.org Subject: Re: programmer questions - MMAP X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Apr 2006 06:56:56 -0000 >> >> #include >> #include >> #include >> #include >> main() { >> int ff=open("test",O_RDWR|O_CREAT,0666); >> char *adr; >> lseek(ff,1<<24,0); >> write(ff,"",1); >> adr=mmap(0,1<<24,PROT_READ|PROT_WRITE,MAP_NOCORE,ff,0); > > Try MAP_NOCORE|MAP_SHARED here. It's probably defaulting to a private > mapping. WORKS!!! thank you. another question - do i need to create 16MB hole to be able to write directly up to 16MB data. it would be nice if mmap is able to extend the file as needed without lseek/write. is it possible?