readPidsMax

tcmts.core.ts.readPidsMax · #tzcjcuwl · term · runs on the server

uses node:fs

The container's cap on processes and threads, as cgroups (v2, then v1) say it, if they do.

import fs from "node:fs";

export function readPidsMax(): string | undefined {
  for (const f of ["/sys/fs/cgroup/pids.max", "/sys/fs/cgroup/pids/pids.max"])
    try {
      return fs.readFileSync(f, "utf8");
    } catch {
      // (not this cgroup version, or not Linux)
    }
  return undefined;
}

used by