On 4/29/24 16:56, enh via Toybox wrote: > isn't nproc(1) just a call to sysconf(3) with either > _SC_NPROCESSORS_ONLN for regular behavior, or _SC_NPROCESSORS_CONF for > --all?
>From musl src/conf/sysconf.c: case JT_NPROCESSORS_CONF & 255: case JT_NPROCESSORS_ONLN & 255: ; unsigned char set[128] = {1}; int i, cnt; __syscall(SYS_sched_getaffinity, 0, sizeof set, set); for (i=cnt=0; i<sizeof set; i++) for (; set[i]; set[i]&=set[i]-1, cnt++); return cnt; Musl returns the same thing for "conf" and "online". Rob _______________________________________________ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net