1
1

Fixed aio_read/write/suspend for AIX w/o _AIO_AIX_SOURCE

This commit was SVN r5255.
Этот коммит содержится в:
Thara Angskun 2005-04-11 06:46:46 +00:00
родитель 7a0c7a24cb
Коммит 3a27c53d19
4 изменённых файлов: 47 добавлений и 0 удалений

Просмотреть файл

@ -200,13 +200,21 @@ int error_code, this_errno;
aiocbp->aio_nbytes = len;
if (wr) {
ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len);
#if !defined(_AIO_AIX_SOURCE) && !defined(_NO_PROTO)
err = aio_write(aiocbp);
#else
err = aio_write(fd_sys, aiocbp);
#endif
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
else {
ADIOI_READ_LOCK(fd, offset, SEEK_SET, len);
#if !defined(_AIO_AIX_SOURCE) && !defined(_NO_PROTO)
err = aio_read(aiocbp);
#else
err = aio_read(fd_sys, aiocbp);
#endif
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
@ -219,13 +227,21 @@ int error_code, this_errno;
ADIOI_Complete_async(&error_code);
if (wr) {
ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len);
#if !defined(_AIO_AIX_SOURCE) && !defined(_NO_PROTO)
err = aio_write(aiocbp);
#else
err = aio_write(fd_sys, aiocbp);
#endif
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
else {
ADIOI_READ_LOCK(fd, offset, SEEK_SET, len);
#if !defined(_AIO_AIX_SOURCE) && !defined(_NO_PROTO)
err = aio_read(aiocbp);
#else
err = aio_read(fd_sys, aiocbp);
#endif
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
@ -236,13 +252,21 @@ int error_code, this_errno;
sleep(1);
if (wr) {
ADIOI_WRITE_LOCK(fd, offset, SEEK_SET, len);
#if !defined(_AIO_AIX_SOURCE) && !defined(_NO_PROTO)
err = aio_write(aiocbp);
#else
err = aio_write(fd_sys, aiocbp);
#endif
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}
else {
ADIOI_READ_LOCK(fd, offset, SEEK_SET, len);
#if !defined(_AIO_AIX_SOURCE) && !defined(_NO_PROTO)
err = aio_read(aiocbp);
#else
err = aio_read(fd_sys, aiocbp);
#endif
this_errno = errno;
ADIOI_UNLOCK(fd, offset, SEEK_SET, len);
}

Просмотреть файл

@ -69,7 +69,11 @@ void ADIOI_NFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int *err
/* IBM */
if ((*request)->queued) {
do {
#if !defined(_AIO_AIX_SOURCE) && !defined(_NO_PROTO)
err = aio_suspend((*request)->handle,1,NULL);
#else
err = aio_suspend(1, (struct aiocb **) &((*request)->handle));
#endif
} while ((err == -1) && (errno == EINTR));
tmp1 = (struct aiocb *) (*request)->handle;

Просмотреть файл

@ -169,8 +169,13 @@ int ADIOI_UFS_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset,
aiocbp->aio_offset = offset;
aiocbp->aio_buf = buf;
aiocbp->aio_nbytes = len;
#if !defined(_AIO_AIX_SOURCE) && !defined(_NO_PROTO)
if (wr) err = aio_write(aiocbp);
else err = aio_read(aiocbp);
#else
if (wr) err = aio_write(fd_sys, aiocbp);
else err = aio_read(fd_sys, aiocbp);
#endif
if (err == -1) {
if (errno == EAGAIN) {
@ -178,15 +183,25 @@ int ADIOI_UFS_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset,
complete all previous async. requests and try again. */
ADIOI_Complete_async(&error_code);
#if !defined(_AIO_AIX_SOURCE) && !defined(_NO_PROTO)
if (wr) err = aio_write(aiocbp);
else err = aio_read(aiocbp);
#else
if (wr) err = aio_write(fd_sys, aiocbp);
else err = aio_read(fd_sys, aiocbp);
#endif
while (err == -1) {
if (errno == EAGAIN) {
/* sleep and try again */
sleep(1);
#if !defined(_AIO_AIX_SOURCE) && !defined(_NO_PROTO)
if (wr) err = aio_write(aiocbp);
else err = aio_read(aiocbp);
#else
if (wr) err = aio_write(fd_sys, aiocbp);
else err = aio_read(fd_sys, aiocbp);
#endif
}
else {
FPRINTF(stderr, "Unknown errno %d in ADIOI_UFS_aio\n", errno);

Просмотреть файл

@ -69,7 +69,11 @@ void ADIOI_UFS_ReadComplete(ADIO_Request *request, ADIO_Status *status, int *err
/* IBM */
if ((*request)->queued) {
do {
#if !defined(_AIO_AIX_SOURCE) && !defined(_NO_PROTO)
err = aio_suspend((*request)->handle,1,NULL);
#else
err = aio_suspend(1, (struct aiocb **) &((*request)->handle));
#endif
} while ((err == -1) && (errno == EINTR));
tmp1 = (struct aiocb *) (*request)->handle;