1829777 Members
1646 Online
109992 Solutions
New Discussion

Asynchronous I/O library

 

Asynchronous I/O library

Hello,

I am receiving the following message when trying to link
a program containing calls
to asynchronous I/O operations on HP-UX 11.0

# /usr/bin/cc wr.c
/usr/ccs/bin/ld: Unsatisfied symbols:
aio_write (first referenced in wr.o) (code)


Where on HP-UX is the async I/O library?


Here's a piece of my code :



#include
#include
#include


#define FILESZ ( 1024 * 1024 *64 )
main(){
struct aiocb aio;
void *buf;
time_t time1, time2;
int err,cnt =2;

buf = ( void * )malloc(FILESZ);
aio.aio_fildes=open("/tmp/file",O_WRONLY);
aio.aio_buf = buf;
aio.aio_offset=0;
aio.aio_nbytes=FILESZ;
aio.aio_reqprio=0;


time(&time1);
err = aio_write(&aio);
while (( err = aio_error(&aio)) == EINPROGRESS){
sleep(1);
}
time(&time2);
printf("The I/O took %d seconds\n", time2-time1 );

}



Thanks a lot for any pointers.

Dimitry.


2 REPLIES 2
Umapathy S
Honored Contributor

Re: Asynchronous I/O library

from the man page

aio_write(2) aio_write(2)

To use this function, link in the realtime library by specifying -lrt
on the compiler or linker command line.



Just end with -lrt when linking. This will do.


HTH
Umapathy
Arise Awake and Stop NOT till the goal is Reached!

Re: Asynchronous I/O library

Fixed.

thanks a lot