qlockfile_unix.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qlockfile_unix.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7static QByteArray localHostName()-
8{-
9 QByteArray hostName(512, Qt::Uninitialized);-
10 if (gethostname(hostName.data(), hostName.size()) == -1
gethostname(ho....size()) == -1Description
TRUEnever evaluated
FALSEevaluated 610 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
)
0-610
11 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
12 hostName.truncate(strlen(hostName.data()));-
13 return
executed 610 times by 8 tests: return hostName;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
hostName;
executed 610 times by 8 tests: return hostName;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
610
14}-
15-
16-
17static qint64 qt_write_loop(int fd, const char *data, qint64 len)-
18{-
19 qint64 pos = 0;-
20 while (pos < len
pos < lenDescription
TRUEevaluated 580 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
FALSEevaluated 580 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
) {
580
21 const qint64 ret = qt_safe_write(fd, data + pos, len - pos);-
22 if (ret == -1
ret == -1Description
TRUEnever evaluated
FALSEevaluated 580 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
)
0-580
23 return
never executed: return pos;
pos;
never executed: return pos;
0
24 pos += ret;-
25 }
executed 580 times by 8 tests: end of block
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
580
26 return
executed 580 times by 8 tests: return pos;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
pos;
executed 580 times by 8 tests: return pos;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
580
27}-
28-
29int QLockFilePrivate::checkFcntlWorksAfterFlock(const QString &fn)-
30{-
31-
32 QTemporaryFile file(fn);-
33 if (!file.open()
!file.open()Description
TRUEnever evaluated
FALSEevaluated 23 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
)
0-23
34 return
never executed: return 0;
0;
never executed: return 0;
0
35 const int fd = file.d_func()->engine()->handle();-
36-
37 if (flock(fd, 2 | 4) == -1
flock(fd, 2 | 4) == -1Description
TRUEnever evaluated
FALSEevaluated 23 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
)
0-23
38 return
never executed: return 0;
0;
never executed: return 0;
0
39-
40 struct flock flockData;-
41 flockData.l_type = 1;-
42 flockData.l_whence = 0;-
43 flockData.l_start = 0;-
44 flockData.l_len = 0;-
45 flockData.l_pid = getpid();-
46 if (fcntl(fd, 6, &flockData) == -1
fcntl(fd, 6, &flockData) == -1Description
TRUEnever evaluated
FALSEevaluated 23 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
)
0-23
47 return
never executed: return 0;
0;
never executed: return 0;
0
48 return
executed 23 times by 8 tests: return 1;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
1;
executed 23 times by 8 tests: return 1;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
23
49-
50-
51-
52}-
53-
54-
55-
56-
57-
58-
59-
60typedef QCache<QString, bool> CacheType;-
61namespace { namespace Q_QGS_fcntlOK { typedef CacheType Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEevaluated 7 times by 7 tests
Evaluated by:
  • tst_languagechange - unknown status
  • tst_qcolordialog - unknown status
  • tst_qfiledialog - unknown status
  • tst_qfiledialog2 - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlockfile - unknown status
  • tst_qsettings - unknown status
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
executed 7 times by 7 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_languagechange - unknown status
  • tst_qcolordialog - unknown status
  • tst_qfiledialog - unknown status
  • tst_qfiledialog2 - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlockfile - unknown status
  • tst_qsettings - unknown status
}
executed 7 times by 7 tests: end of block
Executed by:
  • tst_languagechange - unknown status
  • tst_qcolordialog - unknown status
  • tst_qfiledialog - unknown status
  • tst_qfiledialog2 - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlockfile - unknown status
  • tst_qsettings - unknown status
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type (10))) : value (10) { guard.store(QtGlobalStatic::Initialized); } } holder; return
executed 602 times by 7 tests: return &holder.value;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
&holder.value;
executed 602 times by 7 tests: return &holder.value;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
} } } static QGlobalStatic<CacheType, Q_QGS_fcntlOK::innerFunction, Q_QGS_fcntlOK::guard> fcntlOK;;
0-602
62static QBasicMutex fcntlLock;-
63-
64-
65-
66-
67-
68-
69static bool fcntlWorksAfterFlock(const QString &fn)-
70{-
71 QMutexLocker lock(&fcntlLock);-
72 if (fcntlOK.isDestroyed()
fcntlOK.isDestroyed()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qlockfile - unknown status
FALSEevaluated 580 times by 7 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
)
1-580
73 return
executed 1 time by 1 test: return QLockFilePrivate::checkFcntlWorksAfterFlock(fn);
Executed by:
  • tst_qlockfile - unknown status
QLockFilePrivate::checkFcntlWorksAfterFlock(fn);
executed 1 time by 1 test: return QLockFilePrivate::checkFcntlWorksAfterFlock(fn);
Executed by:
  • tst_qlockfile - unknown status
1
74 bool *worksPtr = fcntlOK->object(fn);-
75 if (worksPtr
worksPtrDescription
TRUEevaluated 558 times by 7 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
FALSEevaluated 22 times by 7 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
)
22-558
76 return
executed 558 times by 7 tests: return *worksPtr;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
*worksPtr;
executed 558 times by 7 tests: return *worksPtr;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
558
77-
78 const bool val = QLockFilePrivate::checkFcntlWorksAfterFlock(fn);-
79 worksPtr = new bool(val);-
80 fcntlOK->insert(fn, worksPtr);-
81-
82 return
executed 22 times by 7 tests: return val;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
val;
executed 22 times by 7 tests: return val;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
22
83}-
84-
85static bool setNativeLocks(const QString &fileName, int fd)-
86{-
87-
88 if (flock(fd, 2 | 4) == -1
flock(fd, 2 | 4) == -1Description
TRUEnever evaluated
FALSEevaluated 581 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
)
0-581
89 return
never executed: return false;
false;
never executed: return false;
0
90-
91 struct flock flockData;-
92 flockData.l_type = 1;-
93 flockData.l_whence = 0;-
94 flockData.l_start = 0;-
95 flockData.l_len = 0;-
96 flockData.l_pid = getpid();-
97 if (fcntlWorksAfterFlock(QDir::cleanPath(QFileInfo(fileName).absolutePath()) + QString('/'))
fcntlWorksAfte... QString('/'))Description
TRUEevaluated 581 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
FALSEnever evaluated
0-581
98 && fcntl(fd, 6, &flockData) == -1
fcntl(fd, 6, &flockData) == -1Description
TRUEnever evaluated
FALSEevaluated 581 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
) {
0-581
99 return
never executed: return false;
false;
never executed: return false;
0
100 }-
101 return
executed 581 times by 8 tests: return true;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
true;
executed 581 times by 8 tests: return true;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
581
102}-
103-
104QLockFile::LockError QLockFilePrivate::tryLock_sys()-
105{-
106-
107-
108-
109 QByteArray fileData = QByteArray::number(QCoreApplication::applicationPid()) % '\n'-
110 % QCoreApplication::applicationName().toUtf8() % '\n'-
111 % localHostName() % '\n';-
112-
113 const QByteArray lockFileName = QFile::encodeName(fileName);-
114 const int fd = qt_safe_open(lockFileName.constData(), 01 | 0100 | 0200, 0666);-
115 if (fd < 0
fd < 0Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_QLockFile
FALSEevaluated 580 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
) {
18-580
116 switch ((*__errno_location ())) {-
117 case
executed 17 times by 1 test: case 17:
Executed by:
  • tst_QLockFile
17:
executed 17 times by 1 test: case 17:
Executed by:
  • tst_QLockFile
17
118 return
executed 17 times by 1 test: return QLockFile::LockFailedError;
Executed by:
  • tst_QLockFile
QLockFile::LockFailedError;
executed 17 times by 1 test: return QLockFile::LockFailedError;
Executed by:
  • tst_QLockFile
17
119 case
executed 1 time by 1 test: case 13:
Executed by:
  • tst_QLockFile
13:
executed 1 time by 1 test: case 13:
Executed by:
  • tst_QLockFile
1
120 case
never executed: case 30:
30:
never executed: case 30:
0
121 return
executed 1 time by 1 test: return QLockFile::PermissionError;
Executed by:
  • tst_QLockFile
QLockFile::PermissionError;
executed 1 time by 1 test: return QLockFile::PermissionError;
Executed by:
  • tst_QLockFile
1
122 default
never executed: default:
:
never executed: default:
0
123 return
never executed: return QLockFile::UnknownError;
QLockFile::UnknownError;
never executed: return QLockFile::UnknownError;
0
124 }-
125 }-
126-
127 if (!setNativeLocks(fileName, fd)
!setNativeLocks(fileName, fd)Description
TRUEnever evaluated
FALSEevaluated 580 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
) {
0-580
128 const int errnoSaved = (*__errno_location ());-
129 QMessageLogger(__FILE__, 206, __PRETTY_FUNCTION__).warning() << "setNativeLocks failed:" << qt_error_string(errnoSaved);-
130 }
never executed: end of block
0
131-
132 if (qt_write_loop(fd, fileData.constData(), fileData.size()) < fileData.size()
qt_write_loop(...ileData.size()Description
TRUEnever evaluated
FALSEevaluated 580 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
) {
0-580
133 close(fd);-
134 if (!QFile::remove(fileName)
!QFile::remove(fileName)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
135 QMessageLogger(__FILE__, 212, __PRETTY_FUNCTION__).warning("QLockFile: Could not remove our own lock file %s.", QString(fileName).toLocal8Bit().constData());
never executed: QMessageLogger(__FILE__, 212, __PRETTY_FUNCTION__).warning("QLockFile: Could not remove our own lock file %s.", QString(fileName).toLocal8Bit().constData());
0
136 return
never executed: return QLockFile::UnknownError;
QLockFile::UnknownError;
never executed: return QLockFile::UnknownError;
0
137 }-
138-
139-
140 fileHandle = fd;-
141-
142-
143-
144 fdatasync(fileHandle);-
145-
146-
147-
148-
149 return
executed 580 times by 8 tests: return QLockFile::NoError;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
QLockFile::NoError;
executed 580 times by 8 tests: return QLockFile::NoError;
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
580
150}-
151-
152bool QLockFilePrivate::removeStaleLock()-
153{-
154 const QByteArray lockFileName = QFile::encodeName(fileName);-
155 const int fd = qt_safe_open(lockFileName.constData(), 01, 0666);-
156 if (fd < 0
fd < 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QLockFile
)
0-1
157 return
never executed: return false;
false;
never executed: return false;
0
158 bool success = setNativeLocks(fileName, fd)
setNativeLocks(fileName, fd)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QLockFile
FALSEnever evaluated
&& (::
(::unlink(lockFileName) == 0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QLockFile
FALSEnever evaluated
unlink(lockFileName) == 0)
(::unlink(lockFileName) == 0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QLockFile
FALSEnever evaluated
;
0-1
159 close(fd);-
160 return
executed 1 time by 1 test: return success;
Executed by:
  • tst_QLockFile
success;
executed 1 time by 1 test: return success;
Executed by:
  • tst_QLockFile
1
161}-
162-
163bool QLockFilePrivate::isApparentlyStale() const-
164{-
165 qint64 pid;-
166 QString hostname, appname;-
167 if (getLockInfo(&pid, &hostname, &appname)
getLockInfo(&p...ame, &appname)Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QLockFile
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QLockFile
) {
2-12
168 if (hostname.isEmpty()
hostname.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QLockFile
|| hostname == QString::fromLocal8Bit(localHostName())
hostname == QS...calHostName())Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QLockFile
FALSEnever evaluated
) {
0-12
169 if (::
::kill(pid, 0) == -1Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QLockFile
kill(pid, 0) == -1
::kill(pid, 0) == -1Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QLockFile
&& (*
(*__errno_location ()) == 3Description
TRUEnever evaluated
FALSEnever evaluated
__errno_location ()) == 3
(*__errno_location ()) == 3Description
TRUEnever evaluated
FALSEnever evaluated
)
0-12
170 return
never executed: return true;
true;
never executed: return true;
0
171 const QString processName = processNameByPid(pid);-
172 if (!processName.isEmpty()
!processName.isEmpty()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QLockFile
FALSEnever evaluated
) {
0-12
173 QFileInfo fi(appname);-
174 if (fi.isSymLink()
fi.isSymLink()Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QLockFile
)
0-12
175 fi.setFile(fi.symLinkTarget());
never executed: fi.setFile(fi.symLinkTarget());
0
176 if (processName != fi.fileName()
processName != fi.fileName()Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QLockFile
)
0-12
177 return
never executed: return true;
true;
never executed: return true;
0
178 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_QLockFile
12
179 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_QLockFile
12
180 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_QLockFile
12
181 const qint64 age = QFileInfo(fileName).lastModified().msecsTo(QDateTime::currentDateTime());-
182 return
executed 14 times by 1 test: return staleLockTime > 0 && age > staleLockTime;
Executed by:
  • tst_QLockFile
staleLockTime > 0 && age > staleLockTime;
executed 14 times by 1 test: return staleLockTime > 0 && age > staleLockTime;
Executed by:
  • tst_QLockFile
14
183}-
184-
185QString QLockFilePrivate::processNameByPid(qint64 pid)-
186{-
187-
188-
189-
190-
191-
192 if (!QFile::exists(([]() -> QString { enum { Size = sizeof(u"" "/proc/version")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "/proc/version" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 12 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QLockFile
qstring_literal_temp;
executed 12 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QLockFile
}()))
!QFile::exists...al_temp; }()))Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QLockFile
)
0-12
193 return
never executed: return QString();
QString();
never executed: return QString();
0
194 char exePath[64];-
195 char buf[4096 + 1];-
196 sprintf(exePath, "/proc/%lld/exe", pid);-
197 size_t len = (size_t)readlink(exePath, buf, sizeof(buf));-
198 if (len >= sizeof(buf)
len >= sizeof(buf)Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QLockFile
) {
0-12
199-
200 return
never executed: return ([]() -> QString { enum { Size = sizeof(u"" "/ERROR/")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "/ERROR/" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
([]() -> QString { enum { Size = sizeof(u"" "/ERROR/")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "/ERROR/" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
never executed: return qstring_literal_temp;
qstring_literal_temp;
never executed: return qstring_literal_temp;
}());
never executed: return ([]() -> QString { enum { Size = sizeof(u"" "/ERROR/")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "/ERROR/" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
0
201 }-
202 buf[len] = 0;-
203 return
executed 12 times by 1 test: return QFileInfo(QFile::decodeName(buf)).fileName();
Executed by:
  • tst_QLockFile
QFileInfo(QFile::decodeName(buf)).fileName();
executed 12 times by 1 test: return QFileInfo(QFile::decodeName(buf)).fileName();
Executed by:
  • tst_QLockFile
12
204}-
205-
206void QLockFile::unlock()-
207{-
208 QLockFilePrivate * const d = d_func();-
209 if (!d->isLocked
!d->isLockedDescription
TRUEevaluated 3764 times by 32 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QIcon
  • tst_QLabel
  • tst_QLineEdit
  • tst_QLockFile
  • tst_QMessageBox
  • tst_QPlainTextEdit
  • tst_QPrinter
  • tst_QSettings
  • tst_QSidebar
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QSystemTrayIcon
  • ...
FALSEevaluated 580 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
)
580-3764
210 return;
executed 3764 times by 32 tests: return;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QIcon
  • tst_QLabel
  • tst_QLineEdit
  • tst_QLockFile
  • tst_QMessageBox
  • tst_QPlainTextEdit
  • tst_QPrinter
  • tst_QSettings
  • tst_QSidebar
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QSystemTrayIcon
  • ...
3764
211 close(d->fileHandle);-
212 d->fileHandle = -1;-
213 if (!QFile::remove(d->fileName)
!QFile::remove(d->fileName)Description
TRUEnever evaluated
FALSEevaluated 580 times by 8 tests
Evaluated by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
) {
0-580
214 QMessageLogger(__FILE__, 328, __PRETTY_FUNCTION__).warning() << "Could not remove our own lock file" << d->fileName << "maybe permissions changed meanwhile?";-
215-
216 }
never executed: end of block
0
217 d->lockError = QLockFile::NoError;-
218 d->isLocked = false;-
219}
executed 580 times by 8 tests: end of block
Executed by:
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLockFile
  • tst_QSettings
  • tst_languageChange
  • tst_qlockfile - unknown status
580
220-
221-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9