xref: /unit/auto/mmap (revision 0:a63ceefd6ab0)
1*0Sigor@sysoev.ru
2*0Sigor@sysoev.ru# Copyright (C) Igor Sysoev
3*0Sigor@sysoev.ru# Copyright (C) NGINX, Inc.
4*0Sigor@sysoev.ru
5*0Sigor@sysoev.ru
6*0Sigor@sysoev.ru# Linux, FreeBSD, Solaris, MacOSX.
7*0Sigor@sysoev.ru
8*0Sigor@sysoev.runxt_feature="MAP_ANON"
9*0Sigor@sysoev.runxt_feature_name=NXT_HAVE_MAP_ANON
10*0Sigor@sysoev.runxt_feature_run=yes
11*0Sigor@sysoev.runxt_feature_incs=
12*0Sigor@sysoev.runxt_feature_libs=
13*0Sigor@sysoev.runxt_feature_test="#include <stdlib.h>
14*0Sigor@sysoev.ru                  #include <sys/mman.h>
15*0Sigor@sysoev.ru
16*0Sigor@sysoev.ru                  int main() {
17*0Sigor@sysoev.ru                      if (mmap(NULL, 4096, PROT_READ | PROT_WRITE,
18*0Sigor@sysoev.ru                               MAP_PRIVATE | MAP_ANON, -1, 0)
19*0Sigor@sysoev.ru                            == MAP_FAILED)
20*0Sigor@sysoev.ru                          return 1;
21*0Sigor@sysoev.ru                      return 0;
22*0Sigor@sysoev.ru                  }"
23*0Sigor@sysoev.ru. auto/feature
24*0Sigor@sysoev.ru
25*0Sigor@sysoev.ru
26*0Sigor@sysoev.ruif [ $nxt_found = no ]; then
27*0Sigor@sysoev.ru
28*0Sigor@sysoev.ru    # Linux, Solaris, HP-UX.
29*0Sigor@sysoev.ru
30*0Sigor@sysoev.ru    nxt_feature="MAP_ANONYMOUS"
31*0Sigor@sysoev.ru    nxt_feature_name=NXT_HAVE_MAP_ANONYMOUS
32*0Sigor@sysoev.ru    nxt_feature_run=yes
33*0Sigor@sysoev.ru    nxt_feature_incs=
34*0Sigor@sysoev.ru    nxt_feature_libs=
35*0Sigor@sysoev.ru    nxt_feature_test="#include <stdlib.h>
36*0Sigor@sysoev.ru                      #include <sys/mman.h>
37*0Sigor@sysoev.ru
38*0Sigor@sysoev.ru                      int main() {
39*0Sigor@sysoev.ru                          if (mmap(NULL, 4096, PROT_READ | PROT_WRITE,
40*0Sigor@sysoev.ru                                   MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)
41*0Sigor@sysoev.ru                                == MAP_FAILED)
42*0Sigor@sysoev.ru                              return 1;
43*0Sigor@sysoev.ru                          return 0;
44*0Sigor@sysoev.ru                      }"
45*0Sigor@sysoev.ru    . auto/feature
46*0Sigor@sysoev.rufi
47*0Sigor@sysoev.ru
48*0Sigor@sysoev.ru
49*0Sigor@sysoev.ru# Linux.
50*0Sigor@sysoev.ru
51*0Sigor@sysoev.runxt_feature="MAP_POPULATE"
52*0Sigor@sysoev.runxt_feature_name=NXT_HAVE_MAP_POPULATE
53*0Sigor@sysoev.runxt_feature_run=no
54*0Sigor@sysoev.runxt_feature_incs=
55*0Sigor@sysoev.runxt_feature_libs=
56*0Sigor@sysoev.runxt_feature_test="#include <stdlib.h>
57*0Sigor@sysoev.ru                  #include <sys/mman.h>
58*0Sigor@sysoev.ru
59*0Sigor@sysoev.ru                  int main() {
60*0Sigor@sysoev.ru                      if (mmap(NULL, 4096, PROT_READ | PROT_WRITE,
61*0Sigor@sysoev.ru                               MAP_SHARED | MAP_POPULATE, -1, 0)
62*0Sigor@sysoev.ru                            == MAP_FAILED)
63*0Sigor@sysoev.ru                          return 1;
64*0Sigor@sysoev.ru                      return 0;
65*0Sigor@sysoev.ru                  }"
66*0Sigor@sysoev.ru. auto/feature
67*0Sigor@sysoev.ru
68*0Sigor@sysoev.ru
69*0Sigor@sysoev.ru# FreeBSD.
70*0Sigor@sysoev.ru
71*0Sigor@sysoev.runxt_feature="MAP_PREFAULT_READ"
72*0Sigor@sysoev.runxt_feature_name=NXT_HAVE_MAP_PREFAULT_READ
73*0Sigor@sysoev.runxt_feature_run=yes
74*0Sigor@sysoev.runxt_feature_incs=
75*0Sigor@sysoev.runxt_feature_libs=
76*0Sigor@sysoev.runxt_feature_test="#include <stdlib.h>
77*0Sigor@sysoev.ru                  #include <sys/mman.h>
78*0Sigor@sysoev.ru
79*0Sigor@sysoev.ru                  int main() {
80*0Sigor@sysoev.ru                      if (mmap(NULL, 4096, PROT_READ | PROT_WRITE,
81*0Sigor@sysoev.ru                               MAP_PRIVATE | MAP_ANON | MAP_PREFAULT_READ,
82*0Sigor@sysoev.ru                               -1, 0)
83*0Sigor@sysoev.ru                            == MAP_FAILED)
84*0Sigor@sysoev.ru                          return 1;
85*0Sigor@sysoev.ru                      return 0;
86*0Sigor@sysoev.ru                  }"
87*0Sigor@sysoev.ru. auto/feature
88