shared memory segment, shmat() ...
Guy Harris
guy at auspex.auspex.com
Sun Jul 29 04:44:50 AEST 1990
>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.
More information about the Comp.unix.questions
mailing list