Skip to content

Commit

Permalink
fixup: test/aio: a simple AIO test
Browse files Browse the repository at this point in the history
  • Loading branch information
atopia committed Sep 9, 2024
1 parent a9cea89 commit c1f2902
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions repos/libports/src/test/aio/aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@ main(int argc, char **argv)
sleep(1);
}

if (aio_error(&write_cb) == 0)
int error = aio_error(&write_cb);
if (error == 0)
printf("Aio write retval: %li\n", aio_return(&write_cb));
else
err(EXIT_FAILURE, "Aio returned write error: %i\n", error);


/*
* Read test
Expand All @@ -61,8 +65,6 @@ main(int argc, char **argv)
if (read_fd == -1)
err(EXIT_FAILURE, "Failed to open '%s'", argv[1]);



struct aiocb read_cb;
char buf[10];

Expand All @@ -80,8 +82,11 @@ main(int argc, char **argv)
sleep(1);
}

if (aio_error(&read_cb) == 0)
printf("Aio read retval: %li\n", aio_return(&read_cb));
error = aio_error(&read_cb);
if (error == 0)
printf("Aio write retval: %li\n", aio_return(&read_cb));
else
err(EXIT_FAILURE, "Aio returned read error: %i\n", error);

for (int i = 0; i < 2 ; i++) {
/* Event triggered */
Expand Down

0 comments on commit c1f2902

Please sign in to comment.