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
sysconf system call (kernel)
- or by the
sysconf function (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.h file (included by unistd.h) contains all possible values for sysconf. It is no longer necessary to duplicate them in the kernel (dos.c)
-
The sysconf function returns the information, or retrieves it from sysctl
- With the exception of
_SC_AVPHYS_PAGES, which requires the sysconf system call because sysctl does not provide this value, sysconf can be completely bypassed and deprecated (but should be kept for existing binaries that call it)
sysctl can be extended to return the total RAM using totalphysmem(), which will allow obtaining the total number of pages and completely eliminating the need for the sysconf system call
-
Maintaining sysconf() only in the mintlib becomes simpler, for when new features are added
-
Whether under TOS or MiNT, sysconf can 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_FSYNC return 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).
-
sysconf.c.patch.txt
-
confname.h.patch.txt
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:
sysconfsystem call (kernel)sysconffunction (mintlib), which can return it itself or obtain it from the system callsysctl(kernel)The goal is to limit ourselves to a
systclbackend (since we don't have a complete/proc/sys) in the kernel and to thesysconffunction only in the library (sysconfin 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_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 callMaintaining
sysconf()only in the mintlib becomes simpler, for when new features are addedWhether 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).sysconf.c.patch.txt
confname.h.patch.txt