From owner-freebsd-hackers Mon Sep 20 9:15:58 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from lamb.sas.com (lamb.sas.com [192.35.83.8]) by hub.freebsd.org (Postfix) with ESMTP id 1F8ED15057 for ; Mon, 20 Sep 1999 09:15:54 -0700 (PDT) (envelope-from jwd@unx.sas.com) Received: from mozart (mozart.unx.sas.com [192.58.184.28]) by lamb.sas.com (8.9.3/8.9.1) with SMTP id MAA01125; Mon, 20 Sep 1999 12:15:43 -0400 (EDT) Received: from bb01f39.unx.sas.com by mozart (5.65c/SAS/Domains/5-6-90) id AA04131; Mon, 20 Sep 1999 00:51:40 -0400 Received: (from jwd@localhost) by bb01f39.unx.sas.com (8.9.1/8.9.1) id AAA38839; Mon, 20 Sep 1999 00:51:40 -0400 (EDT) (envelope-from jwd) From: "John W. DeBoskey" Message-Id: <199909200451.AAA38839@bb01f39.unx.sas.com> Subject: Re: kern/13075 (was: Re: aio_*) In-Reply-To: <19990920023659.78998.qmail@scam.xcf.berkeley.edu> from Jason Nordwick at "Sep 19, 1999 7:36:58 pm" To: nordwick@scam.xcf.berkeley.edu (Jason Nordwick) Date: Mon, 20 Sep 1999 00:51:40 -0400 (EDT) Cc: wes@softweyr.com, freebsd-hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL43 (25)] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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