VirtualBox

Ignore:
Timestamp:
Mar 28, 2019 12:05:23 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
129641
Message:

FsPerf: Do the splice() syscall ourselves (forgot) so we can build this against really ancient glibc versions. bugref:9172

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/fs/FsPerf.cpp

    r77927 r77928  
    290290    kCmdOpt_ReadTests,
    291291    kCmdOpt_NoReadTests,
     292#ifdef FSPERF_TEST_SENDFILE
    292293    kCmdOpt_SendFile,
    293294    kCmdOpt_NoSendFile,
     295#endif
    294296#ifdef RT_OS_LINUX
    295297    kCmdOpt_Splice,
     
    378380    { "--read-perf",        kCmdOpt_ReadPerf,       RTGETOPT_REQ_NOTHING },
    379381    { "--no-read-perf",     kCmdOpt_NoReadPerf,     RTGETOPT_REQ_NOTHING },
     382#ifdef FSPERF_TEST_SENDFILE
    380383    { "--sendfile",         kCmdOpt_SendFile,       RTGETOPT_REQ_NOTHING },
    381384    { "--no-sendfile",      kCmdOpt_NoSendFile,     RTGETOPT_REQ_NOTHING },
     385#endif
    382386#ifdef RT_OS_LINUX
    383387    { "--splice",           kCmdOpt_Splice,         RTGETOPT_REQ_NOTHING },
     
    446450static bool         g_fReadTests = true;
    447451static bool         g_fReadPerf  = true;
     452#ifdef FSPERF_TEST_SENDFILE
    448453static bool         g_fSendFile  = true;
     454#endif
    449455#ifdef RT_OS_LINUX
    450456static bool         g_fSplice    = true;
     
    21742180#ifdef RT_OS_LINUX
    21752181
     2182#ifndef __NR_splice
     2183# if defined(RT_ARCH_AMD64)
     2184#  define __NR_splice 275
     2185# elif defined(RT_ARCH_X86)
     2186#  define __NR_splice 313
     2187# else
     2188#  error "fix me"
     2189# endif
     2190#endif
     2191
     2192/** FsPerf is built against ancient glibc, so make the splice syscall ourselves. */
     2193DECLINLINE(ssize_t) syscall_splice(int fdIn, loff_t *poffIn, int fdOut, loff_t *poffOut, size_t cbChunk, unsigned fFlags)
     2194{
     2195    return syscall(__NR_splice, fdIn, poffIn, fdOut, poffOut, cbChunk, fFlags);
     2196}
     2197
     2198
    21762199/**
    21772200 * Send file thread arguments.
     
    22632286        {
    22642287            loff_t offFileIn = offFile;
    2265             ssize_t cbActual = splice((int)RTFileToNative(hFile1), &offFileIn, (int)RTPipeToNative(hPipeW), NULL,
    2266                                       cbLeft, 0 /*fFlags*/);
     2288            ssize_t cbActual = syscall_splice((int)RTFileToNative(hFile1), &offFileIn, (int)RTPipeToNative(hPipeW), NULL,
     2289                                              cbLeft, 0 /*fFlags*/);
    22672290            int const iErr = errno;
    22682291            if (RT_UNLIKELY(cbActual < 0))
     
    24722495        {
    24732496            loff_t offFileOut = offFile;
    2474             ssize_t cbActual  = splice((int)RTPipeToNative(hPipeR), NULL, (int)RTFileToNative(hFile1), &offFileOut,
    2475                                        cbLeft, 0 /*fFlags*/);
     2497            ssize_t cbActual  = syscall_splice((int)RTPipeToNative(hPipeR), NULL, (int)RTFileToNative(hFile1), &offFileOut,
     2498                                               cbLeft, 0 /*fFlags*/);
    24762499            int const iErr = errno;
    24772500            if (RT_UNLIKELY(cbActual < 0))
     
    43944417                g_fReadTests = true;
    43954418                g_fReadPerf  = true;
     4419#ifdef FSPERF_TEST_SENDFILE
    43964420                g_fSendFile  = true;
     4421#endif
    43974422#ifdef RT_OS_LINUX
    43984423                g_fSplice    = true;
     
    44244449                g_fReadTests = false;
    44254450                g_fReadPerf  = false;
     4451#ifdef FSPERF_TEST_SENDFILE
    44264452                g_fSendFile  = false;
     4453#endif
    44274454#ifdef RT_OS_LINUX
    44284455                g_fSplice    = false;
     
    44554482            CASE_OPT(ReadTests);
    44564483            CASE_OPT(ReadPerf);
     4484#ifdef FSPERF_TEST_SENDFILE
    44574485            CASE_OPT(SendFile);
     4486#endif
    44584487#ifdef RT_OS_LINUX
    44594488            CASE_OPT(Splice);
     
    46174646                if (g_fChSize)
    46184647                    fsPerfChSize();
    4619                 if (   g_fReadPerf || g_fReadTests || g_fSendFile || g_fWritePerf || g_fWriteTests
     4648                if (   g_fReadPerf || g_fReadTests || g_fWritePerf || g_fWriteTests
     4649#ifdef FSPERF_TEST_SENDFILE
     4650                    || g_fSendFile
     4651#endif
    46204652#ifdef RT_OS_LINUX
    46214653                    || g_fSplice
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