[Chore] (MG_Backend, MG_Backend/DirectGLES, MG_Backend/DirectVulkan, MG_Backend/MGPipe, MG_Backend/Record, MG_Benchmark/Buffer, MG_Benchmark/Container, MG_Benchmark/Driver, MG_Benchmark/Program, MG_Benchmark/ShaderCache, MG_Benchmark/Transpile, MG_Gbm, MG_Impl, MG_Impl/CGLImpl, MG_Impl/DyldInterpose, MG_Impl/EGLImpl, MG_Impl/GLImpl, MG_Impl/GLXImpl, MG_Impl/NSOpenGLImpl, MG_Impl/Pipe, MG_Impl/WGLImpl, MG_IntegrationTest, MG_IntegrationTest/Harness, MG_IntegrationTest/Scenarios, MG_Pipe, MG_Remote, MG_Remote/Client, MG_Remote/Protocol, MG_Remote/Server, MG_Remote/Transport, MG_Remote/Wire, MG_State/EGLState, MG_State/GLState, MG_Test, MG_Test/Backend, MG_Test/BackendLoader, MG_Test/Buffer, MG_Test/EGLState, MG_Test/Framebuffer, MG_Test/Gbm, MG_Test/Pipe, MG_Test/Pipeline, MG_Test/Program, MG_Test/Query, MG_Test/SelfTest, MG_Test/ShaderTranspiler, MG_Test/State, MG_Test/Swapchain, MG_Test/Texture, MG_Test/Util, MG_Test/VertexArray, MG_Test/Wire, MG_Util/Async, MG_Util/BackendLoaders, MG_Util/Converters, MG_Util/Damage, MG_Util/Debug, MG_Util/Math, MG_Util/Metrics, MG_Util/SelfTest, MG_Util/ShaderTranspiler, MG_Util/Texture, MG_Util/X11, MobileGL, scripts/data, tools/cts, tools/device_bench, tools/spikes, tools/trace_replay, tools/wgl-smoke): clang-format every C and C++ source

- Layout only: token streams match up to split literals, continuations and using order
- The size totals fall, so the structure baseline is lowered
This commit is contained in:
2026-10-16 06:30:38 -04:00
parent 76b10cc35b
commit f4994ee36e
747 changed files with 35842 additions and 36261 deletions
+27 -30
View File
@@ -33,31 +33,31 @@
namespace {
// The single fact that makes this spike conclusive rather than suggestive: the exec'd
// child reports the domain it is running in. `u:r:untrusted_app:s0:...` means an ordinary
// application process really did exec this file; anything else (shell, adb, a platform
// domain) means the test was run the wrong way and its verdict does not transfer.
void ReadSelinuxContext(char* out, size_t size) {
out[0] = '\0';
FILE* file = std::fopen("/proc/self/attr/current", "r");
if (file == nullptr) {
std::snprintf(out, size, "<unreadable>");
return;
}
const size_t read = std::fread(out, 1, size - 1, file);
std::fclose(file);
out[read] = '\0';
// The kernel returns the context NUL-terminated inside the read; trim anything after.
for (size_t index = 0; index < read; ++index) {
if (out[index] == '\n' || out[index] == '\0') {
out[index] = '\0';
break;
// The single fact that makes this spike conclusive rather than suggestive: the exec'd
// child reports the domain it is running in. `u:r:untrusted_app:s0:...` means an ordinary
// application process really did exec this file; anything else (shell, adb, a platform
// domain) means the test was run the wrong way and its verdict does not transfer.
void ReadSelinuxContext(char* out, size_t size) {
out[0] = '\0';
FILE* file = std::fopen("/proc/self/attr/current", "r");
if (file == nullptr) {
std::snprintf(out, size, "<unreadable>");
return;
}
const size_t read = std::fread(out, 1, size - 1, file);
std::fclose(file);
out[read] = '\0';
// The kernel returns the context NUL-terminated inside the read; trim anything after.
for (size_t index = 0; index < read; ++index) {
if (out[index] == '\n' || out[index] == '\0') {
out[index] = '\0';
break;
}
}
if (out[0] == '\0') {
std::snprintf(out, size, "<empty>");
}
}
if (out[0] == '\0') {
std::snprintf(out, size, "<empty>");
}
}
} // namespace
@@ -69,9 +69,8 @@ int main(int argc, char** argv) {
std::snprintf(line, sizeof(line),
"MobileGLServer-spike ok argv0=%s pid=%d ppid=%d uid=%d gid=%d argc=%d "
"selinux=%s\n",
argc > 0 && argv[0] != nullptr ? argv[0] : "<null>",
static_cast<int>(getpid()), static_cast<int>(getppid()),
static_cast<int>(getuid()), static_cast<int>(getgid()), argc, context);
argc > 0 && argv[0] != nullptr ? argv[0] : "<null>", static_cast<int>(getpid()),
static_cast<int>(getppid()), static_cast<int>(getuid()), static_cast<int>(getgid()), argc, context);
std::fputs(line, stdout);
std::fflush(stdout);
@@ -83,14 +82,12 @@ int main(int argc, char** argv) {
FILE* marker = std::fopen(argv[1], "w");
if (marker == nullptr) {
std::fprintf(stderr, "MobileGLServer-spike: cannot open marker %s: %s\n", argv[1],
std::strerror(errno));
std::fprintf(stderr, "MobileGLServer-spike: cannot open marker %s: %s\n", argv[1], std::strerror(errno));
return 3;
}
std::fputs(line, marker);
if (std::fclose(marker) != 0) {
std::fprintf(stderr, "MobileGLServer-spike: cannot write marker %s: %s\n", argv[1],
std::strerror(errno));
std::fprintf(stderr, "MobileGLServer-spike: cannot write marker %s: %s\n", argv[1], std::strerror(errno));
return 4;
}
return 0;