From: Volker Lendecke Date: Mon, 16 Jul 2012 10:44:42 +0000 (+0200) Subject: config: The AIO engine is indepent of HAVE_AIO now X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=4a9b5cce92d65317fee4583f1ece4af7a3ae9558;p=mdw%2Fsamba.git config: The AIO engine is indepent of HAVE_AIO now Compile the basic aio engine always, it works via libasys/pthreadpool_sync in a sync fashion even if no pthreads are around. Everything else (linux aio, posix aio, aio fork) is now compiled as modules based on specific system capabilities Signed-off-by: Jeremy Allison --- diff --git a/source3/configure.in b/source3/configure.in index b5fd8c253e..4d3db00e40 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -5542,20 +5542,19 @@ int main() { struct aiocb a; return aio_suspend(&a, 1, NULL); }])], fi fi -if test x"$samba_cv_HAVE_AIO" = x"yes"; then - if test x"$samba_cv_msghdr_msg_control" = x"yes" -o \ - x"$samba_cv_msghdr_msg_acctright" = x"yes"; then - default_shared_modules="$default_shared_modules vfs_aio_fork" - fi +if test x"$samba_cv_msghdr_msg_control" = x"yes" -o \ + x"$samba_cv_msghdr_msg_acctright" = x"yes"; then + default_shared_modules="$default_shared_modules vfs_aio_fork" +fi # Check for Linux kernel aio support. - case "$host_os" in - *linux*) - AC_CHECK_LIB(aio,io_submit,[AIO_LIBS="$LIBS -laio"]) - AC_CACHE_CHECK([for Linux kernel asynchronous io support],samba_cv_HAVE_LINUX_KERNEL_AIO,[ - aio_LIBS=$LIBS - LIBS=$AIO_LIBS - AC_TRY_LINK([#include +case "$host_os" in +*linux*) + AC_CHECK_LIB(aio,io_submit,[AIO_LIBS="$LIBS -laio"]) + AC_CACHE_CHECK([for Linux kernel asynchronous io support],samba_cv_HAVE_LINUX_KERNEL_AIO,[ + aio_LIBS=$LIBS + LIBS=$AIO_LIBS + AC_TRY_LINK([#include #include #include #include @@ -5577,13 +5576,11 @@ io_submit(ctx, 1, &ioc); io_getevents(ctx, 1, 1, &ioev, &ts);], samba_cv_HAVE_LINUX_KERNEL_AIO=yes,samba_cv_HAVE_LINUX_KERNEL_AIO=no) LIBS=$aio_LIBS]) - if test x"$samba_cv_HAVE_LINUX_KERNEL_AIO" = x"yes"; then - AC_DEFINE(HAVE_AIO, 1, [Using asynchronous io]) - default_shared_modules="$default_shared_modules vfs_aio_linux" - fi - ;; - esac -fi + if test x"$samba_cv_HAVE_LINUX_KERNEL_AIO" = x"yes"; then + default_shared_modules="$default_shared_modules vfs_aio_linux" + fi + ;; +esac if test x"$samba_cv_HAVE_AIO" = x"yes"; then default_shared_modules="$default_shared_modules vfs_aio_posix" diff --git a/source3/modules/vfs_aio_fork.c b/source3/modules/vfs_aio_fork.c index c8a1fdc0f3..1bbdae2985 100644 --- a/source3/modules/vfs_aio_fork.c +++ b/source3/modules/vfs_aio_fork.c @@ -27,6 +27,8 @@ #include "lib/async_req/async_sock.h" #include "lib/util/tevent_unix.h" +#undef recvmsg + #ifndef MAP_FILE #define MAP_FILE 0 #endif diff --git a/source3/wscript b/source3/wscript index be39a6f845..90a4b76570 100755 --- a/source3/wscript +++ b/source3/wscript @@ -374,9 +374,14 @@ return acl_get_perm_np(permset_d, perm); conf.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg='Checking for aio_error', headers='aio.h', lib='aio rt') conf.CHECK_CODE('struct aiocb a; return aio_cancel(1, &a);', 'HAVE_AIO_CANCEL', msg='Checking for aio_cancel', headers='aio.h', lib='aio rt') conf.CHECK_CODE('struct aiocb a; return aio_suspend(&a, 1, NULL);', 'HAVE_AIO_SUSPEND', msg='Checking for aio_suspend', headers='aio.h', lib='aio rt') - if host_os.rfind('linux') > -1: - conf.CHECK_FUNCS_IN('io_submit', 'aio') - conf.CHECK_CODE(''' + if not conf.CONFIG_SET('HAVE_AIO'): + conf.DEFINE('HAVE_NO_AIO', '1') + else: + conf.DEFINE('HAVE_NO_AIO', '1') + + if host_os.rfind('linux') > -1: + conf.CHECK_FUNCS_IN('io_submit', 'aio') + conf.CHECK_CODE(''' struct io_event ioev; struct iocb *ioc; io_context_t ctx; @@ -397,11 +402,6 @@ io_getevents(ctx, 1, 1, &ioev, &ts); headers='unistd.h stdlib.h sys/types.h fcntl.h sys/eventfd.h libaio.h', lib='aio') - if not conf.CONFIG_SET('HAVE_AIO'): - conf.DEFINE('HAVE_NO_AIO', '1') - else: - conf.DEFINE('HAVE_NO_AIO', '1') - conf.CHECK_CODE(''' struct msghdr msg; union { @@ -1463,14 +1463,16 @@ main() { if conf.CONFIG_SET('HAVE_STATFS_F_FSID'): default_shared_modules.extend(TO_LIST('vfs_fileid')) - if conf.CONFIG_SET('HAVE_AIO') and (conf.CONFIG_SET('HAVE_MSGHDR_MSG_CONTROL') or conf.CONFIG_SET('HAVE_MSGHDR_MSG_ACCTRIGHTS')): + if (conf.CONFIG_SET('HAVE_MSGHDR_MSG_CONTROL') or conf.CONFIG_SET('HAVE_MSGHDR_MSG_ACCTRIGHTS')): default_shared_modules.extend(TO_LIST('vfs_aio_fork')) - if conf.CONFIG_SET('HAVE_AIO') and Options.options.with_pthreadpool: + if Options.options.with_pthreadpool: default_shared_modules.extend(TO_LIST('vfs_aio_pthread')) + + if conf.CONFIG_SET('HAVE_AIO'): default_shared_modules.extend(TO_LIST('vfs_aio_posix')) - if conf.CONFIG_SET('HAVE_AIO') and conf.CONFIG_SET('HAVE_LINUX_KERNEL_AIO'): + if conf.CONFIG_SET('HAVE_LINUX_KERNEL_AIO'): default_shared_modules.extend(TO_LIST('vfs_aio_linux')) if conf.CONFIG_SET('HAVE_LDAP'):