|
|
1.1 root 1: /******************************************************************************
2: * Copyright (c) 2004, 2008 IBM Corporation
3: * All rights reserved.
4: * This program and the accompanying materials
5: * are made available under the terms of the BSD License
6: * which accompanies this distribution, and is available at
7: * http://www.opensource.org/licenses/bsd-license.php
8: *
9: * Contributors:
10: * IBM Corporation - initial implementation
11: *****************************************************************************/
12:
1.1.1.2 ! root 13: #include <unistd.h>
! 14:
1.1 root 15: #define HEAP_SIZE 0x200000
16:
17:
18: static char heap[HEAP_SIZE];
19: static char *actptr;
20:
21: void *sbrk(int increment)
22: {
23: char *oldptr;
24:
25: /* Called for the first time? Then init the actual pointer */
26: if (!actptr) {
27: actptr = heap;
28: }
29:
30: if (actptr + increment > heap + HEAP_SIZE) {
31: /* Out of memory */
32: return (void *)-1;
33: }
34:
35: oldptr = actptr;
36: actptr += increment;
37:
38: return oldptr;
39: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.