From owner-freebsd-bugs Mon Feb 5 16: 0:24 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 1FC1337B503 for ; Mon, 5 Feb 2001 16:00:02 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f16002u06228; Mon, 5 Feb 2001 16:00:02 -0800 (PST) (envelope-from gnats) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id C138337B401 for ; Mon, 5 Feb 2001 15:58:41 -0800 (PST) Received: (from nobody@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f15Nwfi06015; Mon, 5 Feb 2001 15:58:41 -0800 (PST) (envelope-from nobody) Message-Id: <200102052358.f15Nwfi06015@freefall.freebsd.org> Date: Mon, 5 Feb 2001 15:58:41 -0800 (PST) From: ikqumei@computer.org To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: i386/24886: Cant msync memory mapped file onto desk. Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 24886 >Category: i386 >Synopsis: Cant msync memory mapped file onto desk. >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Feb 05 16:00:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Iyad Qumei >Release: 4.0 >Organization: Digital Transit, Inc. >Environment: FreeBSD freebsd.irntdomain.com 4.0-RELEASE FreeBSD 4.0-RELEASE #0: Mon Mar 20 22:50:22 GMT 2000 root@monster.cdrom.com:/usr/src/sys/compile/GENERIC i386 >Description: I wrote a simple program to demonstrate the problem. Basically, I use mmap to exchange information between files. After this is done, I try to msync the information back to desk. The new information does not seem to be saved. The return value from msync is 0, and no error registed through errno. I used simple text files with this program. < source code begin > #include #include #include #include #include #include #include #include bool ResizeFile( int fd, int new_sz ); int main() { int hOldFile=0, hNewFile=0; char *ofbuf=NULL, *nfbuf=NULL; long new_sz=155, ofsz=133; char *ofile="oldf.txt"; char *nfile="newf.txt"; hOldFile = open( ofile, O_RDWR ); hNewFile = open( nfile, O_RDWR ); if( hOldFile ) ofbuf = (char*)mmap(NULL, ofsz, PROT_READ|PROT_WRITE, /*MAP_DENYWRITE*/MAP_PRIVATE, hOldFile, 0); if ( !ResizeFile( hOldFile, new_sz ) ) { close(hOldFile); close(hNewFile); return 1; } nfbuf = (char*) mmap(NULL, new_sz, PROT_READ|PROT_WRITE, MAP_PRIVATE, hNewFile, 0); for( int i=0; iHow-To-Repeat: I used two text files, auto testing: Functional spec and Software design spec as guide to features testing. Generator testing: command line testing. auto testing: Functional spec and Software design spec as guide to features testing. Generator testing: command line testing. Just added a line. >Fix: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message