Mail Archives: djgpp-workers/1998/01/26/16:25:32
--=====================_885871689==_
Content-Type: text/plain; charset="us-ascii"
Hello all,
I've attached a patch to sysconf() that extends its functionality a little
bit. It now returns information for _SC_PHYS_PAGES (the number of system
physical pages) and the _SC_AVPHYS_PAGES (the number of physical pages
available).
Why? I don't actually need the info for anything (atleast not yet).
However I believe that making sysconf() more complete will inspire more
people to use it instead of __dpmi_* and _go32_ calls -- leading to more
portable code, which is a good thing.
Randy
--=====================_885871689==_
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment; filename="sysconf-c.dif"
*** src/libc/posix/unistd/sysconf.c~1 Thu Jan 1 22:14:04 1998
--- src/libc/posix/unistd/sysconf.c Mon Jan 26 14:21:48 1998
***************
*** 5,8 ****
--- 5,9 ----
#include <time.h>
#include <go32.h>
+ #include <dpmi.h>
long
***************
*** 21,24 ****
--- 22,32 ----
case _SC_TZNAME_MAX: return TZNAME_MAX;
case _SC_VERSION: return _POSIX_VERSION;
+ case _SC_AVPHYS_PAGES: return _go32_dpmi_remaining_physical_memory()/4096;
+ case _SC_PHYS_PAGES:
+ {
+ __dpmi_free_mem_info Info;
+ __dpmi_get_free_memory_information(&Info);
+ return Info.total_number_of_physical_pages;
+ }
default:
--=====================_885871689==_
Content-Type: text/plain; charset="us-ascii"
--=====================_885871689==_--
- Raw text -