Re: fstat vs _fstat implementation in newlib/libc-hooks.c

Nashif, Anas

The fstat is not being used and is left there by mistake from a previous implementation of the hooks. I think it is safe to remove it.


On 07/06/2016, 12:59, "Kumar Gala" <kumar.gala(a)> wrote:


Do you know why the fstat and _fstat implementations are slightly different in lib/libc/newlib/libc-hooks.c. Specifically why fstat() sets buf->st_blksize = 0?

int fstat(int fd, struct stat *buf)
buf->st_mode = S_IFCHR; /* Always pretend to be a tty */
buf->st_blksize = 0;

return 0;

int _fstat(int file, struct stat *st)
st->st_mode = S_IFCHR;
return 0;

In addition, the newlib docs minimal implementation only sets st_mode = S_IFCHR

So wondering what the history might be fore st_blksize = 0, and if we need to bother.

- k

Join to automatically receive all group messages.