Mail Archives: cygwin/2002/03/08/17:19:07
I am having a problem using mmap (... MAP_PRIVATE ...) followed by
fork () in Cygwin DLL version 1.3.9. The memory allocated by mmap
does not appear to be available in the child. A small C program that
shows the problem is included below. I would expect to see the
program print
parent hello
child hello
but instead it prints
parent hello
child
I saw the thread at
http://sources.redhat.com/ml/cygwin/2001-04/msg00829.html
which seemed to indicate that a related problem had been fixed a while
ago, but I am still seeing something strange. I can use MAP_SHARED
instead of MAP_PRIVATE, and then everything works, but I am in a
situation where I want to use MAP_PRIVATE.
Any help would be appreciated. I have also included the results of
cygcheck below.
----------------------------------------------------------------------
#include <stddef.h>
#include <stdio.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <unistd.h>
void die (char *s) {
fprintf(stderr, "%d", s);
exit(1);
}
int main (int argc, char **argv) {
pid_t pid;
size_t length;
char *buf;
length = getpagesize ();
buf = (char*) mmap (NULL, length, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON, -1, 0);
if (buf == (void*)-1)
die ("mmap failed");
strcpy (buf, "hello");
pid = fork ();
if (0 == pid) {
fprintf(stderr, "child %s\n", buf);
} else {
fprintf(stderr, "parent %s\n", buf);
}
}
----------------------------------------------------------------------
Cygwin Win95/NT Configuration Diagnostics
Current System Time: Thu Mar 07 18:50:07 2002
Windows NT Ver 4.0 Build 1381 Service Pack 6
Path: z:\cygwin\usr\local\bin
z:\cygwin\bin
z:\cygwin\bin
c:\WINNT\system32
c:\WINNT
SysDir: C:\WINNT\System32
WinDir: C:\WINNT
HOME = `z:\cygwin\home\sweeks'
MAKE_MODE = `unix'
PWD = `/tmp'
USER = `sweeks'
COMPUTERNAME = `WINDOZE'
COMSPEC = `C:\WINNT\system32\cmd.exe'
HOMEDRIVE = `C:'
HOMEPATH = `\'
LOGONSERVER = `\\WINDOZE'
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 = `\[\033]0;\w\007
\033[32m\]\u@\h \[\033[33m\w\033[0m\]
$ '
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
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2
(default) = `/cygdrive'
cygdrive flags = 0x00000022
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\Program Options
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
a: fd N/A N/A
c: hd NTFS 2043Mb 18% CP CS UN PA FC
d: cd N/A N/A
y: net NTFS 71228Mb 18% PA sweeks
z: net NTFS 71228Mb 18% 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
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
751k 2002/02/21 z:\cygwin\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
"cygwin1.dll" v0.0 ts=2002/1/21 9:48
Cygwin DLL version info:
DLL version: 1.3.9
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 Jan 21 12:48:41 EST 2002
Shared id: cygwin1S3
Cygwin Package Information
Last downloaded files to: Z:\cygwin-packages
Last downloaded files from: ftp://ftp.nas.nasa.gov/mirrors/cygwin.com/pub/cygwin
Package Version
ash 20020131-1
bash 2.05a-2
cygwin 1.3.9-1
diff 0.0
fileutils 4.1-1
findutils 4.1
gawk 3.0.4-1
gdbm 1.8.0-4
grep 2.4.2-1
gzip 1.3.2-1
libintl 0.10.38-3
libncurses5 5.2-1
libncurses6 5.2-8
libreadline4 4.1-2
libreadline5 4.2a-1
login 1.4-3
ncurses 5.2-8
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.16-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 -