The aio_waitcomplete(2) syscall should not sleep when the given timeout
is 0. Without this change it was sleeping for one tick. Maybe not a big deal, but it makes share/dtrace/blocking script to report that. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D3814 Sponsored by: Wheel Systems, http://wheelsystems.com
This commit is contained in:
parent
2602284308
commit
38d68e2d42
@ -2494,8 +2494,11 @@ kern_aio_waitcomplete(struct thread *td, struct aiocb **aiocbp,
|
||||
|
||||
ops->store_aiocb(aiocbp, NULL);
|
||||
|
||||
timo = 0;
|
||||
if (ts) {
|
||||
if (ts == NULL) {
|
||||
timo = 0;
|
||||
} else if (ts->tv_sec == 0 && ts->tv_nsec == 0) {
|
||||
timo = -1;
|
||||
} else {
|
||||
if ((ts->tv_nsec < 0) || (ts->tv_nsec >= 1000000000))
|
||||
return (EINVAL);
|
||||
|
||||
@ -2513,6 +2516,10 @@ kern_aio_waitcomplete(struct thread *td, struct aiocb **aiocbp,
|
||||
cb = NULL;
|
||||
AIO_LOCK(ki);
|
||||
while ((cb = TAILQ_FIRST(&ki->kaio_done)) == NULL) {
|
||||
if (timo == -1) {
|
||||
error = EWOULDBLOCK;
|
||||
break;
|
||||
}
|
||||
ki->kaio_flags |= KAIO_WAKEUP;
|
||||
error = msleep(&p->p_aioinfo, AIO_MTX(ki), PRIBIO | PCATCH,
|
||||
"aiowc", timo);
|
||||
|
Loading…
Reference in New Issue
Block a user