--- IO-AIO/AIO.xs 2005/08/23 12:37:19 1.37 +++ IO-AIO/AIO.xs 2006/02/06 23:54:12 1.39 @@ -33,6 +33,11 @@ # endif #endif +/* used for struct dirent, AIX doesn't provide it */ +#ifndef NAME_MAX +# define NAME_MAX 4096 +#endif + #if __ia64 # define STACKSIZE 65536 #else @@ -501,10 +506,10 @@ res = sbytes; } -# else +# endif +#else res = -1; errno = ENOSYS; -# endif #endif if (res < 0 @@ -519,11 +524,11 @@ char buf[4096]; res = 0; - for (;;) + while (count) { ssize_t cnt; - cnt = pread (ifd, buf, 4096, offset); + cnt = pread (ifd, buf, count > 4096 ? 4096 : count, offset); if (cnt <= 0) { @@ -541,6 +546,7 @@ offset += cnt; res += cnt; + count -= cnt; } }