VirtualBox

Changeset 92212 in vbox for trunk/src/VBox/Additions/x11


Ignore:
Timestamp:
Nov 4, 2021 5:50:52 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
148044
Message:

Additions: Linux: VBoxDRMClient: add PID file check on start, bugref:9637, ticketref:19373.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/VBoxClient/display-drm.cpp

    r90624 r92212  
    196196     * e.g. from before a guest reboot. */
    197197    bool fAck = false;
     198
     199    /** The name and handle of the PID file. */
     200    static const char szPidFile[RTPATH_MAX] = "/var/run/VBoxDRMClient";
     201    RTFILE hPidFile;
     202
     203    /* Check PID file before attempting to initialize anything. */
     204    rc = VbglR3PidFile(szPidFile, &hPidFile);
     205    if (rc == VERR_FILE_LOCK_VIOLATION)
     206    {
     207        VBClLogInfo("VBoxDRMClient: already running, exiting\n");
     208        return RTEXITCODE_SUCCESS;
     209    }
     210    else if (RT_FAILURE(rc))
     211    {
     212        VBClLogError("VBoxDRMClient: unable to lock PID file (%Rrc), exiting\n", rc);
     213        return RTEXITCODE_FAILURE;
     214    }
     215
    198216    drmConnect(&drmContext);
    199217    if (drmContext.hDevice == NIL_RTFILE)
     
    279297            VBClLogFatalError("Failure waiting for event, rc=%Rrc\n", rc);
    280298    }
     299
     300    /* ToDo: this code never executed since we do not have yet a clean way to exit
     301     * main event loop above. */
     302    VBClLogInfo("VBoxDRMClient: releasing PID file lock\n");
     303    VbglR3ClosePidFile(szPidFile, hPidFile);
     304
    281305    return 0;
    282306}
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