c - Cygwin 上没有 sys/sendfile.h?

标签 c compiler-errors cygwin

我正在尝试在需要 sendfile.h 的 Cygwin 上编译一些 C 代码。当我尝试编译时,它给了我

fatal error: sys/sendfile.h: No such file or directory
compilation terminated.

我该如何解决这个问题?我必须迁移到 Linux 平台吗?我在 Cygwin 上安装了 gcc4.5。

最佳答案

就像提到的评论一样,sendfile 不是 POSIX,但是,从 sendfile(2)

sendfile() copies data between one file descriptor and another. Because this copying is done within the kernel, sendfile() is more efficient than the combination of read(2) and write(2), which would require transferring data to and from user space.

这意味着它基本上是一个 read() 后跟一个 write(),因此您自己实现它会相对容易。

关于c - Cygwin 上没有 sys/sendfile.h?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13182743/

相关文章:

java - 为什么我不断收到错误: cannot find symbol for variables “weight” and “planet” ?

c++ - 比较整数和字符串没有编译错误?

windows - 无法在 Cygwin 中将 shell 脚本作为 KornShell 脚本执行

bash - Cygwin 中的 root 用户/sudo 等价物?

c - 使用C语言在嵌入式系统中进行可靠的字符串连接

c - 统计文本分析、语言建模和信息检索程序 - Rainbow

我可以让 ungetc 取消阻止阻塞的 fgetc 调用吗?

c++ - fatal error : procinfo. h:没有那个文件或目录

c - 如何知道我的代码在哪个物理处理器和哪个物理内核上运行

c - linux猫: No such file or directory