From bea398d62977e47c0f4078844a854122768fd60b Mon Sep 17 00:00:00 2001 From: Emil Mikulic Date: Fri, 21 Jul 2006 07:11:56 +0000 Subject: [PATCH] Add support for sendfile() on Solaris. --- trunk/Makefile | 2 +- trunk/darkhttpd.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/trunk/Makefile b/trunk/Makefile index 17ec638..317ce02 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -20,7 +20,7 @@ bsd linux: make darkhttpd solaris: - make darkhttpd LIBS=-lxnet + make darkhttpd LIBS="-lxnet -lsendfile" darkhttpd: darkhttpd.c $(CC) $(CFLAGS) $(LIBS) darkhttpd.c -o darkhttpd diff --git a/trunk/darkhttpd.c b/trunk/darkhttpd.c index 598bb0e..2577e58 100644 --- a/trunk/darkhttpd.c +++ b/trunk/darkhttpd.c @@ -33,6 +33,10 @@ static const int debug = 1; #include #endif +#ifdef __sun__ +#include +#endif + #include #include #include @@ -2041,7 +2045,7 @@ static ssize_t send_from_file(const int s, const int fd, } else return size; #else -#ifdef __linux +#if defined(__linux) || defined(__sun__) return sendfile(s, fd, &ofs, size); #else #define BUFSIZE 20000