blob: 8758adfb71e5ddbbfca62d89584dbd0779e38601 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
// Copyright (C) 2013 David Faure <faure+bluesystems@kde.org>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
#ifndef QLOCKFILE_P_H
#define QLOCKFILE_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtCore/private/qglobal_p.h>
#include <QtCore/qlockfile.h>
#include <QtCore/qfile.h>
QT_BEGIN_NAMESPACE
class QLockFilePrivate
{
public:
explicit QLockFilePrivate(const QString &fn);
~QLockFilePrivate();
QLockFile::LockError tryLock_sys();
bool removeStaleLock();
QByteArray lockFileContents() const;
// Returns \c true if the lock belongs to dead PID, or is old.
// The attempt to delete it will tell us if it was really stale or not, though.
bool isApparentlyStale() const;
// used in dbusmenu
Q_CORE_EXPORT static QString processNameByPid(qint64 pid);
static bool isProcessRunning(qint64 pid, const QString &appname);
QString fileName;
#ifdef Q_OS_WIN
Qt::HANDLE fileHandle;
#else
int fileHandle;
#endif
std::chrono::milliseconds staleLockTime = std::chrono::seconds{30};
QLockFile::LockError lockError = QLockFile::NoError;
bool isLocked = false;
// used in tst_QLockFile:
Q_CORE_EXPORT static int getLockFileHandle(QLockFile *f);
};
QT_END_NAMESPACE
#endif /* QLOCKFILE_P_H */
|