diff options
Diffstat (limited to 'src/lib/libc/stdlib/alloca.3')
-rw-r--r-- | src/lib/libc/stdlib/alloca.3 | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/src/lib/libc/stdlib/alloca.3 b/src/lib/libc/stdlib/alloca.3 index dcb97ab11c..8cc5c42ff5 100644 --- a/src/lib/libc/stdlib/alloca.3 +++ b/src/lib/libc/stdlib/alloca.3 | |||
@@ -9,11 +9,7 @@ | |||
9 | .\" 2. Redistributions in binary form must reproduce the above copyright | 9 | .\" 2. Redistributions in binary form must reproduce the above copyright |
10 | .\" notice, this list of conditions and the following disclaimer in the | 10 | .\" notice, this list of conditions and the following disclaimer in the |
11 | .\" documentation and/or other materials provided with the distribution. | 11 | .\" documentation and/or other materials provided with the distribution. |
12 | .\" 3. All advertising materials mentioning features or use of this software | 12 | .\" 3. Neither the name of the University nor the names of its contributors |
13 | .\" must display the following acknowledgement: | ||
14 | .\" This product includes software developed by the University of | ||
15 | .\" California, Berkeley and its contributors. | ||
16 | .\" 4. Neither the name of the University nor the names of its contributors | ||
17 | .\" may be used to endorse or promote products derived from this software | 13 | .\" may be used to endorse or promote products derived from this software |
18 | .\" without specific prior written permission. | 14 | .\" without specific prior written permission. |
19 | .\" | 15 | .\" |
@@ -29,12 +25,11 @@ | |||
29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 25 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
30 | .\" SUCH DAMAGE. | 26 | .\" SUCH DAMAGE. |
31 | .\" | 27 | .\" |
32 | .\" from: @(#)alloca.3 5.1 (Berkeley) 5/2/91 | 28 | .\" $OpenBSD: alloca.3,v 1.12 2012/04/12 15:46:57 deraadt Exp $ |
33 | .\" $Id: alloca.3,v 1.1.1.1 1995/10/18 08:42:16 deraadt Exp $ | ||
34 | .\" | 29 | .\" |
35 | .Dd May 2, 1991 | 30 | .Dd $Mdocdate: April 12 2012 $ |
36 | .Dt ALLOCA 3 | 31 | .Dt ALLOCA 3 |
37 | .Os BSD 4 | 32 | .Os |
38 | .Sh NAME | 33 | .Sh NAME |
39 | .Nm alloca | 34 | .Nm alloca |
40 | .Nd memory allocator | 35 | .Nd memory allocator |
@@ -45,35 +40,37 @@ | |||
45 | .Sh DESCRIPTION | 40 | .Sh DESCRIPTION |
46 | The | 41 | The |
47 | .Fn alloca | 42 | .Fn alloca |
48 | function | 43 | function allocates |
49 | allocates | ||
50 | .Fa size | 44 | .Fa size |
51 | bytes of space in the stack frame of the caller. | 45 | bytes of space in the stack frame of the caller. |
52 | This temporary space is automatically freed on | 46 | This temporary space is automatically freed on return. |
53 | return. | ||
54 | .Sh RETURN VALUES | 47 | .Sh RETURN VALUES |
55 | The | 48 | The |
56 | .Fn alloca | 49 | .Fn alloca |
57 | function returns a pointer to the beginning of the allocated space. | 50 | function returns a pointer to the beginning of the allocated space. |
58 | If the allocation failed, a | ||
59 | .Dv NULL | ||
60 | pointer is returned. | ||
61 | .Sh SEE ALSO | 51 | .Sh SEE ALSO |
52 | .Xr pagesize 1 , | ||
62 | .Xr brk 2 , | 53 | .Xr brk 2 , |
63 | .Xr pagesize 2 | ||
64 | .Xr calloc 3 , | 54 | .Xr calloc 3 , |
65 | .Xr malloc 3 , | 55 | .Xr malloc 3 , |
66 | .Xr realloc 3 , | 56 | .Xr realloc 3 |
67 | .Sh BUGS | ||
68 | The | ||
69 | .Fn alloca | ||
70 | function | ||
71 | is machine dependent; its use is discouraged. | ||
72 | .\" .Sh HISTORY | 57 | .\" .Sh HISTORY |
73 | .\" The | 58 | .\" The |
74 | .\" .Fn alloca | 59 | .\" .Fn alloca |
75 | .\" function appeared in | 60 | .\" function appeared in |
76 | .\" .Bx ?? . | 61 | .\" .Bx ?? . |
77 | .\" The function appeared in 32v, pwb and pwb.2 and in 3bsd 4bsd | 62 | .\" The function appeared in 32v, pwb and pwb.2 and in 3bsd 4bsd |
78 | .\" The first man page (or link to a man page that I can find at the | 63 | .\" The first man page (or link to a man page that I can find at the |
79 | .\" moment is 4.3... | 64 | .\" moment is 4.3... |
65 | .Sh BUGS | ||
66 | The | ||
67 | .Fn alloca | ||
68 | function is slightly unsafe because it cannot ensure that the pointer | ||
69 | returned points to a valid and usable block of memory. | ||
70 | The allocation made may exceed the bounds of the stack, or even go | ||
71 | further into other objects in memory, and | ||
72 | .Fn alloca | ||
73 | cannot determine such an error. | ||
74 | Avoid | ||
75 | .Fn alloca | ||
76 | with large unbounded allocations. | ||