Index: gen/sysconf.3 =================================================================== RCS file: /usr/repo/src/lib/libc/gen/sysconf.3,v retrieving revision 1.21 diff -u -p -r1.21 sysconf.3 --- gen/sysconf.3 20 Jan 2005 09:17:02 -0000 1.21 +++ gen/sysconf.3 14 Aug 2006 12:47:42 -0000 @@ -165,6 +165,19 @@ otherwise \-1. Return 1 if the system supports the User Portability Utilities Option, otherwise \-1. .El +.Pp +These values also exist, but may not be standard: +.Pp +.Bl -tag -width 6n +.Pp +.It Li _SC_PHYS_PAGES +The number of pages of physical memory. +Note that it is possible for the product of this value and the value of +.Li _SC_PAGE_SIZE +to overflow. +.It Li _SC_AVPHYS_PAGES +The number of currently available pages of physical memory. +.El .Sh RETURN VALUES If the call to .Fn sysconf Index: gen/sysconf.c =================================================================== RCS file: /usr/repo/src/lib/libc/gen/sysconf.c,v retrieving revision 1.20 diff -u -p -r1.20 sysconf.c --- gen/sysconf.c 17 Nov 2002 08:54:29 -0000 1.20 +++ gen/sysconf.c 14 Aug 2006 12:46:20 -0000 @@ -574,6 +574,20 @@ yesno: if (sysctl(mib, 2, &value, &len, mib[1] = HW_NCPU; break; + case _SC_PHYS_PAGES: + path = "hw.availpages"; + goto get_sysctl; + case _SC_AVPHYS_PAGES: + path = "vm.stats.vm.v_free_count"; +get_sysctl: + sverrno = errno; + if (sysctlbyname(path, &value, &len, NULL, 0) == -1) { + errno = sverrno; + return (-1); + } + errno = sverrno; + return (value); + default: errno = EINVAL; return (-1);