The library which I intend to use is, io_submit. Not to be confused with POSIX aio.
The iocb structure has a field, called as, aio_buf, which is the address( aligned) of a buffer.
On most examples on the internet, the way it has been shown is,
char data[4096];
struct iocb cb
cb.aio_buf = (uint64_t)data
Here is my problem:
There exists some other API already, which gives me aligned address. ( specifically a kernel driver, which maps into my address space ).
Here is what I am able to do:
char **someBuffer = new char*[someCount];
// in a loop
someBuffer[loopCounter] = valloc(aLenght)
memcpy(someBuffer[loopCounter], someAddress, aLenght);
...
...
...
cbs[someCount].aio_buf = (uint64_t)(someBuffer[loopCounter])
...
...
...
...
...
...
... // looping ends
...
...
...
...
call io_submit.
Here is what I want to do:
I want to avoid the new, memcpy, calls.
I know that the address is already memory aligned which is given to me.
But some basic understanding is missing on my part.
I have tried using io_submit using the addresses, but I get back the error (-14) [bad address] in the io_getevents call.
How Have I tried:
cb.aio_buf = (uint64_t) someAddress;