Mail Archives: cygwin/2002/03/11/23:39:21
I am experience a problem where mmap does not return -1, but the
pointer returned is not to a valid chunk of memory. I have included a
sample program, the output that I see, and the output of cygcheck
below.
I have tried this program both with and withouth the registry setting
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\heap_chunk_in_mb
which, when set, I have set to 512Mb. BTW, I notice that this
registry value isn't checked for by cygcheck. That would seem
useful.
Even if I got the registry setting wrong, I would expect mmap to
return -1 if it is unable to get the space.
Thanks for your help.
--------------------------------------------------------------------------------
#include <stdio.h>
#include <sys/mman.h>
#include <unistd.h>
#include <windows.h>
void try (uint length) {
void *p;
fprintf(stderr, "attempting to mmap %u bytes ...", length);
p = mmap (NULL, length,
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON, -1, 0);
if ((void*)-1 == p) {
fprintf(stderr, " out of memory\n");
exit(0);
}
fprintf(stderr, "zeroing ... ");
memset(p, 0, length);
fprintf(stderr, "unmapping ... ");
munmap(p, length);
fprintf(stderr, "succeeded\n");
length *= 2;
}
int main (int argc, char **argv) {
MEMORYSTATUS ms;
ms.dwLength = sizeof(MEMORYSTATUS);
GlobalMemoryStatus(&ms);
fprintf(stderr, "TotalPhys: %ld\nAvailPhys: %ld\nTotalPageFile: %ld\nAvailPageFile: %ld\nTotalVirtual: %ld\nAvailVirtual: %ld\n",
ms.dwTotalPhys,
ms.dwAvailPhys,
ms.dwTotalPageFile,
ms.dwAvailPageFile,
ms.dwTotalVirtual,
ms.dwAvailVirtual);
try(100000000);
try(130000000);
exit(0);
}
--------------------------------------------------------------------------------
TotalPhys: 209113088
AvailPhys: 166580224
TotalPageFile: 309587968
AvailPageFile: 275365888
TotalVirtual: 2147352576
AvailVirtual: 1589841920
attempting to mmap 100000000 bytes ...zeroing ... unmapping ... succeeded
attempting to mmap 130000000 bytes ...zeroing ... Segmentation fault (core dumped)
--------------------------------------------------------------------------------
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
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -