xref: /unit/auto/files (revision 2228:f403dc1e3ec1)
1
2# Copyright (C) Igor Sysoev
3# Copyright (C) NGINX, Inc.
4
5
6# Linux 2.6, FreeBSD 8.2, 9.1, Solaris 11.
7
8nxt_feature="posix_fadvise()"
9nxt_feature_name=NXT_HAVE_POSIX_FADVISE
10nxt_feature_run=
11nxt_feature_incs=
12nxt_feature_libs=
13nxt_feature_test="#include <fcntl.h>
14
15                  int main(void) {
16                      (void) posix_fadvise(0, 0, 0, POSIX_FADV_WILLNEED);
17                      return 0;
18                  }"
19. auto/feature
20
21
22# FreeBSD 8.0.
23
24nxt_feature="fcntl(F_READAHEAD)"
25nxt_feature_name=NXT_HAVE_READAHEAD
26nxt_feature_run=
27nxt_feature_incs=
28nxt_feature_libs=
29nxt_feature_test="#include <fcntl.h>
30
31                  int main(void) {
32                      (void) fcntl(0, F_READAHEAD, 1024);
33                      return 0;
34                  }"
35. auto/feature
36
37
38# MacOSX, FreeBSD 8.0.
39
40nxt_feature="fcntl(F_RDAHEAD)"
41nxt_feature_name=NXT_HAVE_RDAHEAD
42nxt_feature_run=
43nxt_feature_incs=
44nxt_feature_libs=
45nxt_feature_test="#include <fcntl.h>
46
47                  int main(void) {
48                      (void) fcntl(0, F_RDAHEAD, 1);
49                      return 0;
50                  }"
51. auto/feature
52
53
54nxt_feature="openat2()"
55nxt_feature_name=NXT_HAVE_OPENAT2
56nxt_feature_run=
57nxt_feature_incs=
58nxt_feature_libs=
59nxt_feature_test="#include <fcntl.h>
60                  #include <unistd.h>
61                  #include <sys/syscall.h>
62                  #include <linux/openat2.h>
63                  #include <string.h>
64
65                  int main(void) {
66                      struct open_how  how;
67
68                      memset(&how, 0, sizeof(how));
69
70                      how.flags = O_RDONLY;
71                      how.mode = O_NONBLOCK;
72                      how.resolve = RESOLVE_IN_ROOT
73                                    | RESOLVE_NO_SYMLINKS
74                                    | RESOLVE_NO_XDEV;
75
76                      int fd = syscall(SYS_openat2, AT_FDCWD, \".\",
77                                       &how, sizeof(how));
78                      if (fd == -1)
79                          return 1;
80
81                      return 0;
82                  }"
83. auto/feature
84