Browse Source

actually check in AIX sendfile code

master
Felix von Leitner 17 years ago
parent
commit
1e6cd7dc5c
2 changed files with 28 additions and 0 deletions
  1. +25
    -0
      io/io_sendfile.c
  2. +3
    -0
      t.c

+ 25
- 0
io/io_sendfile.c View File

@@ -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 <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include <errno.h>

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__)


+ 3
- 0
t.c View File

@@ -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;


Loading…
Cancel
Save