You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
789 B
C
36 lines
789 B
C
#ifdef __hpux__
|
|
#include <sys/types.h>
|
|
#include <sys/uio.h>
|
|
#include <sys/socket.h>
|
|
|
|
int main() {
|
|
/*
|
|
sbsize_t sendfile(int s, int fd, off_t offset, bsize_t nbytes,
|
|
const struct iovec *hdtrl, int flags);
|
|
*/
|
|
struct iovec x[2];
|
|
int fd=open("havesendfile.c",0);
|
|
x[0].iov_base="header";
|
|
x[0].iov_len=6;
|
|
x[1].iov_base="footer";
|
|
x[1].iov_len=6;
|
|
sendfile(1 /* dest socket */,fd /* src file */,
|
|
0 /* offset */, 23 /* nbytes */,
|
|
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
|