Browse Source

test for BSD sendfile

master
Felix von Leitner 18 years ago
parent
commit
b67f816052
  1. 12
      GNUmakefile
  2. 16
      trybsdsf.c

12
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 \

16
trybsdsf.c

@ -0,0 +1,16 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <errno.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
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);
}
Loading…
Cancel
Save