-
Notifications
You must be signed in to change notification settings - Fork 12
Description
I propose a modification to the sysconf() function in the mintlib library (the kernel is not modified).
The problem with system information is that it is returned:
- either by the
sysconfsystem call (kernel) - or by the
sysconffunction (mintlib), which can return it itself or obtain it from the system call - or by
sysctl(kernel)
The goal is to limit ourselves to a systcl backend (since we don't have a complete /proc/sys) in the kernel and to the sysconf function only in the library (sysconf in the kernel is redundant).
Thus,
-
the
confname.hfile (included byunistd.h) contains all possible values forsysconf. It is no longer necessary to duplicate them in the kernel (dos.c) -
The
sysconffunction returns the information, or retrieves it fromsysctl- With the exception of
_SC_AVPHYS_PAGES, which requires thesysconfsystem call becausesysctldoes not provide this value,sysconfcan be completely bypassed and deprecated (but should be kept for existing binaries that call it) sysctlcan be extended to return the total RAM usingtotalphysmem(), which will allow obtaining the total number of pages and completely eliminating the need for thesysconfsystem call
- With the exception of
-
Maintaining
sysconf()only in the mintlib becomes simpler, for when new features are added -
Whether under TOS or MiNT,
sysconfcan return relevant values (_SC_V8_ILP32_OFF32, which indicates that the system is 32-bit, for example) -
Modern free software can benefit from the availability of information relating to existing features or not on the system (for example,
_SC_IPV6) -
Conversely, care must be taken regarding the consequences of automatically enabling or disabling directives via headers in the C library based on the returned results (for example, I made
_SC_FSYNCreturn 0 because the function doesn't do what it's expected to do; we could instead make it return 1 because it exists even if it synchronizes the entire filesystem containing the file in question, perhaps some softwares relies on this information).