Corinna Vinschen wrote:
> On Sun, Mar 10, 2002 at 08:49:07PM -0800, Stephen Weeks wrote:
> >
> > Is there a way to find the amount of RAM from within Cygwin? I
> > tried sysconf(_SC_PHYS_PAGES) but that returns -1. The only other
> > thing that I saw was a post on this list
> >
> > http://sources.redhat.com/ml/cygwin/2001-11/msg00849.html
> >
> > but that never received an answer. Any ideas? Thanks.
>
> _SC_PHYS_PAGES is only supported on NT/2K/XP.
Thanks for the information. However, something must be wrong, since I
am on an NT machine and sysconf(_SC_PHYS_PAGES) returns -1.
Fortunately, Chris January's suggestion to use GlobalMemoryStatus
worked fine.
Anyways, here is a simple test program, the output that I see, and the
output of cygcheck. Hopefully that will help you find the problem.
--------------------------------------------------------------------------------
#include <stdio.h>
#include <unistd.h>
#define doit(s) \
fprintf(stderr, #s " = %d\n", sysconf(s));
int main() {
doit(_SC_ARG_MAX);
doit(_SC_CHILD_MAX);
doit(_SC_CLK_TCK);
doit(_SC_NGROUPS_MAX);
doit(_SC_OPEN_MAX);
doit(_SC_JOB_CONTROL);
doit(_SC_SAVED_IDS);
doit(_SC_VERSION);
doit(_SC_PAGESIZE);
doit(_SC_NPROCESSORS_CONF);
doit(_SC_NPROCESSORS_ONLN);
doit(_SC_PHYS_PAGES);
doit(_SC_AVPHYS_PAGES);
doit(_SC_MQ_OPEN_MAX);
doit(_SC_MQ_PRIO_MAX);
doit(_SC_RTSIG_MAX);
doit(_SC_SEM_NSEMS_MAX);
doit(_SC_SEM_VALUE_MAX);
doit(_SC_SIGQUEUE_MAX);
doit(_SC_TIMER_MAX);
doit(_SC_TZNAME_MAX);
doit(_SC_ASYNCHRONOUS_IO);
doit(_SC_FSYNC);
doit(_SC_MAPPED_FILES);
doit(_SC_MEMLOCK);
doit(_SC_MEMLOCK_RANGE);
doit(_SC_MEMORY_PROTECTION);
doit(_SC_MESSAGE_PASSING);
doit(_SC_PRIORITIZED_IO);
doit(_SC_REALTIME_SIGNALS);
doit(_SC_SEMAPHORES);
doit(_SC_SHARED_MEMORY_OBJECTS);
doit(_SC_SYNCHRONIZED_IO);
doit(_SC_TIMERS);
doit(_SC_AIO_LISTIO_MAX);
doit(_SC_AIO_MAX);
doit(_SC_AIO_PRIO_DELTA_MAX);
doit(_SC_DELAYTIMER_MAX);
return 0;
}
--------------------------------------------------------------------------------
_SC_ARG_MAX = 1048576
_SC_CHILD_MAX = 63
_SC_CLK_TCK = 1000
_SC_NGROUPS_MAX = 16
_SC_OPEN_MAX = 256
_SC_JOB_CONTROL = 1
_SC_SAVED_IDS = 0
_SC_VERSION = 199009
_SC_PAGESIZE = 4096
_SC_NPROCESSORS_CONF = -1
_SC_NPROCESSORS_ONLN = -1
_SC_PHYS_PAGES = -1
_SC_AVPHYS_PAGES = -1
_SC_MQ_OPEN_MAX = -1
_SC_MQ_PRIO_MAX = -1
_SC_RTSIG_MAX = -1
_SC_SEM_NSEMS_MAX = -1
_SC_SEM_VALUE_MAX = -1
_SC_SIGQUEUE_MAX = -1
_SC_TIMER_MAX = -1
_SC_TZNAME_MAX = -1
_SC_ASYNCHRONOUS_IO = -1
_SC_FSYNC = -1
_SC_MAPPED_FILES = -1
_SC_MEMLOCK = -1
_SC_MEMLOCK_RANGE = -1
_SC_MEMORY_PROTECTION = -1
_SC_MESSAGE_PASSING = -1
_SC_PRIORITIZED_IO = -1
_SC_REALTIME_SIGNALS = -1
_SC_SEMAPHORES = -1
_SC_SHARED_MEMORY_OBJECTS = -1
_SC_SYNCHRONIZED_IO = -1
_SC_TIMERS = -1
_SC_AIO_LISTIO_MAX = -1
_SC_AIO_MAX = -1
_SC_AIO_PRIO_DELTA_MAX = -1
_SC_DELAYTIMER_MAX = -1
--------------------------------------------------------------------------------
Cygwin Win95/NT Configuration Diagnostics
Current System Time: Mon Mar 11 19:42:08 2002
Windows NT Ver 4.0 Build 1381 Service Pack 6
Path: z:\cygwin\home\sweeks\bin
z:\cygwin\sbin
z:\cygwin\usr\sbin
z:\cygwin\usr\local\bin
z:\cygwin\bin
z:\cygwin\bin
c:\WINNT\system32
c:\WINNT
SysDir: C:\WINNT\System32
WinDir: C:\WINNT
CYGWIN = `binmode ntsec tty '
HOME = `z:\cygwin\home\sweeks'
MAKE_MODE = `unix'
PWD = `/cygdrive/c'
USER = `sweeks'
COMPUTERNAME = `WINDOZE'
COMSPEC = `C:\WINNT\system32\cmd.exe'
HOMEDRIVE = `C:'
HOMEPATH = `\'
LOGONSERVER = `\\WINDOZE'
MANPATH = `:/usr/ssl/man'
NUMBER_OF_PROCESSORS = `1'
OLDPWD = `/home/sweeks'
OS2LIBPATH = `C:\WINNT\system32\os2\dll;'
OS = `Windows_NT'
PATHEXT = `.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH'
PROCESSOR_ARCHITECTURE = `x86'
PROCESSOR_IDENTIFIER = `x86 Family 15 Model 1 Stepping 2, GenuineIntel'
PROCESSOR_LEVEL = `15'
PROCESSOR_REVISION = `0102'
PROMPT = `$P$G'
PS1 = `\W% '
SHLVL = `1'
SYSTEMDRIVE = `C:'
SYSTEMROOT = `C:\WINNT'
TEMP = `c:\TEMP'
TERM = `cygwin'
TMP = `c:\TEMP'
USERDOMAIN = `WINDOZE'
USERNAME = `sweeks'
USERPROFILE = `C:\WINNT\Profiles\sweeks'
WINDIR = `C:\WINNT'
_ = `/usr/bin/cygcheck'
HKEY_CURRENT_USER\Software\Cygnus Solutions
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin
(default) = 0x00000200
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2
(default) = `/cygdrive'
cygdrive flags = 0x00000022
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\Program Options
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\00
(default) = `C:'
unix = `/'
fbinary = 0x00000000
fsilent = 0x00000000
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/
(default) = `z:\cygwin'
flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin
(default) = `z:/cygwin/bin'
flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib
(default) = `z:/cygwin/lib'
flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin B20
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin B20\B20.1
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\00
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\01
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\02
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\03
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\04
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\05
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\06
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\07
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\08
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\09
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0A
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0B
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0C
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0D
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0E
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0F
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\10
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\11
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\12
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\13
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\14
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\15
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\16
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\17
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\18
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\19
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1A
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1B
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1C
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1D
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\GNUPro
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\GNUPro\i586-cygwin32
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\GNUPro\i586-cygwin32\i586-cygwin32
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus
Solutions\GNUPro\i586-cygwin32\i586-cygwin32\cygwin-B20.1
(default) = `z:\cygwin-b20.1\cygwin-b20'
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cygnus Cygwin
B20
(default) = `C:\WINNT\IsUninst.exe -fz:\cygwin-b20.1\cygwin-b20\Uninst.isu'
DisplayName = `Cygwin B20'
a: fd N/A N/A
c: hd NTFS 2043Mb 17% CP CS UN PA FC
d: cd N/A N/A
y: net NTFS 71228Mb 19% PA sweeks
z: net NTFS 71228Mb 19% PA windows
. /cygdrive user binmode,noumount
z:\cygwin / system binmode
z:/cygwin/bin /usr/bin system binmode
z:/cygwin/lib /usr/lib system binmode
Found: z:\cygwin\bin\bash.exe
Found: z:\cygwin\bin\cat.exe
Not Found: cpp (good!)
Found: z:\cygwin\bin\find.exe
Not Found: gcc
Not Found: gdb
Not Found: ld
Found: z:\cygwin\bin\ls.exe
Not Found: make
Found: z:\cygwin\bin\sh.exe
751k 2002/03/09 z:\cygwin\usr\sbin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
"cygwin1.dll" v0.0 ts=2002/2/25 8:14
Cygwin DLL version info:
DLL version: 1.3.10
DLL epoch: 19
DLL bad signal mask: 19005
DLL old termios: 5
DLL malloc env: 28
API major: 0
API minor: 51
Shared data: 3
DLL identifier: cygwin1
Mount registry: 2
Cygnus registry name: Cygnus Solutions
Cygwin registry name: Cygwin
Program options name: Program Options
Cygwin mount registry name: mounts v2
Cygdrive flags: cygdrive flags
Cygdrive prefix: cygdrive prefix
Cygdrive default prefix:
Build date: Mon Feb 25 11:14:34 EST 2002
Shared id: cygwin1S3
19k 2002/02/21 z:\cygwin\bin\cyggdbm.dll - os=4.0 img=1.0 sys=4.0
"cyggdbm.dll" v0.0 ts=2002/2/19 19:05
45k 2002/02/21 z:\cygwin\bin\cygform5.dll - os=4.0 img=1.0 sys=4.0
"cygform5.dll" v0.0 ts=2001/4/24 22:28
26k 2002/02/21 z:\cygwin\bin\cygmenu5.dll - os=4.0 img=1.0 sys=4.0
"cygmenu5.dll" v0.0 ts=2001/4/24 22:27
156k 2002/02/21 z:\cygwin\bin\cygncurses++5.dll - os=4.0 img=1.0 sys=4.0
"cygncurses++5.dll" v0.0 ts=2001/4/24 22:29
226k 2002/02/21 z:\cygwin\bin\cygncurses5.dll - os=4.0 img=1.0 sys=4.0
"cygncurses5.dll" v0.0 ts=2001/4/24 22:17
15k 2002/02/21 z:\cygwin\bin\cygpanel5.dll - os=4.0 img=1.0 sys=4.0
"cygpanel5.dll" v0.0 ts=2001/4/24 22:27
35k 2002/02/21 z:\cygwin\bin\cygform6.dll - os=4.0 img=1.0 sys=4.0
"cygform6.dll" v0.0 ts=2002/1/8 22:03
20k 2002/02/21 z:\cygwin\bin\cygmenu6.dll - os=4.0 img=1.0 sys=4.0
"cygmenu6.dll" v0.0 ts=2002/1/8 22:03
175k 2002/02/21 z:\cygwin\bin\cygncurses++6.dll - os=4.0 img=1.0 sys=4.0
"cygncurses++6.dll" v0.0 ts=2002/1/8 22:03
202k 2002/02/21 z:\cygwin\bin\cygncurses6.dll - os=4.0 img=1.0 sys=4.0
"cygncurses6.dll" v0.0 ts=2002/1/8 22:03
12k 2002/02/21 z:\cygwin\bin\cygpanel6.dll - os=4.0 img=1.0 sys=4.0
"cygpanel6.dll" v0.0 ts=2002/1/8 22:03
17k 2002/02/21 z:\cygwin\bin\cyghistory4.dll - os=4.0 img=1.0 sys=4.0
"cyghistory4.dll" v0.0 ts=2001/1/6 20:34
108k 2002/02/21 z:\cygwin\bin\cygreadline4.dll - os=4.0 img=1.0 sys=4.0
"cygreadline4.dll" v0.0 ts=2001/1/6 20:34
20k 2002/02/21 z:\cygwin\bin\cyghistory5.dll - os=4.0 img=1.0 sys=4.0
"cyghistory5.dll" v0.0 ts=2002/1/12 17:27
121k 2002/02/21 z:\cygwin\bin\cygreadline5.dll - os=4.0 img=1.0 sys=4.0
"cygreadline5.dll" v0.0 ts=2002/1/12 17:27
50k 2002/02/21 z:\cygwin\bin\cygz.dll - os=4.0 img=1.0 sys=4.0
"cygz.dll" v0.0 ts=2002/1/20 11:41
21k 2002/02/21 z:\cygwin\bin\cygintl.dll - os=4.0 img=1.0 sys=4.0
"cygintl.dll" v0.0 ts=2001/6/20 10:09
22k 2002/03/08 z:\cygwin\bin\cygintl-1.dll - os=4.0 img=1.0 sys=4.0
"cygintl-1.dll" v0.0 ts=2001/12/13 1:28
40k 2002/03/08 z:\cygwin\bin\cygpcre.dll - os=4.0 img=1.0 sys=4.0
"cygpcre.dll" v0.0 ts=2001/11/21 14:15
39k 2002/03/08 z:\cygwin\bin\cygpcreposix.dll - os=4.0 img=1.0 sys=4.0
"cygpcreposix.dll" v0.0 ts=2001/11/21 14:15
621k 2002/03/09 z:\cygwin\bin\cygcrypto.dll - os=4.0 img=1.0 sys=4.0
"cygcrypto.dll" v0.0 ts=2002/1/16 1:54
156k 2002/03/09 z:\cygwin\bin\cygssl.dll - os=4.0 img=1.0 sys=4.0
"cygssl.dll" v0.0 ts=2002/1/16 1:54
751k 2002/03/09 z:\cygwin\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
"cygwin1.dll" v0.0 ts=2002/2/25 8:14
Cygwin DLL version info:
DLL version: 1.3.10
DLL epoch: 19
DLL bad signal mask: 19005
DLL old termios: 5
DLL malloc env: 28
API major: 0
API minor: 51
Shared data: 3
DLL identifier: cygwin1
Mount registry: 2
Cygnus registry name: Cygnus Solutions
Cygwin registry name: Cygwin
Program options name: Program Options
Cygwin mount registry name: mounts v2
Cygdrive flags: cygdrive flags
Cygdrive prefix: cygdrive prefix
Cygdrive default prefix:
Build date: Mon Feb 25 11:14:34 EST 2002
Shared id: cygwin1S3
Cygwin Package Information
Last downloaded files to: Z:\cygwin-packages
Last downloaded files from: http://planetmirror.com/pub/sourceware/cygwin
Package Version
ash 20020131-1
bash 2.05a-3
cygrunsrv 0.95-1
cygwin 1.3.10-1
cygwin-src 1.3.10-1
diff 0.0
fileutils 4.1-1
findutils 4.1
gawk 3.0.4-1
gdbm 1.8.0-4
grep 2.5g
groff 1.17.2-1
gzip 1.3.2-1
inetutils 1.3.2-17
less 358-3
libintl 0.10.38-3
libintl1 0.10.40-1
libncurses5 5.2-1
libncurses6 5.2-8
libreadline4 4.1-2
libreadline5 4.2a-1
login 1.4-3
man 1.5g-2
ncurses 5.2-8
openssh 3.1p1-1
openssl 0.9.6c-3
pcre 3.7-1
readline 4.2a-1
sed 3.02-1
sh-utils 2.0-2
tar 1.13.19-1
termcap 20010825-1
terminfo 5.2-1
textutils 2.0.21-1
w32api 1.2-1
which 1.5-1
zlib 1.1.3-7
Use -h to see help about each section