comparison auto/unix @ 5707:31dd63dcb9ea

Events: use eventfd() instead of syscall(SYS_eventfd) if possible. This fixes --with-file-aio support on systems that lack eventfd() syscall, notably aarch64 Linux. The syscall(SYS_eventfd) may still be necessary on systems that have eventfd() syscall in the kernel but lack it in glibc, e.g. as seen in the current CentOS 5 release.
author Ruslan Ermilov <ru@nginx.com>
date Fri, 23 May 2014 16:37:05 +0400
parents 692afcea9d0d
children b92d5a26d55f
comparison
equal deleted inserted replaced
5706:a2bf26774cd3 5707:31dd63dcb9ea
396 n = aio_read(&iocb)" 396 n = aio_read(&iocb)"
397 . auto/feature 397 . auto/feature
398 398
399 if [ $ngx_found = yes ]; then 399 if [ $ngx_found = yes ]; then
400 CORE_SRCS="$CORE_SRCS $FILE_AIO_SRCS" 400 CORE_SRCS="$CORE_SRCS $FILE_AIO_SRCS"
401 401 fi
402 elif [ $ngx_found = no ]; then 402
403 if [ $ngx_found = no ]; then
403 404
404 ngx_feature="Linux AIO support" 405 ngx_feature="Linux AIO support"
405 ngx_feature_name="NGX_HAVE_FILE_AIO" 406 ngx_feature_name="NGX_HAVE_FILE_AIO"
406 ngx_feature_run=no 407 ngx_feature_run=no
407 ngx_feature_incs="#include <linux/aio_abi.h> 408 ngx_feature_incs="#include <linux/aio_abi.h>
408 #include <sys/syscall.h>" 409 #include <sys/eventfd.h>"
409 ngx_feature_path= 410 ngx_feature_path=
410 ngx_feature_libs= 411 ngx_feature_libs=
412 ngx_feature_test="struct iocb iocb;
413 iocb.aio_lio_opcode = IOCB_CMD_PREAD;
414 iocb.aio_flags = IOCB_FLAG_RESFD;
415 iocb.aio_resfd = -1;
416 (void) eventfd(0, 0)"
417 . auto/feature
418
419 if [ $ngx_found = yes ]; then
420 have=NGX_HAVE_EVENTFD . auto/have
421 have=NGX_HAVE_SYS_EVENTFD_H . auto/have
422 CORE_SRCS="$CORE_SRCS $LINUX_AIO_SRCS"
423 fi
424 fi
425
426 if [ $ngx_found = no ]; then
427
428 ngx_feature="Linux AIO support (SYS_eventfd)"
429 ngx_feature_incs="#include <linux/aio_abi.h>
430 #include <sys/syscall.h>"
411 ngx_feature_test="int n = SYS_eventfd; 431 ngx_feature_test="int n = SYS_eventfd;
412 struct iocb iocb; 432 struct iocb iocb;
413 iocb.aio_lio_opcode = IOCB_CMD_PREAD; 433 iocb.aio_lio_opcode = IOCB_CMD_PREAD;
414 iocb.aio_flags = IOCB_FLAG_RESFD; 434 iocb.aio_flags = IOCB_FLAG_RESFD;
415 iocb.aio_resfd = -1;" 435 iocb.aio_resfd = -1;"
416 . auto/feature 436 . auto/feature
417 437
418 if [ $ngx_found = yes ]; then 438 if [ $ngx_found = yes ]; then
419 have=NGX_HAVE_EVENTFD . auto/have 439 have=NGX_HAVE_EVENTFD . auto/have
420 CORE_SRCS="$CORE_SRCS $LINUX_AIO_SRCS" 440 CORE_SRCS="$CORE_SRCS $LINUX_AIO_SRCS"
421 441 fi
422 else 442 fi
423 cat << END 443
444 if [ $ngx_found = no ]; then
445 cat << END
424 446
425 $0: no supported file AIO was found 447 $0: no supported file AIO was found
426 Currently file AIO is supported on FreeBSD 4.3+ and Linux 2.6.22+ only 448 Currently file AIO is supported on FreeBSD 4.3+ and Linux 2.6.22+ only
427 449
428 END 450 END
429 exit 1 451 exit 1
430 fi
431 fi 452 fi
432 fi 453 fi
433 454
434 455
435 have=NGX_HAVE_UNIX_DOMAIN . auto/have 456 have=NGX_HAVE_UNIX_DOMAIN . auto/have