shmat.2 (84306) | shmat.2 (108028) |
---|---|
1.\" 2.\" Copyright (c) 1995 David Hovemeyer <daveho@infocom.com> 3.\" 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: --- 9 unchanged lines hidden (view full) --- 18.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 19.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25.\" | 1.\" 2.\" Copyright (c) 1995 David Hovemeyer <daveho@infocom.com> 3.\" 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: --- 9 unchanged lines hidden (view full) --- 18.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 19.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25.\" |
26.\" $FreeBSD: head/lib/libc/sys/shmat.2 84306 2001-10-01 16:09:29Z ru $ | 26.\" $FreeBSD: head/lib/libc/sys/shmat.2 108028 2002-12-18 09:22:32Z ru $ |
27.\" 28.Dd August 2, 1995 29.Dt SHMAT 2 30.Os 31.Sh NAME 32.Nm shmat , 33.Nm shmdt 34.Nd attach or detach shared memory --- 4 unchanged lines hidden (view full) --- 39.In sys/types.h 40.In sys/ipc.h 41.In sys/shm.h 42.Ft void * 43.Fn shmat "int shmid" "void *addr" "int flag" 44.Ft int 45.Fn shmdt "void *addr" 46.Sh DESCRIPTION | 27.\" 28.Dd August 2, 1995 29.Dt SHMAT 2 30.Os 31.Sh NAME 32.Nm shmat , 33.Nm shmdt 34.Nd attach or detach shared memory --- 4 unchanged lines hidden (view full) --- 39.In sys/types.h 40.In sys/ipc.h 41.In sys/shm.h 42.Ft void * 43.Fn shmat "int shmid" "void *addr" "int flag" 44.Ft int 45.Fn shmdt "void *addr" 46.Sh DESCRIPTION |
47.Fn Shmat | 47The 48.Fn shmat 49system call |
48attaches the shared memory segment identified by 49.Fa shmid 50to the calling process's address space. The address where the segment 51is attached is determined as follows: 52.\" 53.\" These are cribbed almost exactly from Stevens, _Advanced Programming in 54.\" the UNIX Environment_. 55.\" --- 12 unchanged lines hidden (view full) --- 68.It 69If 70.Fa addr 71is specified and SHM_RND is specified, 72.Fa addr 73is rounded down to the nearest multiple of SHMLBA. 74.El 75.Pp | 50attaches the shared memory segment identified by 51.Fa shmid 52to the calling process's address space. The address where the segment 53is attached is determined as follows: 54.\" 55.\" These are cribbed almost exactly from Stevens, _Advanced Programming in 56.\" the UNIX Environment_. 57.\" --- 12 unchanged lines hidden (view full) --- 70.It 71If 72.Fa addr 73is specified and SHM_RND is specified, 74.Fa addr 75is rounded down to the nearest multiple of SHMLBA. 76.El 77.Pp |
76.Fn Shmdt | 78The 79.Fn shmdt 80system call |
77detaches the shared memory segment at the address specified by 78.Fa addr 79from the calling process's address space. 80.Sh RETURN VALUES 81Upon success, 82.Fn shmat 83returns the address where the segment is attached; otherwise, -1 84is returned and 85.Va errno 86is set to indicate the error. 87.Pp 88.Rv -std shmdt 89.Sh ERRORS | 81detaches the shared memory segment at the address specified by 82.Fa addr 83from the calling process's address space. 84.Sh RETURN VALUES 85Upon success, 86.Fn shmat 87returns the address where the segment is attached; otherwise, -1 88is returned and 89.Va errno 90is set to indicate the error. 91.Pp 92.Rv -std shmdt 93.Sh ERRORS |
90.Fn Shmat | 94The 95.Fn shmat 96system call |
91will fail if: 92.Bl -tag -width Er 93.It Bq Er EINVAL 94No shared memory segment was found corresponding to 95.Fa shmid . 96.It Bq Er EINVAL 97.Fa addr 98was not an acceptable address. 99.El 100.Pp | 97will fail if: 98.Bl -tag -width Er 99.It Bq Er EINVAL 100No shared memory segment was found corresponding to 101.Fa shmid . 102.It Bq Er EINVAL 103.Fa addr 104was not an acceptable address. 105.El 106.Pp |
101.Fn Shmdt | 107The 108.Fn shmdt 109system call |
102will fail if: 103.Bl -tag -width Er 104.It Bq Er EINVAL 105.Fa addr 106does not point to a shared memory segment. 107.El 108.Sh "SEE ALSO" 109.Xr shmctl 2 , 110.Xr shmget 2 | 110will fail if: 111.Bl -tag -width Er 112.It Bq Er EINVAL 113.Fa addr 114does not point to a shared memory segment. 115.El 116.Sh "SEE ALSO" 117.Xr shmctl 2 , 118.Xr shmget 2 |