Re: Problem regarding IOMemoryDescriptor ::writeBytes()
Re: Problem regarding IOMemoryDescriptor ::writeBytes()
- Subject: Re: Problem regarding IOMemoryDescriptor ::writeBytes()
- From: Herb Petschauer <email@hidden>
- Date: Thu, 11 Aug 2005 14:16:03 -0700
Just a quick guess. Have you tried kIODirectionInOut?
IOMemoryDescriptor::writeBytes(...) has the following code:
if ( (kIOMemoryPreparedReadOnly & _flags) || offset >= _length) {
IOLog("IOGMD(%p): wB = o%lx, l%lx\n", this, offset, length); // @@@ gvdl
return 0;
}
[I found it by doing a grep -rsI "IOGMD" in the xnu directory of the source]
Cheers,
H.
On 8/11/05, santosh katvate <email@hidden> wrote:
> Hello everybody
>
> I am not able to write in IOMemoryDescriptor buffer using the
> writeBytes function.
> But i am able to read from it using readBytes function.
>
> The return value is coming out to be 0
> and it is giving error in log file as
> IOGMD(0xaddr):wB=o0,l4
>
> What is the cause of the problem.
>
> The code is given below
>
>
> IOMemoryDescriptor *buffer = IOBufferMemoryDescriptor::withCapacity
> (LengthToWrite, kIODirectionOut);
> buffer->prepare (kIODirectionOut);
>
> UInt32* testtemp=(UInt32*)IOMalloc(4);
>
> ByteCount1=buffer->readBytes(0,testtemp,4);
> IOLog("ByteCount1=%d\n",ByteCount1 );
>
> ByteCount2 = buffer->writeBytes (0, pMyBuffer, 4);
> IOLog("ByteCount2=%d\n",ByteCount2 );
>
>
> Output in system.log is
>
> ByteCount1=4
> ByteCount2=0
>
>
> Thanking in Advance
> santosh k
>
>
> --
> Life is Small and Lots of Things to Learn
> Lets Share the Knowledge
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-kernel mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden