From owner-freebsd-current@FreeBSD.ORG Sun Jul 31 22:46:08 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A576716A41F for ; Sun, 31 Jul 2005 22:46:08 +0000 (GMT) (envelope-from keramida@freebsd.org) Received: from rosebud.otenet.gr (rosebud.otenet.gr [195.170.0.94]) by mx1.FreeBSD.org (Postfix) with ESMTP id D7D5543D45 for ; Sun, 31 Jul 2005 22:46:07 +0000 (GMT) (envelope-from keramida@freebsd.org) Received: from gothmog.gr (patr530-b240.otenet.gr [212.205.244.248]) by rosebud.otenet.gr (8.13.4/8.13.4/Debian-1) with ESMTP id j6VMk3t8022685; Mon, 1 Aug 2005 01:46:04 +0300 Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.13.4/8.13.4) with ESMTP id j6VMk2Ln002066; Mon, 1 Aug 2005 01:46:02 +0300 (EEST) (envelope-from keramida@freebsd.org) Received: (from giorgos@localhost) by gothmog.gr (8.13.4/8.13.4/Submit) id j6VMk27w002065; Mon, 1 Aug 2005 01:46:02 +0300 (EEST) (envelope-from keramida@freebsd.org) Date: Mon, 1 Aug 2005 01:46:01 +0300 From: Giorgos Keramidas To: Garrett Wollman Message-ID: <20050731224601.GA2024@gothmog.gr> References: <20050731141801.GA49300@gothmog.gr> <84dead7205073108564f71f1ab@mail.gmail.com> <20050731160853.GC49839@gothmog.gr> <84dead720507311115290f0140@mail.gmail.com> <20050731201858.GC1052@gothmog.gr> <17133.21281.703540.383144@khavrinen.csail.mit.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <17133.21281.703540.383144@khavrinen.csail.mit.edu> Cc: freebsd-current@freebsd.org Subject: Re: mmap bug? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2005 22:46:08 -0000 On 2005-07-31 18:39, Garrett Wollman wrote: >< said: >> The bug seems to be elsewhere, namely to the fact that the filesystem >> code never realizes the file has changed size after I use mmap() to map >> a region beyond its current size and write past its current end. > > You should not expect it to do that. If you want to extend a file, > use ftruncate() before mapping it. Anything written past the end of a > file should be discarded on last close. I see. Thank you for the explanation :) It seems strange though that when the test program runs and finishes, munmapping the region and closing the file the data is still visible. Perhaps the fact that I used MAP_SHARED plays a role in that? Is the fact that the data written to the mapped region visible after the close (by mapping the same region) expected too? - Giorgos