Changeset View
Changeset View
Standalone View
Standalone View
tests/sys/aio/lio_kqueue_test.c
Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | main(int argc, char *argv[]) | ||||
int fd; | int fd; | ||||
struct aiocb *iocb[MAX_IOCBS]; | struct aiocb *iocb[MAX_IOCBS]; | ||||
struct aiocb **lio[LIO_MAX], **kq_lio; | struct aiocb **lio[LIO_MAX], **kq_lio; | ||||
int i, result, run, error, j, k, max_queue_per_proc; | int i, result, run, error, j, k, max_queue_per_proc; | ||||
int max_iocbs, iocbs_per_lio; | int max_iocbs, iocbs_per_lio; | ||||
size_t max_queue_per_proc_size; | size_t max_queue_per_proc_size; | ||||
char buffer[32768]; | char buffer[32768]; | ||||
int kq; | int kq; | ||||
struct kevent ke, kq_returned; | struct kevent kq_returned; | ||||
struct timespec ts; | struct timespec ts; | ||||
struct sigevent sig; | struct sigevent sig; | ||||
time_t time1, time2; | time_t time1, time2; | ||||
char *file, pathname[sizeof(PATH_TEMPLATE)]; | char *file, pathname[sizeof(PATH_TEMPLATE)]; | ||||
int tmp_file = 0, failed = 0; | int tmp_file = 0, failed = 0; | ||||
PLAIN_REQUIRE_KERNEL_MODULE("aio", 0); | PLAIN_REQUIRE_KERNEL_MODULE("aio", 0); | ||||
PLAIN_REQUIRE_UNSAFE_AIO(0); | PLAIN_REQUIRE_UNSAFE_AIO(0); | ||||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | #endif | ||||
for (i = 0; i < LIO_MAX; i++) { | for (i = 0; i < LIO_MAX; i++) { | ||||
for (j = LIO_MAX - 1; j >=0; j--) { | for (j = LIO_MAX - 1; j >=0; j--) { | ||||
if (lio[j]) | if (lio[j]) | ||||
break; | break; | ||||
} | } | ||||
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; | ||||
#ifdef DEBUG | #ifdef DEBUG | ||||
printf("FOO lio %d -> %p\n", j, lio[j]); | printf("FOO lio %d -> %p\n", j, lio[j]); | ||||
#endif | #endif | ||||
EV_SET(&ke, (uintptr_t)lio[j], | |||||
EVFILT_LIO, EV_ONESHOT, 0, 0, iocb[j]); | |||||
result = kevent(kq, NULL, 0, | result = kevent(kq, NULL, 0, | ||||
&kq_returned, 1, &ts); | &kq_returned, 1, &ts); | ||||
error = errno; | error = errno; | ||||
if (result < 0) { | if (result < 0) { | ||||
perror("kevent error: "); | perror("kevent error: "); | ||||
} | } | ||||
kq_lio = kq_returned.udata; | kq_lio = kq_returned.udata; | ||||
#ifdef DEBUG | #ifdef DEBUG | ||||
▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines |