This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CMEM and pread64

I am trying to use pread64 to read data from a sata device into a destination buffer allocated using CMEM on a DM8168. The pread64 function is failing and errno is set to 14 (EFAULT, bad address). If I allocate the destination buffer using malloc or new, the function succeeds. Can anyone tell me why this might be failing or how to go about reading data directly into a CMEM-allocated buffer.  Thx, Steve

  • Can you post your code?

    I can't think of any reason that a CMEM buffer would fail when a regular malloc()ed buffer wouldn't.  EFAULT, in addition to being returned by pread64 for a bad address, is also returned when the buffer is overrun, so make sure the read size is <= CMEM buffer size.

    Regards,

    - Rob