LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.
C cdebiandesktop-environmentebpffirewalllandlocklinuxlinux-distributionopen-sourceprivacyquickjsraspberry-pi-5reactsecuritywaylandwayland-compositor
/* lbcorpus.c — a build tool for LordBench's xz workload (lbwork.c, lb_xz): `lbcorpus text` writes a
* fixed text of LB_CORPUS_SIZE bytes (words drawn from a fixed list with a fixed seed, so every build
* gets the same one), and `lbcorpus header` turns its xz-compressed form on standard input into
* build/gen/lb_corpus.h. `lbcorpus embed <name>` writes standard input as a C array <name> (the fonts
* of build/gen/lb_fonts.h, lbui.c). Runs at build time only; nothing of it ships. */
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#define LB_CORPUS_SIZE (2u << 20)
static const char *const words[] = {
"the", "of", "and", "to", "in", "a", "is", "that", "for", "it", "as", "with", "was", "on", "be", "by",
"this", "are", "from", "at", "or", "an", "which", "not", "but", "all", "can", "has", "were", "one",
"system", "window", "package", "network", "display", "kernel", "memory", "process", "screen", "file",
"folder", "session", "desktop", "update", "signature", "repository", "firewall", "permission", "device",
"frame", "pixel", "layer", "texture", "shader", "buffer", "socket", "thread", "driver", "battery",
"temperature", "keyboard", "pointer", "camera", "microphone", "printer", "scanner", "language", "font",
"glyph", "paragraph", "terminal", "command", "archive", "document", "picture", "video", "audio", "stream",
"measured", "tested", "released", "checked", "signed", "verified", "installed", "started", "stopped",
"quickly", "slowly", "always", "never", "only", "every", "each", "before", "after", "while", "until",
"LordOS", "Debian", "Wayland", "compositor", "sandbox", "helper", "manifest", "release", "version",
"0.8.6", "2026", "1920", "1080", "60", "120", "4096", "65536", "x86-64", "arm64", "/usr/lib", "~/.config",
};
static uint64_t xs(uint64_t *s) { uint64_t x = *s; x ^= x << 13; x ^= x >> 7; x ^= x << 17; return *s = x; }
int main(int argc, char **argv) {
if (argc == 2 && !strcmp(argv[1], "text")) {
uint64_t seed = 0x4c6f72644265ull;
size_t n = 0, line = 0;
int cap = 1;
while (n < LB_CORPUS_SIZE) {
const char *w = words[xs(&seed) % (sizeof words / sizeof *words)];
char buf[64];
int k = snprintf(buf, sizeof buf, "%s", w);
if (cap && buf[0] >= 'a' && buf[0] <= 'z') buf[0] = (char)(buf[0] - 32);
cap = 0;
uint64_t r = xs(&seed) % 23;
if (r == 0) { buf[k++] = '.'; cap = 1; }
else if (r == 1) buf[k++] = ',';
char sep = line + (size_t)k > 76 ? '\n' : ' ';
buf[k++] = sep;
line = buf[k - 1] == '\n' ? 0 : line + (size_t)k;
for (int i = 0; i < k && n < LB_CORPUS_SIZE; i++, n++) putchar(buf[i]);
}
return 0;
}
if (argc == 2 && !strcmp(argv[1], "header")) {
printf("/* generated by src/bench/lbcorpus.c: LordBench's xz workload input */\n");
printf("#define LB_CORPUS_SIZE %uu\nstatic const unsigned char lb_corpus_xz[] = {", LB_CORPUS_SIZE);
int c;
size_t n = 0;
while ((c = getchar()) != EOF) printf("%s%d,", n++ % 24 ? "" : "\n", c);
printf("\n};\n");
return n ? 0 : 1;
}
if (argc == 3 && !strcmp(argv[1], "embed")) {
for (const char *c = argv[2]; *c; c++)
if (!((*c >= 'a' && *c <= 'z') || (*c >= '0' && *c <= '9') || *c == '_')) return 2;
printf("static const unsigned char %s[] = {", argv[2]);
int c;
size_t n = 0;
while ((c = getchar()) != EOF) printf("%s%d,", n++ % 24 ? "" : "\n", c);
printf("\n};\n");
return n ? 0 : 1;
}
fprintf(stderr, "usage: lbcorpus text | header < corpus.xz | embed <name> < file\n");
return 2;
}