VirtualBox

Changeset 23364 in vbox


Ignore:
Timestamp:
Sep 28, 2009 11:19:49 AM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
52888
Message:

Runtime/Aio-posix: The error code from lio_listio is in errno

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/posix/fileaio-posix.cpp

    r23343 r23364  
    4545#include "internal/fileaio.h"
    4646
    47 #if defined(RT_OS_DARWIN)
     47#if defined(RT_OS_DARWIN) || defined(RT_OS_FREEBSD)
    4848# include <sys/types.h>
    4949# include <sys/sysctl.h> /* for sysctlbyname */
     50#endif
     51#if defined(RT_OS_FREEBSD)
     52# include <fcntl.h> /* O_SYNC */
    5053#endif
    5154#include <aio.h>
     
    238241    pAioLimits->cReqsOutstandingMax = cReqsOutstandingMax;
    239242    pAioLimits->cbBufferAlignment   = 0;
     243#elif defined(RT_OS_FREEBSD)
     244    /*
     245     * The AIO API is implemented in a kernel module which is not
     246     * loaded by default.
     247     * If it is loaded there are additional sysctl parameters.
     248     */
     249    int cReqsOutstandingMax = 0;
     250    size_t cbParameter = sizeof(int);
     251
     252    rcBSD = sysctlbyname("vfs.aio.max_aio_per_proc", /* name */
     253                         &cReqsOutstandingMax,       /* Where to store the old value. */
     254                         &cbParameter,               /* Size of the memory pointed to. */
     255                         NULL,                       /* Where the new value is located. */
     256                         NULL);                      /* Where the size of the new value is stored. */
     257    if (rcBSD == -1)
     258    {
     259        /* ENOENT means the value is unknown thus the module is not loaded. */
     260        if (errno == ENOENT)
     261            return VERR_NOT_SUPPORTED;
     262        else
     263            return RTErrConvertFromErrno(errno);
     264    }
     265
     266    pAioLimits->cReqsOutstandingMax = cReqsOutstandingMax;
     267    pAioLimits->cbBufferAlignment   = 0;
    240268#else
    241269    pAioLimits->cReqsOutstandingMax = RTFILEAIO_UNLIMITED_REQS;
     
    549577            if (RT_UNLIKELY(rcPosix < 0))
    550578            {
    551                 if (rcPosix == EAGAIN)
     579                if (errno == EAGAIN)
    552580                    rc = VERR_FILE_AIO_INSUFFICIENT_RESSOURCES;
    553581                else
     
    581609                             * -1 and sets errno to the appropriate value
    582610                             */
    583 #if defined(RT_OS_DARWIN)
     611#if defined(RT_OS_DARWIN) || defined(RT_OS_FREEBSD)
    584612                            Assert(rcPosix == -1);
    585613                            pReqInt->Rc = RTErrConvertFromErrno(errno);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette