1 | #include "eio.h" |
1 | #include "eio.h" |
2 | #include "xthread.h" |
2 | #include "xthread.h" |
3 | |
3 | |
4 | #include <errno.h> |
4 | #include <errno.h> |
5 | |
|
|
6 | #include "EXTERN.h" |
|
|
7 | #include "perl.h" |
|
|
8 | #include "XSUB.h" |
|
|
9 | |
|
|
10 | #include <stddef.h> |
5 | #include <stddef.h> |
11 | #include <stdlib.h> |
6 | #include <stdlib.h> |
|
|
7 | #include <string.h> |
12 | #include <errno.h> |
8 | #include <errno.h> |
13 | #include <sys/types.h> |
9 | #include <sys/types.h> |
14 | #include <sys/stat.h> |
10 | #include <sys/stat.h> |
15 | #include <limits.h> |
11 | #include <limits.h> |
16 | #include <fcntl.h> |
12 | #include <fcntl.h> |
… | |
… | |
38 | # include <sys/time.h> |
34 | # include <sys/time.h> |
39 | # include <sys/select.h> |
35 | # include <sys/select.h> |
40 | # include <unistd.h> |
36 | # include <unistd.h> |
41 | # include <utime.h> |
37 | # include <utime.h> |
42 | # include <signal.h> |
38 | # include <signal.h> |
|
|
39 | # include <dirent.h> |
43 | |
40 | |
44 | # ifndef EIO_STRUCT_DIRENT |
41 | # ifndef EIO_STRUCT_DIRENT |
45 | # define EIO_STRUCT_DIRENT struct dirent |
42 | # define EIO_STRUCT_DIRENT struct dirent |
46 | # endif |
43 | # endif |
47 | |
44 | |
… | |
… | |
571 | |
568 | |
572 | while (todo > 0) |
569 | while (todo > 0) |
573 | { |
570 | { |
574 | size_t len = todo < EIO_BUFSIZE ? todo : EIO_BUFSIZE; |
571 | size_t len = todo < EIO_BUFSIZE ? todo : EIO_BUFSIZE; |
575 | |
572 | |
576 | pread (fd, aio_buf, len, offset); |
573 | pread (fd, eio_buf, len, offset); |
577 | offset += len; |
574 | offset += len; |
578 | todo -= len; |
575 | todo -= len; |
579 | } |
576 | } |
580 | |
577 | |
581 | errno = 0; |
578 | errno = 0; |
… | |
… | |
587 | #if !HAVE_READDIR_R |
584 | #if !HAVE_READDIR_R |
588 | # define readdir_r aio_readdir_r |
585 | # define readdir_r aio_readdir_r |
589 | |
586 | |
590 | static mutex_t readdirlock = X_MUTEX_INIT; |
587 | static mutex_t readdirlock = X_MUTEX_INIT; |
591 | |
588 | |
592 | static int readdir_r (DIR *dirp, X_DIRENT *ent, X_DIRENT **res) |
589 | static int readdir_r (DIR *dirp, EIO_STRUCT_DIRENT *ent, EIO_STRUCT_DIRENT **res) |
593 | { |
590 | { |
594 | X_DIRENT *e; |
591 | EIO_STRUCT_DIRENT *e; |
595 | int errorno; |
592 | int errorno; |
596 | |
593 | |
597 | X_LOCK (readdirlock); |
594 | X_LOCK (readdirlock); |
598 | |
595 | |
599 | e = readdir (dirp); |
596 | e = readdir (dirp); |