Main Page | Report this Page
Linux Forum Index  »  Linux Development - Applications  »  Explanation of fields in struct iocb...
Page 1 of 1    

Explanation of fields in struct iocb...

Author Message
adi.hodos...
Posted: Thu Sep 10, 2009 12:15 pm
Guest
The libaio.h header file contains this definition for struct iocb and
struct io_event :
struct iocb {
PADDEDptr(void *data, __pad1); /* Return in the io completion event
*/
PADDED(unsigned key, __pad2); /* For use in identifying io requests
*/

short aio_lio_opcode;
short aio_reqprio;
int aio_fildes;

union {
struct io_iocb_common c;
struct io_iocb_vector v;
struct io_iocb_poll poll;
struct io_iocb_sockaddr saddr;
} u;
};

struct io_event {
PADDEDptr(void *data, __pad1);
PADDEDptr(struct iocb *obj, __pad2);
PADDEDul(res, __pad3);
PADDEDul(res2, __pad4);
};

The key member has this comment "/* For use in identifying io requests
*/" so I've made a program that issues multiple async i/o operations
and keeps track of them by assigning them a number in the key field.
However when doing io_getevents() every io_event.obj has the member
key reset to 0. Can I use or not the data and key members of struct
iocb ? It seems to me that at least the key member of struct iocb is
reset by the kernel when calling io_submit(). Is this a bug or the
comment in libaio.h is wrong ?
 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Sun Nov 29, 2009 11:58 am