repo.or.cz
/
libc-test.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
use anonymous maps in vmfill
[libc-test.git]
/
src
/
common
/
memfill.c
blob
c53bfeac45c35d5ad1c7f8084e6c8c6088acb031
1
#include <stdlib.h>
2
#include <string.h>
3
#include <errno.h>
4
#include <sys/resource.h>
5
#include
"test.h"
6
7
int
t_memfill
()
8
{
9
int
r
=
0
;
10
/* alloc mmap space with PROT_NONE */
11
if
(
t_vmfill
(
0
,
0
,
0
) <
0
) {
12
t_error
(
"vmfill failed: %s
\n
"
,
strerror
(
errno
));
13
r
= -
1
;
14
}
15
/* limit brk space */
16
if
(
t_setrlim
(
RLIMIT_DATA
,
0
) <
0
)
17
r
= -
1
;
18
if
(!
r
)
19
/* use up libc reserves if any */
20
while
(
malloc
(
1
));
21
return
r
;
22
}