git: 70cf77eaefa8 - main - aio_cancel(2): add kern_aio_cancel
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 13 Nov 2026 10:21:30 UTC
The branch main has been updated by brooks:
URL: https://cgit.FreeBSD.org/src/commit/?id=70cf77eaefa826570287ded6b27087fd5df89298
commit 70cf77eaefa826570287ded6b27087fd5df89298
Author: Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2026-03-12 14:19:04 +0000
Commit: Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2026-11-13 10:18:13 +0000
aio_cancel(2): add kern_aio_cancel
Effort: CHERI upstreaming
Sponsored by: DARPA, AFRL, Innovate UK
Pull Request: https://github.com/freebsd/freebsd-src/pull/2284
---
sys/kern/vfs_aio.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
index f94d343c20ab..2ae8abbc2486 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -330,6 +330,8 @@ static int filt_aio(struct knote *kn, long hint);
static int filt_lioattach(struct knote *kn);
static void filt_liodetach(struct knote *kn);
static int filt_lio(struct knote *kn, long hint);
+static int kern_aio_cancel(struct thread *td, int fd, struct aiocb *ujob,
+ struct aiocb_ops *ops);
/*
* Zones for:
@@ -2041,6 +2043,13 @@ sys_aio_suspend(struct thread *td, struct aio_suspend_args *uap)
*/
int
sys_aio_cancel(struct thread *td, struct aio_cancel_args *uap)
+{
+ return (kern_aio_cancel(td, uap->fd, uap->aiocbp, &aiocb_ops));
+}
+
+static int
+kern_aio_cancel(struct thread *td, int fd, struct aiocb *ujob,
+ struct aiocb_ops *ops)
{
struct proc *p = td->td_proc;
struct kaioinfo *ki;
@@ -2052,7 +2061,7 @@ sys_aio_cancel(struct thread *td, struct aio_cancel_args *uap)
struct vnode *vp;
/* Lookup file object. */
- error = fget(td, uap->fd, &cap_no_rights, &fp);
+ error = fget(td, fd, &cap_no_rights, &fp);
if (error)
return (error);
@@ -2081,8 +2090,8 @@ sys_aio_cancel(struct thread *td, struct aio_cancel_args *uap)
AIO_LOCK(ki);
TAILQ_FOREACH_SAFE(job, &ki->kaio_jobqueue, plist, jobn) {
- if (uap->fd == job->uaiocb.aio_fildes &&
- (uap->aiocbp == NULL || uap->aiocbp == job->ujob) &&
+ if (fd == job->uaiocb.aio_fildes &&
+ (ujob == NULL || ujob == job->ujob) &&
(job->jobflags & KAIOCB_MARKER) == 0) {
TAILQ_INSERT_AFTER(&ki->kaio_jobqueue, job, &marker,
plist);
@@ -2093,7 +2102,7 @@ sys_aio_cancel(struct thread *td, struct aio_cancel_args *uap)
}
jobn = TAILQ_NEXT(&marker, plist);
TAILQ_REMOVE(&ki->kaio_jobqueue, &marker, plist);
- if (uap->aiocbp != NULL)
+ if (ujob != NULL)
break;
}
}
@@ -2102,7 +2111,7 @@ sys_aio_cancel(struct thread *td, struct aio_cancel_args *uap)
done:
fdrop(fp, td);
- if (uap->aiocbp != NULL) {
+ if (ujob != NULL) {
if (cancelled) {
td->td_retval[0] = AIO_CANCELED;
return (0);