1 : /*
2 : * Copyright (c) 2011 The Native Client Authors. All rights reserved.
3 : * Use of this source code is governed by a BSD-style license that can be
4 : * found in the LICENSE file.
5 : */
6 :
7 : #include <errno.h>
8 : #include <stdio.h>
9 : #include "native_client/src/include/nacl_platform.h"
10 : #include "native_client/src/shared/platform/platform_init.h"
11 : #include "native_client/src/shared/platform/nacl_check.h"
12 : #include "native_client/src/trusted/service_runtime/sel_ldr.h"
13 : #include "native_client/src/trusted/service_runtime/sel_memory.h"
14 : #include "native_client/src/trusted/validator/ncvalidate.h"
15 :
16 1 : void run_check(void) {
17 : int error;
18 : void* page;
19 1 : int size = NACL_MAP_PAGESIZE;
20 1 : if (0 != (error = NaClPageAlloc(&page, size))) {
21 0 : errno = -error;
22 0 : perror("NaClPageAlloc");
23 0 : abort();
24 : }
25 :
26 1 : NaClPageFree(page, size);
27 1 : }
28 :
29 1 : int main(int argc, char* argv[]) {
30 : int i;
31 : UNREFERENCED_PARAMETER(argc);
32 : UNREFERENCED_PARAMETER(argv);
33 :
34 1 : NaClPlatformInit();
35 :
36 1 : for (i = 0; i < 1000; i++) {
37 1 : run_check();
38 1 : }
39 :
40 1 : NaClPlatformFini();
41 :
42 1 : return 0;
43 1 : }
|