From eeb35890a1eefbdf6bd8fcb86fcc31233835b0df Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Wed, 26 Apr 2017 15:28:22 +0100 Subject: [PATCH] Enable use of sendfile --- doc/doc-txt/ChangeLog | 4 ++++ src/OS/os.h-Linux | 5 +++-- src/src/dkim_transport.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 1d6ad343b..4ea24a50c 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -61,6 +61,10 @@ JH/09 Avoid using a temporary file during transport using dkim. Unless a creating the signature, and read the spool data file once for the signature and again for transmission. +JH/10 Enable use of sendfile in Linux builds as default. It was disabled in + 4.77 as the kernel support then wasn't solid, having issues in 64bit + mode. Now, it's been long enough. + Exim version 4.89 ----------------- diff --git a/src/OS/os.h-Linux b/src/OS/os.h-Linux index cc1cef99b..3e9303cab 100644 --- a/src/OS/os.h-Linux +++ b/src/OS/os.h-Linux @@ -18,9 +18,10 @@ with the issue. */ /* When using the DKIM, setting HAVE_LINUX_SENDFILE can increase performance on outgoing mail a bit. Note: With older glibc versions this setting will conflict with the _FILE_OFFSET_BITS=64 setting -defined as part of the Linux CFLAGS. */ +defined as part of the Linux CFLAGS. As of 2017 those are declared +to be too old to build by default. */ -/* #define HAVE_LINUX_SENDFILE */ +#define HAVE_LINUX_SENDFILE #define F_FREESP O_TRUNC typedef struct flock flock_t; diff --git a/src/src/dkim_transport.c b/src/src/dkim_transport.c index 552e1beb1..2aba56054 100644 --- a/src/src/dkim_transport.c +++ b/src/src/dkim_transport.c @@ -58,7 +58,7 @@ if (tls_out.active != out_fd) ssize_t copied = 0; while(copied >= 0 && off < size) - copied = sendfile(tctx->u.fd, dkim_fd, &off, size - off); + copied = sendfile(out_fd, in_fd, &off, size - off); if (copied < 0) return FALSE; } -- 2.25.1