On Fri, Nov 29, 2013 at 2:16 PM, Jared Yanovich <[email protected]> wrote:
> Perhaps 'basep' was from an earlier proposed getdents interface but
> I'm not sure what it references now...

Ah, that's left over from when this was also going to be a manpage for
getdirentries(3), but we turned out to not need that wrapper and
didn't re-add it.  Thanks for noting this.



> --- getdents.2  7 Oct 2013 01:50:26 -0000       1.1
> +++ getdents.2  29 Nov 2013 22:15:58 -0000
> @@ -126,19 +126,13 @@ The actual number of bytes transferred i
>  The current position pointer associated with
>  .Fa fd
>  is set to point to the next block of entries.
> -The pointer may not advance by the number of bytes returned by
> -.Fn getdents .
> -.Pp
> -.Fn getdents
> -writes the position of the block read into the location pointed to by
> -.Fa basep .
> -Alternatively, the current position pointer may be set and retrieved by
> -.Xr lseek 2 .
> -The current position pointer should only be set to a value returned by
> +This position can be set or retrieved by
> +.Xr lseek 2
> +but should only ever be set to a value previously returned by
>  .Xr lseek 2 ,
> -a value returned in the location pointed to by
> -.Fa basep ,
>  or zero.
> +The pointer may not advance by the number of bytes returned by
> +.Fn getdents .
>  .Sh RETURN VALUES
>  If successful, the number of bytes actually transferred is returned.
>  A value of zero is returned when
> @@ -154,10 +148,7 @@ will fail if:
>  .Fa fd
>  is not a valid file descriptor open for reading.
>  .It Bq Er EFAULT
> -Either
>  .Fa buf
> -or
> -.Fa basep
>  points outside the allocated address space.

Hmm, I think I prefer a smaller diff that doesn't rearrange it quite
so much.  Also, d_off values are legit for lseek positioning (that's
the point of them), so how about this:

--- getdents.2  7 Oct 2013 01:50:26 -0000       1.1
+++ getdents.2  30 Nov 2013 00:07:06 -0000
@@ -129,15 +129,13 @@ is set to point to the next block of ent
 The pointer may not advance by the number of bytes returned by
 .Fn getdents .
 .Pp
-.Fn getdents
-writes the position of the block read into the location pointed to by
-.Fa basep .
-Alternatively, the current position pointer may be set and retrieved by
+The current position pointer may be set and retrieved by
 .Xr lseek 2 .
 The current position pointer should only be set to a value returned by
 .Xr lseek 2 ,
-a value returned in the location pointed to by
-.Fa basep ,
+the value of
+.Fa d_off
+from an entry,
 or zero.
 .Sh RETURN VALUES
 If successful, the number of bytes actually transferred is returned.
@@ -154,11 +152,9 @@ will fail if:
 .Fa fd
 is not a valid file descriptor open for reading.
 .It Bq Er EFAULT
-Either
+Part of
 .Fa buf
-or
-.Fa basep
-points outside the allocated address space.
+points outside the process's allocated address space.
 .It Bq Er EINVAL
 The file referenced by
 .Fa fd


That last chunk brings the EFAULT wording in line with the other
syscall manpages.


> @@ -174,6 +165,7 @@ error occurred while reading from or wri
>  .Sh SEE ALSO
>  .Xr lseek 2 ,
>  .Xr open 2 ,
> +.Xr directory 3 ,
>  .Xr opendir 3 ,
>  .Xr dirent 5
>  .Sh STANDARDS

directory(3) is the same as opendir(3), so this seems unnecessary.


Philip Guenther

Reply via email to