Blame src/common/memfill.c
|
Szabolcs Nagy |
2c4e47 |
#include <string.h>
|
|
Szabolcs Nagy |
2c4e47 |
#include <errno.h>
|
|
Szabolcs Nagy |
2c4e47 |
#include <sys/resource.h>
|
|
Szabolcs Nagy |
2c4e47 |
#include "test.h"
|
|
Szabolcs Nagy |
2c4e47 |
|
|
Szabolcs Nagy |
2c4e47 |
int t_memfill()
|
|
Szabolcs Nagy |
2c4e47 |
{
|
|
Szabolcs Nagy |
2c4e47 |
int r = 0;
|
|
Szabolcs Nagy |
fc5db4 |
/* alloc mmap space with PROT_NONE */
|
|
Szabolcs Nagy |
2c4e47 |
if (t_vmfill(0,0,0) < 0) {
|
|
Szabolcs Nagy |
2c4e47 |
t_error("vmfill failed: %s\n", strerror(errno));
|
|
Szabolcs Nagy |
2c4e47 |
r = -1;
|
|
Szabolcs Nagy |
2c4e47 |
}
|
|
Szabolcs Nagy |
fc5db4 |
/* limit brk space */
|
|
Szabolcs Nagy |
2c4e47 |
if (t_setrlim(RLIMIT_DATA, 0) < 0)
|
|
Szabolcs Nagy |
2c4e47 |
r = -1;
|
|
Szabolcs Nagy |
fc5db4 |
if (!r)
|
|
Szabolcs Nagy |
fc5db4 |
/* use up libc reserves if any */
|
|
Szabolcs Nagy |
fc5db4 |
while (malloc(1));
|
|
Szabolcs Nagy |
2c4e47 |
return r;
|
|
Szabolcs Nagy |
2c4e47 |
}
|