Replace the last consumber of sbrk in libc.
This commit is contained in:
parent
1c9aac418b
commit
bf33e1e70b
@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/gmon.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <err.h>
|
||||
@ -50,14 +51,6 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include "libc_private.h"
|
||||
|
||||
#if defined(__i386__) || defined(__sparc64__) || defined(__amd64__) || (defined(__powerpc__) && !defined(__powerpc64__))
|
||||
extern char *minbrk __asm (".minbrk");
|
||||
#elif defined(__powerpc64__)
|
||||
extern char *minbrk __asm ("_minbrk");
|
||||
#else
|
||||
extern char *minbrk __asm ("minbrk");
|
||||
#endif
|
||||
|
||||
struct gmonparam _gmonparam = { GMON_PROF_OFF };
|
||||
|
||||
static int s_scale;
|
||||
@ -95,8 +88,9 @@ monstartup(lowpc, highpc)
|
||||
p->tolimit = MAXARCS;
|
||||
p->tossize = p->tolimit * sizeof(struct tostruct);
|
||||
|
||||
cp = sbrk(p->kcountsize + p->fromssize + p->tossize);
|
||||
if (cp == (char *)-1) {
|
||||
cp = mmap(NULL, p->kcountsize + p->fromssize + p->tossize,
|
||||
PROT_READ | PROT_WRITE, MAP_ANON, -1, 0);
|
||||
if (cp == MAP_FAILED) {
|
||||
ERR("monstartup: out of memory\n");
|
||||
return;
|
||||
}
|
||||
@ -109,7 +103,6 @@ monstartup(lowpc, highpc)
|
||||
cp += p->kcountsize;
|
||||
p->froms = (u_short *)cp;
|
||||
|
||||
minbrk = sbrk(0);
|
||||
p->tos[0].link = 0;
|
||||
|
||||
o = p->highpc - p->lowpc;
|
||||
|
Loading…
Reference in New Issue
Block a user