diff options
Diffstat (limited to 'src/lib/libc/stdlib/alloca.3')
-rw-r--r-- | src/lib/libc/stdlib/alloca.3 | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/src/lib/libc/stdlib/alloca.3 b/src/lib/libc/stdlib/alloca.3 index dcb97ab11c..d7fddb04c2 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.11 2007/05/31 19:19:31 jmc 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: May 31 2007 $ |
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,41 @@ | |||
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 | 57 | .Sh BUGS |
68 | The | 58 | The |
69 | .Fn alloca | 59 | .Fn alloca |
70 | function | 60 | function is machine dependent; its use is discouraged. |
71 | is machine dependent; its use is discouraged. | ||
72 | .\" .Sh HISTORY | 61 | .\" .Sh HISTORY |
73 | .\" The | 62 | .\" The |
74 | .\" .Fn alloca | 63 | .\" .Fn alloca |
75 | .\" function appeared in | 64 | .\" function appeared in |
76 | .\" .Bx ?? . | 65 | .\" .Bx ?? . |
77 | .\" The function appeared in 32v, pwb and pwb.2 and in 3bsd 4bsd | 66 | .\" 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 | 67 | .\" The first man page (or link to a man page that I can find at the |
79 | .\" moment is 4.3... | 68 | .\" moment is 4.3... |
69 | .Pp | ||
70 | The | ||
71 | .Fn alloca | ||
72 | function is slightly unsafe because it cannot ensure that the pointer | ||
73 | returned points to a valid and usable block of memory. | ||
74 | The allocation made may exceed the bounds of the stack, or even go | ||
75 | further into other objects in memory, and | ||
76 | .Fn alloca | ||
77 | cannot determine such an error. | ||
78 | Avoid | ||
79 | .Fn alloca | ||
80 | with large unbounded allocations. | ||