MNRS-BM-BSP/libwrap/sys/sbrk.c

20 lines
360 B
C
Raw Normal View History

2020-06-18 12:15:52 +02:00
/* See LICENSE of license details. */
#include <stddef.h>
#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))
2024-01-13 23:06:01 +01:00
return (void*)- 1;
2020-06-18 12:15:52 +02:00
curbrk += incr;
return curbrk - incr;
}
weak_under_alias(sbrk);