Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.unix.questions Subject: Re: shared memory segment, shmat() ... Message-ID: <3783@auspex.auspex.com> Date: 28 Jul 90 18:44:50 GMT References: <34559@ut-emx.UUCP> Organization: Auspex Systems, Santa Clara Lines: 16 >A few days ago, I came across some code that uses shmat() and related >functions. The program maps a file using shmat() (we are using IBM RT, >running AIX 2.2.1). Basically, the program opens an binary digital image >file and maps it. Can someone explain to me what is shared memory >segment and how to use it? In /usr/include/sys/shm.h (AIX), SHM_MAP flag >maps a file instead of share segment. But in SunOS 4.0, shm.h does not >have this flag. How can I map a file in this case? By using the "mmap()" call; see MMAP(2). IBM chose to use "shmat()" to map files; Sun chose to use a modified version of the proposed-but-never-implemented-by-Berkeley "mmap()" call. Other vendors have implemented "mmap()" as well (Convex and Sequent are, I think, among them); the Sun implementation is the basis of the System V Release 4 implementation, and its interface is also planned to be used by Berkeley in 4.4BSD. I think it'll be in OSF/1 as well.