… | |
… | |
36 | * provisions above, a recipient may use your version of this file under |
36 | * provisions above, a recipient may use your version of this file under |
37 | * either the BSD or the GPL. |
37 | * either the BSD or the GPL. |
38 | */ |
38 | */ |
39 | |
39 | |
40 | #include "eio.h" |
40 | #include "eio.h" |
|
|
41 | |
|
|
42 | #ifdef EIO_STACKSIZE |
|
|
43 | # define XTHREAD_STACKSIZE EIO_STACKSIZE |
|
|
44 | #endif |
41 | #include "xthread.h" |
45 | #include "xthread.h" |
42 | |
46 | |
43 | #include <errno.h> |
47 | #include <errno.h> |
44 | #include <stddef.h> |
48 | #include <stddef.h> |
45 | #include <stdlib.h> |
49 | #include <stdlib.h> |
… | |
… | |
767 | |
771 | |
768 | X_LOCK (preadwritelock); |
772 | X_LOCK (preadwritelock); |
769 | ooffset = lseek (fd, 0, SEEK_CUR); |
773 | ooffset = lseek (fd, 0, SEEK_CUR); |
770 | lseek (fd, offset, SEEK_SET); |
774 | lseek (fd, offset, SEEK_SET); |
771 | res = write (fd, buf, count); |
775 | res = write (fd, buf, count); |
772 | lseek (fd, offset, SEEK_SET); |
776 | lseek (fd, ooffset, SEEK_SET); |
773 | X_UNLOCK (preadwritelock); |
777 | X_UNLOCK (preadwritelock); |
774 | |
778 | |
775 | return res; |
779 | return res; |
776 | } |
780 | } |
777 | #endif |
781 | #endif |
… | |
… | |
829 | | (flags & EIO_SYNC_FILE_RANGE_WAIT_AFTER ? SYNC_FILE_RANGE_WAIT_AFTER : 0); |
833 | | (flags & EIO_SYNC_FILE_RANGE_WAIT_AFTER ? SYNC_FILE_RANGE_WAIT_AFTER : 0); |
830 | } |
834 | } |
831 | |
835 | |
832 | res = sync_file_range (fd, offset, nbytes, flags); |
836 | res = sync_file_range (fd, offset, nbytes, flags); |
833 | |
837 | |
834 | if (res != ENOSYS) |
838 | if (!res || errno != ENOSYS) |
835 | return res; |
839 | return res; |
836 | #endif |
840 | #endif |
837 | |
841 | |
838 | /* even though we could play tricks with the flags, it's better to always |
842 | /* even though we could play tricks with the flags, it's better to always |
839 | * call fdatasync, as thta matches the expectation of it's users best */ |
843 | * call fdatasync, as thta matches the expectation of it's users best */ |
… | |
… | |
1016 | req->result = res; |
1020 | req->result = res; |
1017 | } |
1021 | } |
1018 | |
1022 | |
1019 | #if !(_POSIX_MAPPED_FILES && _POSIX_SYNCHRONIZED_IO) |
1023 | #if !(_POSIX_MAPPED_FILES && _POSIX_SYNCHRONIZED_IO) |
1020 | # undef msync |
1024 | # undef msync |
1021 | # define msync(a,b,c) ENOSYS |
1025 | # define msync(a,b,c) ((errno = ENOSYS), -1) |
1022 | #endif |
1026 | #endif |
1023 | |
1027 | |
1024 | int |
1028 | int |
1025 | eio__mtouch (void *mem, size_t len, int flags) |
1029 | eio__mtouch (void *mem, size_t len, int flags) |
1026 | { |
1030 | { |