Commit 8c30f11c by xiongziliang

修复windows下编译错误

parent 1dd3d6f1
...@@ -67,15 +67,15 @@ HttpFileBody::HttpFileBody(const std::shared_ptr<FILE> &fp, size_t offset, size_ ...@@ -67,15 +67,15 @@ HttpFileBody::HttpFileBody(const std::shared_ptr<FILE> &fp, size_t offset, size_
init(fp, offset, max_size, use_mmap); init(fp, offset, max_size, use_mmap);
} }
#if defined(__linux__) || defined(__linux) #if defined(__linux__) || defined(__linux)
#include <sys/sendfile.h> #include <sys/sendfile.h>
#endif #endif
int HttpFileBody::sendFile(int fd) { int HttpFileBody::sendFile(int fd) {
#if defined(__linux__) || defined(__linux)
static onceToken s_token([]() { static onceToken s_token([]() {
signal(SIGPIPE, SIG_IGN); signal(SIGPIPE, SIG_IGN);
}); });
#if defined(__linux__) || defined(__linux)
off_t off = _file_offset; off_t off = _file_offset;
return sendfile(fd, fileno(_fp.get()), &off, _max_size); return sendfile(fd, fileno(_fp.get()), &off, _max_size);
#else #else
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论