… | |
… | |
129 | #define sync() EIO_ENOSYS () |
129 | #define sync() EIO_ENOSYS () |
130 | #define readlink(path,buf,s) EIO_ENOSYS () |
130 | #define readlink(path,buf,s) EIO_ENOSYS () |
131 | #define statvfs(path,buf) EIO_ENOSYS () |
131 | #define statvfs(path,buf) EIO_ENOSYS () |
132 | #define fstatvfs(fd,buf) EIO_ENOSYS () |
132 | #define fstatvfs(fd,buf) EIO_ENOSYS () |
133 | |
133 | |
|
|
134 | /* rename() uses MoveFile, which fails to overwrite */ |
|
|
135 | #define rename(old,neu) eio__rename (old, neu) |
|
|
136 | |
|
|
137 | static int |
|
|
138 | eio__rename (const char *old, const char *neu) |
|
|
139 | { |
|
|
140 | if (MoveFileEx (old, neu, MOVEFILE_REPLACE_EXISTING)) |
|
|
141 | return 0; |
|
|
142 | |
|
|
143 | /* should steal _dosmaperr */ |
|
|
144 | switch (GetLastError ()) |
|
|
145 | { |
|
|
146 | case ERROR_FILE_NOT_FOUND: |
|
|
147 | case ERROR_PATH_NOT_FOUND: |
|
|
148 | case ERROR_INVALID_DRIVE: |
|
|
149 | case ERROR_NO_MORE_FILES: |
|
|
150 | case ERROR_BAD_NETPATH: |
|
|
151 | case ERROR_BAD_NET_NAME: |
|
|
152 | case ERROR_BAD_PATHNAME: |
|
|
153 | case ERROR_FILENAME_EXCED_RANGE: |
|
|
154 | errno = ENOENT; |
|
|
155 | break; |
|
|
156 | |
|
|
157 | default: |
|
|
158 | errno = EACCES; |
|
|
159 | break; |
|
|
160 | } |
|
|
161 | |
|
|
162 | return -1; |
|
|
163 | } |
|
|
164 | |
134 | /* we could even stat and see if it exists */ |
165 | /* we could even stat and see if it exists */ |
135 | static int |
166 | static int |
136 | symlink (const char *old, const char *neu) |
167 | symlink (const char *old, const char *neu) |
137 | { |
168 | { |
138 | #if WINVER >= 0x0600 |
169 | #if WINVER >= 0x0600 |
… | |
… | |
199 | |
230 | |
200 | #endif |
231 | #endif |
201 | |
232 | |
202 | #if HAVE_UTIMES |
233 | #if HAVE_UTIMES |
203 | # include <utime.h> |
234 | # include <utime.h> |
|
|
235 | #endif |
|
|
236 | |
|
|
237 | #if HAVE_SYS_SYSCALL_H |
|
|
238 | # include <sys/syscall.h> |
|
|
239 | #endif |
|
|
240 | |
|
|
241 | #if HAVE_SYS_PRCTL_H |
|
|
242 | # include <sys/prctl.h> |
204 | #endif |
243 | #endif |
205 | |
244 | |
206 | #if HAVE_SENDFILE |
245 | #if HAVE_SENDFILE |
207 | # if __linux |
246 | # if __linux |
208 | # include <sys/sendfile.h> |
247 | # include <sys/sendfile.h> |
… | |
… | |
214 | # elif __solaris |
253 | # elif __solaris |
215 | # include <sys/sendfile.h> |
254 | # include <sys/sendfile.h> |
216 | # else |
255 | # else |
217 | # error sendfile support requested but not available |
256 | # error sendfile support requested but not available |
218 | # endif |
257 | # endif |
219 | #endif |
|
|
220 | |
|
|
221 | #if HAVE_SYS_SYSCALL_H |
|
|
222 | # include <sys/syscall.h> |
|
|
223 | #endif |
258 | #endif |
224 | |
259 | |
225 | #ifndef D_TYPE |
260 | #ifndef D_TYPE |
226 | # define D_TYPE(de) 0 |
261 | # define D_TYPE(de) 0 |
227 | #endif |
262 | #endif |
… | |
… | |
1670 | |
1705 | |
1671 | if (dirp == INVALID_HANDLE_VALUE) |
1706 | if (dirp == INVALID_HANDLE_VALUE) |
1672 | { |
1707 | { |
1673 | dirp = 0; |
1708 | dirp = 0; |
1674 | |
1709 | |
|
|
1710 | /* should steal _dosmaperr */ |
1675 | switch (GetLastError ()) |
1711 | switch (GetLastError ()) |
1676 | { |
1712 | { |
1677 | case ERROR_FILE_NOT_FOUND: |
1713 | case ERROR_FILE_NOT_FOUND: |
1678 | req->result = 0; |
1714 | req->result = 0; |
1679 | break; |
1715 | break; |
… | |
… | |
1913 | { |
1949 | { |
1914 | ETP_REQ *req; |
1950 | ETP_REQ *req; |
1915 | struct timespec ts; |
1951 | struct timespec ts; |
1916 | etp_worker *self = (etp_worker *)thr_arg; |
1952 | etp_worker *self = (etp_worker *)thr_arg; |
1917 | |
1953 | |
|
|
1954 | #if HAVE_PRCTL_SET_NAME |
|
|
1955 | prctl (PR_SET_NAME, (unsigned long)"eio_thread", 0, 0, 0); |
|
|
1956 | #endif |
|
|
1957 | |
1918 | /* try to distribute timeouts somewhat evenly */ |
1958 | /* try to distribute timeouts somewhat evenly */ |
1919 | ts.tv_nsec = ((unsigned long)self & 1023UL) * (1000000000UL / 1024UL); |
1959 | ts.tv_nsec = ((unsigned long)self & 1023UL) * (1000000000UL / 1024UL); |
1920 | |
1960 | |
1921 | for (;;) |
1961 | for (;;) |
1922 | { |
1962 | { |