freebsd-skq/share/man/man9/vm_map_stack.9
bapt 21f6fe7ae4 use .Mt to mark up email addresses consistently (part6)
PR:		191174
Submitted by:	Franco Fichtner <franco at lastsummer.de>
2014-06-26 21:44:30 +00:00

133 lines
3.5 KiB
Groff

.\"
.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd January 11, 2013
.Dt VM_MAP_STACK 9
.Os
.Sh NAME
.Nm vm_map_stack ,
.Nm vm_map_growstack
.Nd manage process stacks
.Sh SYNOPSIS
.In sys/param.h
.In vm/vm.h
.In vm/vm_map.h
.Ft int
.Fo vm_map_stack
.Fa "vm_map_t map" "vm_offset_t addrbos" "vm_size_t max_ssize" "vm_prot_t prot"
.Fa "vm_prot_t max" "int cow"
.Fc
.Ft int
.Fn vm_map_growstack "struct proc *p" "vm_offset_t addr"
.Sh DESCRIPTION
The
.Fn vm_map_stack
function maps a process stack for a new process image.
The stack is mapped
.Fa addrbos
in
.Fa map ,
with a maximum size of
.Fa max_ssize .
Copy-on-write flags passed in
.Fa cow
are also applied to the new mapping.
Protection bits are supplied by
.Fa prot
and
.Fa max .
.Pp
It is typically called by
.Xr execve 2 .
.Pp
The
.Fn vm_map_growstack
function is responsible for growing a stack for the process
.Fa p
to the desired address
.Fa addr ,
similar to the legacy
.Xr sbrk 2
call.
.Sh IMPLEMENTATION NOTES
The
.Fn vm_map_stack
function calls
.Xr vm_map_insert 9
to create its mappings.
.Pp
The
.Fn vm_map_stack
and
.Fn vm_map_growstack
functions acquire the process lock on
.Fa p
for the duration of the call.
.Sh RETURN VALUES
The
.Fn vm_map_stack
function returns
.Dv KERN_SUCCESS
if the mapping was allocated successfully.
.Pp
Otherwise,
if mapping the stack would exceed the process's VMEM resource limit,
or if the specified bottom-of-stack address is out of range for the map,
or if there is already a mapping at the address which would result,
or if
.Fa max_ssize
could not be accommodated within the current mapping,
.Dv KERN_NO_SPACE
is returned.
.Pp
Other possible return values for this function are documented in
.Xr vm_map_insert 9 .
.Pp
The
.Fn vm_map_growstack
function returns
.Dv KERN_SUCCESS
if
.Fa addr
is already mapped, or if the stack was grown successfully.
.Pp
It also returns
.Dv KERN_SUCCESS
if
.Fa addr
is outside the stack range; this is done in order to preserve
compatibility with the deprecated
.Fn grow
function previously located in the file
.Pa vm_machdep.c .
.Sh SEE ALSO
.Xr vm_map 9 ,
.Xr vm_map_insert 9
.Sh AUTHORS
This manual page was written by
.An Bruce M Simpson Aq Mt bms@spc.org .