On Linux, `init_cpu_info()` uses `sysconf(_SC_NPROCESSORS_ONLN)` which returns the host machine's total CPU count, ignoring cgroup CPU bandwidth limits. This causes applications that scale thread counts based on `GetSystemInfo().dwNumberOfProcessors` to over-subscribe CPUs in container environments (Docker, Kubernetes). This MR reads cgroup v2 `cpu.max` and cgroup v1 `cpu.cfs_quota_us`/`cpu.cfs_period_us` to determine the effective CPU limit, and clamps the reported processor count accordingly. For cgroup v2, it walks up the hierarchy to find the most restrictive quota. Falls back to `sysconf` when no cgroup limit is configured. GNU coreutils 9.8 (September 2025) added similar cgroup v2 awareness to `nproc`: https://github.com/coreutils/coreutils/issues/108 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59556 ## Verification Verified with Wine built from this branch running inside Docker containers (cgroup v2). **Environment:** Docker on Linux (4-core host), Wine 11.5 with this patch applied. ### Without CPU limit ``` $ cat /sys/fs/cgroup/cpu.max max 100000 $ wine cmd /c "echo %NUMBER_OF_PROCESSORS%" 4 ``` All 4 host CPUs are reported. No override is applied when `cpu.max` is unlimited. ### With `--cpus=1.4` ``` $ cat /sys/fs/cgroup/cpu.max 140000 100000 $ wine cmd /c "echo %NUMBER_OF_PROCESSORS%" 1 ``` ### With `--cpus=1.5` ``` $ cat /sys/fs/cgroup/cpu.max 150000 100000 $ wine cmd /c "echo %NUMBER_OF_PROCESSORS%" 2 ``` ### With `--cpus=2.0` ``` $ cat /sys/fs/cgroup/cpu.max 200000 100000 $ wine cmd /c "echo %NUMBER_OF_PROCESSORS%" 2 ``` ### With `--cpus=2.4` ``` $ cat /sys/fs/cgroup/cpu.max 240000 100000 $ wine cmd /c "echo %NUMBER_OF_PROCESSORS%" 2 ``` ### With `--cpus=2.5` ``` $ cat /sys/fs/cgroup/cpu.max 250000 100000 $ wine cmd /c "echo %NUMBER_OF_PROCESSORS%" 3 ``` The rounding uses `(double)quota / period + 0.5`, which rounds to the nearest integer. For example, `--cpus=1.4` rounds down to 1, while `--cpus=1.5` rounds up to 2. -- v3: ntdll: Use system_cpu_mask in get_system_affinity_mask() when available. https://gitlab.winehq.org/wine/wine/-/merge_requests/10466