fileaio-solaris.cpp revision 427735c505430fb6cd1253b26ca5ac0e4c55cbcf
1c9bd843ebc00801cc418156a3893362a1dc872edinak * IPRT - File async I/O, native implementation for the Solaris host platform.
1c9bd843ebc00801cc418156a3893362a1dc872edinak * Copyright (C) 2006-2010 Oracle Corporation
1c9bd843ebc00801cc418156a3893362a1dc872edinak * This file is part of VirtualBox Open Source Edition (OSE), as
1c9bd843ebc00801cc418156a3893362a1dc872edinak * available from http://www.virtualbox.org. This file is free software;
1c9bd843ebc00801cc418156a3893362a1dc872edinak * you can redistribute it and/or modify it under the terms of the GNU
1c9bd843ebc00801cc418156a3893362a1dc872edinak * General Public License (GPL) as published by the Free Software
1c9bd843ebc00801cc418156a3893362a1dc872edinak * Foundation, in version 2 as it comes in the "COPYING" file of the
1c9bd843ebc00801cc418156a3893362a1dc872edinak * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
1c9bd843ebc00801cc418156a3893362a1dc872edinak * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
1c9bd843ebc00801cc418156a3893362a1dc872edinak * The contents of this file may alternatively be used under the terms
1c9bd843ebc00801cc418156a3893362a1dc872edinak * of the Common Development and Distribution License Version 1.0
1c9bd843ebc00801cc418156a3893362a1dc872edinak * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
1c9bd843ebc00801cc418156a3893362a1dc872edinak * VirtualBox OSE distribution, in which case the provisions of the
1c9bd843ebc00801cc418156a3893362a1dc872edinak * CDDL are applicable instead of those of the GPL.
1c9bd843ebc00801cc418156a3893362a1dc872edinak * You may elect to license modified versions of this file under the
1c9bd843ebc00801cc418156a3893362a1dc872edinak * terms and conditions of either the GPL or the CDDL or both.
1c9bd843ebc00801cc418156a3893362a1dc872edinak/*******************************************************************************
1c9bd843ebc00801cc418156a3893362a1dc872edinak* Header Files *
1c9bd843ebc00801cc418156a3893362a1dc872edinak*******************************************************************************/
1c9bd843ebc00801cc418156a3893362a1dc872edinak/*******************************************************************************
1c9bd843ebc00801cc418156a3893362a1dc872edinak* Structures and Typedefs *
1c9bd843ebc00801cc418156a3893362a1dc872edinak*******************************************************************************/
1c9bd843ebc00801cc418156a3893362a1dc872edinak * Async I/O completion context state.
1c9bd843ebc00801cc418156a3893362a1dc872edinak /** Handle to the port. */
1c9bd843ebc00801cc418156a3893362a1dc872edinak /** Current number of requests active on this context. */
1c9bd843ebc00801cc418156a3893362a1dc872edinak /** Magic value (RTFILEAIOCTX_MAGIC). */
1c9bd843ebc00801cc418156a3893362a1dc872edinak/** Pointer to an internal context structure. */
1c9bd843ebc00801cc418156a3893362a1dc872edinak * Async I/O request state.
1c9bd843ebc00801cc418156a3893362a1dc872edinak /** The aio control block. Must be the FIRST
1c9bd843ebc00801cc418156a3893362a1dc872edinak * element. */
1c9bd843ebc00801cc418156a3893362a1dc872edinak /** Current state the request is in. */
1c9bd843ebc00801cc418156a3893362a1dc872edinak /** Flag whether this is a flush request. */
1c9bd843ebc00801cc418156a3893362a1dc872edinak /** Port notifier object to associate a request to a port. */
1c9bd843ebc00801cc418156a3893362a1dc872edinak /** Opaque user data. */
1c9bd843ebc00801cc418156a3893362a1dc872edinak /** Completion context we are assigned to. */
1c9bd843ebc00801cc418156a3893362a1dc872edinak /** Magic value (RTFILEAIOREQ_MAGIC). */
1c9bd843ebc00801cc418156a3893362a1dc872edinak/** Pointer to an internal request structure. */
1c9bd843ebc00801cc418156a3893362a1dc872edinak/*******************************************************************************
1c9bd843ebc00801cc418156a3893362a1dc872edinak* Defined Constants And Macros *
1c9bd843ebc00801cc418156a3893362a1dc872edinak*******************************************************************************/
1c9bd843ebc00801cc418156a3893362a1dc872edinak/** The max number of events to get in one call. */
1c9bd843ebc00801cc418156a3893362a1dc872edinak/** Id for the wakeup event. */
1c9bd843ebc00801cc418156a3893362a1dc872edinakRTR3DECL(int) RTFileAioGetLimits(PRTFILEAIOLIMITS pAioLimits)
1c9bd843ebc00801cc418156a3893362a1dc872edinak /* No limits known. */
1c9bd843ebc00801cc418156a3893362a1dc872edinak pAioLimits->cReqsOutstandingMax = RTFILEAIO_UNLIMITED_REQS;
1c9bd843ebc00801cc418156a3893362a1dc872edinak PRTFILEAIOREQINTERNAL pReqInt = (PRTFILEAIOREQINTERNAL)RTMemAllocZ(sizeof(RTFILEAIOREQINTERNAL));
1c9bd843ebc00801cc418156a3893362a1dc872edinak /* Ininitialize static parts. */
1c9bd843ebc00801cc418156a3893362a1dc872edinak pReqInt->AioCB.aio_sigevent.sigev_notify = SIGEV_PORT;
1c9bd843ebc00801cc418156a3893362a1dc872edinak pReqInt->AioCB.aio_sigevent.sigev_value.sival_ptr = &pReqInt->PortNotifier;
return VINF_SUCCESS;
return VINF_SUCCESS;
unsigned uTransferDirection,
void *pvUser)
return VINF_SUCCESS;
return VINF_SUCCESS;
return VINF_SUCCESS;
return VERR_FILE_AIO_COMPLETED;
return VERR_FILE_AIO_IN_PROGRESS;
if (rcSol == 0)
if (pcbTransfered)
return VINF_SUCCESS;
return VERR_NO_MEMORY;
return rc;
return VINF_SUCCESS;
return VERR_FILE_AIO_BUSY;
return VINF_SUCCESS;
return RTFILEAIO_UNLIMITED_REQS;
return VINF_SUCCESS;
int rcSol = 0;
cReqsSubmit++;
if (cReqsSubmit)
for (i = 0; i < cReqs; i++)
if (cReqs)
cReqs--;
pahReqs++;
} while (cReqs);
return rc;
int cRequestsCompleted = 0;
return VERR_FILE_AIO_NO_REQUEST;
if (!cMinReqs)
while ( cMinReqs
int cRequestsToWait = cMinReqs < AIO_MAXIMUM_REQUESTS_PER_CONTEXT ? cReqs : AIO_MAXIMUM_REQUESTS_PER_CONTEXT;
int rcSol;
return rc;
return VINF_SUCCESS;