… | |
… | |
200 | /*****************************************************************************/ |
200 | /*****************************************************************************/ |
201 | |
201 | |
202 | #define ETP_NUM_PRI (ETP_PRI_MAX - ETP_PRI_MIN + 1) |
202 | #define ETP_NUM_PRI (ETP_PRI_MAX - ETP_PRI_MIN + 1) |
203 | |
203 | |
204 | /* calculate time difference in ~1/EIO_TICKS of a second */ |
204 | /* calculate time difference in ~1/EIO_TICKS of a second */ |
205 | ECB_INLINE int |
205 | ecb_inline int |
206 | tvdiff (struct timeval *tv1, struct timeval *tv2) |
206 | tvdiff (struct timeval *tv1, struct timeval *tv2) |
207 | { |
207 | { |
208 | return (tv2->tv_sec - tv1->tv_sec ) * EIO_TICKS |
208 | return (tv2->tv_sec - tv1->tv_sec ) * EIO_TICKS |
209 | + ((tv2->tv_usec - tv1->tv_usec) >> 10); |
209 | + ((tv2->tv_usec - tv1->tv_usec) >> 10); |
210 | } |
210 | } |
… | |
… | |
1006 | |
1006 | |
1007 | /* according to source inspection, this is correct, and useful behaviour */ |
1007 | /* according to source inspection, this is correct, and useful behaviour */ |
1008 | if (sbytes) |
1008 | if (sbytes) |
1009 | res = sbytes; |
1009 | res = sbytes; |
1010 | |
1010 | |
1011 | # elif defined (__APPLE__) |
1011 | # elif defined (__APPLE__) && 0 /* broken, as everything on os x */ |
1012 | off_t sbytes = count; |
1012 | off_t sbytes = count; |
1013 | res = sendfile (ifd, ofd, offset, &sbytes, 0, 0); |
1013 | res = sendfile (ifd, ofd, offset, &sbytes, 0, 0); |
1014 | |
1014 | |
1015 | /* according to the manpage, sbytes is always valid */ |
1015 | /* according to the manpage, sbytes is always valid */ |
1016 | if (sbytes) |
1016 | if (sbytes) |
… | |
… | |
1305 | flags &= ~(EIO_READDIR_DIRS_FIRST | EIO_READDIR_STAT_ORDER); |
1305 | flags &= ~(EIO_READDIR_DIRS_FIRST | EIO_READDIR_STAT_ORDER); |
1306 | |
1306 | |
1307 | X_LOCK (wrklock); |
1307 | X_LOCK (wrklock); |
1308 | /* the corresponding closedir is in ETP_WORKER_CLEAR */ |
1308 | /* the corresponding closedir is in ETP_WORKER_CLEAR */ |
1309 | self->dirp = dirp = opendir (req->ptr1); |
1309 | self->dirp = dirp = opendir (req->ptr1); |
|
|
1310 | |
|
|
1311 | if (req->flags & EIO_FLAG_PTR1_FREE) |
|
|
1312 | free (req->ptr1); |
1310 | |
1313 | |
1311 | req->flags |= EIO_FLAG_PTR1_FREE | EIO_FLAG_PTR2_FREE; |
1314 | req->flags |= EIO_FLAG_PTR1_FREE | EIO_FLAG_PTR2_FREE; |
1312 | req->ptr1 = dents = flags ? malloc (dentalloc * sizeof (eio_dirent)) : 0; |
1315 | req->ptr1 = dents = flags ? malloc (dentalloc * sizeof (eio_dirent)) : 0; |
1313 | req->ptr2 = names = malloc (namesalloc); |
1316 | req->ptr2 = names = malloc (namesalloc); |
1314 | X_UNLOCK (wrklock); |
1317 | X_UNLOCK (wrklock); |
… | |
… | |
1695 | eio_init (void (*want_poll)(void), void (*done_poll)(void)) |
1698 | eio_init (void (*want_poll)(void), void (*done_poll)(void)) |
1696 | { |
1699 | { |
1697 | return etp_init (want_poll, done_poll); |
1700 | return etp_init (want_poll, done_poll); |
1698 | } |
1701 | } |
1699 | |
1702 | |
1700 | ECB_INLINE void |
1703 | ecb_inline void |
1701 | eio_api_destroy (eio_req *req) |
1704 | eio_api_destroy (eio_req *req) |
1702 | { |
1705 | { |
1703 | free (req); |
1706 | free (req); |
1704 | } |
1707 | } |
1705 | |
1708 | |