Support Solaris 9 sendfile

master
leitner 21 years ago
parent 1748073c1e
commit 7ddce27f49

@ -7,6 +7,7 @@ http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/cre
http://www.sysinternals.com/ntw2k/info/comport.shtml
http://msdn.microsoft.com/msdnmag/issues/1000/winsock/default.aspx
Solaris 9: http://docs.sun.com/db/doc/816-5218/6mbcj7nrr?q=sendfile&a=view
@ -14,3 +15,4 @@ Solaris 9: http://docs.sun.com/db/doc/816-5218/6mbcj7nrr?q=sendfile&a=view
HP-UX: http://docs.hp.com/hpux/onlinedocs/B9106-90009/00/01/168-con.html
AIX: http://publib16.boulder.ibm.com/pseries/en_US/libs/commtrf2/send_file.htm

@ -1,3 +1,3 @@
#if defined(__linux__) || defined(_SGI_SOURCE) || defined(__hpux__)
#if defined(__linux__) || defined(_SGI_SOURCE) || defined(__hpux__) || defined(__sun__)
#include <alloca.h>
#endif

@ -53,6 +53,19 @@ int64 io_sendfile(int64 s,int64 fd,uint64 off,uint64 n) {
int64 io_sendfile(int64 out,int64 in,uint64 off,uint64 bytes) {
return sendfile64(out,in,off,bytes,0,0);
}
#elif defined (__sun__) && defined(__svr4__)
#define _LARGEFILE64_SOURCE
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sendfile.h>
int64 io_sendfile(int64 out,int64 in,uint64 off,uint64 bytes) {
off64_t o=off;
return sendfile64(out,in,&o,bytes);
}
#endif
#else

@ -19,6 +19,17 @@ int main() {
x, 0);
perror("sendfile");
}
#elif defined (__sun__) && defined(__svr4__)
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sendfile.h>
int main() {
off_t o;
o=0;
sendfile(1 /* dest */, 0 /* src */,&o,23 /* nbytes */);
perror("sendfile");
}
#else
#error unsupported architecture
#endif

Loading…
Cancel
Save