diff options
author | Jeremy Allison <jra@samba.org> | 2012-01-25 15:30:56 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2012-01-26 02:11:28 +0100 |
commit | 1ca4df58c76e98d963d90c092532ca584606ccff (patch) | |
tree | d4f2f56da6cc4fbbd4a3a91941857bdef1a1e1b1 | |
parent | d8c699190d2cc0ce64395c7b2b10bb25c98a2943 (diff) | |
download | samba-1ca4df58c76e98d963d90c092532ca584606ccff.tar.gz samba-1ca4df58c76e98d963d90c092532ca584606ccff.tar.bz2 samba-1ca4df58c76e98d963d90c092532ca584606ccff.zip |
Use sys_pread/sys_pwrite to cope correctly with 64-bit sizes. As in the default VFS case fall back from pread -> read and pwrite -> write on an ESPIPE error in the worker thread.
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Thu Jan 26 02:11:28 CET 2012 on sn-devel-104
-rw-r--r-- | source3/modules/vfs_aio_pthread.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/source3/modules/vfs_aio_pthread.c b/source3/modules/vfs_aio_pthread.c index e1cc492bb5..c172ff04b2 100644 --- a/source3/modules/vfs_aio_pthread.c +++ b/source3/modules/vfs_aio_pthread.c @@ -115,15 +115,29 @@ static void aio_worker(void *private_data) (struct aio_private_data *)private_data; if (pd->write_command) { - pd->ret_size = pwrite(pd->aiocb->aio_fildes, + pd->ret_size = sys_pwrite(pd->aiocb->aio_fildes, (const void *)pd->aiocb->aio_buf, pd->aiocb->aio_nbytes, pd->aiocb->aio_offset); + if (pd->ret_size == -1 && errno == ESPIPE) { + /* Maintain the fiction that pipes can + be seeked (sought?) on. */ + pd->ret_size = sys_write(pd->aiocb->aio_fildes, + (const void *)pd->aiocb->aio_buf, + pd->aiocb->aio_nbytes); + } } else { - pd->ret_size = pread(pd->aiocb->aio_fildes, + pd->ret_size = sys_pread(pd->aiocb->aio_fildes, (void *)pd->aiocb->aio_buf, pd->aiocb->aio_nbytes, pd->aiocb->aio_offset); + if (pd->ret_size == -1 && errno == ESPIPE) { + /* Maintain the fiction that pipes can + be seeked (sought?) on. */ + pd->ret_size = sys_read(pd->aiocb->aio_fildes, + (void *)pd->aiocb->aio_buf, + pd->aiocb->aio_nbytes); + } } if (pd->ret_size == -1) { pd->ret_errno = errno; |