[comp.unix.questions] MMAP reference

garrity@garrity.applicon.UUCP (05/19/87)

   Could somebody please point me at a good reference for mmap?  Bach doesn't
discuss it.  I presume that is because of Bach's SysV leanings.  Is mmap 
intended as a Berkeley shmat?  Thanks in advance.


--                                                          -MPG-
-- Mike Garrity
--
-- snail: Applicon, a division of Schlumberger Systems, Inc.
--        829 Middlesex Tpk.
--        P.O. box 7004
--        Billerica MA, 01821
--
-- uucp: {allegra|decvax|mit-eddie|utzoo}!linus!raybed2!applicon!garrity
--       {amd|bbncca|cbosgd|wjh12|ihnp4|yale}!ima!applicon!garrity

guy%gorodish@Sun.COM (Guy Harris) (05/22/87)

>    Could somebody please point me at a good reference for mmap?  Bach doesn't
> discuss it.  I presume that is because of Bach's SysV leanings.

No, it's probably because Berkeley didn't implement it.  SunOS
currently implements it only for devices; it's used for mapping things
such as frame buffers into your address space.

> Is mmap intended as a Berkeley shmat?

That's what it would have been, sort of, had it been implemented.  It
takes a file descriptor and maps whatever that descriptor refers to
into your address space.  If this is a file, the file is mapped into
your address space, so that page faults on addresses in the range
mapped by "mmap" cause the page to be read from the file, and if the
file is mapped in the appropriate fashion page pushes of those pages
cause the data to be written to the file.  If this is a device,
something related to that device is mapped into your address space;
precisely what that is depends on the device.

The S5 shared memory IPC calls act on objects that don't exist in the
file system and aren't referred to by file descriptors.
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy@sun.com