There's no need for high performance in these little tests, so instead of
supporting various platform-specific sendfile() implementations, just use a local read-write function.
#include "linux/input.h"
#include <sys/ptrace.h>
#include <sys/resource.h>
-#include <sys/sendfile.h>
#include <sys/timerfd.h>
#include <sys/wait.h>
#include <sys/stat.h>
src,
strerror(errno));
/* lazy, just check for error and empty file copy */
- litest_assert_int_gt(sendfile(out, in, NULL, 40960), 0);
+ litest_assert_int_gt(litest_send_file(out, in), 0);
close(out);
close(in);
return is_external;
}
+static inline int
+litest_send_file(int sock, int fd)
+{
+ char buf[40960];
+ int n = read(fd, buf, 40960);
+ return write(sock, buf, n);
+}
+
#undef ck_assert_double_eq
#undef ck_assert_double_ne
#undef ck_assert_double_lt