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


Nashif, Anas
 

Kumar,
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.

Anas

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

Anas,

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

https://sourceware.org/newlib/libc.html#Stubs

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

- k

Join devel@lists.zephyrproject.org to automatically receive all group messages.