Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 05 Apr 1999 10:56:10 -0700
From:      Terry Lambert <terry@whistle.com>
To:        Robert Watson <robert+freebsd@cyrus.watson.org>
Cc:        current@freebsd.org
Subject:   Re: aio_read
Message-ID:  <3708F93A.B2810187@whistle.com>
References:  <Pine.BSF.3.96.990405133547.22049B-100000@fledge.watson.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Robert Watson wrote:
> 
> Terry,
> 
> In the BUGS section of the 4.0-CURRENT aio_read man page,
> the following comment is made:
> 
>         The value of iocb->aio_offset is ignored.
> 
> Is this actually the case, and what would be required to
> fix it?  Does this comment imply that reads always occur
> at the current file offset from the open file structure?

It was true at the time I wrote the manual page, which I
verified against the source code for the bugs section.

It would be fairly trivial (IMO) to fix this, either by
setting the current file offset before doing the read, or,
more correctly, using the element offset itself instead
(which would allow concurrent aio_read calls on the same
fd at staggered offsets).


> What I would like to do is have a child process read
> from an inherited file descriptor without affecting the
> parent process's access to the descriptor (for example,
> the offset it reads from using a normal read() or readv()).

This should be the way it works anyway.  The offset is an
artifact of the struct file, not the vnode, and a child
process inheriting a descriptor does so by making a copy
of the parent's open file table into its own open file
table -- and thus the child gets its own struct file that
points to the vnode, and thus a seperate "current offset".

An exception to this would be where the parent and child
share kernel structures as a result of an rfork() without
the RFFDG flag set.
 
> I address this to you because you seem to be listed in the
> man page as the author of the man page (although it looks
> like John Dyson has the copyright on the source code?)

John did the code.  I did the man page because I wanted to
use it with some test code, but there wasn't a man page.  8-).

-- Terry Lambert
-- Whistle Communications, Inc.
-- terry@whistle.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3708F93A.B2810187>