2020-06-18 12:15:52 +02:00
|
|
|
/* See LICENSE of license details. */
|
|
|
|
|
|
|
|
#include <stddef.h>
|
2023-09-28 11:51:20 +02:00
|
|
|
#include "weak_under_alias.h"
|
2020-06-18 12:15:52 +02:00
|
|
|
|
|
|
|
void *__wrap_sbrk(ptrdiff_t incr)
|
|
|
|
{
|
|
|
|
extern char _end[];
|
|
|
|
extern char _heap_end[];
|
|
|
|
static char *curbrk = _end;
|
|
|
|
|
|
|
|
if ((curbrk + incr < _end) || (curbrk + incr > _heap_end))
|
|
|
|
return NULL - 1;
|
|
|
|
|
|
|
|
curbrk += incr;
|
|
|
|
return curbrk - incr;
|
|
|
|
}
|
2023-09-28 11:51:20 +02:00
|
|
|
|
|
|
|
weak_under_alias(sbrk);
|