[ofw] running ibnetdisc with the debugger attached

Tzachi Dar tzachid at mellanox.co.il
Thu Sep 2 12:30:40 PDT 2010


Hi sean,

Do you succeed in running ibnetdisc with windbg attached? I must say we have not?

In any case the WriteFile api has a return value. I don't understand why you ignore it.

I must say that I have an offline version of the documentation that does not have the comment 
"For an hFile that does not support byte offsets, Offset and OffsetHigh are ignored." But I have found your version of the docs. How do we know that our device does not support offsets?

Please note that once running with the debugger we saw that writefile returned invalid parameter and the getoverlapped result was stuck for ever.

Thanks
Tzachi

> -----Original Message-----
> From: ofw-bounces at lists.openfabrics.org [mailto:ofw-
> bounces at lists.openfabrics.org] On Behalf Of Hefty, Sean
> Sent: Thursday, September 02, 2010 9:27 PM
> To: Tzachi Dar
> Cc: ofw at lists.openfabrics.org
> Subject: Re: [ofw] running ibnetdisc with the debugger attached
> 
> > m_OverlapWrite.hEvent is being closed twice.
> >
> > CWMProvider::~CWMProvider()
> >
> > {
> >
> >                 if (m_OverlapRead.hEvent != NULL) {
> >
> >                                 CloseHandle(m_OverlapWrite.hEvent);
> 
> This has been fixed.
> 
> >
> >                 }
> >
> >                 if (m_OverlapWrite.hEvent != NULL) {
> >
> >                                 CloseHandle(m_OverlapWrite.hEvent);
> >
> >                 }
> >
> >
> >
> > Writefile is not being used according to the docs. Should be
> something
> > like:
> >
> >
> >
> >         m_OverlapWrite.Offset = 0;
> >
> >         m_OverlapWrite.OffsetHigh = 0;
> >
> >
> >
> >
> EnterCriticalSection(&m_CritSecWrite);
> >
> >                                 ret = WriteFile(m_hFile, pMad, bytes,
> > &bytes, &m_OverlapWrite);
> >
> >         if (ret==0) {
> >
> >             if(GetLastError() == ERROR_IO_PENDING) {
> >
> >                 hr = GetOverlappedResult(&m_OverlapWrite, &bytes,
> TRUE);
> >
> >             } else {
> >
> >                 Print()
> >
> >                 hr = ???
> >
> >             }
> 
> The current code looks okay to me.  From the documentation:
> 
> "For an hFile that does not support byte offsets, Offset and OffsetHigh
> are ignored."
> 
> We can add initialization code to clear the overlap structures, so if
> we ever do want to support byte offsets, we'll have that capability.
> But, it's technically not needed.
> 
> The file itself is always opened using asynchronous operation.  A user
> can control the WMProvider:Send() operation by passing in NULL for
> pOverlapped.  NULL results in Send() behaving in synchronously.
> Otherwise, the default asynchronous operation is in effect.  This
> accounts for the following code:
> 
> 	if (pOverlapped == NULL) {
> 		// Send() is synchronous
> 		EnterCriticalSection(&m_CritSecWrite);
> 		WriteFile(m_hFile, pMad, bytes, &bytes, &m_OverlapWrite);
> 		hr = GetOverlappedResult(&m_OverlapWrite, &bytes, TRUE);
> 		LeaveCriticalSection(&m_CritSecWrite);
> 	} else {
> 		// Send() is async
> 		if (WriteFile(m_hFile, pMad, bytes, &bytes, pOverlapped)) {
> 			hr = NOERROR;
> 		} else {
> 			hr = HRESULT_FROM_WIN32(GetLastError());
> 		}
> 	}
> 
> A user wishing for asynchronous operation must handle Send() returning
> IO pending.
> 
> - Sean
> _______________________________________________
> ofw mailing list
> ofw at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw



More information about the ofw mailing list