Line buffered mode is not set by default
Fernando Ramos
bocadillodeatun@gmail.com
Thu Dec 4 13:59:00 GMT 2008
I finally figured it out. There was (obviously) something I was doing
wrong, and even if it has nothing to do with "newlib"'s
implementations, I'll post what the problem was just in case someone
ever googles for a similar problem :)
When printf()ing to "stdout" for the first time, "__smakebuf()" will
only set the "__SLBF" flag if a call to "_fstat_r()" on "stdout"
returns the "S_IFCHR" flag set on the "st_mode" of the passed "struct
stat st" structure.
As I said on the previous message, I thought this was not the problem,
because my "_fstat_r()" implementations looks like this:
> int _fstat_r(struct _reent *_r, int fd, struct stat *pstat){
> pstat->st_mode = S_IFCHR;
> return 0;
> }
I finally found that the value of "offesetof(struct stat, st_mode)"
was "4" in "libc.a" but "12" in my "firmware.a" binary... so I was
actually changing something else from "_fstat_r()" and not the
"st_mode" member.
And this is what was happening: whoever compiled our "libc.a" for the
last time (the one I am not allowed to recompile :), did not use the
"-D__rtems__" flag, which we do use while compiling against the newlib
header files.
This causes "dev_t" and "ino_t" (the type of the two struct stat
members that come BEFORE "st_mode") to have different sizes in
"libc.a" and "firmware.a".
:)
More information about the Newlib
mailing list