From c18a0dbf6251841a79c0dfbd5080c9c9fd68cbb4 Mon Sep 17 00:00:00 2001 From: leitner Date: Wed, 14 Jan 2004 01:11:49 +0000 Subject: [PATCH] actually check in AIX sendfile code --- io/io_sendfile.c | 25 +++++++++++++++++++++++++ t.c | 3 +++ 2 files changed, 28 insertions(+) diff --git a/io/io_sendfile.c b/io/io_sendfile.c index 27590ee..000246d 100644 --- a/io/io_sendfile.c +++ b/io/io_sendfile.c @@ -43,6 +43,31 @@ int64 io_sendfile(int64 out,int64 in,uint64 off,uint64 bytes) { return sendfile64(out,in,&o,bytes); } +#elif defined(_AIX) + +#include +#include +#include +#include + +int64 io_sendfile(int64 out,int64 in,uint64 off,uint64 bytes) { + struct sf_parms p; + int destfd=out; + p.header_data=0; + p.header_length=0; + p.file_descriptor=in; + p.file_offset=off; + p.file_bytes=bytes; + p.trailer_data=0; + p.trailer_length=0; + if (send_file(&destfd,&p,0)>=0) + return p.bytes_sent; + if (errno==EAGAIN) + return -1; + else + return -3; +} + #elif defined(__linux__) #if defined(__GLIBC__) diff --git a/t.c b/t.c index 68aece6..ca72be0 100644 --- a/t.c +++ b/t.c @@ -36,6 +36,9 @@ int main(int argc,char* argv[]) { buffer_putnlflush(buffer_1); buffer_put(buffer_1,buf,fmt_ip6ifc(buf,blubip,scope_id)); buffer_putnlflush(buffer_1); + scan_ip6("2001:7d0:0:f015:0:0:0:1",ip); + buffer_put(buffer_1,buf,fmt_ip6(buf,ip)); + buffer_putnlflush(buffer_1); #if 0 char buf[100]; int i;