Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
libowfat/trysendfile.c

24 lines
557 B

#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");
}
#else
#error unsupported architecture
#endif