diff options
| author | Jonathan Lemon <jlemon@FreeBSD.org> | 2001-02-26 03:32:12 +0000 |
|---|---|---|
| committer | Jonathan Lemon <jlemon@FreeBSD.org> | 2001-02-26 03:32:12 +0000 |
| commit | d1c1cd368b37cc1fb1392285e4ead218530c30a6 (patch) | |
| tree | 35a88374b1ba9b4aca3cecb5138b65b730387bda /sys | |
| parent | 28767e5c60e7c5159b0b5b7a836433e002dd6f04 (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/kern/vfs_aio.c | 62 | ||||
| -rw-r--r-- | sys/sys/signal.h | 8 |
2 files changed, 40 insertions, 30 deletions
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index dd4879a9fcb6..5b5d5e1b8520 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -1203,6 +1203,9 @@ _aio_aqueue(struct proc *p, struct aiocb *job, struct aio_liojob *lj, int type) struct aiocblist *aiocbe; struct aioproclist *aiop; struct kaioinfo *ki; + struct kevent kev; + struct kqueue *kq; + struct file *kq_fp; if ((aiocbe = TAILQ_FIRST(&aio_freejobs)) != NULL) TAILQ_REMOVE(&aio_freejobs, aiocbe, list); @@ -1299,16 +1302,18 @@ _aio_aqueue(struct proc *p, struct aiocb *job, struct aio_liojob *lj, int type) fhold(fp); - /* - * XXX - * Figure out how to do this properly. This currently won't - * work on the alpha, since we're passing in a pointer via - * aio_lio_opcode, which is an int. - */ - { - struct kevent kev, *kevp; - struct kqueue *kq; - struct file *kq_fp; + if (aiocbe->uaiocb.aio_sigevent.sigev_notify == SIGEV_KEVENT) { + kev.ident = aiocbe->uaiocb.aio_sigevent.sigev_notify_kqueue; + kev.udata = aiocbe->uaiocb.aio_sigevent.sigev_value.sigval_ptr; + } + else { + /* + * This method for requesting kevent-based notification won't + * work on the alpha, since we're passing in a pointer + * via aio_lio_opcode, which is an int. Use the SIGEV_KEVENT- + * based method instead. + */ + struct kevent *kevp; kevp = (struct kevent *)job->aio_lio_opcode; if (kevp == NULL) @@ -1317,27 +1322,26 @@ _aio_aqueue(struct proc *p, struct aiocb *job, struct aio_liojob *lj, int type) error = copyin((caddr_t)kevp, (caddr_t)&kev, sizeof(kev)); if (error) goto aqueue_fail; - - if ((u_int)kev.ident >= fdp->fd_nfiles || - (kq_fp = fdp->fd_ofiles[kev.ident]) == NULL || - (kq_fp->f_type != DTYPE_KQUEUE)) { - error = EBADF; - goto aqueue_fail; - } - kq = (struct kqueue *)kq_fp->f_data; - kev.ident = (u_long)aiocbe; - kev.filter = EVFILT_AIO; - kev.flags = EV_ADD | EV_ENABLE | EV_FLAG1; - error = kqueue_register(kq, &kev, p); + } + if ((u_int)kev.ident >= fdp->fd_nfiles || + (kq_fp = fdp->fd_ofiles[kev.ident]) == NULL || + (kq_fp->f_type != DTYPE_KQUEUE)) { + error = EBADF; + goto aqueue_fail; + } + kq = (struct kqueue *)kq_fp->f_data; + kev.ident = (uintptr_t)aiocbe; + kev.filter = EVFILT_AIO; + kev.flags = EV_ADD | EV_ENABLE | EV_FLAG1; + error = kqueue_register(kq, &kev, p); aqueue_fail: - if (error) { - TAILQ_INSERT_HEAD(&aio_freejobs, aiocbe, list); - if (type == 0) - suword(&job->_aiocb_private.error, error); - goto done; - } -no_kqueue: + if (error) { + TAILQ_INSERT_HEAD(&aio_freejobs, aiocbe, list); + if (type == 0) + suword(&job->_aiocb_private.error, error); + goto done; } +no_kqueue: suword(&job->_aiocb_private.error, EINPROGRESS); aiocbe->uaiocb._aiocb_private.error = EINPROGRESS; diff --git a/sys/sys/signal.h b/sys/sys/signal.h index 2e405a2d03cc..2b6c0a7e1a1c 100644 --- a/sys/sys/signal.h +++ b/sys/sys/signal.h @@ -133,12 +133,18 @@ union sigval { struct sigevent { int sigev_notify; /* Notification type */ - int sigev_signo; /* Signal number */ + union { + int __sigev_signo; /* Signal number */ + int __sigev_notify_kqueue; + } __sigev_u; union sigval sigev_value; /* Signal value */ }; +#define sigev_signo __sigev_u.__sigev_signo +#define sigev_notify_kqueue __sigev_u.__sigev_notify_kqueue #define SIGEV_NONE 0 /* No async notification */ #define SIGEV_SIGNAL 1 /* Generate a queued signal */ +#define SIGEV_KEVENT 3 /* Generate a kevent */ typedef struct __siginfo { int si_signo; /* signal number */ |
