From 736aba29ed8aa851defd9d3873f9bb268011b212 Mon Sep 17 00:00:00 2001 From: leitner Date: Mon, 6 Oct 2003 01:52:13 +0000 Subject: [PATCH] test for BSD sendfile --- GNUmakefile | 12 +++++++++--- trybsdsf.c | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 trybsdsf.c diff --git a/GNUmakefile b/GNUmakefile index cb25927..387cf4e 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -71,7 +71,7 @@ $(DNS_OBJS): dns.h stralloc.h taia.h tai.h uint64.h iopause.h $(CASE_OBJS): case.h $(ARRAY_OBJS): uint64.h array.h $(MULT_OBJS): uint64.h uint32.h uint16.h safemult.h -$(IO_OBJS): uint64.h array.h io.h io_internal.h taia.h tai.h haveepoll.h havekqueue.h havesigio.h +$(IO_OBJS): uint64.h array.h io.h io_internal.h taia.h tai.h haveepoll.h havekqueue.h havesigio.h havebsdsf.h iob_addbuf.o iob_addfile.o iob_new.o iob_reset.o iob_send.o: iob_internal.h iob.h @@ -121,8 +121,9 @@ t: t.o libowfat.a .PHONY: all clean tar install rename clean: - rm -f *.o *.a *.da *.bbg *.bb core t haveip6.h haven2i.h havesl.h haveinline.h \ -iopause.h select.h havekqueue.h haveepoll.h libepoll havesigio.h Makefile dep + rm -f *.o *.a *.da *.bbg *.bb core t haveip6.h haven2i.h \ +havesl.h haveinline.h iopause.h select.h havekqueue.h haveepoll.h \ +libepoll havesigio.h havebsdsf.h Makefile dep INCLUDES=buffer.h byte.h fmt.h ip4.h ip6.h mmap.h scan.h socket.h str.h stralloc.h \ uint16.h uint32.h uint64.h open.h textcode.h tai.h taia.h dns.h iopause.h case.h \ @@ -174,6 +175,11 @@ havekqueue.h: trykqueue.c if $(DIET) $(CC) $(CFLAGS) -c trykqueue.c >/dev/null 2>&1; then echo "#define HAVE_KQUEUE"; fi > $@ -rm -f trykqueue.o +havebsdsf.h: trybsdsf.c + -rm -f $@ + if $(DIET) $(CC) $(CFLAGS) -c trybsdsf.c >/dev/null 2>&1; then echo "#define HAVE_BSDSENDFILE"; fi > $@ + -rm -f trybsdsf.o + haveepoll.h: tryepoll.c -rm -f $@ if $(DIET) $(CC) $(CFLAGS) -o tryepoll tryepoll.c >/dev/null 2>&1; then echo "#define HAVE_EPOLL 1"; else \ diff --git a/trybsdsf.c b/trybsdsf.c new file mode 100644 index 0000000..9e931f6 --- /dev/null +++ b/trybsdsf.c @@ -0,0 +1,16 @@ +#include +#include +#include +#include +#include +#include + +int main() { + struct sf_hdtr hdr; + struct iovec v[17+23]; + int r,fd=1; + off_t sbytes; + hdr.headers=v; hdr.hdr_cnt=17; + hdr.trailers=v+headers; hdr.trl_cnt=23; + r=sendfile(0,1,37,42,&hdr,&sbytes,0); +}