Artifact af1b8d9b453e893026435524d28887062ebb79c0fb16d4922b32a6ec2764156e:
- File
src/platform.h
— part of check-in
[6d70dcc76a]
at
2026-11-12 19:36:41
on branch trunk
— Phase 1: the config parser, the no-change run and the speed bench
suit check parses suit.conf strictly and prints a canonical dump. Any unknown kind or key, duplicate, cycle or dangling name rejects the whole file with its line number.
suit run compares a stamp against the files it names and exits without writing, allocating or printing when nothing changed.
suit bench times suit run against an empty program built the same way and against /usr/bin/true, interleaved, and fails the build when the no-change run costs more than 1 ms over the empty program or 1 MiB more memory. It measured 0.65 to 0.94 ms over, quiet and under load. A system binary starts 0.6 to 1.5 ms faster than any built binary on macOS, so it is shown for information and is not the baseline.
94 unit checks, 100 shell cases and a libFuzzer target for the parser. (user: dmestas, size: 589) [annotate] [blame] [check-ins using]
#ifndef SUIT_PLATFORM_H #define SUIT_PLATFORM_H // The only file that knows which operating system this is. #include <stddef.h> #include <stdint.h> #include <sys/resource.h> #include <sys/stat.h> #define PLATFORM_TRUE_PATH "/usr/bin/true" int64_t platform_mtime_sec(const struct stat *st); int64_t platform_mtime_nsec(const struct stat *st); // Peak resident size from a wait4 result, in bytes. uint64_t platform_peak_resident(const struct rusage *ru); // Absolute path of the running program. False if it does not fit in CAP. bool platform_self_path(char *buf, size_t cap); #endif