linux-sysprog · intermediate · ~15 min
Reuse the labelled-field parsing pattern.
From the same /proc/<pid>/status text, implement int parse_threads(const char *status) returning the integer after Threads:, or -1 if absent.
#include <string.h>
#include <stdlib.h>
int parse_threads(const char *status) {
/* TODO */
return -1;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.