This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Uli, I'm enhancing rt/tst-aio.c to test also aio_fsync. My Posix Standard mentions (1003.1, 1996 Edition) on page 181 for aio_fsync: "If aiocb is NULL, then no status is returned..." Currently aio_fsync (O_SYNC, NULL) gives a segmentation fault. The current Austin Draft does not mention NULL anymore. Shall I add the test for NULL or not? I'm appending my current patch. 2000-07-26 Andreas Jaeger <aj@suse.de> * rt/tst-aio.c: Add tests for aio_fsync. ============================================================ Index: rt/tst-aio.c --- rt/tst-aio.c 2000/07/26 10:36:57 1.4 +++ rt/tst-aio.c 2000/07/26 13:44:28 @@ -124,7 +124,9 @@ do_test (int argc, char *argv[]) { struct aiocb cbs[10]; + struct aiocb cbs_fsync; struct aiocb *cbp[10]; + struct aiocb *cbp_fsync; char buf[1000]; size_t cnt; int result = 0; @@ -190,6 +192,54 @@ lio_listio (LIO_WAIT, cbp, 10, NULL); /* ...and immediately test it since we started it in wait mode. */ result |= test_file (buf, sizeof (buf), fd, "lio_listio (write)"); + + /* Test aio_fsync. */ + cbs_fsync.aio_fildes = fd; + cbs_fsync.aio_reqprio = 0; + cbp_fsync = &cbs_fsync; + + /* Remove the test file contents first. */ + if (ftruncate (fd, 0) < 0) + { + error (0, errno, "ftruncate failed\n"); + result = 1; + } + + /* Write again. */ + for (cnt = 10; cnt > 0; ) + aio_write (cbp[--cnt]); + + if (aio_fsync (O_SYNC, cbp_fsync) < 0) + { + error (0, errno, "aio_fsync failed\n"); + result = 1; + } + do_wait (&cbp_fsync, 1); + + /* ...and test since all data should be on disk now. */ + result |= test_file (buf, sizeof (buf), fd, "aio_fsync (aio_write)"); + + /* One more aio_fsync test. */ + /* Remove the test file contents first. */ + if (ftruncate (fd, 0) < 0) + { + error (0, errno, "ftruncate failed\n"); + result = 1; + } + + /* Write again. */ + for (cnt = 10; cnt > 0; ) + aio_write (cbp[--cnt]); + + if (aio_fsync (O_SYNC, NULL) < 0) + { + error (0, errno, "aio_fsync (O_SYNC, NULL) failed\n"); + result = 1; + } + do_wait (&cbp, 10; + + /* ...and test since all data should be on disk now. */ + result |= test_file (buf, sizeof (buf), fd, "aio_fsync (aio_write)"); return result; } -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |