Changeset View
Changeset View
Standalone View
Standalone View
tests/sys/aio/aio_kqueue_test.c
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | |||||
#define MAX_RUNS 300 | #define MAX_RUNS 300 | ||||
/* #define DEBUG */ | /* #define DEBUG */ | ||||
int | int | ||||
main (int argc, char *argv[]) | main (int argc, char *argv[]) | ||||
{ | { | ||||
struct aiocb **iocb, *kq_iocb; | struct aiocb **iocb, *kq_iocb; | ||||
char *file, pathname[sizeof(PATH_TEMPLATE)+1]; | char *file, pathname[sizeof(PATH_TEMPLATE)+1]; | ||||
struct kevent ke, kq_returned; | struct kevent kq_returned; | ||||
struct timespec ts; | struct timespec ts; | ||||
char buffer[32768]; | char buffer[32768]; | ||||
int max_queue_per_proc; | int max_queue_per_proc; | ||||
size_t max_queue_per_proc_size; | size_t max_queue_per_proc_size; | ||||
#ifdef DEBUG | #ifdef DEBUG | ||||
int cancel, error; | int cancel, error; | ||||
#endif | #endif | ||||
int failed = 0, fd, kq, pending, result, run; | int failed = 0, fd, kq, pending, result, run; | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | #ifdef DEBUG | ||||
cancel = max_queue_per_proc - pending; | cancel = max_queue_per_proc - pending; | ||||
#endif | #endif | ||||
i = 0; | i = 0; | ||||
while (pending) { | while (pending) { | ||||
for (;;) { | for (;;) { | ||||
bzero(&ke, sizeof(ke)); | bzero(&kq_returned, sizeof(kq_returned)); | ||||
bzero(&kq_returned, sizeof(ke)); | |||||
ts.tv_sec = 0; | ts.tv_sec = 0; | ||||
ts.tv_nsec = 1; | ts.tv_nsec = 1; | ||||
result = kevent(kq, NULL, 0, | result = kevent(kq, NULL, 0, | ||||
&kq_returned, 1, &ts); | &kq_returned, 1, &ts); | ||||
#ifdef DEBUG | #ifdef DEBUG | ||||
error = errno; | error = errno; | ||||
#endif | #endif | ||||
if (result < 0) | if (result < 0) | ||||
▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines |