Problem in resmgr_msgread Command

As depicted in the figure attached along with, if I pass the pBuf (which I received by calling the dev_malloc function) in the resmgr_msgread system call to copy the data passed in the write command to pBuf, I gets the Resource Manager Server Error. This means that the Resource Manager is not able to access the memory. [Scenario 1]
But if I copy the data passed from the write command to the local memory in the Resource Manager and then I do memcpy to the pBuf, it allows. [Scenario 2]

Does any have any idea why the Resource Manager is behaving like this?

Thanks in advance,

BR,
-Dheeraj

AFAIK dev_malloc is not a QNX fonction (unless it’s part of an TDK)???

What error are you getting? How and when is your resmgr returning that error?

From the information you are providing it should work, hence my guess is there is something more to what you are telling us ;) Would be so much easier with real code instead of trying to guess what you could have done wrong.

I am sorry, that I have mentioned the dev_malloc. Actually this API is provided by the Device Driver.

The error code is as…

“resmgr_msgread Error [Server fault on msg pass]”

I am not having any clue why this is so.
And there is no more magic I am doing in the code… (:slight_smile:

BR,
-Dheeraj

Devil is in the detail. Maybe there is no magic in your code, but there is got to be more then what you drawing shows. For example in method 2, doesn’t show how pLocal is initialise.

The error message SRVRFAULT: A fault occurred when the kernel tried to access the buffers provided. I suggest you trust this error message and start from there.

Hi,

some suggestions:

  • Check if your dev_malloc() API returns a valid (i.e. non-NULL) pointer.
  • Don’t you have the source code for that call? If not contact the authors.
  • Maybe dev_malloc() operates on some HW memory and the mmap() is not for WRITING?
  • Try to allocate a buffer with dev_malloc() and copy some arbitrary data into it. Does it generate a fault as well?

Regards,
Albrecht

Just saw something odd in your drawing: What is the return type of dev_malloc() API call? I guess it is void*, so your code should be

void* pBuf;
pBuf = dev_malloc(size); // and NOT *pBuf !!!
if (pBuf) {
	resmgr_msgread(ctp, pBuf, size, offset);
} else {
	return ENOMEM;
}

Why don’t you post your code?

Regards,
Albrecht

Hi,
This is provided by the other library, and the usage seems is fine.

Sorry, I can’ post the code. (:frowning:

Well, I have asked this with the QNX itself, and waiting for the resolution. Once I will get, I will post over here.

BR,
-Dheeraj