This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch for fread (was: romfs on linux / use of fread)


All,

>> It seems that fread() works in CYGNUM_LIBC_STDIO_BUFSIZE and it will read a maximum of this number of
>> bytes from a file at a time.
>>
>> performing an fread(buff, 1, 4096, fp) (right after opening the file) tells me that 256 items have been read.
>> Performing multiple fread(buff, 1, 250, fp) operations return 250, 6, 250, 6 etc. and looking at the implementation
>> I found that indeed the function stops after reading all data from the current buffer.
>
> I agree that this is actually a bug rather than a performance issue - the
> standard says it should only read less than requested on error or EOF.
> Since you offered to make a patch that would be the most convenient :-).
> Ditto fwrite presumably?

> You can have your name in lights if you also include a ChangeLog entry.

> Jifl

So this is it.
My very first patch. Install it from the eCos tree (/opt/eCos) with "patch -p0 <fread.pat".

I have tested this patch on the synthetic Linux target (with ROMFS and RAMFS) and on my ARM system.
Would be nice to know if others could test this on some other targets as well ;-)

Jonathan,

I have included my name in neon and hope to see it in CVS soon :-)

Regards,

	Rob Jansen

Software Engineer
Competence Center Platforms
BU Mobile Communications
Meijhorst 60-10, 6537 KT Nijmegen, The Netherlands
Tel: +31-24-353-6329
Fax: +31-24-353-3613
mailto:Rob.WJ.Jansen@philips.com

fread.pat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]