tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Equivalent of the system call sendfile



kamel derouiche(kamelderouiche%yahoo.com@localhost) said 2008.11.25 08:37:29 
+0000:
> > Oops, you're right ... read() doesn't work. So:
> > 
> > mmap() the file - or a big portion of it
> > 
> > write() to the network.
> 
> There is a software that i want to ported on pkgsrc,
> That last package uses sendfile system call. I need a
> call system that corresponding to the that sendfile in netbsd

sendfile has the following arguments:
        socket
        file descriptor
        offset
        length
        and some other guff.
So, you can use:
        void *addr = mmap(NULL, length, PROT_READ, MAP_FILE | MAP_SHARED,
                file descriptor, offset);
        send(socket, addr, length, 0);

HTH

        --Wouter


Home | Main Index | Thread Index | Old Index