export aio presence knowledge to prevent using "aio sendfile",
if aio does not present
diff --git a/src/os/unix/ngx_file_aio_read.c b/src/os/unix/ngx_file_aio_read.c
index 19a7589..ef7a461 100644
--- a/src/os/unix/ngx_file_aio_read.c
+++ b/src/os/unix/ngx_file_aio_read.c
@@ -39,12 +39,11 @@
ngx_file_aio_read(ngx_file_t *file, u_char *buf, size_t size, off_t offset,
ngx_pool_t *pool)
{
- int n;
- ngx_event_t *ev;
- ngx_event_aio_t *aio;
- static ngx_uint_t enosys = 0;
+ int n;
+ ngx_event_t *ev;
+ ngx_event_aio_t *aio;
- if (enosys) {
+ if (!ngx_file_aio) {
return ngx_read_file(file, buf, size, offset);
}
@@ -116,7 +115,7 @@
"aio_read(\"%V\") failed", &file->name);
if (n == NGX_ENOSYS) {
- enosys = 1;
+ ngx_file_aio = 0;
return ngx_read_file(file, buf, size, offset);
}
diff --git a/src/os/unix/ngx_files.c b/src/os/unix/ngx_files.c
index 618d4e2..2264cc1 100644
--- a/src/os/unix/ngx_files.c
+++ b/src/os/unix/ngx_files.c
@@ -8,6 +8,13 @@
#include <ngx_core.h>
+#if (NGX_HAVE_FILE_AIO)
+
+ngx_uint_t ngx_file_aio = 1;
+
+#endif
+
+
ssize_t
ngx_read_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset)
{
diff --git a/src/os/unix/ngx_files.h b/src/os/unix/ngx_files.h
index 9662621..2efd247 100644
--- a/src/os/unix/ngx_files.h
+++ b/src/os/unix/ngx_files.h
@@ -313,6 +313,8 @@
ssize_t ngx_file_aio_read(ngx_file_t *file, u_char *buf, size_t size,
off_t offset, ngx_pool_t *pool);
+extern ngx_uint_t ngx_file_aio;
+
#endif
diff --git a/src/os/unix/ngx_linux_aio_read.c b/src/os/unix/ngx_linux_aio_read.c
index 3b4185c..834a11d 100644
--- a/src/os/unix/ngx_linux_aio_read.c
+++ b/src/os/unix/ngx_linux_aio_read.c
@@ -27,13 +27,12 @@
ngx_file_aio_read(ngx_file_t *file, u_char *buf, size_t size, off_t offset,
ngx_pool_t *pool)
{
- long n;
- struct iocb *piocb[1];
- ngx_event_t *ev;
- ngx_event_aio_t *aio;
- static ngx_uint_t enosys = 0;
+ long n;
+ struct iocb *piocb[1];
+ ngx_event_t *ev;
+ ngx_event_aio_t *aio;
- if (enosys) {
+ if (!ngx_file_aio) {
return ngx_read_file(file, buf, size, offset);
}
@@ -109,7 +108,7 @@
"io_submit(\"%V\") failed", &file->name);
if (n == NGX_ENOSYS) {
- enosys = 1;
+ ngx_file_aio = 0;
return ngx_read_file(file, buf, size, offset);
}