view ui/processhelp_linux.cpp @ 975:b3695a3399de

(issue86) Install into default directories on Linux If the mozilla process is now started as root it will try to write into the default directories for NSS Shared and mozilla / thunderbird profiles. Cinst will now start the mozilla process once as root.
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 29 Aug 2014 12:59:44 +0200
parents 20ca94680003
children 2a1206932f53
line wrap: on
line source
/* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU GPL (v>=2)
 * and comes with ABSOLUTELY NO WARRANTY!
 * See LICENSE.txt for details.
 */
#ifndef WIN32

#include "processhelp.h"
#include "linuxlockfile.h"

#include <fcntl.h>
#include <semaphore.h>

#include <QDebug>
#include <QDir>
#include <QStandardPaths>

namespace ProcessHelp
{
    int lockFileFD = -1;
}

const QList<int> ProcessHelp::getProcessesIdForName(const QString &processName) {
    // TODO
    Q_UNUSED(processName);
    return QList<int>();
}

bool ProcessHelp::otherProcessesExist(const QString &processName) {
    // FIXME: We are using lock file semantics on GNU Linux so the
    // name of this method is rather misleading.

    QDir dataDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation));
    dataDir.mkpath(".");
    QString lockFilePath = dataDir.filePath(processName + ".pid");
    lockFileFD = open_lockfile(lockFilePath.toLocal8Bit().data());
    if (lockFileFD == -1)
        // Creating the lock file failed, so we assume another
        // instance is runnning.
        return true;
    return false;
}

void ProcessHelp::activateWindowForProcess(const QString &executableName) {
    // TODO
    Q_UNUSED(executableName);
    return;
}

void ProcessHelp::cleanUp() {
    close_lockfile(lockFileFD);
}

#endif /* Not WIN32 */

http://wald.intevation.org/projects/trustbridge/