VirtualBox

Changeset 90098 in vbox


Ignore:
Timestamp:
Jul 8, 2021 2:28:12 PM (4 years ago)
Author:
vboxsync
Message:

Audio/ValKit: Use RTProcDaemonizeUsingFork() and also added PID file support to VKAT / VBoxAudioTest. bugref:10008

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp

    r90087 r90098  
    129129    VKAT_TEST_OPT_PCM_CHAN,
    130130    VKAT_TEST_OPT_PCM_SIGNED,
     131    VKAT_TEST_OPT_PIDFILE,
    131132    VKAT_TEST_OPT_TAG,
    132133    VKAT_TEST_OPT_TEMPDIR,
     
    177178    { "--pcm-hz",            VKAT_TEST_OPT_PCM_HZ,         RTGETOPT_REQ_UINT16  },
    178179    { "--pcm-signed",        VKAT_TEST_OPT_PCM_SIGNED,     RTGETOPT_REQ_BOOL    },
     180    { "--pidfile",           VKAT_TEST_OPT_PIDFILE,        RTGETOPT_REQ_STRING  },
    179181    { "--mode",              VKAT_TEST_OPT_MODE,           RTGETOPT_REQ_STRING  },
    180182    { "--no-verify",         VKAT_TEST_OPT_NO_VERIFY,      RTGETOPT_REQ_NOTHING },
     
    646648        case VKAT_TEST_OPT_PCM_CHAN:       return "Specifies the number of PCM channels to use [2]";
    647649        case VKAT_TEST_OPT_PCM_SIGNED:     return "Specifies whether to use signed (true) or unsigned (false) samples [true]";
     650        case VKAT_TEST_OPT_PIDFILE:        return "Specifies the PID file to use (for daemonizing)";
    648651        case VKAT_TEST_OPT_TAG:            return "Specifies the test set tag to use";
    649652        case VKAT_TEST_OPT_TEMPDIR:        return "Specifies the temporary directory to use";
     
    676679    bool        fPcmSigned    = true;
    677680
     681    const char *pszPidFile    = NULL;
    678682    bool        fDaemonize    = false;
    679683    bool        fDaemonized   = false;
     
    785789                break;
    786790
     791            case VKAT_TEST_OPT_PIDFILE:
     792                pszPidFile = ValueUnion.psz;
     793                break;
     794
    787795            case VKAT_TEST_OPT_TAG:
    788796                pszTag = ValueUnion.psz;
     
    816824        {
    817825            if (g_uVerbosity > 0)
    818                 RTMsgInfo("Daemonizing...");
    819             rc = RTProcDaemonize(pGetState->argv, "--daemonized");
     826            {
     827                RTMsgInfo("Starting in background (as daemon) ...");
     828                if (pszPidFile)
     829                    RTMsgInfo("Using PID file '%s'", pszPidFile);
     830            }
     831            rc = RTProcDaemonizeUsingFork(true /* fNoChDir */, false /* fNoClose */, pszPidFile);
    820832            if (RT_FAILURE(rc))
    821                 return RTMsgErrorExit(RTEXITCODE_FAILURE, "RTProcDaemonize: %Rrc\n", rc);
    822             return RTEXITCODE_SUCCESS;
     833                return RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to daemonize: %Rrc\n", rc);
    823834        }
    824835        else
    825836        {
    826837            if (g_uVerbosity > 0)
    827                 RTMsgInfo("Running daemonized ...");
     838                RTMsgInfo("Running in background (as daemon) ...");
    828839        }
    829840    }
Note: See TracChangeset for help on using the changeset viewer.

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