c++cnetwork-programminggccosx-snow-leopard

sys/sendfile.h not found GCC


I am using Mac OS 10.6.7,

The gcc compiler was already there when I bought Mac. but when I try to include sys/sendfile.h #include<sys/sendfile.h>

it throws an error

sys/sendfile.h: No such file or directory.

But this program works correctly in ubuntu GCC Compiler. Any idea how to fix this?


Solution

  • According to the Linux manual page:

    Not specified in POSIX.1-2001, or other standards.

    Other UNIX systems implement sendfile() with different semantics and prototypes. It should not be used in portable programs.

    I'm not sure about OSX, but it seems you have to do a little digging yourself to find it.