Re: [gccsdk] FILE structure
In article <20191126092042.bffc220...@orac.inputplus.co.uk>, Ralph Corderoy wrote: > Hi Ronald, > > In trying to implement wget's own support lib there was a requirement > > for an implementation of freading(). > Here's glibc's description. https://manned.org/__freading.3 > > It looks like some extra system flag would need to be set on every > > read, and negated on a write. > That may be needed anyway as a side effect of tracking a buffer's state, > e.g. > https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=blob;f=newlib/libc/stdio/refill.c;h=87a715b848b0009624f3fc76d938ef49a35bc282;hb=HEAD#l33 Yes, dawned on me it is the generic gnu support lib. The only use of freading() in wget is in gnulib function fflush() and it appears to be only there to address a mingw problem. whether unixlib would benefit as well I dont know. excerpt from fflush.c /* We test ! freading (stream) here, rather than fwriting (stream), because what we need to know is whether the stream holds a "read buffer", and on mingw this is indicated by _IOREAD, regardless of _IOWRT. */ if (stream == NULL || ! freading (stream)) return fflush (stream); Changing to if (stream == NULL) Will let it can drop through to the other methods if stream is not NULL. I'd still have to satisfy the building of the unused freading.c for the autobuilder though, and just changing freading.c #ifdef __riscos__ return 0; may suffice, I guess ! 0 is untrue for the useage and it will drop through. I might log it for a while to make sure. Ronald ___ GCCSDK mailing list gcc@gccsdk.riscos.info Bugzilla: http://www.riscos.info/bugzilla/index.cgi List Info: http://www.riscos.info/mailman/listinfo/gcc Main Page: http://www.riscos.info/index.php/GCCSDK
Re: [gccsdk] FILE structure
Hi Ronald, > In trying to implement wget's own support lib there was a requirement > for an implementation of freading(). Here's glibc's description. https://manned.org/__freading.3 > It looks like some extra system flag would need to be set on every > read, and negated on a write. That may be needed anyway as a side effect of tracking a buffer's state, e.g. https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=blob;f=newlib/libc/stdio/refill.c;h=87a715b848b0009624f3fc76d938ef49a35bc282;hb=HEAD#l33 -- Cheers, Ralph. ___ GCCSDK mailing list gcc@gccsdk.riscos.info Bugzilla: http://www.riscos.info/bugzilla/index.cgi List Info: http://www.riscos.info/mailman/listinfo/gcc Main Page: http://www.riscos.info/index.php/GCCSDK
[gccsdk] FILE structure
In trying to implement wget's own support lib there was a requirement for an implementation of freading(). /* Return non-zero value if the stream FP is opened readonly, or if the last operation on the stream was a read operation. */ Other platforms have functions using fp structure members, but unixlib usually gives the error io.mode has no such member. Sounds like normally stdio.h has this structure, but we may be using something different? I'm after any good suggestions, I think the complication is when a file is opened "rw" and finding if the last operation was a read. Otherwise you could assume if it is 'r' it is for reading. It looks like some extra system flag would need to be set on every read, and negated on a write. TIA, Ronald ___ GCCSDK mailing list gcc@gccsdk.riscos.info Bugzilla: http://www.riscos.info/bugzilla/index.cgi List Info: http://www.riscos.info/mailman/listinfo/gcc Main Page: http://www.riscos.info/index.php/GCCSDK