summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-06-27 22:53:56 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:58:05 -0500
commitf2f55d703d0dd549a83809d3e5cc5151569b48d6 (patch)
treef5c2e7747c6541d19472a0157215c54af1b2cd62 /source3/lib
parent7ebd74e6c502483b7f7c73943b698d6433c8c0b2 (diff)
downloadsamba-f2f55d703d0dd549a83809d3e5cc5151569b48d6.tar.gz
samba-f2f55d703d0dd549a83809d3e5cc5151569b48d6.tar.bz2
samba-f2f55d703d0dd549a83809d3e5cc5151569b48d6.zip
r7963: Add aio support to 3.0.
Jeremy. (This used to be commit 1de27da47051af08790317f5b48b02719d6b9934)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/system.c158
1 files changed, 158 insertions, 0 deletions
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 6c36544b77..6ac2cdf243 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -1846,3 +1846,161 @@ uint32 unix_dev_minor(SMB_DEV_T dev)
return (uint32)(dev & 0xff);
#endif
}
+
+#if defined(WITH_AIO)
+
+/*******************************************************************
+ An aio_read wrapper that will deal with 64-bit sizes.
+********************************************************************/
+
+int sys_aio_read(SMB_STRUCT_AIOCB *aiocb)
+{
+#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_AIOCB64) && defined(HAVE_AIO_READ64)
+ return aio_read64(aiocb);
+#elif defined(HAVE_AIO_READ)
+ return aio_read(aiocb);
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+/*******************************************************************
+ An aio_write wrapper that will deal with 64-bit sizes.
+********************************************************************/
+
+int sys_aio_write(SMB_STRUCT_AIOCB *aiocb)
+{
+#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_AIOCB64) && defined(HAVE_AIO_WRITE64)
+ return aio_write64(aiocb);
+#elif defined(HAVE_AIO_WRITE)
+ return aio_write(aiocb);
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+/*******************************************************************
+ An aio_return wrapper that will deal with 64-bit sizes.
+********************************************************************/
+
+ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb)
+{
+#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_AIOCB64) && defined(HAVE_AIO_RETURN64)
+ return aio_return64(aiocb);
+#elif defined(HAVE_AIO_RETURN)
+ return aio_return(aiocb);
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+/*******************************************************************
+ An aio_cancel wrapper that will deal with 64-bit sizes.
+********************************************************************/
+
+int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb)
+{
+#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_AIOCB64) && defined(HAVE_AIO_CANCEL64)
+ return aio_cancel64(fd, aiocb);
+#elif defined(HAVE_AIO_CANCEL)
+ return aio_cancel(fd, aiocb);
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+/*******************************************************************
+ An aio_error wrapper that will deal with 64-bit sizes.
+********************************************************************/
+
+int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb)
+{
+#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_AIOCB64) && defined(HAVE_AIO_ERROR64)
+ return aio_error64(aiocb);
+#elif defined(HAVE_AIO_ERROR)
+ return aio_error(aiocb);
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+/*******************************************************************
+ An aio_fsync wrapper that will deal with 64-bit sizes.
+********************************************************************/
+
+int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb)
+{
+#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_AIOCB64) && defined(HAVE_AIO_FSYNC64)
+ return aio_fsync64(op, aiocb);
+#elif defined(HAVE_AIO_FSYNC)
+ return aio_fsync64(op, aiocb);
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+/*******************************************************************
+ An aio_fsync wrapper that will deal with 64-bit sizes.
+********************************************************************/
+
+int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout)
+{
+#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_AIOCB64) && defined(HAVE_AIO_SUSPEND64)
+ return aio_suspend64(cblist, n, timeout);
+#elif defined(HAVE_AIO_FSYNC)
+ return aio_suspend(cblist, n, timeout);
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+#else /* !WITH_AIO */
+
+int sys_aio_read(SMB_STRUCT_AIOCB *aiocb)
+{
+ errno = ENOSYS;
+ return -1;
+}
+
+int sys_aio_write(SMB_STRUCT_AIOCB *aiocb)
+{
+ errno = ENOSYS;
+ return -1;
+}
+
+ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb)
+{
+ errno = ENOSYS;
+ return -1;
+}
+
+int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb)
+{
+ errno = ENOSYS;
+ return -1;
+}
+
+int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb)
+{
+ errno = ENOSYS;
+ return -1;
+}
+
+int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb)
+{
+ errno = ENOSYS;
+ return -1;
+}
+
+int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout)
+{
+ errno = ENOSYS;
+ return -1;
+}
+#endif /* WITH_AIO */