ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libeio/eio.c
(Generate patch)

Comparing libeio/eio.c (file contents):
Revision 1.86 by root, Thu Jul 14 18:30:10 2011 UTC vs.
Revision 1.98 by root, Sun Jul 24 05:53:34 2011 UTC

58#include <sys/stat.h> 58#include <sys/stat.h>
59#include <limits.h> 59#include <limits.h>
60#include <fcntl.h> 60#include <fcntl.h>
61#include <assert.h> 61#include <assert.h>
62 62
63#include <sys/statvfs.h>
64/* intptr_t comes from unistd.h, says POSIX/UNIX/tradition */ 63/* intptr_t comes from unistd.h, says POSIX/UNIX/tradition */
65/* intptr_t only comes from stdint.h, says idiot openbsd coder */ 64/* intptr_t only comes from stdint.h, says idiot openbsd coder */
66#if HAVE_STDINT_H 65#if HAVE_STDINT_H
67# include <stdint.h> 66# include <stdint.h>
68#endif 67#endif
69 68
70#ifndef ECANCELED 69#ifndef ECANCELED
71# define ECANCELED EDOM 70# define ECANCELED EDOM
72#endif 71#endif
72#ifndef ELOOP
73# define ELOOP EDOM
74#endif
75
76#if !defined(ENOTSOCK) && defined(WSAENOTSOCK)
77# define ENOTSOCK WSAENOTSOCK
78#endif
73 79
74static void eio_destroy (eio_req *req); 80static void eio_destroy (eio_req *req);
75 81
76#ifndef EIO_FINISH 82#ifndef EIO_FINISH
77# define EIO_FINISH(req) ((req)->finish) && !EIO_CANCELLED (req) ? (req)->finish (req) : 0 83# define EIO_FINISH(req) ((req)->finish) && !EIO_CANCELLED (req) ? (req)->finish (req) : 0
96 102
97#define EIO_ENOSYS() EIO_ERRNO (ENOSYS, -1) 103#define EIO_ENOSYS() EIO_ERRNO (ENOSYS, -1)
98 104
99#ifdef _WIN32 105#ifdef _WIN32
100 106
107 #undef PAGESIZE
101 #define PAGESIZE 4096 /* GetSystemInfo? */ 108 #define PAGESIZE 4096 /* GetSystemInfo? */
102 109
110 #ifdef EIO_STRUCT_STATI64
103 #define stat(path,buf) _stati64 (path,buf) 111 #define stat(path,buf) _stati64 (path,buf)
112 #define fstat(fd,buf) _fstati64 (fd,buf)
113 #endif
104 #define lstat(path,buf) stat (path,buf) 114 #define lstat(path,buf) stat (path,buf)
105 #define fstat(fd,buf) _fstati64 (path,buf)
106 #define fsync(fd) (FlushFileBuffers (EIO_FD_TO_WIN32_HANDLE (fd)) ? 0 : EIO_ERRNO (EBADF, -1)) 115 #define fsync(fd) (FlushFileBuffers ((HANDLE)EIO_FD_TO_WIN32_HANDLE (fd)) ? 0 : EIO_ERRNO (EBADF, -1))
107 #define mkdir(path,mode) _mkdir (path) 116 #define mkdir(path,mode) _mkdir (path)
108 #define link(old,neu) (CreateHardLink (neu, old, 0) ? 0 : EIO_ERRNO (ENOENT, -1)) 117 #define link(old,neu) (CreateHardLink (neu, old, 0) ? 0 : EIO_ERRNO (ENOENT, -1))
109 118
119 #define chmod(path,mode) _chmod (path, mode)
120 #define dup(fd) _dup (fd)
121 #define dup2(fd1,fd2) _dup2 (fd1, fd2)
122
123 #define fchmod(fd,mode) EIO_ENOSYS ()
110 #define chown(path,uid,gid) EIO_ENOSYS () 124 #define chown(path,uid,gid) EIO_ENOSYS ()
111 #define fchown(fd,uid,gid) EIO_ENOSYS () 125 #define fchown(fd,uid,gid) EIO_ENOSYS ()
112 #define truncate(path,offs) EIO_ENOSYS () /* far-miss: SetEndOfFile */ 126 #define truncate(path,offs) EIO_ENOSYS () /* far-miss: SetEndOfFile */
113 #define ftruncate(fd,offs) EIO_ENOSYS () /* near-miss: SetEndOfFile */ 127 #define ftruncate(fd,offs) EIO_ENOSYS () /* near-miss: SetEndOfFile */
114 #define mknod(path,mode,dev) EIO_ENOSYS () 128 #define mknod(path,mode,dev) EIO_ENOSYS ()
115 #define sync() EIO_ENOSYS () 129 #define sync() EIO_ENOSYS ()
130 #define readlink(path,buf,s) EIO_ENOSYS ()
131 #define statvfs(path,buf) EIO_ENOSYS ()
132 #define fstatvfs(fd,buf) EIO_ENOSYS ()
116 133
117 /* we could even stat and see if it exists */ 134 /* we could even stat and see if it exists */
118 static int 135 static int
119 symlink (const char *old, const char *neu) 136 symlink (const char *old, const char *neu)
120 { 137 {
138 #if WINVER >= 0x0600
121 if (CreateSymbolicLink (neu, old, 1)) 139 if (CreateSymbolicLink (neu, old, 1))
122 return 0; 140 return 0;
123 141
124 if (CreateSymbolicLink (neu, old, 0)) 142 if (CreateSymbolicLink (neu, old, 0))
125 return 0; 143 return 0;
144 #endif
126 145
127 return EIO_ERRNO (ENOENT, -1); 146 return EIO_ERRNO (ENOENT, -1);
128 } 147 }
148
149 /* POSIX API only */
150 #define CreateHardLink(neu,old,flags) 0
151 #define CreateSymbolicLink(neu,old,flags) 0
152
153 struct statvfs
154 {
155 int dummy;
156 };
157
158 #define DT_DIR EIO_DT_DIR
159 #define DT_REG EIO_DT_REG
160 #define D_NAME(entp) entp.cFileName
161 #define D_TYPE(entp) (entp.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ? DT_DIR : DT_REG)
129 162
130#else 163#else
131 164
132 #include <sys/time.h> 165 #include <sys/time.h>
133 #include <sys/select.h> 166 #include <sys/select.h>
134 #include <sys/statvfs.h> 167 #include <sys/statvfs.h>
135 #include <unistd.h> 168 #include <unistd.h>
136 #include <utime.h>
137 #include <signal.h> 169 #include <signal.h>
138 #include <dirent.h> 170 #include <dirent.h>
139 171
140 #if _POSIX_MEMLOCK || _POSIX_MEMLOCK_RANGE || _POSIX_MAPPED_FILES 172 #if _POSIX_MEMLOCK || _POSIX_MEMLOCK_RANGE || _POSIX_MAPPED_FILES
141 #include <sys/mman.h> 173 #include <sys/mman.h>
142 #endif 174 #endif
175
176 #define D_NAME(entp) entp->d_name
143 177
144 /* POSIX_SOURCE is useless on bsd's, and XOPEN_SOURCE is unreliable there, too */ 178 /* POSIX_SOURCE is useless on bsd's, and XOPEN_SOURCE is unreliable there, too */
145 #if __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ 179 #if __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__
146 #define _DIRENT_HAVE_D_TYPE /* sigh */ 180 #define _DIRENT_HAVE_D_TYPE /* sigh */
147 #define D_INO(de) (de)->d_fileno 181 #define D_INO(de) (de)->d_fileno
161 195
162 #ifndef EIO_STRUCT_DIRENT 196 #ifndef EIO_STRUCT_DIRENT
163 #define EIO_STRUCT_DIRENT struct dirent 197 #define EIO_STRUCT_DIRENT struct dirent
164 #endif 198 #endif
165 199
200#endif
201
202#if HAVE_UTIMES
203# include <utime.h>
204#endif
205
206#if HAVE_SYS_SYSCALL_H
207# include <sys/syscall.h>
208#endif
209
210#if HAVE_SYS_PRCTL_H
211# include <sys/prctl.h>
166#endif 212#endif
167 213
168#if HAVE_SENDFILE 214#if HAVE_SENDFILE
169# if __linux 215# if __linux
170# include <sys/sendfile.h> 216# include <sys/sendfile.h>
185#endif 231#endif
186#ifndef D_INO 232#ifndef D_INO
187# define D_INO(de) 0 233# define D_INO(de) 0
188#endif 234#endif
189#ifndef D_NAMLEN 235#ifndef D_NAMLEN
190# define D_NAMLEN(de) strlen ((de)->d_name) 236# define D_NAMLEN(entp) strlen (D_NAME (entp))
191#endif 237#endif
192 238
193/* used for struct dirent, AIX doesn't provide it */ 239/* used for struct dirent, AIX doesn't provide it */
194#ifndef NAME_MAX 240#ifndef NAME_MAX
195# define NAME_MAX 4096 241# define NAME_MAX 4096
202 248
203/* buffer size for various temporary buffers */ 249/* buffer size for various temporary buffers */
204#define EIO_BUFSIZE 65536 250#define EIO_BUFSIZE 65536
205 251
206#define dBUF \ 252#define dBUF \
207 char *eio_buf; \
208 ETP_WORKER_LOCK (self); \
209 self->dbuf = eio_buf = malloc (EIO_BUFSIZE); \ 253 char *eio_buf = malloc (EIO_BUFSIZE); \
210 ETP_WORKER_UNLOCK (self); \
211 errno = ENOMEM; \ 254 errno = ENOMEM; \
212 if (!eio_buf) \ 255 if (!eio_buf) \
213 return -1; 256 return -1
257
258#define FUBd \
259 free (eio_buf)
214 260
215#define EIO_TICKS ((1000000 + 1023) >> 10) 261#define EIO_TICKS ((1000000 + 1023) >> 10)
216 262
217#define ETP_PRI_MIN EIO_PRI_MIN 263#define ETP_PRI_MIN EIO_PRI_MIN
218#define ETP_PRI_MAX EIO_PRI_MAX 264#define ETP_PRI_MAX EIO_PRI_MAX
224static int eio_finish (eio_req *req); 270static int eio_finish (eio_req *req);
225#define ETP_FINISH(req) eio_finish (req) 271#define ETP_FINISH(req) eio_finish (req)
226static void eio_execute (struct etp_worker *self, eio_req *req); 272static void eio_execute (struct etp_worker *self, eio_req *req);
227#define ETP_EXECUTE(wrk,req) eio_execute (wrk,req) 273#define ETP_EXECUTE(wrk,req) eio_execute (wrk,req)
228 274
229#define ETP_WORKER_CLEAR(req) \
230 if (wrk->dbuf) \
231 { \
232 free (wrk->dbuf); \
233 wrk->dbuf = 0; \
234 } \
235 \
236 if (wrk->dirp) \
237 { \
238 closedir (wrk->dirp); \
239 wrk->dirp = 0; \
240 }
241
242#define ETP_WORKER_COMMON \
243 void *dbuf; \
244 DIR *dirp;
245
246/*****************************************************************************/ 275/*****************************************************************************/
247 276
248#define ETP_NUM_PRI (ETP_PRI_MAX - ETP_PRI_MIN + 1) 277#define ETP_NUM_PRI (ETP_PRI_MAX - ETP_PRI_MIN + 1)
249 278
250/* calculate time difference in ~1/EIO_TICKS of a second */ 279/* calculate time difference in ~1/EIO_TICKS of a second */
278/* 307/*
279 * make our pread/pwrite emulation safe against themselves, but not against 308 * make our pread/pwrite emulation safe against themselves, but not against
280 * normal read/write by using a mutex. slows down execution a lot, 309 * normal read/write by using a mutex. slows down execution a lot,
281 * but that's your problem, not mine. 310 * but that's your problem, not mine.
282 */ 311 */
283static xmutex_t preadwritelock = X_MUTEX_INIT; 312static xmutex_t preadwritelock;
284#endif 313#endif
285 314
286typedef struct etp_worker 315typedef struct etp_worker
287{ 316{
288 /* locked by wrklock */ 317 /* locked by wrklock */
291 xthread_t tid; 320 xthread_t tid;
292 321
293 /* locked by reslock, reqlock or wrklock */ 322 /* locked by reslock, reqlock or wrklock */
294 ETP_REQ *req; /* currently processed request */ 323 ETP_REQ *req; /* currently processed request */
295 324
325#ifdef ETP_WORKER_COMMON
296 ETP_WORKER_COMMON 326 ETP_WORKER_COMMON
327#endif
297} etp_worker; 328} etp_worker;
298 329
299static etp_worker wrk_first = { &wrk_first, &wrk_first, 0 }; /* NOT etp */ 330static etp_worker wrk_first; /* NOT etp */
300 331
301#define ETP_WORKER_LOCK(wrk) X_LOCK (wrklock) 332#define ETP_WORKER_LOCK(wrk) X_LOCK (wrklock)
302#define ETP_WORKER_UNLOCK(wrk) X_UNLOCK (wrklock) 333#define ETP_WORKER_UNLOCK(wrk) X_UNLOCK (wrklock)
303 334
304/* worker threads management */ 335/* worker threads management */
305 336
306static void ecb_cold 337static void ecb_cold
307etp_worker_clear (etp_worker *wrk) 338etp_worker_clear (etp_worker *wrk)
308{ 339{
309 ETP_WORKER_CLEAR (wrk);
310} 340}
311 341
312static void ecb_cold 342static void ecb_cold
313etp_worker_free (etp_worker *wrk) 343etp_worker_free (etp_worker *wrk)
314{ 344{
375} etp_reqq; 405} etp_reqq;
376 406
377static etp_reqq req_queue; 407static etp_reqq req_queue;
378static etp_reqq res_queue; 408static etp_reqq res_queue;
379 409
410static void ecb_noinline ecb_cold
411reqq_init (etp_reqq *q)
412{
413 int pri;
414
415 for (pri = 0; pri < ETP_NUM_PRI; ++pri)
416 q->qs[pri] = q->qe[pri] = 0;
417
418 q->size = 0;
419}
420
380static int ecb_noinline 421static int ecb_noinline
381reqq_push (etp_reqq *q, ETP_REQ *req) 422reqq_push (etp_reqq *q, ETP_REQ *req)
382{ 423{
383 int pri = req->pri; 424 int pri = req->pri;
384 req->next = 0; 425 req->next = 0;
418 } 459 }
419 460
420 abort (); 461 abort ();
421} 462}
422 463
423static void ecb_cold 464static int ecb_cold
424etp_thread_init (void) 465etp_init (void (*want_poll)(void), void (*done_poll)(void))
425{ 466{
426#if !HAVE_PREADWRITE
427 X_MUTEX_CREATE (preadwritelock);
428#endif
429 X_MUTEX_CREATE (wrklock); 467 X_MUTEX_CREATE (wrklock);
430 X_MUTEX_CREATE (reslock); 468 X_MUTEX_CREATE (reslock);
431 X_MUTEX_CREATE (reqlock); 469 X_MUTEX_CREATE (reqlock);
432 X_COND_CREATE (reqwait); 470 X_COND_CREATE (reqwait);
433}
434 471
435static void ecb_cold 472 reqq_init (&req_queue);
436etp_atfork_prepare (void) 473 reqq_init (&res_queue);
437{
438}
439 474
440static void ecb_cold 475 wrk_first.next =
441etp_atfork_parent (void) 476 wrk_first.prev = &wrk_first;
442{
443}
444
445static void ecb_cold
446etp_atfork_child (void)
447{
448 ETP_REQ *prv;
449
450 while ((prv = reqq_shift (&req_queue)))
451 ETP_DESTROY (prv);
452
453 while ((prv = reqq_shift (&res_queue)))
454 ETP_DESTROY (prv);
455
456 while (wrk_first.next != &wrk_first)
457 {
458 etp_worker *wrk = wrk_first.next;
459
460 if (wrk->req)
461 ETP_DESTROY (wrk->req);
462
463 etp_worker_clear (wrk);
464 etp_worker_free (wrk);
465 }
466 477
467 started = 0; 478 started = 0;
468 idle = 0; 479 idle = 0;
469 nreqs = 0; 480 nreqs = 0;
470 nready = 0; 481 nready = 0;
471 npending = 0; 482 npending = 0;
472
473 etp_thread_init ();
474}
475
476static void ecb_cold
477etp_once_init (void)
478{
479 etp_thread_init ();
480 X_THREAD_ATFORK (etp_atfork_prepare, etp_atfork_parent, etp_atfork_child);
481}
482
483static int ecb_cold
484etp_init (void (*want_poll)(void), void (*done_poll)(void))
485{
486 static pthread_once_t doinit = PTHREAD_ONCE_INIT;
487
488 pthread_once (&doinit, etp_once_init);
489 483
490 want_poll_cb = want_poll; 484 want_poll_cb = want_poll;
491 done_poll_cb = done_poll; 485 done_poll_cb = done_poll;
492 486
493 return 0; 487 return 0;
876# undef pread 870# undef pread
877# undef pwrite 871# undef pwrite
878# define pread eio__pread 872# define pread eio__pread
879# define pwrite eio__pwrite 873# define pwrite eio__pwrite
880 874
881static ssize_t 875static eio_ssize_t
882eio__pread (int fd, void *buf, size_t count, off_t offset) 876eio__pread (int fd, void *buf, size_t count, off_t offset)
883{ 877{
884 ssize_t res; 878 eio_ssize_t res;
885 off_t ooffset; 879 off_t ooffset;
886 880
887 X_LOCK (preadwritelock); 881 X_LOCK (preadwritelock);
888 ooffset = lseek (fd, 0, SEEK_CUR); 882 ooffset = lseek (fd, 0, SEEK_CUR);
889 lseek (fd, offset, SEEK_SET); 883 lseek (fd, offset, SEEK_SET);
892 X_UNLOCK (preadwritelock); 886 X_UNLOCK (preadwritelock);
893 887
894 return res; 888 return res;
895} 889}
896 890
897static ssize_t 891static eio_ssize_t
898eio__pwrite (int fd, void *buf, size_t count, off_t offset) 892eio__pwrite (int fd, void *buf, size_t count, off_t offset)
899{ 893{
900 ssize_t res; 894 eio_ssize_t res;
901 off_t ooffset; 895 off_t ooffset;
902 896
903 X_LOCK (preadwritelock); 897 X_LOCK (preadwritelock);
904 ooffset = lseek (fd, 0, SEEK_CUR); 898 ooffset = lseek (fd, 0, SEEK_CUR);
905 lseek (fd, offset, SEEK_SET); 899 lseek (fd, offset, SEEK_SET);
950 944
951#if !HAVE_FDATASYNC 945#if !HAVE_FDATASYNC
952# undef fdatasync 946# undef fdatasync
953# define fdatasync(fd) fsync (fd) 947# define fdatasync(fd) fsync (fd)
954#endif 948#endif
949
950static int
951eio__syncfs (int fd)
952{
953 int res;
954
955#if HAVE_SYS_SYNCFS
956 res = (int)syscall (__NR_syncfs, (int)(fd));
957#else
958 res = -1;
959 errno = ENOSYS;
960#endif
961
962 if (res < 0 && errno == ENOSYS && fd >= 0)
963 sync ();
964
965 return res;
966}
955 967
956/* sync_file_range always needs emulation */ 968/* sync_file_range always needs emulation */
957static int 969static int
958eio__sync_file_range (int fd, off_t offset, size_t nbytes, unsigned int flags) 970eio__sync_file_range (int fd, off_t offset, size_t nbytes, unsigned int flags)
959{ 971{
994 1006
995#if !HAVE_READAHEAD 1007#if !HAVE_READAHEAD
996# undef readahead 1008# undef readahead
997# define readahead(fd,offset,count) eio__readahead (fd, offset, count, self) 1009# define readahead(fd,offset,count) eio__readahead (fd, offset, count, self)
998 1010
999static ssize_t 1011static eio_ssize_t
1000eio__readahead (int fd, off_t offset, size_t count, etp_worker *self) 1012eio__readahead (int fd, off_t offset, size_t count, etp_worker *self)
1001{ 1013{
1002 size_t todo = count; 1014 size_t todo = count;
1003 dBUF; 1015 dBUF;
1004 1016
1009 pread (fd, eio_buf, len, offset); 1021 pread (fd, eio_buf, len, offset);
1010 offset += len; 1022 offset += len;
1011 todo -= len; 1023 todo -= len;
1012 } 1024 }
1013 1025
1026 FUBd;
1027
1014 errno = 0; 1028 errno = 0;
1015 return count; 1029 return count;
1016} 1030}
1017 1031
1018#endif 1032#endif
1019 1033
1020/* sendfile always needs emulation */ 1034/* sendfile always needs emulation */
1021static ssize_t 1035static eio_ssize_t
1022eio__sendfile (int ofd, int ifd, off_t offset, size_t count, etp_worker *self) 1036eio__sendfile (int ofd, int ifd, off_t offset, size_t count)
1023{ 1037{
1024 ssize_t written = 0; 1038 eio_ssize_t written = 0;
1025 ssize_t res; 1039 eio_ssize_t res;
1026 1040
1027 if (!count) 1041 if (!count)
1028 return 0; 1042 return 0;
1029 1043
1030 for (;;) 1044 for (;;)
1125 && (errno == ENOSYS || errno == EINVAL || errno == ENOTSOCK 1139 && (errno == ENOSYS || errno == EINVAL || errno == ENOTSOCK
1126 /* BSDs */ 1140 /* BSDs */
1127#ifdef ENOTSUP /* sigh, if the steenking pile called openbsd would only try to at least compile posix code... */ 1141#ifdef ENOTSUP /* sigh, if the steenking pile called openbsd would only try to at least compile posix code... */
1128 || errno == ENOTSUP 1142 || errno == ENOTSUP
1129#endif 1143#endif
1144#ifdef EOPNOTSUPP /* windows */
1130 || errno == EOPNOTSUPP /* BSDs */ 1145 || errno == EOPNOTSUPP /* BSDs */
1146#endif
1131#if __solaris 1147#if __solaris
1132 || errno == EAFNOSUPPORT || errno == EPROTOTYPE 1148 || errno == EAFNOSUPPORT || errno == EPROTOTYPE
1133#endif 1149#endif
1134 ) 1150 )
1135 ) 1151 )
1139 1155
1140 res = 0; 1156 res = 0;
1141 1157
1142 while (count) 1158 while (count)
1143 { 1159 {
1144 ssize_t cnt; 1160 eio_ssize_t cnt;
1145 1161
1146 cnt = pread (ifd, eio_buf, count > EIO_BUFSIZE ? EIO_BUFSIZE : count, offset); 1162 cnt = pread (ifd, eio_buf, count > EIO_BUFSIZE ? EIO_BUFSIZE : count, offset);
1147 1163
1148 if (cnt <= 0) 1164 if (cnt <= 0)
1149 { 1165 {
1161 1177
1162 offset += cnt; 1178 offset += cnt;
1163 res += cnt; 1179 res += cnt;
1164 count -= cnt; 1180 count -= cnt;
1165 } 1181 }
1182
1183 FUBd;
1166 } 1184 }
1167 1185
1168 return res; 1186 return res;
1169} 1187}
1170 1188
1197 /* round up length */ 1215 /* round up length */
1198 *length = (*length + mask) & ~mask; 1216 *length = (*length + mask) & ~mask;
1199} 1217}
1200 1218
1201#if !_POSIX_MEMLOCK 1219#if !_POSIX_MEMLOCK
1202# define eio__mlockall(a) eio_nosyscall() 1220# define eio__mlockall(a) EIO_ENOSYS ()
1203#else 1221#else
1204 1222
1205static int 1223static int
1206eio__mlockall (int flags) 1224eio__mlockall (int flags)
1207{ 1225{
1357 res += strlen (res); 1375 res += strlen (res);
1358 } 1376 }
1359 1377
1360 while (*rel) 1378 while (*rel)
1361 { 1379 {
1362 ssize_t len, linklen; 1380 eio_ssize_t len, linklen;
1363 char *beg = rel; 1381 char *beg = rel;
1364 1382
1365 while (*rel && *rel != '/') 1383 while (*rel && *rel != '/')
1366 ++rel; 1384 ++rel;
1367 1385
1460 1478
1461#define EIO_SORT_CUTOFF 30 /* quite high, but performs well on many filesystems */ 1479#define EIO_SORT_CUTOFF 30 /* quite high, but performs well on many filesystems */
1462#define EIO_SORT_FAST 60 /* when to only use insertion sort */ 1480#define EIO_SORT_FAST 60 /* when to only use insertion sort */
1463 1481
1464static void 1482static void
1465eio_dent_radix_sort (eio_dirent *dents, int size, signed char score_bits, ino_t inode_bits) 1483eio_dent_radix_sort (eio_dirent *dents, int size, signed char score_bits, eio_ino_t inode_bits)
1466{ 1484{
1467 unsigned char bits [9 + sizeof (ino_t) * 8]; 1485 unsigned char bits [9 + sizeof (eio_ino_t) * 8];
1468 unsigned char *bit = bits; 1486 unsigned char *bit = bits;
1469 1487
1470 assert (CHAR_BIT == 8); 1488 assert (CHAR_BIT == 8);
1471 assert (sizeof (eio_dirent) * 8 < 256); 1489 assert (sizeof (eio_dirent) * 8 < 256);
1472 assert (offsetof (eio_dirent, inode)); /* we use bit #0 as sentinel */ 1490 assert (offsetof (eio_dirent, inode)); /* we use bit #0 as sentinel */
1474 1492
1475 if (size <= EIO_SORT_FAST) 1493 if (size <= EIO_SORT_FAST)
1476 return; 1494 return;
1477 1495
1478 /* first prepare an array of bits to test in our radix sort */ 1496 /* first prepare an array of bits to test in our radix sort */
1479 /* try to take endianness into account, as well as differences in ino_t sizes */ 1497 /* try to take endianness into account, as well as differences in eio_ino_t sizes */
1480 /* inode_bits must contain all inodes ORed together */ 1498 /* inode_bits must contain all inodes ORed together */
1481 /* which is used to skip bits that are 0 everywhere, which is very common */ 1499 /* which is used to skip bits that are 0 everywhere, which is very common */
1482 { 1500 {
1483 ino_t endianness; 1501 eio_ino_t endianness;
1484 int i, j; 1502 int i, j;
1485 1503
1486 /* we store the byte offset of byte n into byte n of "endianness" */ 1504 /* we store the byte offset of byte n into byte n of "endianness" */
1487 for (i = 0; i < sizeof (ino_t); ++i) 1505 for (i = 0; i < sizeof (eio_ino_t); ++i)
1488 ((unsigned char *)&endianness)[i] = i; 1506 ((unsigned char *)&endianness)[i] = i;
1489 1507
1490 *bit++ = 0; 1508 *bit++ = 0;
1491 1509
1492 for (i = 0; i < sizeof (ino_t); ++i) 1510 for (i = 0; i < sizeof (eio_ino_t); ++i)
1493 { 1511 {
1494 /* shifting off the byte offsets out of "endianness" */ 1512 /* shifting off the byte offsets out of "endianness" */
1495 int offs = (offsetof (eio_dirent, inode) + (endianness & 0xff)) * 8; 1513 int offs = (offsetof (eio_dirent, inode) + (endianness & 0xff)) * 8;
1496 endianness >>= 8; 1514 endianness >>= 8;
1497 1515
1498 for (j = 0; j < 8; ++j) 1516 for (j = 0; j < 8; ++j)
1499 if (inode_bits & (((ino_t)1) << (i * 8 + j))) 1517 if (inode_bits & (((eio_ino_t)1) << (i * 8 + j)))
1500 *bit++ = offs + j; 1518 *bit++ = offs + j;
1501 } 1519 }
1502 1520
1503 for (j = 0; j < 8; ++j) 1521 for (j = 0; j < 8; ++j)
1504 if (score_bits & (1 << j)) 1522 if (score_bits & (1 << j))
1505 *bit++ = offsetof (eio_dirent, score) * 8 + j; 1523 *bit++ = offsetof (eio_dirent, score) * 8 + j;
1506 } 1524 }
1507 1525
1508 /* now actually do the sorting (a variant of MSD radix sort) */ 1526 /* now actually do the sorting (a variant of MSD radix sort) */
1509 { 1527 {
1510 eio_dirent *base_stk [9 + sizeof (ino_t) * 8], *base; 1528 eio_dirent *base_stk [9 + sizeof (eio_ino_t) * 8], *base;
1511 eio_dirent *end_stk [9 + sizeof (ino_t) * 8], *end; 1529 eio_dirent *end_stk [9 + sizeof (eio_ino_t) * 8], *end;
1512 unsigned char *bit_stk [9 + sizeof (ino_t) * 8]; 1530 unsigned char *bit_stk [9 + sizeof (eio_ino_t) * 8];
1513 int stk_idx = 0; 1531 int stk_idx = 0;
1514 1532
1515 base_stk [stk_idx] = dents; 1533 base_stk [stk_idx] = dents;
1516 end_stk [stk_idx] = dents + size; 1534 end_stk [stk_idx] = dents + size;
1517 bit_stk [stk_idx] = bit - 1; 1535 bit_stk [stk_idx] = bit - 1;
1596 } 1614 }
1597 } 1615 }
1598} 1616}
1599 1617
1600static void 1618static void
1601eio_dent_sort (eio_dirent *dents, int size, signed char score_bits, ino_t inode_bits) 1619eio_dent_sort (eio_dirent *dents, int size, signed char score_bits, eio_ino_t inode_bits)
1602{ 1620{
1603 if (size <= 1) 1621 if (size <= 1)
1604 return; /* our insertion sort relies on size > 0 */ 1622 return; /* our insertion sort relies on size > 0 */
1605 1623
1606 /* first we use a radix sort, but only for dirs >= EIO_SORT_FAST */ 1624 /* first we use a radix sort, but only for dirs >= EIO_SORT_FAST */
1614 1632
1615/* read a full directory */ 1633/* read a full directory */
1616static void 1634static void
1617eio__scandir (eio_req *req, etp_worker *self) 1635eio__scandir (eio_req *req, etp_worker *self)
1618{ 1636{
1619 DIR *dirp;
1620 EIO_STRUCT_DIRENT *entp;
1621 char *name, *names; 1637 char *name, *names;
1622 int namesalloc = 4096; 1638 int namesalloc = 4096 - sizeof (void *) * 4;
1623 int namesoffs = 0; 1639 int namesoffs = 0;
1624 int flags = req->int1; 1640 int flags = req->int1;
1625 eio_dirent *dents = 0; 1641 eio_dirent *dents = 0;
1626 int dentalloc = 128; 1642 int dentalloc = 128;
1627 int dentoffs = 0; 1643 int dentoffs = 0;
1628 ino_t inode_bits = 0; 1644 eio_ino_t inode_bits = 0;
1645#ifdef _WIN32
1646 HANDLE dirp;
1647 WIN32_FIND_DATA entp;
1648#else
1649 DIR *dirp;
1650 EIO_STRUCT_DIRENT *entp;
1651#endif
1629 1652
1630 req->result = -1; 1653 req->result = -1;
1631 1654
1632 if (!(flags & EIO_READDIR_DENTS)) 1655 if (!(flags & EIO_READDIR_DENTS))
1633 flags &= ~(EIO_READDIR_DIRS_FIRST | EIO_READDIR_STAT_ORDER); 1656 flags &= ~(EIO_READDIR_DIRS_FIRST | EIO_READDIR_STAT_ORDER);
1634 1657
1635 X_LOCK (wrklock); 1658#ifdef _WIN32
1636 /* the corresponding closedir is in ETP_WORKER_CLEAR */ 1659 {
1660 int len = strlen ((const char *)req->ptr1);
1661 char *path = malloc (MAX_PATH);
1662 const char *fmt;
1663
1664 if (!len)
1665 fmt = "./*";
1666 else if (((const char *)req->ptr1)[len - 1] == '/' || ((const char *)req->ptr1)[len - 1] == '\\')
1667 fmt = "%s*";
1668 else
1669 fmt = "%s/*";
1670
1671 _snprintf (path, MAX_PATH, fmt, (const char *)req->ptr1);
1672 dirp = FindFirstFile (path, &entp);
1673 free (path);
1674
1675 if (dirp == INVALID_HANDLE_VALUE)
1676 {
1677 dirp = 0;
1678
1679 switch (GetLastError ())
1680 {
1681 case ERROR_FILE_NOT_FOUND:
1682 req->result = 0;
1683 break;
1684
1685 case ERROR_INVALID_NAME:
1686 case ERROR_PATH_NOT_FOUND:
1687 case ERROR_NO_MORE_FILES:
1688 errno = ENOENT;
1689 break;
1690
1691 case ERROR_NOT_ENOUGH_MEMORY:
1692 errno = ENOMEM;
1693 break;
1694
1695 default:
1696 errno = EINVAL;
1697 break;
1698 }
1699 }
1700 }
1701#else
1637 self->dirp = dirp = opendir (req->ptr1); 1702 dirp = opendir (req->ptr1);
1703#endif
1638 1704
1639 if (req->flags & EIO_FLAG_PTR1_FREE) 1705 if (req->flags & EIO_FLAG_PTR1_FREE)
1640 free (req->ptr1); 1706 free (req->ptr1);
1641 1707
1642 req->flags |= EIO_FLAG_PTR1_FREE | EIO_FLAG_PTR2_FREE; 1708 req->flags |= EIO_FLAG_PTR1_FREE | EIO_FLAG_PTR2_FREE;
1643 req->ptr1 = dents = flags ? malloc (dentalloc * sizeof (eio_dirent)) : 0; 1709 req->ptr1 = dents = flags ? malloc (dentalloc * sizeof (eio_dirent)) : 0;
1644 req->ptr2 = names = malloc (namesalloc); 1710 req->ptr2 = names = malloc (namesalloc);
1645 X_UNLOCK (wrklock);
1646 1711
1647 if (dirp && names && (!flags || dents)) 1712 if (dirp && names && (!flags || dents))
1648 for (;;) 1713 for (;;)
1649 { 1714 {
1715 int done;
1716
1717#ifdef _WIN32
1718 done = !dirp;
1719#else
1650 errno = 0; 1720 errno = 0;
1651 entp = readdir (dirp); 1721 entp = readdir (dirp);
1722 done = !entp;
1723#endif
1652 1724
1653 if (!entp) 1725 if (done)
1654 { 1726 {
1727#ifndef _WIN32
1728 int old_errno = errno;
1729 closedir (dirp);
1730 errno = old_errno;
1731
1655 if (errno) 1732 if (errno)
1656 break; 1733 break;
1734#endif
1657 1735
1658 /* sort etc. */ 1736 /* sort etc. */
1659 req->int1 = flags; 1737 req->int1 = flags;
1660 req->result = dentoffs; 1738 req->result = dentoffs;
1661 1739
1690 1768
1691 break; 1769 break;
1692 } 1770 }
1693 1771
1694 /* now add the entry to our list(s) */ 1772 /* now add the entry to our list(s) */
1695 name = entp->d_name; 1773 name = D_NAME (entp);
1696 1774
1697 /* skip . and .. entries */ 1775 /* skip . and .. entries */
1698 if (name [0] != '.' || (name [1] && (name [1] != '.' || name [2]))) 1776 if (name [0] != '.' || (name [1] && (name [1] != '.' || name [2])))
1699 { 1777 {
1700 int len = D_NAMLEN (entp) + 1; 1778 int len = D_NAMLEN (entp) + 1;
1701 1779
1702 while (ecb_expect_false (namesoffs + len > namesalloc)) 1780 while (ecb_expect_false (namesoffs + len > namesalloc))
1703 { 1781 {
1704 namesalloc *= 2; 1782 namesalloc *= 2;
1705 X_LOCK (wrklock);
1706 req->ptr2 = names = realloc (names, namesalloc); 1783 req->ptr2 = names = realloc (names, namesalloc);
1707 X_UNLOCK (wrklock);
1708 1784
1709 if (!names) 1785 if (!names)
1710 break; 1786 break;
1711 } 1787 }
1712 1788
1717 struct eio_dirent *ent; 1793 struct eio_dirent *ent;
1718 1794
1719 if (ecb_expect_false (dentoffs == dentalloc)) 1795 if (ecb_expect_false (dentoffs == dentalloc))
1720 { 1796 {
1721 dentalloc *= 2; 1797 dentalloc *= 2;
1722 X_LOCK (wrklock);
1723 req->ptr1 = dents = realloc (dents, dentalloc * sizeof (eio_dirent)); 1798 req->ptr1 = dents = realloc (dents, dentalloc * sizeof (eio_dirent));
1724 X_UNLOCK (wrklock);
1725 1799
1726 if (!dents) 1800 if (!dents)
1727 break; 1801 break;
1728 } 1802 }
1729 1803
1809 if (EIO_CANCELLED (req)) 1883 if (EIO_CANCELLED (req))
1810 { 1884 {
1811 errno = ECANCELED; 1885 errno = ECANCELED;
1812 break; 1886 break;
1813 } 1887 }
1888
1889#ifdef _WIN32
1890 if (!FindNextFile (dirp, &entp))
1891 {
1892 FindClose (dirp);
1893 dirp = 0;
1894 }
1895#endif
1814 } 1896 }
1815} 1897}
1816 1898
1817/*****************************************************************************/ 1899/*****************************************************************************/
1818 1900
1834X_THREAD_PROC (etp_proc) 1916X_THREAD_PROC (etp_proc)
1835{ 1917{
1836 ETP_REQ *req; 1918 ETP_REQ *req;
1837 struct timespec ts; 1919 struct timespec ts;
1838 etp_worker *self = (etp_worker *)thr_arg; 1920 etp_worker *self = (etp_worker *)thr_arg;
1839 int timeout; 1921
1922#if HAVE_PRCTL_SET_NAME
1923 prctl (PR_SET_NAME, (unsigned long)"eio_thread", 0, 0, 0);
1924#endif
1840 1925
1841 /* try to distribute timeouts somewhat evenly */ 1926 /* try to distribute timeouts somewhat evenly */
1842 ts.tv_nsec = ((unsigned long)self & 1023UL) * (1000000000UL / 1024UL); 1927 ts.tv_nsec = ((unsigned long)self & 1023UL) * (1000000000UL / 1024UL);
1843 1928
1844 for (;;) 1929 for (;;)
1914/*****************************************************************************/ 1999/*****************************************************************************/
1915 2000
1916int ecb_cold 2001int ecb_cold
1917eio_init (void (*want_poll)(void), void (*done_poll)(void)) 2002eio_init (void (*want_poll)(void), void (*done_poll)(void))
1918{ 2003{
2004#if !HAVE_PREADWRITE
2005 X_MUTEX_CREATE (preadwritelock);
2006#endif
2007
1919 return etp_init (want_poll, done_poll); 2008 return etp_init (want_poll, done_poll);
1920} 2009}
1921 2010
1922ecb_inline void 2011ecb_inline void
1923eio_api_destroy (eio_req *req) 2012eio_api_destroy (eio_req *req)
1968 case EIO_WRITE: req->result = req->offs >= 0 2057 case EIO_WRITE: req->result = req->offs >= 0
1969 ? pwrite (req->int1, req->ptr2, req->size, req->offs) 2058 ? pwrite (req->int1, req->ptr2, req->size, req->offs)
1970 : write (req->int1, req->ptr2, req->size); break; 2059 : write (req->int1, req->ptr2, req->size); break;
1971 2060
1972 case EIO_READAHEAD: req->result = readahead (req->int1, req->offs, req->size); break; 2061 case EIO_READAHEAD: req->result = readahead (req->int1, req->offs, req->size); break;
1973 case EIO_SENDFILE: req->result = eio__sendfile (req->int1, req->int2, req->offs, req->size, self); break; 2062 case EIO_SENDFILE: req->result = eio__sendfile (req->int1, req->int2, req->offs, req->size); break;
1974 2063
1975 case EIO_STAT: ALLOC (sizeof (EIO_STRUCT_STAT)); 2064 case EIO_STAT: ALLOC (sizeof (EIO_STRUCT_STAT));
1976 req->result = stat (req->ptr1, (EIO_STRUCT_STAT *)req->ptr2); break; 2065 req->result = stat (req->ptr1, (EIO_STRUCT_STAT *)req->ptr2); break;
1977 case EIO_LSTAT: ALLOC (sizeof (EIO_STRUCT_STAT)); 2066 case EIO_LSTAT: ALLOC (sizeof (EIO_STRUCT_STAT));
1978 req->result = lstat (req->ptr1, (EIO_STRUCT_STAT *)req->ptr2); break; 2067 req->result = lstat (req->ptr1, (EIO_STRUCT_STAT *)req->ptr2); break;
2008 req->result = readlink (req->ptr1, req->ptr2, PATH_MAX); break; 2097 req->result = readlink (req->ptr1, req->ptr2, PATH_MAX); break;
2009 2098
2010 case EIO_SYNC: req->result = 0; sync (); break; 2099 case EIO_SYNC: req->result = 0; sync (); break;
2011 case EIO_FSYNC: req->result = fsync (req->int1); break; 2100 case EIO_FSYNC: req->result = fsync (req->int1); break;
2012 case EIO_FDATASYNC: req->result = fdatasync (req->int1); break; 2101 case EIO_FDATASYNC: req->result = fdatasync (req->int1); break;
2102 case EIO_SYNCFS: req->result = eio__syncfs (req->int1); break;
2103 case EIO_SYNC_FILE_RANGE: req->result = eio__sync_file_range (req->int1, req->offs, req->size, req->int2); break;
2013 case EIO_MSYNC: req->result = eio__msync (req->ptr2, req->size, req->int1); break; 2104 case EIO_MSYNC: req->result = eio__msync (req->ptr2, req->size, req->int1); break;
2014 case EIO_MTOUCH: req->result = eio__mtouch (req); break; 2105 case EIO_MTOUCH: req->result = eio__mtouch (req); break;
2015 case EIO_MLOCK: req->result = eio__mlock (req->ptr2, req->size); break; 2106 case EIO_MLOCK: req->result = eio__mlock (req->ptr2, req->size); break;
2016 case EIO_MLOCKALL: req->result = eio__mlockall (req->int1); break; 2107 case EIO_MLOCKALL: req->result = eio__mlockall (req->int1); break;
2017 case EIO_SYNC_FILE_RANGE: req->result = eio__sync_file_range (req->int1, req->offs, req->size, req->int2); break;
2018 case EIO_FALLOCATE: req->result = eio__fallocate (req->int1, req->int2, req->offs, req->size); break; 2108 case EIO_FALLOCATE: req->result = eio__fallocate (req->int1, req->int2, req->offs, req->size); break;
2019 2109
2020 case EIO_READDIR: eio__scandir (req, self); break; 2110 case EIO_READDIR: eio__scandir (req, self); break;
2021 2111
2022 case EIO_BUSY: 2112 case EIO_BUSY:
2103eio_req *eio_msync (void *addr, size_t length, int flags, int pri, eio_cb cb, void *data) 2193eio_req *eio_msync (void *addr, size_t length, int flags, int pri, eio_cb cb, void *data)
2104{ 2194{
2105 REQ (EIO_MSYNC); req->ptr2 = addr; req->size = length; req->int1 = flags; SEND; 2195 REQ (EIO_MSYNC); req->ptr2 = addr; req->size = length; req->int1 = flags; SEND;
2106} 2196}
2107 2197
2198eio_req *eio_fdatasync (int fd, int pri, eio_cb cb, void *data)
2199{
2200 REQ (EIO_FDATASYNC); req->int1 = fd; SEND;
2201}
2202
2203eio_req *eio_syncfs (int fd, int pri, eio_cb cb, void *data)
2204{
2205 REQ (EIO_SYNCFS); req->int1 = fd; SEND;
2206}
2207
2208eio_req *eio_sync_file_range (int fd, off_t offset, size_t nbytes, unsigned int flags, int pri, eio_cb cb, void *data)
2209{
2210 REQ (EIO_SYNC_FILE_RANGE); req->int1 = fd; req->offs = offset; req->size = nbytes; req->int2 = flags; SEND;
2211}
2212
2108eio_req *eio_mtouch (void *addr, size_t length, int flags, int pri, eio_cb cb, void *data) 2213eio_req *eio_mtouch (void *addr, size_t length, int flags, int pri, eio_cb cb, void *data)
2109{ 2214{
2110 REQ (EIO_MTOUCH); req->ptr2 = addr; req->size = length; req->int1 = flags; SEND; 2215 REQ (EIO_MTOUCH); req->ptr2 = addr; req->size = length; req->int1 = flags; SEND;
2111} 2216}
2112 2217
2118eio_req *eio_mlockall (int flags, int pri, eio_cb cb, void *data) 2223eio_req *eio_mlockall (int flags, int pri, eio_cb cb, void *data)
2119{ 2224{
2120 REQ (EIO_MLOCKALL); req->int1 = flags; SEND; 2225 REQ (EIO_MLOCKALL); req->int1 = flags; SEND;
2121} 2226}
2122 2227
2123eio_req *eio_sync_file_range (int fd, off_t offset, size_t nbytes, unsigned int flags, int pri, eio_cb cb, void *data)
2124{
2125 REQ (EIO_SYNC_FILE_RANGE); req->int1 = fd; req->offs = offset; req->size = nbytes; req->int2 = flags; SEND;
2126}
2127
2128eio_req *eio_fallocate (int fd, int mode, off_t offset, size_t len, int pri, eio_cb cb, void *data) 2228eio_req *eio_fallocate (int fd, int mode, off_t offset, size_t len, int pri, eio_cb cb, void *data)
2129{ 2229{
2130 REQ (EIO_FALLOCATE); req->int1 = fd; req->int2 = mode; req->offs = offset; req->size = len; SEND; 2230 REQ (EIO_FALLOCATE); req->int1 = fd; req->int2 = mode; req->offs = offset; req->size = len; SEND;
2131} 2231}
2132 2232
2133eio_req *eio_fdatasync (int fd, int pri, eio_cb cb, void *data)
2134{
2135 REQ (EIO_FDATASYNC); req->int1 = fd; SEND;
2136}
2137
2138eio_req *eio_close (int fd, int pri, eio_cb cb, void *data) 2233eio_req *eio_close (int fd, int pri, eio_cb cb, void *data)
2139{ 2234{
2140 REQ (EIO_CLOSE); req->int1 = fd; SEND; 2235 REQ (EIO_CLOSE); req->int1 = fd; SEND;
2141} 2236}
2142 2237
2178eio_req *eio_fchmod (int fd, mode_t mode, int pri, eio_cb cb, void *data) 2273eio_req *eio_fchmod (int fd, mode_t mode, int pri, eio_cb cb, void *data)
2179{ 2274{
2180 REQ (EIO_FCHMOD); req->int1 = fd; req->int2 = (long)mode; SEND; 2275 REQ (EIO_FCHMOD); req->int1 = fd; req->int2 = (long)mode; SEND;
2181} 2276}
2182 2277
2183eio_req *eio_fchown (int fd, uid_t uid, gid_t gid, int pri, eio_cb cb, void *data) 2278eio_req *eio_fchown (int fd, eio_uid_t uid, eio_gid_t gid, int pri, eio_cb cb, void *data)
2184{ 2279{
2185 REQ (EIO_FCHOWN); req->int1 = fd; req->int2 = (long)uid; req->int3 = (long)gid; SEND; 2280 REQ (EIO_FCHOWN); req->int1 = fd; req->int2 = (long)uid; req->int3 = (long)gid; SEND;
2186} 2281}
2187 2282
2188eio_req *eio_dup2 (int fd, int fd2, int pri, eio_cb cb, void *data) 2283eio_req *eio_dup2 (int fd, int fd2, int pri, eio_cb cb, void *data)
2208eio_req *eio_truncate (const char *path, off_t offset, int pri, eio_cb cb, void *data) 2303eio_req *eio_truncate (const char *path, off_t offset, int pri, eio_cb cb, void *data)
2209{ 2304{
2210 REQ (EIO_TRUNCATE); PATH; req->offs = offset; SEND; 2305 REQ (EIO_TRUNCATE); PATH; req->offs = offset; SEND;
2211} 2306}
2212 2307
2213eio_req *eio_chown (const char *path, uid_t uid, gid_t gid, int pri, eio_cb cb, void *data) 2308eio_req *eio_chown (const char *path, eio_uid_t uid, eio_gid_t gid, int pri, eio_cb cb, void *data)
2214{ 2309{
2215 REQ (EIO_CHOWN); PATH; req->int2 = (long)uid; req->int3 = (long)gid; SEND; 2310 REQ (EIO_CHOWN); PATH; req->int2 = (long)uid; req->int3 = (long)gid; SEND;
2216} 2311}
2217 2312
2218eio_req *eio_chmod (const char *path, mode_t mode, int pri, eio_cb cb, void *data) 2313eio_req *eio_chmod (const char *path, mode_t mode, int pri, eio_cb cb, void *data)
2365} 2460}
2366 2461
2367/*****************************************************************************/ 2462/*****************************************************************************/
2368/* misc garbage */ 2463/* misc garbage */
2369 2464
2370ssize_t 2465eio_ssize_t
2371eio_sendfile_sync (int ofd, int ifd, off_t offset, size_t count) 2466eio_sendfile_sync (int ofd, int ifd, off_t offset, size_t count)
2372{ 2467{
2373 etp_worker wrk;
2374 ssize_t ret;
2375
2376 wrk.dbuf = 0;
2377
2378 ret = eio__sendfile (ofd, ifd, offset, count, &wrk); 2468 return eio__sendfile (ofd, ifd, offset, count);
2379
2380 if (wrk.dbuf)
2381 free (wrk.dbuf);
2382
2383 return ret;
2384} 2469}
2385 2470

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines