Do note that according to man sendfile, "Other UNIX systems implement
sendfile() with different semantics and prototypes."
If this is something we care about, a better check is needed.
Suggested-by: Karel Zak <kzak@redhat.com>
Reviewed-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Egor Chelak <egor.chelak@gmail.com>
qsort_r \
rpmatch \
scandirat \
+ sendfile \
setprogname \
setresgid \
setresuid \
#include <unistd.h>
#include <sys/time.h>
#include <sys/resource.h>
+#ifdef HAVE_SENDFILE
#include <sys/sendfile.h>
+#endif
#include <string.h>
#include "c.h"
/* Copies the contents of a file. Returns -1 on read error, -2 on write error. */
int ul_copy_file(int from, int to)
{
+#ifdef HAVE_SENDFILE
struct stat st;
ssize_t nw;
off_t left;
if (nw < 0)
return copy_file_simple(from, to);
return 0;
+#else
+ return copy_file_simple(from, to);
+#endif
}