[PATCH] fix sendfile detection on Solaris and waf logic

Jeremy Allison jra at samba.org
Mon Jan 7 18:20:11 UTC 2019


On Mon, Jan 07, 2019 at 01:24:29AM +0100, Björn JACKE via samba-technical wrote:
> Hi,
> 
> the one fixes sendfile detection on Solaris, the other one fixes the waf logic
> with making "auto" the default and fixes bug 9707 at the same time.
> 
> Review appreciated!

LGTM Björn, RB+ and pushed.

Thanks,

Jeremy.

> From 4d109756364029479fd368f1ab22571752d3f76d Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bjacke at samba.org>
> Date: Mon, 7 Jan 2019 00:28:34 +0100
> Subject: [PATCH 1/2] waf: fix waf errors with sendfail detection on Solaris
> 
> Signed-off-by: Bjoern Jacke <bjacke at samba.org>
> ---
>  source3/wscript | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/source3/wscript b/source3/wscript
> index d054dbaed1f8..67941258efe6 100644
> --- a/source3/wscript
> +++ b/source3/wscript
> @@ -1340,8 +1340,8 @@ main() {
>                  conf.DEFINE('HAVE_SENDFILE', '1')
>                  conf.DEFINE('HPUX_SENDFILE_API', '1')
>                  conf.DEFINE('WITH_SENDFILE', '1')
> -        elif (host_os.rfind('solaris') > -1):
> -            conf.CHECK_FUNCS_IN('sendfile', 'sendfilev')
> +        elif (host_os.rfind('sunos') > -1):
> +            conf.CHECK_FUNCS_IN('sendfilev', 'sendfile')
>              conf.CHECK_CODE('''
>                              #include <sys/sendfile.h>,
>                              int sfvcnt;
> @@ -1361,7 +1361,8 @@ main() {
>                              nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
>                              ''',
>                              '_HAVE_SENDFILEV',
> -                            msg='Checking for solaris sendfilev support')
> +                            msg='Checking for solaris sendfilev support',
> +                            lib='sendfile')
>              if conf.CONFIG_SET('_HAVE_SENDFILEV'):
>                  conf.DEFINE('HAVE_SENDFILEV', '1')
>                  conf.DEFINE('SOLARIS_SENDFILE_API', '1')
> -- 
> 2.17.1
> 

> From 45322e68086cbfbb6eba3f4f30609ecd8a64d732 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bjacke at samba.org>
> Date: Mon, 7 Jan 2019 01:05:19 +0100
> Subject: [PATCH 2/2] waf: fix tri-state of --with-sendfile-support being auto
>  the default
> 
> --with-sendfile-support should be used automatically if it's found.
> 
> Configure now also fails reliably for all platforms when sendfile was
> explicitly requested but failed to be detected.
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=9707
> 
> Signed-off-by: Bjoern Jacke <bjacke at samba.org>
> ---
>  source3/wscript | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/source3/wscript b/source3/wscript
> index 67941258efe6..4da33afa31aa 100644
> --- a/source3/wscript
> +++ b/source3/wscript
> @@ -47,7 +47,7 @@ def options(opt):
>      opt.SAMBA3_ADD_OPTION('iprint', with_name="enable", without_name="disable")
>      opt.SAMBA3_ADD_OPTION('pam')
>      opt.SAMBA3_ADD_OPTION('quotas')
> -    opt.SAMBA3_ADD_OPTION('sendfile-support')
> +    opt.SAMBA3_ADD_OPTION('sendfile-support', default=None)
>      opt.SAMBA3_ADD_OPTION('utmp')
>      opt.SAMBA3_ADD_OPTION('avahi', with_name="enable", without_name="disable")
>      opt.SAMBA3_ADD_OPTION('iconv')
> @@ -1258,7 +1258,7 @@ main() {
>                      addmain=False,
>                      execute=True)
>  
> -    if Options.options.with_sendfile_support:
> +    if not Options.options.with_sendfile_support == False:
>          if (host_os.rfind('linux') > -1) or (host_os.rfind('gnu') > -1) or (host_os.rfind('k*bsd*-gnu') > -1) or (host_os.rfind('kopensolaris*-gnu') > -1):
>              conf.CHECK_CODE('''
>                              int tofd, fromfd;
> @@ -1273,7 +1273,6 @@ main() {
>              if conf.CONFIG_SET('_HAVE_SENDFILE'):
>                  conf.DEFINE('HAVE_SENDFILE', '1')
>                  conf.DEFINE('LINUX_SENDFILE_API', '1')
> -                conf.DEFINE('WITH_SENDFILE', '1')
>          elif (host_os.rfind('freebsd') > -1) or (host_os.rfind('dragonfly') > -1):
>              conf.CHECK_CODE('''
>                              #include <sys/types.h>
> @@ -1297,7 +1296,6 @@ main() {
>              if conf.CONFIG_SET('_HAVE_SENDFILE'):
>                  conf.DEFINE('HAVE_SENDFILE', '1')
>                  conf.DEFINE('FREEBSD_SENDFILE_API', '1')
> -                conf.DEFINE('WITH_SENDFILE', '1')
>          elif (host_os.rfind('darwin') > -1):
>              conf.CHECK_CODE('''
>                              #include <sys/types.h>
> @@ -1320,7 +1318,6 @@ main() {
>              if conf.CONFIG_SET('_HAVE_SENDFILE'):
>                  conf.DEFINE('HAVE_SENDFILE', '1')
>                  conf.DEFINE('DARWIN_SENDFILE_API', '1')
> -                conf.DEFINE('WITH_SENDFILE', '1')
>          elif (host_os.rfind('hpux') > -1) or (host_os.rfind('osf') > -1):
>              conf.CHECK_CODE('''
>                              #include <sys/socket.h>
> @@ -1339,7 +1336,6 @@ main() {
>              if conf.CONFIG_SET('_HAVE_SENDFILE'):
>                  conf.DEFINE('HAVE_SENDFILE', '1')
>                  conf.DEFINE('HPUX_SENDFILE_API', '1')
> -                conf.DEFINE('WITH_SENDFILE', '1')
>          elif (host_os.rfind('sunos') > -1):
>              conf.CHECK_FUNCS_IN('sendfilev', 'sendfile')
>              conf.CHECK_CODE('''
> @@ -1366,7 +1362,6 @@ main() {
>              if conf.CONFIG_SET('_HAVE_SENDFILEV'):
>                  conf.DEFINE('HAVE_SENDFILEV', '1')
>                  conf.DEFINE('SOLARIS_SENDFILE_API', '1')
> -                conf.DEFINE('WITH_SENDFILE', '1')
>          elif (host_os.rfind('aix') > -1):
>              conf.CHECK_CODE('''
>                              #include <sys/socket.h>
> @@ -1388,8 +1383,9 @@ main() {
>              if conf.CONFIG_SET('_HAVE_SENDFILE'):
>                  conf.DEFINE('HAVE_SENDFILE', '1')
>                  conf.DEFINE('AIX_SENDFILE_API', '1')
> -                conf.DEFINE('WITH_SENDFILE', '1')
>  
> +    if Options.options.with_sendfile_support == True and not conf.CONFIG_SET('HAVE_SENDFILE'):
> +        conf.fatal('sendfile support not found but it was requested !')
>      # Check for getcwd allowing a NULL arg.
>      conf.CHECK_CODE('''
>  #include <unistd.h>
> -- 
> 2.17.1
> 




More information about the samba-technical mailing list