From owner-freebsd-hackers Thu Mar 4 16:58:36 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from mercury.inktomi.com (mercury.inktomi.com [209.1.32.126]) by hub.freebsd.org (Postfix) with ESMTP id 8EEE81511A for ; Thu, 4 Mar 1999 16:58:35 -0800 (PST) (envelope-from jplevyak@inktomi.com) Received: from proxydev.inktomi.com (proxydev.inktomi.com [209.1.32.44]) by mercury.inktomi.com (8.9.1a/8.9.1) with ESMTP id QAA28267 for ; Thu, 4 Mar 1999 16:58:27 -0800 (PST) Received: (from jplevyak@localhost) by proxydev.inktomi.com (8.8.5/8.7.3) id QAA20889 for hackers@FreeBSD.org; Thu, 4 Mar 1999 16:58:18 -0800 (PST) Message-ID: <19990304165818.A20680@proxydev.inktomi.com> Date: Thu, 4 Mar 1999 16:58:18 -0800 From: John Plevyak To: hackers@FreeBSD.org Subject: aio_read/write pread/pwrite Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.2i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In investigating the lack of pread/pwrite, I found the bug report kern/8011, and the patch therein. This patch mashes fd->f_offset around the (*fp->f_ops->fo_read)(fp, &auio, fp->f_cred) and then resets it to achieve a sort of poor-mans pread/pwrite. This breaks multi-threaded programs. The same problem exists for aio_read/aio_write. The simple solution would be to use 'auio.uio_offset' directly (which is what aio_read/aio_write do), but alas, vn_read() mangles fp->f_offset anyway. Moreover, vn_write totally ignores auio.uio_offset == -1. The correct solution seems to be to recognize (aio.uio_offset != -1) as indicating 'don't mess with fp->f_offset at all!' since this is really what is intended in the places where it is set to non-zero. I have a patch for this which I am attaching to kern/8011, but I think it is more generally applicable since it should also fix aio_XXXX. Is anyone interested in it? john -- John Bradley Plevyak, PhD, jplevyak@inktomi.com, PGP KeyID: 051130BD Inktomi Corporation, 1900 S. Norfolk Street, Suite 110, San Mateo, CA 94403 W:(415)653-2830 F:(415)653-2801 P:(888)491-1332/5103192436.4911332@pagenet.net To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message