Re: [PATCH v3 09/13] target/hexagon: add main arch-specific semihosting operations

Matheus Tavares Bernardino <[email protected]>
Newsgroups gmane.comp.emulators.qemu
Message-ID <[email protected]>
On Mon, 17 Aug 2026 06:29:56 +0200 =?UTF-8?Q?Philippe_Mathieu-Daud=C3=A9?= <[email protected]> wrote:
>
> On 20/7/26 19:41, Matheus Tavares Bernardino wrote:
> > 
> > +        if (rc = 0) {
> > +            sys_stat.dev   = st_buf.st_dev;
> > +            sys_stat.ino   = st_buf.st_ino;
> > +            sys_stat.mode  = st_buf.st_mode;
> > +            sys_stat.nlink = (uint32_t) st_buf.st_nlink;
> > +            sys_stat.rdev  = st_buf.st_rdev;
> > +            sys_stat.size  = (uint32_t) st_buf.st_size;
> > +#if defined(__linux__)
> > +            sys_stat.atime = (uint32_t) st_buf.st_atim.tv_sec;
> > +            sys_stat.mtime = (uint32_t) st_buf.st_mtim.tv_sec;
> > +            sys_stat.ctime = (uint32_t) st_buf.st_ctim.tv_sec;
> > +#elif defined(_WIN32)
> > +            sys_stat.atime = st_buf.st_atime;
> > +            sys_stat.mtime = st_buf.st_mtime;
> > +            sys_stat.ctime = st_buf.st_ctime;
> > +#endif
> 
> This #if/elif seems bogus in that various hosts are not covered,
> in particular *BSD and WASM. We could use #else #error to catch
> them, or better implement OS-specific [f]stat() helpers (see
> include/system/os-*.h).

Good point... Hmm, what if we used st_buf.st_[amc]time for all cases?

It is mandatory on POSIX 2018[1] and also provided by mingw-w64[2]. Would that
cover all our use cases? Or maybe not?

[1]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html
[2]: https://github.com/mingw-w64/mingw-w64/blob/master/mingw-w64-headers/crt/_mingw_stat64.h#L38
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.