Add support for sendfile() on Solaris.

This commit is contained in:
Emil Mikulic 2006-07-21 07:11:56 +00:00
parent 49fb5f3fbf
commit bea398d629
2 changed files with 6 additions and 2 deletions

View File

@ -20,7 +20,7 @@ bsd linux:
make darkhttpd make darkhttpd
solaris: solaris:
make darkhttpd LIBS=-lxnet make darkhttpd LIBS="-lxnet -lsendfile"
darkhttpd: darkhttpd.c darkhttpd: darkhttpd.c
$(CC) $(CFLAGS) $(LIBS) darkhttpd.c -o darkhttpd $(CC) $(CFLAGS) $(LIBS) darkhttpd.c -o darkhttpd

View File

@ -33,6 +33,10 @@ static const int debug = 1;
#include <sys/sendfile.h> #include <sys/sendfile.h>
#endif #endif
#ifdef __sun__
#include <sys/sendfile.h>
#endif
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -2041,7 +2045,7 @@ static ssize_t send_from_file(const int s, const int fd,
} }
else return size; else return size;
#else #else
#ifdef __linux #if defined(__linux) || defined(__sun__)
return sendfile(s, fd, &ofs, size); return sendfile(s, fd, &ofs, size);
#else #else
#define BUFSIZE 20000 #define BUFSIZE 20000