MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / readBsdId

Function readBsdId

app/src/Licensing/MachineID.cpp:167–184  ·  view source on GitHub ↗

* @brief Reads the BSD host id, falling back to the SMBIOS system UUID. */

Source from the content-addressed store, hash-verified

165 * @brief Reads the BSD host id, falling back to the SMBIOS system UUID.
166 */
167static QString readBsdId(bool& complete)
168{
169 QProcess process;
170 const auto catTool = resolveSystemTool({"/bin/cat", "/usr/bin/cat"}, "cat");
171 const auto kenvTool = resolveSystemTool({"/sbin/kenv", "/usr/sbin/kenv"}, "kenv");
172 process.start(catTool, {"/etc/hostid"});
173 awaitTool(process);
174 QString id = process.readAllStandardOutput().trimmed();
175
176 if (id.isEmpty()) {
177 process.start(kenvTool, {"-q", "smbios.system.uuid"});
178 awaitTool(process);
179 id = process.readAllStandardOutput().trimmed();
180 }
181
182 complete = !id.isEmpty();
183 return id;
184}
185#endif
186
187/**

Callers 1

readPlatformIdFunction · 0.85

Calls 4

resolveSystemToolFunction · 0.85
awaitToolFunction · 0.85
isEmptyMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected