gnu-arch-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-arch-users] POSIX spec expert needed


From: Andrew Suffield
Subject: Re: [Gnu-arch-users] POSIX spec expert needed
Date: Mon, 30 Aug 2004 21:25:18 +0100
User-agent: Mutt/1.5.6+20040818i

On Mon, Aug 30, 2004 at 02:14:02PM -0500, Matthew Dempsky wrote:
> Can anyone confirm for me that when you make a call such as this:
> 
>           if (0 > vu_lseek (errn, file_fd, -1026, SEEK_END))
> 
> that it means there will be 1026 bytes left available to be read from
> the file?

*At least* 1026 bytes.

> Also, that after:
> 
>           amt = vu_read_retry (errn, file_fd, buf, sizeof (buf));
> 
> when buf is defined to 'char buf[1025]' that we will be missing the
> last (possibly newline) byte of the file?

No, see above. These operations aren't atomic; there might be more
data. Just keep reading until you run out of file - treat the seek as
an optimisation hint, rather than a part of the algorithm.

-- 
  .''`.  ** Debian GNU/Linux ** | Andrew Suffield
 : :' :  http://www.debian.org/ |
 `. `'                          |
   `-             -><-          |

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]