CreateFileMapping/MapViewOfFile and fork

Sean Daley spdaley@gmail.com
Wed Mar 7 03:06:00 GMT 2007


As part of an application we're developing, we use
CreateFileMapping/MapViewOfFile to be able to share information among
processes.  I noticed today that if I try to reference the map
immediately after calling fork() but before calling exec, that my
application will crash.

I should be able to resolve this in my app but I was just curious if
this was unexpected behavior or not.

I've attached a test program parent_test.cpp and my cygcheck.out.

######################
sdaley@sdaley2 ~
$ gcc -Wall parent_test.cpp -o parent_test

sdaley@sdaley2 ~
$ ./parent_test.exe
Dumping map in parent
 --> length = 11
 --> name = test-string
Dumping map in child
     17 [main] parent_test 2460 _cygtls::handle_exceptions: Error while dumping
state (probably corrupted stack)

sdaley@sdaley2 ~
$
######################

Sean
-------------- next part --------------
A non-text attachment was scrubbed...
Name: parent_test.cpp
Type: application/octet-stream
Size: 1897 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20070307/f8cae78d/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 21561 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20070307/f8cae78d/attachment-0001.obj>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list