Date: Mon, 20 Sep 1999 00:51:40 -0400 (EDT) From: "John W. DeBoskey" <jwd@unx.sas.com> To: nordwick@scam.xcf.berkeley.edu (Jason Nordwick) Cc: wes@softweyr.com, freebsd-hackers@FreeBSD.ORG Subject: Re: kern/13075 (was: Re: aio_*) Message-ID: <199909200451.AAA38839@bb01f39.unx.sas.com> In-Reply-To: <19990920023659.78998.qmail@scam.xcf.berkeley.edu> from Jason Nordwick at "Sep 19, 1999 7:36:58 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
Well, another code fragment might be useful: /*--------------------------------------------------------------+ | Set up iocb for aio_write() call | +--------------------------------------------------------------*/ memset(iocb, 0, sizeof(struct aiocb)); iocb->aio_fildes = atask->tfd; iocb->aio_offset = 0; iocb->aio_buf = fileaddr; iocb->aio_nbytes = (int)cb.st_size; iocb->aio_sigevent.sigev_notify = SIGEV_SIGNAL; iocb->aio_sigevent.sigev_signo = SIGAIO; /* currently USR1 */ *** iocb->aio_sigevent.sigev_value.sigval_ptr = atask; Note the last line above where we would like to signal value to the address of the task which started the io operation. At io completion/signal delivery time the signal value can then be recovered from the 'code' parameter of the signal handler (since this is a soft interupt code is not required to hold a hardware indication/value). void handler(sig, code, scp) int sig, code; struct sigcontext *scp; Unfortunately, the 'psignal' function used called from vfs_aio.c only takes a signo parameter, and kern_sig.c wouldn't understand how to hold onto the new code value anyways if the signal recipient isn't curproc. ie: the difference between psignal() and trapsignal(). Anyways, it the above worked, then you could always tell which aio request had completed. Thus, no looping would be required in the userland app nor in the kernel with a 'find the next completed aio request' syscall. Comments welcome! -John > >And now for a wish: > [ST_AIO stuff cut] > > > If I understand what you are trying to say, then > when real time signals are added, this will be unnecessary. > You can get the completion of an aio_* call from the signal > queue. > > -jason > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199909200451.AAA38839>