summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_aio.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2002-08-06 19:01:08 +0000
committeralc <alc@FreeBSD.org>2002-08-06 19:01:08 +0000
commita7174d2f86d7eeb93a3759293bc8d474c6ae4fb1 (patch)
treedfbadf8f97aa63268ba1f371052c96e0cb96f5ad /sys/kern/vfs_aio.c
parentea746a5dab02c45c3d3b91c05437f1e9c51a13ac (diff)
downloadFreeBSD-src-a7174d2f86d7eeb93a3759293bc8d474c6ae4fb1.zip
FreeBSD-src-a7174d2f86d7eeb93a3759293bc8d474c6ae4fb1.tar.gz
Set the ident field of the struct kevent that is registered by _aio_aqueue()
to the address of the user's aiocb rather than the kernel's aiocb. (In other words, prior to this change, the ident field returned by kevent(2) on completion of an AIO was effectively garbage.) Submitted by: Romer Gil <rgil@cs.rice.edu>
Diffstat (limited to 'sys/kern/vfs_aio.c')
-rw-r--r--sys/kern/vfs_aio.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
index 240140a..c46dd13 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -1406,9 +1406,10 @@ _aio_aqueue(struct thread *td, struct aiocb *job, struct aio_liojob *lj, int typ
goto aqueue_fail;
}
kq = (struct kqueue *)kq_fp->f_data;
- kev.ident = (uintptr_t)aiocbe;
+ kev.ident = (uintptr_t)aiocbe->uuaiocb;
kev.filter = EVFILT_AIO;
kev.flags = EV_ADD | EV_ENABLE | EV_FLAG1;
+ kev.data = (intptr_t)aiocbe;
error = kqueue_register(kq, &kev, td);
aqueue_fail:
if (error) {
@@ -2266,7 +2267,7 @@ aio_waitcomplete(struct thread *td, struct aio_waitcomplete_args *uap)
static int
filt_aioattach(struct knote *kn)
{
- struct aiocblist *aiocbe = (struct aiocblist *)kn->kn_id;
+ struct aiocblist *aiocbe = (struct aiocblist *)kn->kn_sdata;
/*
* The aiocbe pointer must be validated before using it, so
@@ -2286,7 +2287,7 @@ filt_aioattach(struct knote *kn)
static void
filt_aiodetach(struct knote *kn)
{
- struct aiocblist *aiocbe = (struct aiocblist *)kn->kn_id;
+ struct aiocblist *aiocbe = (struct aiocblist *)kn->kn_sdata;
SLIST_REMOVE(&aiocbe->klist, kn, knote, kn_selnext);
}
@@ -2296,7 +2297,7 @@ filt_aiodetach(struct knote *kn)
static int
filt_aio(struct knote *kn, long hint)
{
- struct aiocblist *aiocbe = (struct aiocblist *)kn->kn_id;
+ struct aiocblist *aiocbe = (struct aiocblist *)kn->kn_sdata;
kn->kn_data = aiocbe->uaiocb._aiocb_private.error;
if (aiocbe->jobstate != JOBST_JOBFINISHED &&
OpenPOWER on IntegriCloud