fileaio-linux.cpp revision 10d739d22a5d5a13803f7e34de34de010099270c
335466db9e11d9713ddd2cdc4b8caf9c688e155aTinderbox User * IPRT - File async I/O, native implementation for the Linux host platform.
335466db9e11d9713ddd2cdc4b8caf9c688e155aTinderbox User * Copyright (C) 2006-2011 Oracle Corporation
335466db9e11d9713ddd2cdc4b8caf9c688e155aTinderbox User * This file is part of VirtualBox Open Source Edition (OSE), as
335466db9e11d9713ddd2cdc4b8caf9c688e155aTinderbox User * available from http://www.virtualbox.org. This file is free software;
335466db9e11d9713ddd2cdc4b8caf9c688e155aTinderbox User * you can redistribute it and/or modify it under the terms of the GNU
335466db9e11d9713ddd2cdc4b8caf9c688e155aTinderbox User * General Public License (GPL) as published by the Free Software
335466db9e11d9713ddd2cdc4b8caf9c688e155aTinderbox User * Foundation, in version 2 as it comes in the "COPYING" file of the
335466db9e11d9713ddd2cdc4b8caf9c688e155aTinderbox User * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
335466db9e11d9713ddd2cdc4b8caf9c688e155aTinderbox User * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
335466db9e11d9713ddd2cdc4b8caf9c688e155aTinderbox User * The contents of this file may alternatively be used under the terms
335466db9e11d9713ddd2cdc4b8caf9c688e155aTinderbox User * of the Common Development and Distribution License Version 1.0
335466db9e11d9713ddd2cdc4b8caf9c688e155aTinderbox User * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
335466db9e11d9713ddd2cdc4b8caf9c688e155aTinderbox User * VirtualBox OSE distribution, in which case the provisions of the
335466db9e11d9713ddd2cdc4b8caf9c688e155aTinderbox User * CDDL are applicable instead of those of the GPL.
335466db9e11d9713ddd2cdc4b8caf9c688e155aTinderbox User * You may elect to license modified versions of this file under the
335466db9e11d9713ddd2cdc4b8caf9c688e155aTinderbox User * terms and conditions of either the GPL or the CDDL or both.
335466db9e11d9713ddd2cdc4b8caf9c688e155aTinderbox User/** @page pg_rtfileaio_linux RTFile Async I/O - Linux Implementation Notes
335466db9e11d9713ddd2cdc4b8caf9c688e155aTinderbox User * Linux implements the kernel async I/O API through the io_* syscalls. They are
#include <unistd.h>
#include <errno.h>
typedef unsigned long LNXKAIOCONTEXT;
typedef struct LNXKAIOIOCB
void *pvUser;
#ifdef RT_ARCH_X86
/** The userspace pointer to the buffer containing/receiving the data. */
void *pvBuf;
#ifdef RT_ARCH_X86
#ifdef RT_ARCH_X86
typedef struct LNXKAIOIOEVENT
void *pvUser;
#ifdef RT_ARCH_X86
#ifdef RT_ARCH_X86
#ifdef RT_ARCH_X86
#ifdef RT_ARCH_X86
typedef struct RTFILEAIOCTXINTERNAL
int cRequestsMax;
volatile bool fWokenUp;
volatile bool fWaiting;
typedef struct RTFILEAIOREQINTERNAL
int Rc;
return VINF_SUCCESS;
return VINF_SUCCESS;
DECLINLINE(int) rtFileAsyncIoLinuxSubmit(LNXKAIOCONTEXT AioContext, long cReqs, LNXKAIOIOCB **ppIoCB, int *pcSubmitted)
return VINF_SUCCESS;
DECLINLINE(int) rtFileAsyncIoLinuxCancel(LNXKAIOCONTEXT AioContext, PLNXKAIOIOCB pIoCB, PLNXKAIOIOEVENT pIoResult)
return VINF_SUCCESS;
return rc;
return rc;
return rc;
return VINF_SUCCESS;
return VERR_NO_MEMORY;
return VINF_SUCCESS;
return VINF_SUCCESS;
return VINF_SUCCESS;
void *pvUser)
return VINF_SUCCESS;
return VINF_SUCCESS;
return VERR_FILE_AIO_IN_PROGRESS;
return rc;
if ( pcbTransfered
return VERR_OUT_OF_RANGE;
return VERR_NO_MEMORY;
return rc;
return VINF_SUCCESS;
return VERR_FILE_AIO_BUSY;
return rc;
return VINF_SUCCESS;
return VINF_SUCCESS;
while (iUndo-- > i)
return VERR_INVALID_HANDLE;
int cReqsSubmitted = 0;
i = cReqs;
return rc;
} while (cReqs);
return rc;
return VERR_FILE_AIO_NO_REQUEST;
if (!cMinReqs)
int cRequestsCompleted = 0;
rc = rtFileAsyncIoLinuxGetEvents(pCtxInt->AioContext, cMinReqs, cRequestsToWait, &aPortEvents[0], pTimeout);
return rc;
if ( !fWokenUp
&& fWaiting)
return VINF_SUCCESS;