xref: /unit/auto/files (revision 1855:a946d8cd7f8c)
10Sigor@sysoev.ru
20Sigor@sysoev.ru# Copyright (C) Igor Sysoev
30Sigor@sysoev.ru# Copyright (C) NGINX, Inc.
40Sigor@sysoev.ru
50Sigor@sysoev.ru
60Sigor@sysoev.ru# Linux 2.6, FreeBSD 8.2, 9.1, Solaris 11.
70Sigor@sysoev.ru
80Sigor@sysoev.runxt_feature="posix_fadvise()"
90Sigor@sysoev.runxt_feature_name=NXT_HAVE_POSIX_FADVISE
100Sigor@sysoev.runxt_feature_run=
110Sigor@sysoev.runxt_feature_incs=
120Sigor@sysoev.runxt_feature_libs=
130Sigor@sysoev.runxt_feature_test="#include <fcntl.h>
140Sigor@sysoev.ru
150Sigor@sysoev.ru                  int main() {
160Sigor@sysoev.ru                      (void) posix_fadvise(0, 0, 0, POSIX_FADV_WILLNEED);
170Sigor@sysoev.ru                      return 0;
180Sigor@sysoev.ru                  }"
190Sigor@sysoev.ru. auto/feature
200Sigor@sysoev.ru
210Sigor@sysoev.ru
220Sigor@sysoev.ru# FreeBSD 8.0.
230Sigor@sysoev.ru
240Sigor@sysoev.runxt_feature="fcntl(F_READAHEAD)"
250Sigor@sysoev.runxt_feature_name=NXT_HAVE_READAHEAD
260Sigor@sysoev.runxt_feature_run=
270Sigor@sysoev.runxt_feature_incs=
280Sigor@sysoev.runxt_feature_libs=
290Sigor@sysoev.runxt_feature_test="#include <fcntl.h>
300Sigor@sysoev.ru
310Sigor@sysoev.ru                  int main() {
320Sigor@sysoev.ru                      (void) fcntl(0, F_READAHEAD, 1024);
330Sigor@sysoev.ru                      return 0;
340Sigor@sysoev.ru                  }"
350Sigor@sysoev.ru. auto/feature
360Sigor@sysoev.ru
370Sigor@sysoev.ru
380Sigor@sysoev.ru# MacOSX, FreeBSD 8.0.
390Sigor@sysoev.ru
400Sigor@sysoev.runxt_feature="fcntl(F_RDAHEAD)"
410Sigor@sysoev.runxt_feature_name=NXT_HAVE_RDAHEAD
420Sigor@sysoev.runxt_feature_run=
430Sigor@sysoev.runxt_feature_incs=
440Sigor@sysoev.runxt_feature_libs=
450Sigor@sysoev.runxt_feature_test="#include <fcntl.h>
460Sigor@sysoev.ru
470Sigor@sysoev.ru                  int main() {
480Sigor@sysoev.ru                      (void) fcntl(0, F_RDAHEAD, 1);
490Sigor@sysoev.ru                      return 0;
500Sigor@sysoev.ru                  }"
510Sigor@sysoev.ru. auto/feature
52*1855Sz.hong@f5.com
53*1855Sz.hong@f5.com
54*1855Sz.hong@f5.comnxt_feature="openat2()"
55*1855Sz.hong@f5.comnxt_feature_name=NXT_HAVE_OPENAT2
56*1855Sz.hong@f5.comnxt_feature_run=
57*1855Sz.hong@f5.comnxt_feature_incs=
58*1855Sz.hong@f5.comnxt_feature_libs=
59*1855Sz.hong@f5.comnxt_feature_test="#include <fcntl.h>
60*1855Sz.hong@f5.com                  #include <unistd.h>
61*1855Sz.hong@f5.com                  #include <sys/syscall.h>
62*1855Sz.hong@f5.com                  #include <linux/openat2.h>
63*1855Sz.hong@f5.com                  #include <string.h>
64*1855Sz.hong@f5.com
65*1855Sz.hong@f5.com                  int main() {
66*1855Sz.hong@f5.com                      struct open_how  how;
67*1855Sz.hong@f5.com
68*1855Sz.hong@f5.com                      memset(&how, 0, sizeof(how));
69*1855Sz.hong@f5.com
70*1855Sz.hong@f5.com                      how.flags = O_RDONLY;
71*1855Sz.hong@f5.com                      how.mode = O_NONBLOCK;
72*1855Sz.hong@f5.com                      how.resolve = RESOLVE_IN_ROOT
73*1855Sz.hong@f5.com                                    | RESOLVE_NO_SYMLINKS
74*1855Sz.hong@f5.com                                    | RESOLVE_NO_XDEV;
75*1855Sz.hong@f5.com
76*1855Sz.hong@f5.com                      int fd = syscall(SYS_openat2, AT_FDCWD, \".\",
77*1855Sz.hong@f5.com                                       &how, sizeof(how));
78*1855Sz.hong@f5.com                      if (fd == -1)
79*1855Sz.hong@f5.com                          return 1;
80*1855Sz.hong@f5.com
81*1855Sz.hong@f5.com                      return 0;
82*1855Sz.hong@f5.com                  }"
83*1855Sz.hong@f5.com. auto/feature
84