17 memset(&a
, 0, sizeof(struct aiocb
));
18 // Not sure if the sigevent is even looked at by aio_*... just zero it.
19 memset(&s
, 0, sizeof(struct sigevent
));
27 a
.aio_lio_opcode
= 0; // ignored
29 //------------------------------------------------------------------------
30 // The cases where aiocbp itself points to bogus memory is handled in
31 // memcheck/tests/darwin/scalar.c, so we don't check that here.
33 //------------------------------------------------------------------------
34 // XXX: This causes an unexpected undef value error later, at the XXX mark.
35 // Not sure why, it shouldn't.
36 // assert( aio_return(&a) < 0); // (aiocbp hasn't been inited)
38 //------------------------------------------------------------------------
39 assert( aio_read(&a
) < 0); // invalid fd
41 //------------------------------------------------------------------------
42 a
.aio_fildes
= open("aio.c", O_RDONLY
);
43 assert(a
.aio_fildes
>= 0);
45 assert( aio_read(&a
) < 0); // unaddressable aio_buf
47 //------------------------------------------------------------------------
50 assert( aio_read(&a
) == 0 );
52 assert( aio_read(&a
) < 0 ); // (don't crash on the repeated &a)
54 while (0 != aio_error(&a
)) { }
56 if (buf
[0] == buf
[9]) x
++; // undefined -- aio_return() not called yet
58 assert( aio_return(&a
) > 0 ); // XXX: (undefined value error here)
60 if (buf
[0] == buf
[9]) x
++;
62 assert( aio_return(&a
) < 0 ); // (repeated aio_return(); fails because
63 // Valgrind can't find &a in the table)
65 //------------------------------------------------------------------------
67 a
.aio_fildes
= creat("mytmpfile", S_IRUSR
|S_IWUSR
);
68 assert(a
.aio_fildes
>= 0);
70 assert( aio_write(&a
) < 0); // unaddressable aio_buf
72 //------------------------------------------------------------------------
75 assert( aio_write(&a
) == 0 );
77 assert( aio_write(&a
) < 0 ); // (don't crash on the repeated &a)
79 while (0 != aio_error(&a
)) { }
81 assert( aio_return(&a
) > 0 );
83 assert( aio_return(&a
) < 0 ); // (repeated aio_return(); fails because
84 // Valgrind can't find &a in the table)