[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFr9PXkO-iGFVpe6w=WobnMUe-6Eiw+fq+B_pq1G3Su5cmnD1Q@mail.gmail.com>
Date: Mon, 5 Jan 2026 18:43:03 +0900
From: Daniel Palmer <daniel@...ngy.jp>
To: David Laight <david.laight.linux@...il.com>
Cc: w@....eu, linux@...ssschuh.net, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] tools/nolibc: Add fread() to stdio.h
Hi David,
On Mon, 5 Jan 2026 at 18:27, David Laight <david.laight.linux@...il.com> wrote:
> But you've deleted the partial bytes from the input.
> I'm sure that isn't right.
> Normally a FILE is buffered and the bytes are saved for the next read.
> Remember you can be reading from a pipe that is being written using
> 'block buffering' - so it is valid for only a partial 'item' be read.
> (I'm sure non-blocking IO is also valid...)
I see now. If a partial read happens, the next call to fread() will
read from after the end of the partial read that happened and it'll be
broken.
Since in nolibc the FILE pointer that gets used isn't really a pointer
but the file descriptor I'm not sure where we'd stash the partial part
so we need to avoid doing the partial read entirely.
Thanks,
Daniel
Powered by blists - more mailing lists