This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Better diagnostics in mmap.cc


Short history and explanation:

According to my Makefile, I'm using 1.09
My purpose of using ipc-daemon is to get postgresql to work
on NT (4.0).  Unfortunately, fork() is failing trying to remap
shared memory segments between parent and child.  My guess from
other experience with shared memory I've had, was to force the
3 main shared memory segments of ipc-daemon into a predefined
memory segment, thus getting around the problem.  Currently, I've
hard coded these address values, but making this an
option/environment variable in the future is a good idea.
BTW, in doing this, I believe I exposed a bug with MapViewOfFile
in mmap.cc which should now be fixed in the Feb 25 snapshot.

Here is some example code I changed in ipc-daemon.c

      LFdSem  = open(CYGWIN_IPCNT_FILESEM, O_RDWR, 00666 ) ;
      LAdrSem = (CYGWIN_IPCNT_SEMSTR *)
                mmap(SFADDR , PAGE_ROUND_HELP(sizeof(CYGWIN_IPCNT_SEMSTR)), 
PROT_READ|PROT_WRITE,
                MAP_FIXED|MAP_SHARED, LFdSem, 0) ;
      sem_init(LAdrSem) ;

The change is addition of SFADDR, a #define, and MAP_FIXED, to put
the shared memory segment into a particular, predefined area.

...Anyway, doing this has helped, but now I'm encountering a new
problem with mmap.cc.  Here is an excerpt from my strace log for
ipctest:


.
.
.
  378  349277 [main] ipctest 269 _open: 3 = open (/tmp/MultiFileShm, 0x2)
  374  349651 [main] ipctest 269 mmap: addr 20180000, len 262144, prot 3, 
flags 11, fd 3, off 0
2055  351706 [main] ipctest 269 mmap: 20180000 = mmap() succeeded
  665  352371 [main] ipctest 269 _open: open (/tmp/cygipc1, 0x602)
  360  352731 [main] ipctest 269 dtable::build_fhandler: some disk file - cb 
56, fd 4, fh 0x1A020788
  340  353071 [main] ipctest 269 fhandler_disk_file::open: (/tmp/cygipc1, 
0x602)
  372  353443 [main] ipctest 269 mount_info::conv_to_win32_path: 
conv_to_win32_path (/tmp/cygipc1)
.
.
.
  335  397341 [main] ipctest 269 mmap: addr 0, len 65536, prot 3, flags 1, 
fd 4, off 0
1405  398746 [main] ipctest 269 mmap_record::map_map: -1 = map_map (): Win32 
error 487
  350  399096 [main] ipctest 269 mmap: 1C0E0000 = mmap() succeeded
.
.
.

The command line is: strace -o trace.out ipctest h

>From: "Charles S. Wilson" <cwilson@ece.gatech.edu>
>To: Gene Spleen <gene_spleen@hotmail.com>
>CC: cygwin@cygwin.com
>Subject: Re: Better diagnostics in mmap.cc
>Date: Tue, 27 Feb 2001 23:22:38 -0500
>
>
>
>Gene Spleen wrote:
> >
> > I'm trying to debug ipc-daemon, et al, and have found the cygwin 
>libraries
> > impossible to build for various reasons.  This is a problem because I'm
> > trying to debug a problem inside mmap.cc.  It would be great if you 
>could
> > add syscall_printf to the beggining of all calls in this module, much 
>like
> > what was done with
>
>Q: which ipc-daemon are you using?  I released 1.09 with some fixes
>about two weeks ago.
>
>--Chuck

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]