committed by
Norman Feske
parent
3fb5ae4fdc
commit
2471410fe5
@@ -49,12 +49,15 @@ extern "C" long sysconf(int name)
|
|||||||
switch (name) {
|
switch (name) {
|
||||||
case _SC_CHILD_MAX: return CHILD_MAX;
|
case _SC_CHILD_MAX: return CHILD_MAX;
|
||||||
case _SC_OPEN_MAX: return getdtablesize();
|
case _SC_OPEN_MAX: return getdtablesize();
|
||||||
case _SC_NPROCESSORS_CONF: return 1;
|
|
||||||
case _SC_NPROCESSORS_ONLN: return 1;
|
|
||||||
case _SC_PAGESIZE: return PAGESIZE;
|
case _SC_PAGESIZE: return PAGESIZE;
|
||||||
|
|
||||||
case _SC_PHYS_PAGES:
|
case _SC_PHYS_PAGES:
|
||||||
return _global_env->pd().ram_quota().value / PAGESIZE;
|
return _global_env->pd().ram_quota().value / PAGESIZE;
|
||||||
|
case _SC_NPROCESSORS_CONF:
|
||||||
|
[[fallthrough]];
|
||||||
|
case _SC_NPROCESSORS_ONLN: {
|
||||||
|
Affinity::Space space = _global_env->cpu().affinity_space();
|
||||||
|
return space.total() ? : 1;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
warning(__func__, "(", name, ") not implemented");
|
warning(__func__, "(", name, ") not implemented");
|
||||||
return Errno(EINVAL);
|
return Errno(EINVAL);
|
||||||
@@ -155,7 +158,9 @@ extern "C" int __sysctl(const int *name, u_int namelen,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case HW_NCPU:
|
case HW_NCPU:
|
||||||
*(int*)oldp = 1;
|
Affinity::Space space = _global_env->cpu().affinity_space();
|
||||||
|
|
||||||
|
*(int*)oldp = space.total() ? : 1;
|
||||||
*oldlenp = sizeof(int);
|
*oldlenp = sizeof(int);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user