… | |
… | |
1032 | int res; |
1032 | int res; |
1033 | |
1033 | |
1034 | #if HAVE_SYS_SYNCFS |
1034 | #if HAVE_SYS_SYNCFS |
1035 | res = (int)syscall (__NR_syncfs, (int)(fd)); |
1035 | res = (int)syscall (__NR_syncfs, (int)(fd)); |
1036 | #else |
1036 | #else |
1037 | res = -1; |
1037 | res = EIO_ENOSYS (); |
1038 | errno = ENOSYS; |
|
|
1039 | #endif |
1038 | #endif |
1040 | |
1039 | |
1041 | if (res < 0 && errno == ENOSYS && fd >= 0) |
1040 | if (res < 0 && errno == ENOSYS && fd >= 0) |
1042 | sync (); |
1041 | sync (); |
1043 | |
1042 | |
… | |
… | |
1073 | } |
1072 | } |
1074 | |
1073 | |
1075 | static int |
1074 | static int |
1076 | eio__fallocate (int fd, int mode, off_t offset, size_t len) |
1075 | eio__fallocate (int fd, int mode, off_t offset, size_t len) |
1077 | { |
1076 | { |
1078 | #if HAVE_FALLOCATE |
1077 | #if HAVE_LINUX_FALLOCATE |
1079 | return fallocate (fd, mode, offset, len); |
1078 | return fallocate (fd, mode, offset, len); |
1080 | #else |
1079 | #else |
1081 | errno = ENOSYS; |
1080 | return EIO_ENOSYS (); |
1082 | return -1; |
|
|
1083 | #endif |
1081 | #endif |
1084 | } |
1082 | } |
1085 | |
1083 | |
1086 | #if !HAVE_READAHEAD |
1084 | #if !HAVE_READAHEAD |
1087 | # undef readahead |
1085 | # undef readahead |
… | |
… | |
1186 | HANDLE h = TO_SOCKET (ifd); |
1184 | HANDLE h = TO_SOCKET (ifd); |
1187 | SetFilePointer (h, offset, 0, FILE_BEGIN); |
1185 | SetFilePointer (h, offset, 0, FILE_BEGIN); |
1188 | res = TransmitFile (TO_SOCKET (ofd), h, count, 0, 0, 0, 0); |
1186 | res = TransmitFile (TO_SOCKET (ofd), h, count, 0, 0, 0, 0); |
1189 | |
1187 | |
1190 | #else |
1188 | #else |
1191 | res = -1; |
1189 | res = EIO_ENOSYS (); |
1192 | errno = ENOSYS; |
|
|
1193 | #endif |
1190 | #endif |
1194 | |
1191 | |
1195 | /* we assume sendfile can copy at least 128mb in one go */ |
1192 | /* we assume sendfile can copy at least 128mb in one go */ |
1196 | if (res <= 128 * 1024 * 1024) |
1193 | if (res <= 128 * 1024 * 1024) |
1197 | { |
1194 | { |
… | |
… | |
2495 | case EIO_CUSTOM: |
2492 | case EIO_CUSTOM: |
2496 | req->feed (req); |
2493 | req->feed (req); |
2497 | break; |
2494 | break; |
2498 | |
2495 | |
2499 | default: |
2496 | default: |
2500 | errno = ENOSYS; |
|
|
2501 | req->result = -1; |
2497 | req->result = EIO_ENOSYS (); |
2502 | break; |
2498 | break; |
2503 | } |
2499 | } |
2504 | |
2500 | |
2505 | req->errorno = errno; |
2501 | req->errorno = errno; |
2506 | } |
2502 | } |