Forgotten commit. Added automount.
[AROS.git] / rom / exec / allocpooled.c
blobfa0bf390b0e1da3883da3e2589423747bd52cd84
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Allocate memory in a pool.
6 Lang: english
7 */
9 #include <aros/libcall.h>
11 #include "exec_intern.h"
12 #include "exec_util.h"
13 #include "memory.h"
15 #include "exec_debug.h"
16 #ifndef DEBUG_AllocPooled
17 # define DEBUG_AllocPooled 0
18 #endif
19 #undef DEBUG
20 #if DEBUG_AllocPooled
21 # define DEBUG 1
22 #endif
23 #include <aros/debug.h>
24 #undef kprintf
28 /*****************************************************************************
30 NAME */
31 #include <exec/memory.h>
32 #include <proto/exec.h>
34 AROS_LH2(APTR, AllocPooled,
36 /* SYNOPSIS */
37 AROS_LHA(APTR, poolHeader, A0),
38 AROS_LHA(ULONG, memSize, D0),
40 /* LOCATION */
41 struct ExecBase *, SysBase, 118, Exec)
43 /* FUNCTION
44 Allocate memory out of a private memory pool.
46 INPUTS
47 poolHeader - Handle of the memory pool
48 memSize - Number of bytes you want to get
50 RESULT
51 A pointer to the number of bytes you wanted or NULL if the memory
52 couldn't be allocated
54 NOTES
56 EXAMPLE
58 BUGS
60 SEE ALSO
61 CreatePool(), DeletePool(), FreePooled()
63 INTERNALS
65 ******************************************************************************/
67 AROS_LIBFUNC_INIT
69 struct TraceLocation tp = CURRENT_LOCATION("AllocPooled");
70 struct Pool *pool = poolHeader + MEMHEADER_TOTAL;
72 D(bug("AllocPooled 0x%P memsize %u by \"%s\"\n", poolHeader, memSize, SysBase->ThisTask->tc_Node.ln_Name));
74 /* Allocate from the specified pool with flags stored in pool header */
75 return InternalAllocPooled(poolHeader, memSize, pool->Requirements, &tp, SysBase);
77 AROS_LIBFUNC_EXIT
79 } /* AllocPooled */