Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!emory!gatech!mcnc!rti!bnrunix!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request From: kendall@saber.com Newsgroups: comp.sys.sun Subject: Can you guarantee integrity of an mmap'd file under SVR4? Keywords: Miscellaneous Message-ID: <2023@brchh104.bnr.ca> Date: 21 Mar 91 21:31:00 GMT Sender: news@brchh104.bnr.ca Organization: Sun-Spots Lines: 32 Approved: Sun-Spots@rice.edu X-Original-Date: Wed, 13 Mar 91 12:59:08 EST X-Sun-Spots-Digest: Volume 10, Issue 58, message 16 X-Note: Submissions: sun-spots@rice.edu, Admin: sun-spots-request@rice.edu My application would like to mmap an NFS-mounted file read-only and be guaranteed of the integrity of its data; that is, if someone overwrites the file, I'd like my application to keep seeing the original data. This is for SunOS or SVR4. Of course, this could be implemented by making a copy of the file, but that is too slow and takes up too much disk or swap space. I want mmap's wonderful performance behavior: lazy reading, and no swap space used. My understanding is that what I want is impossible under SVR4. So I'm reluctantly willing to guarantee that only other instances of my application will be anyone trying to overwrite the file, so they can cooperate. This reduces the problem to advisory file locking, more or less. SunOS documents two kinds of file locking. Only one (lockf(3)) is supposed to work across a network, and when I tried reasonable things it hung my processes for a while. From this experience, and from talking to people, I get the feeling that nobody uses lockf because it doesn't work very well. I need this locking to be a reliable service available at all customer sites without much trouble on the customers' part. My questions are: Has anyone made a system that guarantees this behavior? More specifically, is there a reliable advisory file locking service available, either a fixed lockf(3) or a 3rd party equivalent? Any other advice? Please reply by mail. Sam Kendall kendall@Saber.COM Saber Software, Inc. uunet!saber!kendall (617) 876-7636