From d3581b58890389794de5d5222c91a0129873e95c Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Sat, 18 Jan 2014 21:24:58 +0100 Subject: cache: use sendfile() instead of a pair of read() + write() sendfile() does the same job and avoids to copy the content into userland and back. One has to define NO_SENDFILE in case the OS (kernel / libc) does not supported. It is disabled by default on non-linux environemnts. According to the glibc, sendfile64() was added in Linux 2.4 (so it has been there for a while) but after browsing over the mapage of FreeBSD's I noticed that the prototype is little different. Signed-off-by: Sebastian Andrzej Siewior --- cgit.mk | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cgit.mk') diff --git a/cgit.mk b/cgit.mk index 056c3f9..3b8b79a 100644 --- a/cgit.mk +++ b/cgit.mk @@ -68,6 +68,14 @@ ifeq ($(findstring BSD,$(uname_S)),) CGIT_LIBS += -ldl endif +# glibc 2.1+ offers sendfile which the most common C library on Linux +ifeq ($(uname_S),Linux) + HAVE_LINUX_SENDFILE = YesPlease +endif + +ifdef HAVE_LINUX_SENDFILE + CGIT_CFLAGS += -DHAVE_LINUX_SENDFILE +endif CGIT_OBJ_NAMES += cgit.o CGIT_OBJ_NAMES += cache.o -- cgit v1.2.3-70-g09d2