1 .\" $NetBSD: shmat.2,v 1.18 2010/03/22 19:30:55 joerg Exp $
3 .\" Copyright (c) 1995 Frank van der Linden
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. All advertising materials mentioning features or use of this software
15 .\" must display the following acknowledgement:
16 .\" This product includes software developed for the NetBSD Project
17 .\" by Frank van der Linden
18 .\" 4. The name of the author may not be used to endorse or promote products
19 .\" derived from this software without specific prior written permission
21 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 .Nd map/unmap shared memory
44 .Fn shmat "int shmid" "const void *shmaddr" "int shmflg"
46 .Fn shmdt "const void *shmaddr"
49 maps the shared memory segment associated with the shared memory identifier
51 into the address space of the calling process.
52 The address at which the segment is mapped is determined by the
55 If it is equal to 0, the system will pick an address itself.
56 Otherwise, an attempt is made to map the shared memory segment at the
64 the system will round the address down to a multiple of
71 A shared memory segment can be mapped read-only by specifying the
77 unmaps the shared memory segment that is currently mapped at
79 from the calling process' address space.
81 must be a value returned by a prior
84 A shared memory segment will remain in existence until it is
92 returns the address at which the shared memory segment has been mapped into
93 the calling process' address space when successful,
95 returns 0 on successful completion.
96 Otherwise, a value of \-1 is returned, and the global variable
98 is set to indicate the error.
104 The calling process has no permission to access this shared memory segment.
106 There is not enough available data space for the calling process to
107 map the shared memory segment.
110 is not a valid shared memory identifier.
113 specifies an illegal address.
115 The number of shared memory segments has reached the system-wide limit.
123 is not the start address of a mapped shared memory segment.
136 system calls conform to
139 Shared memory segments appeared in the first release of