From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,a7c397921f0cefda,start X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1991-11-12 05:32:48 PST Path: gmdzi!zeus.ieee.org!europa.asd.contel.com!uunet!munnari.oz.au!manuel!csis!caroli!peterf From: peterf@olivine.csis.dit.csiro.au (Peter A Fletcher) Newsgroups: comp.sys.dec Subject: Why won't mmap work on my Ultrix 4.2 Decstation 5000 ? Message-ID: Date: 12 Nov 91 11:50:47 GMT Sender: news@csis.dit.csiro.au Organization: /users/peterf/.organization Nntp-Posting-Host: olivine.csis.dit.csiro.au Hello everyone! I have been having some problems with my Decstation; it won't do mmaps for me. The following piece of code works fine on Suns and Apollos, but fails with an invalid argument on the mmap call on my Decstation. Can anyone help ? -peter. ----- #include #include #include #include #include #include main() { int d; int len = getpagesize(); char *cp; int i; int z; d = open("test", O_RDWR | O_CREAT | O_TRUNC, 0777); z = lseek(d, 255, L_XTND); z = write(d, &i, 1); #ifdef apollo cp = mmap(0, &len, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, d, 0); #else cp = mmap(0, len, PROT_READ | PROT_WRITE, MAP_SHARED, d, 0); #endif if (cp == (char *)-1) { perror("tmap"); exit(1); } printf("cp = %1u\n",cp); for (i=0; i<256; i++) { cp[i] = i&255; } #ifndef mips #ifdef apollo z = msync(cp, len); #else z = msync(cp, len, 0); #endif #endif z = munmap(cp, len); z = close(d); } ----- -- Peter Fletcher, Internet : peterf@csis.dit.csiro.au PhD Student Physical : CSIRO Division of Information Technology, Phone : +61-6-2750914 ANU, Acton, Canberra ACT AUSTRALIA -------------------------------------------------------------------------------