2 * Copyright (C) 2012-2020 all contributors <cmogstored-public@yhbt.net>
3 * License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
6 static ssize_t
compat_sendfile(int sockfd
, int filefd
, off_t
*off
, size_t count
)
9 void *buf
= mog_fsbuf_get(&max_pread
);
13 max_pread
= MIN(max_pread
, count
);
15 r
= off
? pread(filefd
, buf
, max_pread
, *off
) :
16 read(filefd
, buf
, max_pread
);
17 } while (r
< 0 && errno
== EINTR
);
22 w
= write(sockfd
, buf
, r
);
27 # define sendfile(out_fd, in_fd, offset, count) \
28 compat_sendfile((out_fd),(in_fd),(offset),(count))