summaryrefslogtreecommitdiffhomepage
path: root/auto/mmap
blob: 8ecdf6706fa27eab23e53a62963c8c4fdad20b6f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87

# Copyright (C) Igor Sysoev
# Copyright (C) NGINX, Inc.


# Linux, FreeBSD, Solaris, MacOSX.

nxt_feature="MAP_ANON"
nxt_feature_name=NXT_HAVE_MAP_ANON
nxt_feature_run=yes
nxt_feature_incs=
nxt_feature_libs=
nxt_feature_test="#include <stdlib.h>
                  #include <sys/mman.h>

                  int main() {
                      if (mmap(NULL, 4096, PROT_READ | PROT_WRITE,
                               MAP_PRIVATE | MAP_ANON, -1, 0)
                            == MAP_FAILED)
                          return 1;
                      return 0;
                  }"
. auto/feature


if [ $nxt_found = no ]; then

    # Linux, Solaris, HP-UX.

    nxt_feature="MAP_ANONYMOUS"
    nxt_feature_name=NXT_HAVE_MAP_ANONYMOUS
    nxt_feature_run=yes
    nxt_feature_incs=
    nxt_feature_libs=
    nxt_feature_test="#include <stdlib.h>
                      #include <sys/mman.h>

                      int main() {
                          if (mmap(NULL, 4096, PROT_READ | PROT_WRITE,
                                   MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)
                                == MAP_FAILED)
                              return 1;
                          return 0;
                      }"
    . auto/feature
fi


# Linux.

nxt_feature="MAP_POPULATE"
nxt_feature_name=NXT_HAVE_MAP_POPULATE
nxt_feature_run=no
nxt_feature_incs=
nxt_feature_libs=
nxt_feature_test="#include <stdlib.h>
                  #include <sys/mman.h>

                  int main() {
                      if (mmap(NULL, 4096, PROT_READ | PROT_WRITE,
                               MAP_SHARED | MAP_POPULATE, -1, 0)
                            == MAP_FAILED)
                          return 1;
                      return 0;
                  }"
. auto/feature


# FreeBSD.

nxt_feature="MAP_PREFAULT_READ"
nxt_feature_name=NXT_HAVE_MAP_PREFAULT_READ
nxt_feature_run=yes
nxt_feature_incs=
nxt_feature_libs=
nxt_feature_test="#include <stdlib.h>
                  #include <sys/mman.h>

                  int main() {
                      if (mmap(NULL, 4096, PROT_READ | PROT_WRITE,
                               MAP_PRIVATE | MAP_ANON | MAP_PREFAULT_READ,
                               -1, 0)
                            == MAP_FAILED)
                          return 1;
                      return 0;
                  }"
. auto/feature