20 memset(&a
, 0, sizeof(struct aiocb
));
21 // Not sure if the sigevent is even looked at by aio_*... just zero it.
22 memset(&s
, 0, sizeof(struct sigevent
));
30 a
.aio_lio_opcode
= 0; // ignored
32 //------------------------------------------------------------------------
33 // The cases where aiocbp itself points to bogus memory is handled in
34 // memcheck/tests/darwin/scalar.c, so we don't check that here.
36 //------------------------------------------------------------------------
37 // XXX: This causes an unexpected undef value error later, at the XXX mark.
38 // Not sure why, it shouldn't.
39 // assert( aio_return(&a) < 0); // (iocb hasn't been inited)
41 //------------------------------------------------------------------------
42 assert( aio_read(&a
) < 0); // invalid fd
44 //------------------------------------------------------------------------
45 a
.aio_fildes
= open("aio.c", O_RDONLY
);
46 assert(a
.aio_fildes
>= 0);
48 // unaddressable aio_buf
49 //assert(aio_read(&a) == 0);
50 //assert(aio_return(&a) == -1);
52 //------------------------------------------------------------------------
55 assert( aio_read(&a
) == 0 );
57 // also failed on macOS
58 // (don't crash on the repeated &a)
59 // assert( aio_read(&a) < 0 );
61 // undefined -- aio_return() not called yet
62 if (buf
[0] == buf
[9]) x
++;
65 int res
= aio_error(&a
);
66 while (0 != res
&& try_count
< 1000) {
68 struct timespec rq
= { 0, 1000 };
73 assert(try_count
< 1000);
75 assert( aio_return(&a
) > 0 ); // XXX: (undefined value error here)
77 if (buf
[0] == buf
[9]) x
++;
80 assert( aio_return(&a
) < 0 ); // (repeated aio_return(); fails because
81 // Valgrind can't find &a in the table)
84 //------------------------------------------------------------------------
86 a
.aio_fildes
= creat("mytmpfile", S_IRUSR
|S_IWUSR
);
87 assert(a
.aio_fildes
>= 0);
89 // unaddressable aio_buf
90 //assert( aio_write(&a) == 0);
91 //assert(aio_return(&a) == -1);
93 //------------------------------------------------------------------------
96 assert( aio_write(&a
) == 0 );
98 // (don't crash on the repeated &a)
99 //assert( aio_write(&a) < 0 );
103 while (0 != res
&& try_count
< 1000) {
105 struct timespec rq
= { 0, 1000 };
106 nanosleep(&rq
, NULL
);
110 assert(try_count
< 1000);
112 assert( aio_return(&a
) > 0 );
115 assert( aio_return(&a
) < 0 ); // (repeated aio_return(); fails because
116 // Valgrind can't find &a in the table)