mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-18 16:54:42 -04:00
make it compile on linux
svn:r1058
This commit is contained in:
parent
fdf694933c
commit
8b5bd77415
9
buffer.c
9
buffer.c
@ -1254,10 +1254,10 @@ evbuffer_write_sendfile(struct evbuffer *buffer, evutil_socket_t fd,
|
|||||||
|
|
||||||
return (len);
|
return (len);
|
||||||
#elif SENDFILE_IS_LINUX
|
#elif SENDFILE_IS_LINUX
|
||||||
/* TODO(niels): implement splice
|
/* TODO(niels): implement splice */
|
||||||
ssize_t res;
|
ssize_t res;
|
||||||
off_t offset = chain->misalign;
|
off_t offset = chain->misalign;
|
||||||
res = sendfile(fd, info->fd, chain->misalign, &offset, chain->off);
|
res = sendfile(fd, info->fd, &offset, chain->off);
|
||||||
if (res == -1 && EVUTIL_ERR_RW_RETRIABLE(errno)) {
|
if (res == -1 && EVUTIL_ERR_RW_RETRIABLE(errno)) {
|
||||||
/* if this is EGAIN or EINTR return 0; otherwise, -1 */
|
/* if this is EGAIN or EINTR return 0; otherwise, -1 */
|
||||||
return (0);
|
return (0);
|
||||||
@ -1456,7 +1456,10 @@ evbuffer_add_file(struct evbuffer *outbuf, int fd,
|
|||||||
#if defined(HAVE_MMAP)
|
#if defined(HAVE_MMAP)
|
||||||
if (use_mmap) {
|
if (use_mmap) {
|
||||||
void *mapped = mmap(NULL, length + offset, PROT_READ,
|
void *mapped = mmap(NULL, length + offset, PROT_READ,
|
||||||
MAP_FILE | MAP_NOCACHE | MAP_PRIVATE,
|
#ifdef MAP_NOCACHE
|
||||||
|
MAP_NOCACHE |
|
||||||
|
#endif
|
||||||
|
MAP_FILE | MAP_PRIVATE,
|
||||||
fd, 0);
|
fd, 0);
|
||||||
/* some mmap implementations require offset to be a multiple of
|
/* some mmap implementations require offset to be a multiple of
|
||||||
* the page size. most users of this api, are likely to use 0
|
* the page size. most users of this api, are likely to use 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user