When you install the source rpm for pure-ftpd you would see that sendfile code is there with proper flags, and pure-ftpd does not seem to use it
If you check the pure-ftpd binary for any references to sendfile() in pure-ftpd binary, then there won't be any
$ nm /usr/sbin/pure-ftpd | grep sendfile
When you look deeper into the code there is a bug in src/ftpd.h of pure-ftpd bundled with SLES11SP1 which causes mmap to be used instead of the preferred sendfile()
Install the source rpm and check the sources and Create the source tree for the package. Unpack the source tar ball and apply patches
$ rpm -ivh pure-ftpd-1.0.21-183.11.2.src.rpm
$ cd /usr/src/packages $ rpmbuild -bp SPECS/pure-ftpd.spec
Once the sources the sources are installed, if we look at how sendfile can be enabled from Makefile/configure scripts
# grep SENDFILE * | grep LINUX | grep 64 config.h.in:#undef SENDFILE64_LINUX configure:#define SENDFILE64_LINUX configure.ac: AC_DEFINE(SENDFILE64_LINUX,,[define if you have a linuxish sendfile64])
But the ftp sources in src/ directory
# grep SENDFILE * | grep LINUX | grep 64 ftpd.h:# undef SENDFILE64_LINUX ftpd.h: defined(SENDFILE_HPUX) || defined(SENDFILE64_LINUX) ftpd.h.orig:# undef SENDFILE_LINUX64 ftpd.h.orig: defined(SENDFILE_HPUX) || defined(SENDFILE_LINUX64)
The configure/makefile scripts use SENDFILE64_LINUX, whereas the ftp sources use SENDFILE_LINUX64. Due to this incorrect macro variable name being used in sources, even though sendfile is enabled from configure/makefile level, the code generated with SLES11SP1 does not use sendfile().
http://bradthemad.org/tech/notes/patching_rpms.php contains details of how to make changes to the package and rebuild the rpm
No comments:
Post a Comment